Skip to content

Instantly share code, notes, and snippets.

@nkabir
Created November 3, 2023 13:34
Show Gist options
  • Save nkabir/ba4d09a43b973baff389bd01935b2183 to your computer and use it in GitHub Desktop.
Save nkabir/ba4d09a43b973baff389bd01935b2183 to your computer and use it in GitHub Desktop.
desktop-manager
#!/usr/bin/env bash
# workspace switcher for 1024 workspaces
declare -A ws=(
[mail-rk]=0 # rocketknowledge
[mail-bt]=1 # bulltrout
[mail-ag]=2 # arc global
[mail-rp]=3 # repurposeful
[im]=4 # messaging apps
[messaging]=4
[torrent]=5 # bitorrent
[libgen]=6 # library
[banking]=7 # banking and finance
[labkey]=10
[bench]=20
# vendor
[polylith]=30
[cookiecutter]=31
[openai]=32
# xpkg
[rkx]=100
# xspike
# xbook
[mate]=500
[matedoc]=500
[git]=501
[gitdoc]=501
[loguru]=502
[logurudoc]=502
[redo]=503
)
readonly target="${1}"
if [[ -z ${target} ]]; then
printarr() { declare -n __p="$1"; for k in "${!__p[@]}"; do printf "%s=%s\n" "$k" "${__p[$k]}" ; done ; }
# wmctrl -s "${index}"
printarr ws | sort
exit 0
fi
readonly index="${ws[${target}]}"
# echo "switching to ${index}"
if [[ -z $index ]]; then
index=0
fi
wmctrl -s ${index}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment