This commit is contained in:
2026-07-31 14:39:33 +09:00
parent ad6dff2f6a
commit 82d00fb574
9 changed files with 262 additions and 176 deletions
+38
View File
@@ -1,6 +1,44 @@
{
config,
lib,
osConfig,
...
}:
let
mkSessionService = target: {
Unit = {
Description = "Fcitx 5 input method";
Documentation = [ "https://fcitx-im.org/" ];
PartOf = [ target ];
After = [ target ];
};
Service = {
ExecStart = "${osConfig.i18n.inputMethod.package}/bin/fcitx5 --replace";
Restart = "on-failure";
};
Install.WantedBy = [ target ];
};
in
{ {
home.file.".config/fcitx5/config" = { home.file.".config/fcitx5/config" = {
recursive = true; recursive = true;
source = ./config; source = ./config;
}; };
# niri starts XDG autostart entries through systemd. The explicit service
# below is shared with labwc, so suppress the package-provided entry.
xdg.configFile."autostart/org.fcitx.Fcitx5.desktop".text = ''
[Desktop Entry]
Hidden=true
'';
systemd.user.services =
lib.optionalAttrs config.my.applications.niri.enable {
fcitx5-niri = mkSessionService "niri.service";
}
// lib.optionalAttrs config.my.applications.labwc.enable {
fcitx5-labwc = mkSessionService "labwc-session.target";
};
} }
+149 -16
View File
@@ -1,24 +1,157 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let
action = key: name: {
"@key" = key;
action = {
"@name" = name;
};
};
execute = key: command: {
"@key" = key;
action = {
"@name" = "Execute";
"@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
{ {
xdg.configFile = { wayland.windowManager.labwc = {
"labwc/rc.xml".source = ./rc.xml; enable = true;
# NixOS owns the package so Home Manager only generates the user config.
package = null;
"labwc/environment".text = '' rc = {
XKB_DEFAULT_LAYOUT=jp core = {
XKB_DEFAULT_OPTIONS=ctrl:nocaps decoration = "client";
''; gap = 10;
autoEnableOutputs = "yes";
reuseOutputMode = "yes";
};
"labwc/autostart".text = '' theme = {
# Pull in graphical-session.target so Home Manager services such as name = "Dracula";
# portals, Vicinae, and the idle manager follow the labwc session. cornerRadius = 8;
${lib.getExe' pkgs.systemd "systemctl"} --user --no-block start labwc-session.target dropShadows = "yes";
dropShadowsOnTiled = "yes";
};
# labwc does not run XDG autostart entries itself. Start the input method windowSwitcher = {
# explicitly so both native Wayland and XWayland applications can use it. "@preview" = "yes";
fcitx5 -d --replace >/dev/null 2>&1 & "@outlines" = "yes";
osd = {
"@style" = "thumbnail";
};
};
NOCTALIA_CONFIG_HOME="$HOME/.config/noctalia-labwc" noctalia >/dev/null 2>&1 & focus = {
${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1 >/dev/null 2>&1 & followMouse = "yes";
''; followMouseRequiresMovement = "yes";
raiseOnFocus = "no";
};
desktops = {
"@number" = 9;
"@popupTime" = 500;
"@prefix" = "Workspace";
};
keyboard = {
default = true;
numlock = "on";
keybind = [
(action "W-q" "Close")
(action "W-f" "ToggleMaximize")
(action "W-Tab" "NextWindow")
(action "W-S-Tab" "PreviousWindow")
(action "W-j" "NextWindow")
(action "W-k" "PreviousWindow")
{
"@key" = "W-a";
action = {
"@name" = "ShowMenu";
"@menu" = "client-list-combined-menu";
};
position = {
x = "center";
y = "center";
};
}
(execute "W-t" "ghostty")
(execute "W-d" "vicinae toggle")
(execute "W-e" "nautilus --new-window")
(execute "W-l" "loginctl lock-session")
(execute "W-v" "vicinae vicinae://launch/clipboard/history?toggle=true")
(execute "W-space" "ghostty +toggle-quick-terminal")
(execute "W-p" "wdisplays")
(execute "W-s" "noctalia msg panel-toggle control-center")
(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")
(execute "XF86AudioMute" "noctalia msg volume-mute")
(execute "XF86AudioMicMute" "noctalia msg mic-mute")
(execute "XF86MonBrightnessUp" "noctalia msg brightness-up")
(execute "XF86MonBrightnessDown" "noctalia msg brightness-down")
];
};
mouse.default = true;
libinput.device = [
{
"@category" = "touchpad";
naturalScroll = "yes";
tap = "yes";
tapAndDrag = "yes";
dragLock = "yes";
clickMethod = "clickfinger";
scrollMethod = "twoFinger";
scrollFactor = "4.0";
}
{
"@category" = "non-touch";
pointerSpeed = "-0.1";
accelProfile = "flat";
}
];
};
environment = [
"XKB_DEFAULT_LAYOUT=jp"
"XKB_DEFAULT_OPTIONS=ctrl:nocaps"
];
# Pull in graphical-session.target so Home Manager services such as
# portals, Vicinae, and the idle manager follow the labwc session.
systemd.extraCommands = [
"${lib.getExe' pkgs.systemd "systemctl"} --user --no-block start labwc-session.target"
];
}; };
} }
-147
View File
@@ -1,147 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<labwc_config>
<core>
<decoration>server</decoration>
<gap>10</gap>
<autoEnableOutputs>yes</autoEnableOutputs>
<reuseOutputMode>yes</reuseOutputMode>
</core>
<theme>
<name>Dracula</name>
<cornerRadius>8</cornerRadius>
<dropShadows>yes</dropShadows>
<dropShadowsOnTiled>yes</dropShadowsOnTiled>
</theme>
<windowSwitcher preview="yes" outlines="yes">
<osd style="thumbnail" />
</windowSwitcher>
<focus>
<followMouse>yes</followMouse>
<followMouseRequiresMovement>yes</followMouseRequiresMovement>
<raiseOnFocus>no</raiseOnFocus>
</focus>
<desktops number="9" popupTime="500" prefix="Workspace" />
<keyboard>
<default />
<keybind key="W-q">
<action name="Close" />
</keybind>
<keybind key="W-f">
<action name="ToggleMaximize" />
</keybind>
<keybind key="W-Tab">
<action name="NextWindow" />
</keybind>
<keybind key="W-S-Tab">
<action name="PreviousWindow" />
</keybind>
<keybind key="W-j">
<action name="NextWindow" />
</keybind>
<keybind key="W-k">
<action name="PreviousWindow" />
</keybind>
<keybind key="W-a">
<action name="ShowMenu" menu="client-list-combined-menu" />
<position>
<x>center</x>
<y>center</y>
</position>
</keybind>
<keybind key="W-t">
<action name="Execute" command="ghostty" />
</keybind>
<keybind key="W-d">
<action name="Execute" command="vicinae toggle" />
</keybind>
<keybind key="W-e">
<action name="Execute" command="nautilus --new-window" />
</keybind>
<keybind key="W-l">
<action name="Execute" command="loginctl lock-session" />
</keybind>
<keybind key="W-v">
<action name="Execute" command="vicinae vicinae://launch/clipboard/history?toggle=true" />
</keybind>
<keybind key="W-space">
<action name="Execute" command="ghostty +toggle-quick-terminal" />
</keybind>
<keybind key="W-p">
<action name="Execute" command="wdisplays" />
</keybind>
<keybind key="W-s">
<action name="Execute" command="noctalia msg panel-toggle control-center" />
</keybind>
<keybind key="W-comma">
<action name="Execute" command="noctalia msg settings-toggle" />
</keybind>
<keybind key="W-S-e">
<action name="Exit" />
</keybind>
<keybind key="W-1"><action name="GoToDesktop" to="1" /></keybind>
<keybind key="W-2"><action name="GoToDesktop" to="2" /></keybind>
<keybind key="W-3"><action name="GoToDesktop" to="3" /></keybind>
<keybind key="W-4"><action name="GoToDesktop" to="4" /></keybind>
<keybind key="W-5"><action name="GoToDesktop" to="5" /></keybind>
<keybind key="W-6"><action name="GoToDesktop" to="6" /></keybind>
<keybind key="W-7"><action name="GoToDesktop" to="7" /></keybind>
<keybind key="W-8"><action name="GoToDesktop" to="8" /></keybind>
<keybind key="W-9"><action name="GoToDesktop" to="9" /></keybind>
<keybind key="W-C-1"><action name="SendToDesktop" to="1" /></keybind>
<keybind key="W-C-2"><action name="SendToDesktop" to="2" /></keybind>
<keybind key="W-C-3"><action name="SendToDesktop" to="3" /></keybind>
<keybind key="W-C-4"><action name="SendToDesktop" to="4" /></keybind>
<keybind key="W-C-5"><action name="SendToDesktop" to="5" /></keybind>
<keybind key="W-C-6"><action name="SendToDesktop" to="6" /></keybind>
<keybind key="W-C-7"><action name="SendToDesktop" to="7" /></keybind>
<keybind key="W-C-8"><action name="SendToDesktop" to="8" /></keybind>
<keybind key="W-C-9"><action name="SendToDesktop" to="9" /></keybind>
<keybind key="XF86AudioRaiseVolume">
<action name="Execute" command="noctalia msg volume-up" />
</keybind>
<keybind key="XF86AudioLowerVolume">
<action name="Execute" command="noctalia msg volume-down" />
</keybind>
<keybind key="XF86AudioMute">
<action name="Execute" command="noctalia msg volume-mute" />
</keybind>
<keybind key="XF86AudioMicMute">
<action name="Execute" command="noctalia msg mic-mute" />
</keybind>
<keybind key="XF86MonBrightnessUp">
<action name="Execute" command="noctalia msg brightness-up" />
</keybind>
<keybind key="XF86MonBrightnessDown">
<action name="Execute" command="noctalia msg brightness-down" />
</keybind>
</keyboard>
<mouse>
<default />
</mouse>
<libinput>
<device category="touchpad">
<naturalScroll>yes</naturalScroll>
<tap>yes</tap>
<tapAndDrag>yes</tapAndDrag>
<dragLock>yes</dragLock>
<clickMethod>clickfinger</clickMethod>
<scrollMethod>twoFinger</scrollMethod>
<scrollFactor>4.0</scrollFactor>
</device>
<device category="non-touch">
<pointerSpeed>-0.1</pointerSpeed>
<accelProfile>flat</accelProfile>
</device>
</libinput>
</labwc_config>
-9
View File
@@ -31,15 +31,6 @@ in
}; };
}; };
spawn-at-startup = [
{ command = [ "noctalia" ]; }
{
command = [
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
];
}
];
cursor.size = 16; cursor.size = 16;
layout = { layout = {
+35 -2
View File
@@ -39,6 +39,25 @@ let
${lib.getExe config.programs.noctalia.package} config validate ${labwcRawConfig} ${lib.getExe config.programs.noctalia.package} config validate ${labwcRawConfig}
cp ${labwcRawConfig} $out cp ${labwcRawConfig} $out
''; '';
mkSessionService = target: environment: {
Unit = {
Description = "Noctalia Wayland desktop shell";
Documentation = [ "https://docs.noctalia.dev/" ];
PartOf = [ target ];
After = [ target ];
};
Service = {
ExecStart = lib.getExe config.programs.noctalia.package;
Restart = "on-failure";
}
// lib.optionalAttrs (environment != [ ]) {
Environment = environment;
};
Install.WantedBy = [ target ];
};
in in
{ {
home.packages = [ pkgs.networkmanagerapplet ]; home.packages = [ pkgs.networkmanagerapplet ];
@@ -54,8 +73,7 @@ in
programs.noctalia = { programs.noctalia = {
enable = true; enable = true;
# Both compositors start Noctalia themselves so labwc can select its own # Session-specific services below let labwc select its own config home.
# config home without racing the generic graphical-session service.
systemd.enable = false; systemd.enable = false;
settings = { settings = {
@@ -74,6 +92,11 @@ in
fingerprint = false; fingerprint = false;
}; };
osd.kinds = {
keyboard_layout = false;
media = false;
};
bar.main = { bar.main = {
margin_ends = 15; margin_ends = 15;
position = "top"; position = "top";
@@ -214,5 +237,15 @@ in
}; };
}; };
systemd.user.services =
lib.optionalAttrs config.my.applications.niri.enable {
noctalia-niri = mkSessionService "niri.service" [ ];
}
// lib.optionalAttrs config.my.applications.labwc.enable {
noctalia-labwc = mkSessionService "labwc-session.target" [
"NOCTALIA_CONFIG_HOME=%h/.config/noctalia-labwc"
];
};
xdg.configFile."noctalia-labwc/noctalia/config.toml".source = labwcConfig; xdg.configFile."noctalia-labwc/noctalia/config.toml".source = labwcConfig;
} }
+4 -2
View File
@@ -50,8 +50,10 @@ when removing it from any supported host would make that host invalid.
Select independent concerns independently in `hosts/default.nix`. For example, Select independent concerns independently in `hosts/default.nix`. For example,
a NixOS desktop can combine `interface.labwc` and `interface.niri` to provide a NixOS desktop can combine `interface.labwc` and `interface.niri` to provide
both sessions while sharing `interface.linux-desktop` and `interface.gui`. both sessions while sharing `interface.linux-desktop` and `interface.gui`.
The shared Linux desktop profile provides the common desktop applications; both The shared Linux desktop profile provides the common desktop applications and
session profiles select ly. A daily-use macOS development machine can combine `interface.macos`, session-independent services; both session profiles select ly. The laptop
platform selects niri as Ly's default session, while the desktop platform
selects labwc. A daily-use macOS development machine can combine `interface.macos`,
`workload.development`, and `workload.personal`. Hardware support does not `workload.development`, and `workload.personal`. Hardware support does not
implicitly select an interface or workload. implicitly select an interface or workload.
@@ -8,6 +8,7 @@
"applications.gtk" "applications.gtk"
"applications.nautilus" "applications.nautilus"
"hardwares.graphics" "hardwares.graphics"
"services.polkit-gnome"
"systems.audio" "systems.audio"
"systems.fonts" "systems.fonts"
]; ];
+32
View File
@@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}:
let
mkSessionService = target: {
Unit = {
Description = "GNOME PolicyKit authentication agent";
Documentation = [ "man:polkit(8)" ];
PartOf = [ target ];
After = [ target ];
};
Service = {
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
Restart = "on-failure";
};
Install.WantedBy = [ target ];
};
in
{
systemd.user.services =
lib.optionalAttrs config.my.applications.niri.enable {
polkit-gnome-niri = mkSessionService "niri.service";
}
// lib.optionalAttrs config.my.applications.labwc.enable {
polkit-gnome-labwc = mkSessionService "labwc-session.target";
};
}
+3
View File
@@ -0,0 +1,3 @@
{
security.polkit.enable = true;
}