41 lines
1.2 KiB
Bash
Executable File
41 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
current=$(hyprctl activeworkspace -j | jq -r '.id')
|
|
|
|
if [ "$1" = "click" ]; then
|
|
group=$2
|
|
start=$(( (group - 1) * 3 + 1 ))
|
|
|
|
hyprctl --batch " \
|
|
dispatch focusmonitor DP-1; dispatch workspace $start; \
|
|
dispatch focusmonitor DP-2; dispatch workspace $((start+1)); \
|
|
dispatch focusmonitor HDMI-A-2; dispatch workspace $((start+2)); \
|
|
dispatch focusmonitor DP-1"
|
|
|
|
else
|
|
# Display button state
|
|
group=$1
|
|
start=$(( (group - 1) * 3 + 1 ))
|
|
end=$(( start + 2 ))
|
|
case $group in
|
|
1) range="1-3"; icon="" ;;
|
|
2) range="4-6"; icon="" ;;
|
|
3) range="7-9"; icon="" ;;
|
|
4) range="10-12"; icon="" ;;
|
|
5) range="13-15"; icon="" ;;
|
|
6) range="16-18"; icon="" ;;
|
|
7) range="19-21"; icon="" ;;
|
|
8) range="22-24"; icon="" ;;
|
|
9) range="25-27"; icon="" ;;
|
|
10) range="28-30"; icon="" ;;
|
|
esac
|
|
|
|
if [ $current -ge $start ] && [ $current -le $end ]; then
|
|
# Active group - return with active class
|
|
echo "{\"text\": \"$icon\", \"class\": \"active\"}"
|
|
else
|
|
# Inactive group
|
|
echo "{\"text\": \"$icon\", \"class\": \"inactive\"}"
|
|
fi
|
|
fi
|