From 8e05ad4caebcc465ed98bf61d9653651d5dd2fbd Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 16 May 2023 11:15:54 -0400 Subject: [PATCH] hyprland: Use hyprctl activeworkspace This is a new command that came out 2 weeks ago. --- swapmaster.sh | 10 ++++++---- tags.sh | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/swapmaster.sh b/swapmaster.sh index 355afe06..fc9849b4 100755 --- a/swapmaster.sh +++ b/swapmaster.sh @@ -3,12 +3,14 @@ # Temporary make the animation a fade for effect hyprctl keyword animation workspaces,1,12,default,fade -# Get the workspace ID of the current window +# Get the current window cw=`hyprctl activewindow -j` -oldWorkspaceID=`echo "$cw" | jq -r '.workspace.id'` + +# Get the current workspace ID +oldWorkspaceID=`hyprctl activeworkspace -j | jq -r '.id'` # Get the number of windows on the workspace (0 = do nothing, 2 or more = swap) -numWindowsOnWorkspace=`hyprctl workspaces -j | jq -r ".[] | select(.id==$oldWorkspaceID) | .windows"` +numWindowsOnWorkspace=`hyprctl activeworkspace -j | jq -r '.windows'` # If there are no windows yet, function as a program launcher if [[ $numWindowsOnWorkspace -eq 0 ]]; then @@ -24,7 +26,7 @@ hyprctl dispatch layoutmsg focusmaster master hyprctl dispatch focuscurrentorlast # Get the workspace ID of the last window -newWorkspaceID=`hyprctl activewindow -j | jq -r '.workspace.id'` +newWorkspaceID=`hyprctl activeworkspace -j | jq -r '.id'` # If the workspaces are the same, swap master with that last window. if [[ "$oldWorkspaceID" == "$newWorkspaceID" ]]; then diff --git a/tags.sh b/tags.sh index b8be031d..318ebce7 100755 --- a/tags.sh +++ b/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 monitors -j | jq -r '.[] | select(.focused==true) | .activeWorkspace.id')",address:"$id" + hyprctl dispatch movetoworkspacesilent "$(hyprctl activeworkspace -j | jq -r '.id')",address:"$id" hyprctl dispatch focuswindow address:"$id" done