dunst: ignore low urgency notifications from history for now
[~bandali/configs] / .local / bin / sway-ws-util
1 #!/bin/sh
2
3 curr_ws=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused==true).name')
4 [ "$curr_ws" -eq 1 ] && prev_ws=10 || prev_ws=$((curr_ws-1))
5 [ "$curr_ws" -eq 10 ] && next_ws=1 || next_ws=$((curr_ws+1))
6 dest_ws=-1
7 op=-1
8
9 if [ "$1" = "switch" ] || [ "$1" = "move" ]; then
10 op="$1"
11 if [ "$2" = "prev" ]; then
12 dest_ws="$prev_ws"
13 elif [ "$2" = "next" ]; then
14 dest_ws="$next_ws"
15 else
16 echo "Usage: $0 $1 {prev|next} [follow]"
17 exit 1
18 fi
19 else
20 echo "Usage: $0 {switch|move} {prev|next} [follow]"
21 exit 1
22 fi
23
24 if [ "$op" = "switch" ]; then
25 sway workspace "$dest_ws"
26 elif [ "$op" = "move" ]; then
27 sway move container to workspace "$dest_ws"
28 if [ "$3" = "follow" ]; then
29 sway workspace "$dest_ws"
30 fi
31 fi