Files
nixos/test/force-switch-workspace.sh
kenji 161c6337a4 feat(hypr): add force switching of workspace
useful for going from special workspace to normal workspace
2025-12-28 12:13:41 -06:00

27 lines
680 B
Bash
Executable File

#!/usr/bin/env bash
# flow
# check workspace
# if the workspace is a special workspace, toggle it off
# switch to workspace based on the chosen num
special_workspace=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .specialWorkspace.name')
workspace_name=${special_workspace#*:}
chosen_workspace_num=$1
if [[ -z ${chosen_workspace_num} ]]; then
echo "Usage: $0 [number]"
exit 1
fi
if [[ "${special_workspace}" == *"special"* ]]; then
echo "[LOG] workspace is ${special_workspace}"
hyprctl dispatch togglespecialworkspace "${workspace_name}"
hyprctl dispatch workspace "${chosen_workspace_num}"
else
echo "[ERR] workspace is not special"
exit 1
fi
exit 0