diff --git a/dotfiles/takamaki/niri.kdl b/dotfiles/takamaki/niri.kdl index ea3ff01..1ec6948 100644 --- a/dotfiles/takamaki/niri.kdl +++ b/dotfiles/takamaki/niri.kdl @@ -41,10 +41,10 @@ overview { zoom 0.67; } layout { gaps 16 struts { - left 6 - right 6 - top 0 - bottom 0 + left 24 + right 24 + top -8 + bottom -4 } focus-ring { width 1.5 @@ -108,8 +108,8 @@ binds { Mod+Shift+WheelScrollUp { focus-workspace-up; } Mod+Shift+WheelScrollDown { focus-workspace-down; } - Mod+equal { set-column-width "+2%"; } - Mod+minus { set-column-width "-2%"; } + Mod+equal { set-column-width "+5%"; } + Mod+minus { set-column-width "-5%"; } Mod+Shift+Up { move-window-to-workspace-up; } Mod+Shift+Down { move-window-to-workspace-down; } @@ -119,6 +119,9 @@ binds { Mod+Control+Left { focus-monitor-left; } Mod+Control+Right { focus-monitor-right; } + Mod+Shift+Control+Up { move-workspace-up; } + Mod+Shift+Control+Down { move-workspace-down; } + Mod+Shift+Control+Left { move-window-to-monitor-left; } Mod+Shift+Control+Right { move-window-to-monitor-right; } @@ -130,8 +133,24 @@ binds { Mod+XF86AudioLowerVolume cooldown-ms=250 { spawn "decrease-brightness" "/dev/i2c-10"; } Mod+Shift+XF86AudioRaiseVolume cooldown-ms=250 { spawn "increase-brightness" "/dev/i2c-6"; } Mod+Shift+XF86AudioLowerVolume cooldown-ms=250 { spawn "decrease-brightness" "/dev/i2c-6"; } + + Mod+Slash { spawn "niri-scratch-workspace-toggle"; } + Mod+Shift+Slash { move-window-to-workspace "x" focus=false; } + + Mod+X { toggle-window-floating; } + Mod+Z { spawn "kitty" "zsh" "-i" "-c" "apply-config"; } +} +workspace "x" { + hidden true + layout { + focus-ring { + width 3 + active-color "#a33d3d" + } + } } spawn-at-startup "noctalia" +spawn-at-startup "niri-listen-for-scratch-workspace-change" window-rule { draw-border-with-background false geometry-corner-radius 4 diff --git a/modules/hosts/takamaki/takamaki.nix b/modules/hosts/takamaki/takamaki.nix index bb2354f..9861444 100644 --- a/modules/hosts/takamaki/takamaki.nix +++ b/modules/hosts/takamaki/takamaki.nix @@ -72,7 +72,6 @@ extraPackages = with pkgs; [ nix-init github-desktop - self.packages.${stdenv.hostPlatform.system}.biri ]; shellScripts = let @@ -118,6 +117,31 @@ increase-brightness = mkBrightnessScript "+"; decrease-brightness = mkBrightnessScript "-"; + + niri-scratch-workspace-toggle = '' + if niri msg --json workspaces-with-hidden | jq -e '.[] | select(.name=="x") | .is_hidden' >/dev/null; then + niri msg action unhide-workspace --focus=false "x" + OUTPUT=$(niri msg --json focused-output | jq '.name' | sed 's/"//g') + echo "OUTPUT=$OUTPUT" + niri msg action move-workspace-to-monitor --reference "x" "$OUTPUT" + echo "moved scratch workspace: $(niri msg --json workspaces | jq '.[] | select(.name=="x") | .output')" + niri msg action focus-workspace "x" + else + niri msg action hide-workspace "x" + fi + ''; + + niri-listen-for-scratch-workspace-change = '' + niri msg --json event-stream | while read -r event; do + if echo $event | jq -e '.WorkspaceActivated.focused' >/dev/null; then + if niri msg --json workspaces | jq -e '.[] | select(.name=="x") | .is_active==false' >/dev/null; then + niri msg action hide-workspace "x" + fi + elif echo $event | jq -e '.WorkspacesChanged.workspaces.[] | select(.name=="x") | .is_active==false' >/dev/null; then + niri msg action hide-workspace "x" + fi + done + ''; }; }; };