fcitx5 on labwc

This commit is contained in:
2026-08-03 11:44:15 +09:00
parent d67d53644e
commit d5e4c90710
3 changed files with 89 additions and 71 deletions
+47 -61
View File
@@ -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
'';
+33 -1
View File
@@ -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
'';
}