e8f35bf283
This reverts commit c656cf81d2.
36 lines
944 B
Nix
36 lines
944 B
Nix
{pkgs, ...}: let
|
|
hakase-workspace-switch-force = pkgs.writeShellScriptBin "hakase-workspace-switch-force" ''
|
|
HYPRCTL="${pkgs.hyprland}/bin/hyprctl"
|
|
JQ="${pkgs.jq}/bin/jq"
|
|
|
|
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: $(basename "$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 "[LOG] workspace is not special"
|
|
$HYPRCTL dispatch workspace "''${chosen_workspace_num}"
|
|
exit 0
|
|
fi
|
|
|
|
exit 0
|
|
'';
|
|
in {
|
|
home.packages = [
|
|
hakase-workspace-switch-force
|
|
];
|
|
}
|