From aaf03d1860760f8fc4ae100d3db3b71ba1d99526 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 5 Dec 2025 10:14:10 +0100 Subject: ... --- accounts/gkleen@sif/default.nix | 2 +- accounts/gkleen@sif/niri.nix | 24 +++++++++++++++--------- accounts/gkleen@sif/shell/quickshell/Bar.qml | 18 +++++++++++++++--- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index 5a4521a8..3c68645e 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix @@ -71,7 +71,7 @@ in { home-manager.users.${userName} = { imports = [ ./libvirt - ./niri + ./niri.nix ./shell ./synadm flakeInputs.nix-index-database.homeModules.nix-index diff --git a/accounts/gkleen@sif/niri.nix b/accounts/gkleen@sif/niri.nix index d4b77d9c..fada053b 100644 --- a/accounts/gkleen@sif/niri.nix +++ b/accounts/gkleen@sif/niri.nix @@ -716,6 +716,11 @@ in { (plain "binds" (let bind = name: cfg: node name [(lib.removeAttrs cfg ["action"])] (lib.mapAttrsToList leaf (lib.removeAttrs cfg.action ["__functor"])); + + move-column-to-workspace = kdl.magic-leaf "move-column-to-workspace"; + screenshot = kdl.magic-leaf "screenshot"; + screenshot-window = kdl.magic-leaf "screenshot-window"; + screenshot-screen = kdl.magic-leaf "screenshot-screen"; in normalize-nodes [ (lib.mapAttrsToList bind (with config.lib.niri.actions; { @@ -821,9 +826,9 @@ in { wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste ''; })); - "Print".action = kdl.magic-leaf "screenshot"; - "Control+Print".action = kdl.magic-leaf "screenshot-window"; - "Shift+Print".action = kdl.magic-leaf "screenshot-screen"; + "Print".action = screenshot; + "Control+Print".action = screenshot-window; + "Shift+Print".action = screenshot-screen; "Mod+B".action = with-select-window-action ".workspace_id == ($active_workspace | tonumber)" "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}"; "Mod+Shift+B".action = with-select-window-action "true" "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}"; @@ -862,19 +867,19 @@ in { "Mod+Shift+Control+C".action = move-workspace-up; "Mod+ParenLeft".action = focus-workspace "comm"; - "Mod+Shift+ParenLeft".action = kdl.magic-leaf "move-column-to-workspace" "comm"; + "Mod+Shift+ParenLeft".action = move-column-to-workspace "comm"; "Mod+ParenRight".action = focus-workspace "web"; - "Mod+Shift+ParenRight".action = kdl.magic-leaf "move-column-to-workspace" "web"; + "Mod+Shift+ParenRight".action = move-column-to-workspace "web"; "Mod+BraceRight".action = focus-workspace "read"; - "Mod+Shift+BraceRight".action = kdl.magic-leaf "move-column-to-workspace" "read"; + "Mod+Shift+BraceRight".action = move-column-to-workspace "read"; "Mod+BraceLeft".action = focus-workspace "mon"; - "Mod+Shift+BraceLeft".action = kdl.magic-leaf "move-column-to-workspace" "mon"; + "Mod+Shift+BraceLeft".action = move-column-to-workspace "mon"; "Mod+Asterisk".action = focus-workspace "vid"; - "Mod+Shift+Asterisk".action = kdl.magic-leaf "move-column-to-workspace" "vid"; + "Mod+Shift+Asterisk".action = move-column-to-workspace "vid"; "Mod+Plus".action = with-unnamed-workspace-action ''{"Action":{"FocusWorkspace":{"reference":{"Id": .id}}}}''; "Mod+Shift+Plus".action = with-unnamed-workspace-action ''{"Action":{"MoveColumnToWorkspace":{"reference":{"Id": .id}, "focus": true}}}''; @@ -884,6 +889,7 @@ in { "Mod+Shift+M".action = toggle-column-tabbed-display; + "Mod+L".action = maximize-window-to-edges; "Mod+R".action = switch-preset-column-width; "Mod+Shift+R".action = maximize-column; "Mod+Shift+Ctrl+R".action = switch-preset-window-height; @@ -970,7 +976,7 @@ in { "Mod+Shift+Semicolon".action = shell { Notifications = { DismissAll = {}; }; }; })) (map ({ name, selector, spawn, key, ...}: if key != null && selector != null && spawn != null then bind key { action = focus-or-spawn-action selector name spawn; } else null) cfg.scratchspaces) - (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = kdl.magic-leaf "move-column-to-workspace" name; } else null) cfg.scratchspaces) + (map ({ name, moveKey, ...}: if moveKey != null then bind moveKey { action = move-column-to-workspace name; } else null) cfg.scratchspaces) ] )) ]; diff --git a/accounts/gkleen@sif/shell/quickshell/Bar.qml b/accounts/gkleen@sif/shell/quickshell/Bar.qml index c0ff4dac..54ac2d3c 100644 --- a/accounts/gkleen@sif/shell/quickshell/Bar.qml +++ b/accounts/gkleen@sif/shell/quickshell/Bar.qml @@ -1,27 +1,39 @@ import Quickshell import Quickshell.Wayland import QtQuick +import qs.Services PanelWindow { id: bar WlrLayershell.namespace: "bar" + property bool haveMaximizedWindow: { + let currWindowId = Array.from(NiriService.workspaces).find(ws => { + return ws.output === bar.screen.name && ws.is_active; + })?.active_window_id; + let activeWindowTileSize = Array.from(NiriService.windows).find(win => win.id == currWindowId)?.layout?.tile_size; + + if (!activeWindowTileSize) + return false; + return activeWindowTileSize[0] >= bar.screen.width && activeWindowTileSize[1] >= bar.screen.height - bar.height; + } + anchors { top: true left: true right: true } margins { - left: 26 + 8 - right: 26 + 8 + left: bar.haveMaximizedWindow ? 0 : 26 + 8 + right: bar.haveMaximizedWindow ? 0 : 26 + 8 } implicitHeight: 21 color: "transparent" Rectangle { - color: Qt.rgba(0, 0, 0, 0.75) + color: bar.haveMaximizedWindow ? "black" : Qt.rgba(0, 0, 0, 0.75) anchors.fill: parent // bottomLeftRadius: 8 // bottomRightRadius: 8 -- cgit v1.2.3