Files
dotfiles/.config/hypr/scripts/workspace-handler.sh
T
2026-03-13 10:37:01 +03:00

53 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Usage: workspace-handler.sh <mode> <direction>
# mode: "change" | "move"
# direction: "next" | "previous"
mode="$1"
direction="$2"
if [[ -z "$mode" || -z "$direction" ]]; then
exit 1
fi
if [[ "$mode" != "change" && "$mode" != "move" ]]; then
exit 1
fi
if [[ "$direction" != "next" && "$direction" != "previous" ]]; then
exit 1
fi
if [[ "$GNOME_STYLE_WORKSPACES" == "true" ]] && command -v hyprnome &>/dev/null; then
# Hyprnome style
if [[ "$mode" == "change" ]]; then
if [[ "$direction" == "previous" ]]; then
exec hyprnome --previous
else
exec hyprnome
fi
else
if [[ "$direction" == "previous" ]]; then
exec hyprnome --previous --move
else
exec hyprnome --move
fi
fi
else
# Hyprland style
if [[ "$mode" == "change" ]]; then
if [[ "$direction" == "previous" ]]; then
exec hyprctl dispatch focusworkspaceoncurrentmonitor r-1
else
exec hyprctl dispatch focusworkspaceoncurrentmonitor r+1
fi
else
if [[ "$direction" == "previous" ]]; then
exec hyprctl dispatch movetoworkspace r-1
else
exec hyprctl dispatch movetoworkspace r+1
fi
fi
fi