Created
January 6, 2023 23:06
-
-
Save lidgnulinux/b9a892e7e6cf60979bc34d84bb1f8dc5 to your computer and use it in GitHub Desktop.
Toggle desktop for sway.
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
#!/usr/bin/bash | |
unminimize () { | |
swaymsg [app_id='.*'] focus | |
} | |
minimize () { | |
swaymsg [app_id='.*'] move scratchpad | |
} | |
focus () { | |
swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)' | jq -r '.app_id' | |
} | |
if [[ $(focus) == null ]]; then | |
unminimize | |
else | |
minimize | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment