Coder Social home page Coder Social logo

himanshu-pro / script-runner Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 197.05 MB

An electron app for running configured scripts from the menu bar

License: Other

JavaScript 100.00%
elctron automation learning-exercise shell-scripts batteries-included welcome-pr

script-runner's Introduction

ScriptRunner - an electron app for running configured scripts from the menu bar

BUILD:
    Clone the repo (duh..)
    Run the following in a terminal:
        `npm run build:mac`   (For macOs)
        `npm run build:win`   (For Win)
        `npm run build:linux` (For Linux)
        `npm run build`       (For all)

USAGE:
    Compressed (.zip) distributions are provided in releases(https://github.com/himanshu-pro/script-runner/releases) for direct usage.
    Unzip the appropriate distribution or build manually (as described in BUILD section)

    Run executables from appropriate folder:
        bin/ScriptRunner-darwin-x64     (For macOs)
        bin/ScriptRunner-win32-x64      (For Win)
        bin/ScriptRunner-linux-x64      (For Linux)

SETTINGS:
    The Settings menu item opens the settings file.. It should be of the following format..
    {
        "scripts": [
            // add one object (like below) per script 
            {
                // used in menu item as `Run <label>`
                "label": "myScript",

                // absolute path of the executable
                "file": "path/to/script>",
                
                // (optional) timeout in ms (default is 1000)
                "timeout": 5000
            }
        ]
    }

COMMON ERRORS:
    `Permission Denied`: The script files provided need to be executable.. (chmod +x <script.sh>)
    `File not found`: The script file wasn't found on the path given.. (Check spelling)
    `wine not found on path`: For build (especially for windows) `wine` command is needed (brew install wine)

EXAMPLE:
    Let's say you have a vpn installed that requires you to run setup and teardown commands in terminal.
    Assuming the commands are `vpn start` and `vpn stop` respectively.
    To be able to run these from the menu bar, follow the steps below:

        Create file `vpn_start_script.sh` with `vpn start` as contents
        Run the following in terminal: `chmod +x path/to/vpn_start_script.sh`
        Run ScriptRunner. It should show the app icon in the menubar (top bar).
        Click on the app icon in the menubar. It should show a dropdown (context menu) with Settings as an option.
        Click on Settings option. It should open settings.json (in user's app data directory).
        Add `{"label": "Vpn Start", "file": "path/to/vpn_start_script.sh"}` (as described in SETTINGS section)
        Save the file. The menu bar app dropdown will now show `Run Vpn Start` option.
        Click on the `Run Vpn Start` option and the vpn is started..!!

    You can do the same for `vpn stop` command and have `Run Vpn Stop` option in the app dropdown.
    Note that once added these options are persistent and don't go away even if you quit the app.

    Tip: If you want these scripts available all the time, add the application to your startup programs.
    This will run the app whenever the system starts

script-runner's People

Contributors

himanshu-pro avatar

Stargazers

 avatar

Watchers

 avatar

script-runner's Issues

command run doesn't exit (hence timeout)

The process running the shell command doesn't exit automatically when the command is done running.. This has to be done explicitly in the shell script (using exit command)..

Gatekeeper blocks macOs binary Release - Untrusted Developer

For a mac binary to be runnable without getting blocked, it has to either come from app store or has to be signed with a trusted developer id which this isn't..

One workaround is to go to system preferences and explicitly allow it to run..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.