~mil/sxmo-utils

ref: f9976df021982ad51c83486808ee7420a202e47a sxmo-utils/scripts/core/sxmo_workspace.sh -rw-r--r-- 1.1 KiB
f9976df0Stacy Harper Prevent already existing modifiers to prevent view change 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env sh

# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"

current() {
	swaymsg -t get_outputs  | \
		jq -r '.[] | select(.focused == true) | .current_workspace'
}

next() {
	value="$(($(current)+1))"
	if [ "$value" -eq "$((${SXMO_WORKSPACE_WRAPPING:-4}+1))" ]; then
		printf 1
	else
		printf %s "$value"
	fi
}

previous() {
	value="$(($(current)-1))"
	if [ "$value" -lt 1 ]; then
		if [ "${SXMO_WORKSPACE_WRAPPING:-4}" -ne 0 ]; then
			printf %s "${SXMO_WORKSPACE_WRAPPING:-4}"
		fi
	else
		printf %s "$value"
	fi
}

sway() {
	case "$1" in
		next)
			printf "workspace "
			next;;
		previous)
			printf "workspace "
			previous;;
		move-next)
			printf "move container to workspace "
			next;;
		move-previous)
			printf "move container to workspace "
			previous;;
	esac | xargs swaymsg
}

dwm() {
	case "$1" in
		next)
			xdotool key --clearmodifiers Super+Shift+r
			;;
		previous)
			xdotool key --clearmodifiers Super+Shift+e
			;;
		move-next)
			xdotool key --clearmodifiers Super+r
			;;
		move-previous)
			xdotool key --clearmodifiers Super+e
			;;
	esac
}

"$(sxmo_wm.sh)" "$@"