Skip to content

Instantly share code, notes, and snippets.

@codepuncher
Created July 19, 2017 11:55
Show Gist options
  • Select an option

  • Save codepuncher/806cabf9c72263fbd5addd50ade39ad8 to your computer and use it in GitHub Desktop.

Select an option

Save codepuncher/806cabf9c72263fbd5addd50ade39ad8 to your computer and use it in GitHub Desktop.

Revisions

  1. codepuncher created this gist Jul 19, 2017.
    4 changes: 4 additions & 0 deletions quickwin.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    #!/usr/bin/env bash
    # Focus window from 1st argument or
    # executes command from 2nd argument
    wmctrl -ia $(wmctrl -l | grep -i ${1} | awk '{print $1}') || ${2} &
    8 changes: 8 additions & 0 deletions usage.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # Example usage:

    # from cli
    ./quickwin 'user@hostname:' 'gnome-terminal --hide-menubar' # Tries to focus window with title 'user@hostname:' or run gnome-terminal
    ./quickwin 'chrome' 'google-chrome'

    # keyboard shortcut usage
    bash -c "~/.local/bin/quickwin 'user@hostname:' 'gnome-terminal --hide-menubar'"