Skip to content

start common GUI applications under Git BASH or WSL just like under Linux

Notifications You must be signed in to change notification settings

Konfekt/win-bash-gui-bins

Repository files navigation

Many GUI (graphical user interface) applications on Linux have corresponding versions on Microsoft Windows, such as chromium, digikam, firefox, thunderbird, gimp, goldendict, gvim, inkscape, krita, libreoffice, mupdf, mpv, okular, scribus, smplayer, vlc and zeal.

This repository contributes small Shell scripts to start these (GUI) applications from the Git BASH or WSL (Windows Subsystem for Linux) shell just like from a Linux shell. (Provided that their executables have been installed either into the path proposed during installation, or into a directory whose path is listed in the Microsoft Windows environment variable %PATH% --- conveniently set by, say, Rapidee.)

Installation

  1. Clone this repository into ~/bin by mkdir -p ~/bin && cd ~/bin && git clone https://github.com/Konfekt/win-bash-gui-bins.
  2. The paths of the shell scripts have to be added to the environment variable $PATH. For this, add to your ~/.profile (for Bash, or ~/.zshenv for ZSH) the following line for Git BASH
[ -z ${MSYSTEM+x} ] || export PATH="${PATH:+"$PATH:"}$HOME/bin/win-bash-gui-bins"

respectively, for WSL,

[ -z ${WSLENV+x} ] || export PATH="${PATH:+"$PATH:"}$HOME/bin/win-bash-gui-bins"

Hints

As an upshot, the environment variables $BROWSER and $PDFVIEWER can be defined as under Linux, for example,

    export BROWSER=firefox
    export PDFVIEWER=mupdf

Imitate (XDG)-Open

To imitate xdg-open (and open from MacOS) under WSL,

  xdg_open() { eval cmd.exe /c /start /b "$(wslpath -aw "$1")"; }
  alias xdg-open=xdg_open
  alias     open=xdg_open

This lets you, for example, open the current work dir in Windows Explorer by open .. For a more thorough solution, put the bash script wsl-open.sh into a folder listed in your $PATH environment variable, mark it executable and alias (xdg-)open to its file path.

Under Git-Bash, the following aliases suffice:

  alias xdg-open=start
  alias     open=start

File manager

As a file manager, install totalcommander to start it by totalcmd. To open the current work dir in by an alias, say o. :

  command -v totalcmd >/dev/null 2>&1 && alias o.='totalcmd /O /T /R="$(winpath -aw "$(pwd)")"'

Image Viewer

As an alternative to an image viewer such as feh or sviv on Linux, install irfanview to start it by iv. If you use ZSH, then to view an image file by entering its path on the command line, define a suffix alias :

command -v iv  >/dev/null 2>&1 && alias -s {tiff,raw,jpg,jpeg,png,gif,bmp}='iv'

Run Batch files in ZSH under WSL

If you use ZSH under WSL, then to start Batch (and CMD) files as under Windows, define a suffix alias

  wslbatch() { eval cmd.exe /c "$(wslpath -aw "$1")"; }
  alias -s {cmd,bat}='wslbatch'

About

start common GUI applications under Git BASH or WSL just like under Linux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages