1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-14 04:51:08 +01:00

sway: systemd customization

This commit is contained in:
Ivan Leshchenko 2024-04-19 11:15:54 -04:00 committed by GitHub
parent 068dd4ae29
commit 31c77dcc2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 166 additions and 2 deletions

View file

@ -256,6 +256,11 @@ let
outputStr = moduleStr "output";
seatStr = moduleStr "seat";
variables = concatStringsSep " " cfg.systemd.variables;
extraCommands = concatStringsSep " && " cfg.systemd.extraCommands;
systemdActivation = ''
exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd ${variables}; ${extraCommands}"'';
configFile = pkgs.writeText "sway.conf" (concatStringsSep "\n"
((optional (cfg.extraConfigEarly != "") cfg.extraConfigEarly)
++ (if cfg.config != null then
@ -310,8 +315,7 @@ let
++ map workspaceOutputStr workspaceOutputAssign # custom mapping
)
else
[ ]) ++ (optional cfg.systemd.enable ''
exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE; systemctl --user start sway-session.target"'')
[ ]) ++ (optional cfg.systemd.enable systemdActivation)
++ (optional (!cfg.xwayland) "xwayland disable") ++ [ cfg.extraConfig ]));
defaultSwayPackage = pkgs.sway.override {
@ -366,6 +370,37 @@ in {
* {env}`WAYLAND_DISPLAY`
* {env}`SWAYSOCK`
* {env}`XDG_CURRENT_DESKTOP`
* {env}`XDG_SESSION_TYPE`
* {env}`NIXOS_OZONE_WL`
* {env}`XCURSOR_THEME`
* {env}`XCURSOR_SIZE`
You can extend this list using the `systemd.variables` option.
'';
};
variables = mkOption {
type = types.listOf types.str;
default = [
"DISPLAY"
"WAYLAND_DISPLAY"
"SWAYSOCK"
"XDG_CURRENT_DESKTOP"
"XDG_SESSION_TYPE"
"NIXOS_OZONE_WL"
"XCURSOR_THEME"
"XCURSOR_SIZE"
];
example = [ "-all" ];
description = ''
Environment variables imported into the systemd and D-Bus user environment.
'';
};
extraCommands = mkOption {
type = types.listOf types.str;
default = [ "systemctl --user start sway-session.target" ];
description = ''
Extra commands to run after D-Bus activation.
'';
};