This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/apps/kanshi/desktop-H-workspaces.sh

18 lines
684 B
Bash
Raw Normal View History

2020-11-02 10:55:20 -06:00
#!/usr/bin/env bash
2020-11-02 10:55:20 -06:00
# kanshi will potentially run this more than once
LOCKFILE="/tmp/kanshi-workspace-arranging.lock"
if ! (set -o noclobber; echo > "$LOCKFILE"); then exit 1; fi
touch "$LOCKFILE"
# TODO: some way to ensure the lock file is cleaned up?
# maybe check if the file is older than a minute?
2020-11-02 10:55:20 -06:00
move_workspace() { swaymsg workspace "$1"; swaymsg move workspace to "'$2'"; }
setup_output() { out="$1"; shift; while (($#)); do move_workspace "$1" "$out"; shift; done; }
2020-11-02 10:55:20 -06:00
setup_output 'Dell Inc. DELL U2719DC 9DL4QS2' 9 8 7
setup_output 'Dell Inc. DELL U2719DC 5DL4QS2' 6 5 4
setup_output 'Samsung Electric Company CF791 HTRJ500315' 3 2 1
2020-11-02 10:55:20 -06:00
rm "$LOCKFILE"