From 1286ec48cbfc2988678afbfbbfdcb88b891d6a6f Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 21 May 2023 14:17:08 -0400 Subject: [PATCH] Revert "hyprland: Use hyprctl activeworkspace" "activeworkspace" can be useful if you aren't interested in the special workspace, but since it ignores special workspaces, it causes this script to behave unexpectedly. --- desktop/hyprland/swapmaster.sh | 10 ++++------ desktop/hyprland/tags.sh | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/desktop/hyprland/swapmaster.sh b/desktop/hyprland/swapmaster.sh index fc9849b..355afe0 100755 --- a/desktop/hyprland/swapmaster.sh +++ b/desktop/hyprland/swapmaster.sh @@ -3,14 +3,12 @@ # Temporary make the animation a fade for effect hyprctl keyword animation workspaces,1,12,default,fade -# Get the current window +# Get the workspace ID of the current window cw=`hyprctl activewindow -j` - -# Get the current workspace ID -oldWorkspaceID=`hyprctl activeworkspace -j | jq -r '.id'` +oldWorkspaceID=`echo "$cw" | jq -r '.workspace.id'` # Get the number of windows on the workspace (0 = do nothing, 2 or more = swap) -numWindowsOnWorkspace=`hyprctl activeworkspace -j | jq -r '.windows'` +numWindowsOnWorkspace=`hyprctl workspaces -j | jq -r ".[] | select(.id==$oldWorkspaceID) | .windows"` # If there are no windows yet, function as a program launcher if [[ $numWindowsOnWorkspace -eq 0 ]]; then @@ -26,7 +24,7 @@ hyprctl dispatch layoutmsg focusmaster master hyprctl dispatch focuscurrentorlast # Get the workspace ID of the last window -newWorkspaceID=`hyprctl activeworkspace -j | jq -r '.id'` +newWorkspaceID=`hyprctl activewindow -j | jq -r '.workspace.id'` # If the workspaces are the same, swap master with that last window. if [[ "$oldWorkspaceID" == "$newWorkspaceID" ]]; then diff --git a/desktop/hyprland/tags.sh b/desktop/hyprland/tags.sh index 318ebce..b8be031 100755 --- a/desktop/hyprland/tags.sh +++ b/desktop/hyprland/tags.sh @@ -6,6 +6,6 @@ ids="$(hyprctl clients -j | jq -r ".[] | select(.workspace.id == "$1") | .addres # Move those windows to the current workspace for id in $ids; do - hyprctl dispatch movetoworkspacesilent "$(hyprctl activeworkspace -j | jq -r '.id')",address:"$id" + hyprctl dispatch movetoworkspacesilent "$(hyprctl monitors -j | jq -r '.[] | select(.focused==true) | .activeWorkspace.id')",address:"$id" hyprctl dispatch focuswindow address:"$id" done