add(binds): focus between nonfloating and floaters

This commit is contained in:
kenji
2026-01-14 19:20:13 -06:00
parent da383a3526
commit 97a23a26dd
3 changed files with 57 additions and 0 deletions
+7
View File
@@ -27,6 +27,7 @@
"SUPER, K, Move focus up, movefocus, u"
"SUPER, H, Move focus left, movefocus, l"
"SUPER, L, Move focus right, movefocus, r"
"SUPER, G, Switch Focus (Float/Tile), exec, hakase-focus-switch"
# move window
"SUPER SHIFT, h, Move window left, movewindow, l"
@@ -55,6 +56,12 @@
# [Workspaces] Toggle between most recent workspaces
"SUPER, Tab, Cycle workspaces, workspace, previous"
# [Workspaces] Move to another workspace
"CTRL SHIFT, H, Move to previous workspace, split:workspace, -1"
"CTRL SHIFT, L, Move to next workspace, split:workspace, +1"
"CTRL SHIFT, K, Move to previous workspace, split:workspace, -1"
"CTRL SHIFT, J, Move to next workspace, split:workspace, +1"
# hyprspace - workspace overview
"SUPER, E, Toggle Workspace Overview, overview:toggle"
]
+20
View File
@@ -28,8 +28,28 @@
exit 0
'';
hakase-focus-switch = pkgs.writeShellScriptBin "hakase-focus-switch" ''
HYPRCTL="${pkgs.hyprland}/bin/hyprctl"
JQ="${pkgs.jq}/bin/jq"
workspace_id=$($HYPRCTL activeworkspace -j | $JQ '.id')
active_window=$($HYPRCTL activewindow -j)
is_floating=$(echo "$active_window" | $JQ '.floating')
if [ "$is_floating" == "true" ]; then
target_addr=$($HYPRCTL clients -j | $JQ -r --argjson ws "$workspace_id" '[.[] | select(.workspace.id == $ws and .floating == false)] | .[0].address')
else
target_addr=$($HYPRCTL clients -j | $JQ -r --argjson ws "$workspace_id" '[.[] | select(.workspace.id == $ws and .floating == true)] | .[0].address')
fi
if [ "$target_addr" != "null" ] && [ -n "$target_addr" ]; then
$HYPRCTL dispatch focuswindow address:$target_addr
fi
'';
in {
home.packages = [
hakase-workspace-switch-force
hakase-focus-switch
];
}