diff --git a/flake.lock b/flake.lock index 872382a..6f6d2b8 100644 --- a/flake.lock +++ b/flake.lock @@ -588,11 +588,11 @@ "xwayland-satellite-unstable": "xwayland-satellite-unstable" }, "locked": { - "lastModified": 1785360640, - "narHash": "sha256-fg8SdA1SbiY1QhEuHLd9mSc99PIesiHEwf31O7oO044=", + "lastModified": 1785705919, + "narHash": "sha256-fkLVrf2tZ/822v+kF2NgXxQD5ugMNTgGlUd7Y1kHEHg=", "owner": "sodiboo", "repo": "niri-flake", - "rev": "014fda2da9e9667b8da9c5d6258743415456fba4", + "rev": "50e136c5452ae98638d066454391c7ba7e16410a", "type": "github" }, "original": { @@ -621,11 +621,11 @@ "niri-unstable": { "flake": false, "locked": { - "lastModified": 1784570726, - "narHash": "sha256-9EMn69JBcFWFgUM7f0VBAX+jBby5b9H3M59U75+5yI4=", + "lastModified": 1785701241, + "narHash": "sha256-ircVOzPWRircI39ac/tqJajr5OoJxEVrDlBb05TULEk=", "owner": "YaLTeR", "repo": "niri", - "rev": "7f26c3ee804fb6ed458ef7fb0e3c794f14e0b3bc", + "rev": "feb3e43f1475e0865bb89cbd1e898b34d1d2ccf6", "type": "github" }, "original": { @@ -908,11 +908,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1785318670, - "narHash": "sha256-dN6Ou5x/+23FZLEpYP3IffO+NyJFzUlGumt1uu3MMaY=", + "lastModified": 1785571196, + "narHash": "sha256-KoTsyMQqnXQZq8deCEnu4QkyldkwH/bpMMhUcfMdGIw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0954f7ee2f6bb3dc7d4e3d0d8bcb8fd4bde4cfc5", + "rev": "148bab9c1c3c53136ecb44a6ea356a0ed5b39b06", "type": "github" }, "original": { diff --git a/modules/applications/labwc/home.nix b/modules/applications/labwc/home.nix index c4b7a68..aa8fea9 100644 --- a/modules/applications/labwc/home.nix +++ b/modules/applications/labwc/home.nix @@ -1,6 +1,7 @@ { lib, pkgs, ... }: let systemctl = lib.getExe' pkgs.systemd "systemctl"; + action = key: name: { "@key" = key; action = { @@ -15,29 +16,6 @@ let "@command" = command; }; }; - - desktopKeybinds = lib.concatMap ( - desktop: - let - number = toString desktop; - in - [ - { - "@key" = "W-${number}"; - action = { - "@name" = "GoToDesktop"; - "@to" = number; - }; - } - { - "@key" = "W-C-${number}"; - action = { - "@name" = "SendToDesktop"; - "@to" = number; - }; - } - ] - ) (lib.range 1 9); in { wayland.windowManager.labwc = { @@ -45,40 +23,18 @@ in # NixOS owns the package so Home Manager only generates the user config. package = null; + systemd = { + enable = true; + + variables = [ + "DISPLAY" + "WAYLAND_DISPLAY" + "XDG_CURRENT_DESKTOP" + "XDG_SESSION_TYPE" + ]; + }; + rc = { - core = { - decoration = "client"; - gap = 10; - autoEnableOutputs = "yes"; - reuseOutputMode = "yes"; - }; - - theme = { - name = "Dracula"; - cornerRadius = 8; - dropShadows = "yes"; - dropShadowsOnTiled = "yes"; - }; - - windowSwitcher = { - "@preview" = "yes"; - "@outlines" = "yes"; - osd = { - "@style" = "thumbnail"; - }; - }; - - focus = { - followMouse = "yes"; - followMouseRequiresMovement = "yes"; - raiseOnFocus = "no"; - }; - - desktops = { - "@number" = 1; - "@popupTime" = 500; - "@prefix" = "Workspace"; - }; keyboard = { default = true; @@ -136,7 +92,6 @@ in (execute "W-comma" "noctalia msg settings-toggle") (action "W-S-e" "Exit") ] - ++ desktopKeybinds ++ [ (execute "XF86AudioRaiseVolume" "noctalia msg volume-up") (execute "XF86AudioLowerVolume" "noctalia msg volume-down") @@ -147,6 +102,40 @@ in ]; }; + core = { + decoration = "client"; + gap = 10; + autoEnableOutputs = "yes"; + reuseOutputMode = "yes"; + }; + + theme = { + name = "Dracula"; + cornerRadius = 8; + dropShadows = "yes"; + dropShadowsOnTiled = "yes"; + }; + + windowSwitcher = { + "@preview" = "yes"; + "@outlines" = "yes"; + osd = { + "@style" = "thumbnail"; + }; + }; + + focus = { + followMouse = "yes"; + followMouseRequiresMovement = "yes"; + raiseOnFocus = "no"; + }; + + desktops = { + "@number" = 1; + "@popupTime" = 500; + "@prefix" = "Workspace"; + }; + mouse.default = true; libinput.device = [ @@ -159,6 +148,7 @@ in clickMethod = "clickfinger"; scrollMethod = "twoFinger"; scrollFactor = "4.0"; + disableWhileTyping = "yes"; } { "@category" = "non-touch"; @@ -174,10 +164,6 @@ in ]; }; - xdg.configFile."labwc/autostart".text = lib.mkAfter '' - ${systemctl} --user --no-block start labwc-session.target - ''; - xdg.configFile."labwc/shutdown".text = lib.mkAfter '' ${systemctl} --user stop graphical-session.target ''; diff --git a/modules/applications/labwc/nixos.nix b/modules/applications/labwc/nixos.nix index f35573e..fae6173 100644 --- a/modules/applications/labwc/nixos.nix +++ b/modules/applications/labwc/nixos.nix @@ -1,4 +1,9 @@ -{ inputs, pkgs, ... }: +{ + inputs, + pkgs, + lib, + ... +}: let unstable = inputs.nixpkgs-unstable.legacyPackages.${pkgs.stdenv.hostPlatform.system}; in @@ -7,4 +12,31 @@ in enable = true; package = unstable.labwc; }; + + # NixOS decides whether a graphical session manages graphical-session.target + # itself by checking XDG_CURRENT_DESKTOP against a hard-coded list. Labwc is + # currently absent from that list, so NixOS starts + # nixos-fake-graphical-session.target before Labwc is ready. + # + # This configuration uses Home Manager's Labwc systemd integration, which + # imports the Wayland environment and starts labwc-session.target correctly. + # Mark the Labwc session as systemd-aware before the display-manager wrapper + # performs its hard-coded check. Otherwise services such as Fcitx5 can start + # before WAYLAND_DISPLAY is available. + # + # Despite the services.xserver namespace, this session wrapper is also used + # for Wayland sessions by display managers such as Ly. + services.xserver.displayManager.sessionCommands = lib.mkAfter '' + case ":''${XDG_CURRENT_DESKTOP:-}:" in + *:labwc:*) + case ":$XDG_CURRENT_DESKTOP:" in + *:X-NIXOS-SYSTEMD-AWARE:*) + ;; + *) + export XDG_CURRENT_DESKTOP="$XDG_CURRENT_DESKTOP:X-NIXOS-SYSTEMD-AWARE" + ;; + esac + ;; + esac + ''; }