Last active
April 28, 2018 08:09
-
-
Save aberranthacker/d4b9858e9257ef7a0811ea8b109dd0c2 to your computer and use it in GitHub Desktop.
Modified version of script from http://akuederle.com/windows-like-appshortcuts-in-linux to set Win+n keybindings to behave like in Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
desk_id=$(xdotool get_desktop) | |
apps_table=$(wmctrl -lx | awk -v desk_id=$desk_id '$2==desk_id {print $0}') | |
win_id=$(printf '%x' $(xdotool getactivewindow)) | |
active_window_class=$(echo "$apps_table" | awk -v id=$win_id '$0 ~ id {print $3}') | |
if [[ "$active_window_class" = "$2" ]]; | |
then | |
xdotool getactivewindow windowminimize; | |
else | |
wm_id=$(echo "$apps_table" | awk -v wm_class=$2 \ | |
'$3 == wm_class {print $1; exit;}'); | |
if [ ! -z "$wm_id" ]; | |
then | |
wmctrl -i -a "$wm_id"; | |
else | |
("$1"&) ; | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment