Giter VIP home page Giter VIP logo

cygextreg's Introduction

MIT License

CygExtReg

A utility program allowing to register an extension (eg. .sh) to be executed in Cygwin by double-clicking a file from Windows File Explorer or by dragging and dropping files to an icon of a registered extension.

You can use any scripting language installed on your Cygwin. Just define the preferred shebang line, eg. #!/usr/bin/python3

Installing

Install cygextreg via Cygwin setup.

To install manually, download the latest version for 32-bit (i686) or 64-bit (x86_64) Cygwin installation. Extract the contents of a zip to the root of your Cygwin directory.

Installing from source

Install Cygwin packages:

gcc-g++ make automake autoconf

Get the source:

git clone https://github.com/sop/cygextreg.git

Prepare environment:

aclocal && autoheader && automake --add-missing && autoconf

Compile and install:

./configure && make && make install-strip

Usage

Register default (.sh) filetype:

cygextreg -r

Default is to register only for the current user. To register for all users, use cygextreg -ra. Note that this prompts for an elevated process.

To unregister default filetype:

cygextreg -u

To register another filetype (eg. .bash), pass the extension as an --ext argument:

cygextreg -r --ext bash

Internals

Scripts are executed with bash in an interactive login shell. This means that your ~/.bash_profile will be executed first, which usually sources ~/.bashrc as well. This way you can alter your environment, eg. by modifying the $PATH variable.

Bash is started in a MinTTY terminal with UTF-8 charset. All arguments that are Windows style paths are automatically converted to Cygwin equivalents (/cygdrive/...). So if you drag and drop a file to a script icon, the script receives the dropped file's path in Cygwin format as a first argument.

Multiple files can be dragged and dropped to a registered file type. The script receives paths as separate arguments, eg. $1, $2, $3, etc. (or $@) in bash script or sys.argv[1:] in Python.

If the executed script exits with a non-zero code, MinTTY window shall be kept open so that you have a chance to review the output. If the script succeeds (exits with code 0), MinTTY window is closed automatically.

License

This project is licensed under the MIT License.

cygextreg's People

Contributors

sop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wyrover

cygextreg's Issues

option to change default shell

Hi,

it would be interresting to have an option to change the default shell from bash to another (ksh, zsh, etc.).

Regards.

Script isnt't executed if tmux is started by .bashrc

In my case, tmux is started by .bashrc.

This has the consequence that the script to be executed by cygextreg starts only after tmux was ended.

I see a possible solution in setting an environment variable by cygextreg, which can be evaluated in .bashrc.

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.