#!/usr/bin/env bash usage() { cat < OPTIONS: -h | --help: Show this help page. EOF } target_workspace="" active_workspace=$(hyprctl activewindow -j | jq -r '.workspace.name') while [[ $# -gt 0 ]]; do if [[ $1 =~ ^-h ]] || [[ $1 =~ ^--help ]]; then usage && exit 0 else target_workspace=$1 fi shift done if [[ -z target_workspace ]]; then echo "[ERROR]: Must supply a workpsace to switch to." usage && exit 1 fi # If active window is on a special workspace, then toggle the special workspace off. if [[ $active_workspace =~ ^special ]]; then echo "Toggling special workspace: '$active_workspace'" hyprctl dispatch togglespecialworkspace ${active_workspace#special:} # Only toggle the special workspace if trying to switch to previous and we're currently # on a special workspace. if [[ $target_workspace == "previous" ]]; then exit 0 fi fi echo "Switching to workspace: $target_workspace" hyprctl dispatch workspace $target_workspace