26 lines
638 B
Bash
Executable File
26 lines
638 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# CONFIGURATION: Set your monitor names here
|
|
MON_1="DP-4" # Your primary laptop/screen (Workspaces 1-9)
|
|
MON_2="DP-3" # Your external screen (Workspaces 11-19)
|
|
MON_3="HDMI-A-5"
|
|
|
|
# Get current focused monitor
|
|
current_mon=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name')
|
|
command=$1 # "workspace" or "movetoworkspace"
|
|
arg=$2 # The key pressed (1-9)
|
|
|
|
offset=0
|
|
|
|
if [ "$current_mon" == "$MON_2" ]; then
|
|
offset=10
|
|
elif [ "$current_mon" == "$MON_3" ]; then
|
|
offset=20
|
|
fi
|
|
|
|
# Calculate the actual workspace ID
|
|
target=$((arg + offset))
|
|
|
|
# Dispatch the command
|
|
hyprctl dispatch "$command" "$target"
|