From aceb3d4808071274ff49292121219e877922b0a3 Mon Sep 17 00:00:00 2001 From: moons Date: Sun, 2 Aug 2026 23:53:38 +0900 Subject: [PATCH] labwc --- .../applications/fcitx5/{ => home}/nixos.nix | 44 ++++-------- modules/applications/fcitx5/meta.nix | 2 +- modules/applications/labwc/home.nix | 67 ++++++++++++------- modules/applications/labwc/nixos.nix | 10 --- modules/applications/niri/nixos.nix | 14 +--- modules/systems/wayland/nixos.nix | 2 + 6 files changed, 59 insertions(+), 80 deletions(-) rename modules/applications/fcitx5/{ => home}/nixos.nix (72%) diff --git a/modules/applications/fcitx5/nixos.nix b/modules/applications/fcitx5/home/nixos.nix similarity index 72% rename from modules/applications/fcitx5/nixos.nix rename to modules/applications/fcitx5/home/nixos.nix index 2f05d01..7df41df 100644 --- a/modules/applications/fcitx5/nixos.nix +++ b/modules/applications/fcitx5/home/nixos.nix @@ -1,5 +1,6 @@ { pkgs, ... }: { + services.hazkey.enable = true; i18n.inputMethod = { @@ -8,6 +9,7 @@ fcitx5 = { waylandFrontend = true; + addons = with pkgs; [ fcitx5-gtk kdePackages.fcitx5-qt @@ -17,14 +19,17 @@ settings = { inputMethod = { GroupOrder."0" = "Default"; + "Groups/0" = { Name = "Default"; "Default Layout" = "jp"; DefaultIM = "hazkey"; }; + "Groups/0/Items/0" = { Name = "keyboard-jp"; }; + "Groups/0/Items/1" = { Name = "hazkey"; }; @@ -38,37 +43,14 @@ ModifierOnlyKeyTimeout = 250; }; - "Hotkey/TriggerKeys" = { - "1" = "Zenkaku_Hankaku"; - }; - - "Hotkey/ActivateKeys" = { - "0" = "Henkan"; - }; - - "Hotkey/DeactivateKeys" = { - "0" = "Muhenkan"; - }; - - "Hotkey/PrevPage" = { - "0" = "Up"; - }; - - "Hotkey/NextPage" = { - "0" = "Down"; - }; - - "Hotkey/PrevCandidate" = { - "0" = "Shift+Tab"; - }; - - "Hotkey/NextCandidate" = { - "0" = "Tab"; - }; - - "Hotkey/TogglePreedit" = { - "0" = "Control+Alt+P"; - }; + "Hotkey/TriggerKeys"."1" = "Zenkaku_Hankaku"; + "Hotkey/ActivateKeys"."0" = "Henkan"; + "Hotkey/DeactivateKeys"."0" = "Muhenkan"; + "Hotkey/PrevPage"."0" = "Up"; + "Hotkey/NextPage"."0" = "Down"; + "Hotkey/PrevCandidate"."0" = "Shift+Tab"; + "Hotkey/NextCandidate"."0" = "Tab"; + "Hotkey/TogglePreedit"."0" = "Control+Alt+P"; Behavior = { ActiveByDefault = false; diff --git a/modules/applications/fcitx5/meta.nix b/modules/applications/fcitx5/meta.nix index d6337b7..caaa6cf 100644 --- a/modules/applications/fcitx5/meta.nix +++ b/modules/applications/fcitx5/meta.nix @@ -2,5 +2,5 @@ { description = "Fcitx 5 input method framework with Hazkey Japanese input"; - imports.nixos = [ inputs.nix-hazkey.nixosModules.hazkey ]; + imports.home = [ inputs.nix-hazkey.homeModules.hazkey ]; } diff --git a/modules/applications/labwc/home.nix b/modules/applications/labwc/home.nix index bb51960..c4b7a68 100644 --- a/modules/applications/labwc/home.nix +++ b/modules/applications/labwc/home.nix @@ -1,5 +1,6 @@ { lib, pkgs, ... }: let + systemctl = lib.getExe' pkgs.systemd "systemctl"; action = key: name: { "@key" = key; action = { @@ -74,7 +75,7 @@ in }; desktops = { - "@number" = 9; + "@number" = 1; "@popupTime" = 500; "@prefix" = "Workspace"; }; @@ -85,19 +86,43 @@ in keybind = [ (action "W-q" "Close") (action "W-f" "ToggleMaximize") + (action "W-c" "Iconify") (action "W-Tab" "NextWindow") (action "W-S-Tab" "PreviousWindow") - (action "W-j" "NextWindow") - (action "W-k" "PreviousWindow") + (action "W-Up" "Lower") + (action "W-Down" "Raise") + (action "W-Left" "NextWindow") + (action "W-Right" "PreviousWindow") { - "@key" = "W-a"; + "@key" = "W-C-Left"; action = { - "@name" = "ShowMenu"; - "@menu" = "client-list-combined-menu"; + "@name" = "SnapToEdge"; + "@direction" = "left"; + "@combine" = "yes"; }; - position = { - x = "center"; - y = "center"; + } + { + "@key" = "W-C-Right"; + action = { + "@name" = "SnapToEdge"; + "@direction" = "right"; + "@combine" = "yes"; + }; + } + { + "@key" = "W-C-Up"; + action = { + "@name" = "SnapToEdge"; + "@direction" = "up"; + "@combine" = "yes"; + }; + } + { + "@key" = "W-C-Down"; + action = { + "@name" = "SnapToEdge"; + "@direction" = "down"; + "@combine" = "yes"; }; } (execute "W-t" "ghostty") @@ -147,21 +172,13 @@ in "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 = [ - # The wlroots portal is conditionally started with WAYLAND_DISPLAY. It - # can otherwise be skipped before labwc imports its session environment, - # leaving the desktop portal without the ScreenCast interface. - "${lib.getExe' pkgs.systemd "systemctl"} --user restart xdg-desktop-portal-wlr.service" - "${lib.getExe' pkgs.systemd "systemctl"} --user restart xdg-desktop-portal.service" - - # Clear the previous session's target first. Otherwise services such as - # kanshi that lose their Wayland connection on logout remain in a - # failed/start-limit-hit state and are not started for the next login. - "${lib.getExe' pkgs.systemd "systemctl"} --user stop labwc-session.target" - "${lib.getExe' pkgs.systemd "systemctl"} --user --no-block start labwc-session.target" - ]; }; + + 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 d825bd2..f35573e 100644 --- a/modules/applications/labwc/nixos.nix +++ b/modules/applications/labwc/nixos.nix @@ -7,14 +7,4 @@ in enable = true; package = unstable.labwc; }; - - xdg.portal.config.labwc.default = [ - "wlr" - "gtk" - ]; - - environment.systemPackages = [ - pkgs.wdisplays - pkgs.wlr-randr - ]; } diff --git a/modules/applications/niri/nixos.nix b/modules/applications/niri/nixos.nix index 0be33a4..17c6abd 100644 --- a/modules/applications/niri/nixos.nix +++ b/modules/applications/niri/nixos.nix @@ -1,20 +1,8 @@ -{ config, pkgs, ... }: -let - wdisplays = pkgs.wdisplays.overrideAttrs (oldAttrs: { - patches = (oldAttrs.patches or [ ]) ++ [ ./wdisplays-canonical-scale.patch ]; - }); -in +{ config, ... }: { programs.niri.enable = true; # niri-flake supplies the compositor package but does not register its # user units with NixOS. Without this, Ly cannot start niri-session. systemd.packages = [ config.programs.niri.package ]; - - environment.systemPackages = [ - # Keep the transient Wayland-native GUI, with fractional scales rounded to - # the same wl_fixed_t value that niri receives on the first Apply. - wdisplays - pkgs.wlr-randr # Wayland output management CLI - ]; } diff --git a/modules/systems/wayland/nixos.nix b/modules/systems/wayland/nixos.nix index 97a605e..a9a0266 100644 --- a/modules/systems/wayland/nixos.nix +++ b/modules/systems/wayland/nixos.nix @@ -32,5 +32,7 @@ environment.systemPackages = [ pkgs.xwayland-satellite pkgs.uwsm + pkgs.wlr-randr + pkgs.wdisplays ]; }