Use uwsm to manage systemd

This commit is contained in:
2024-12-21 17:06:57 +01:00
parent 35020994d7
commit 09ae6823a9
2 changed files with 34 additions and 21 deletions

View File

@@ -1,10 +1,23 @@
{pkgs, user, ...}: {
{
pkgs,
user,
lib,
...
}: {
imports = [
../../modules/wm
];
# this is called manually in the river init script.
services.xserver.desktopManager.runXdgAutostartIfNone = true;
programs.uwsm = {
enable = true;
waylandCompositors = {
river = {
prettyName = "river";
comment = "river compositor managed by UWSM";
binPath = "${pkgs.river}/bin/river";
};
};
};
services.greetd = {
enable = true;
@@ -14,12 +27,21 @@
user = "greeter";
};
initial_session = {
command = "${pkgs.systemd}/bin/systemctl --wait --user start river.service";
command = "uwsm start -S river-uwsm.desktop";
user = user;
};
};
};
# Without this, greetd would depend on graphical.target & would get activated before
# uwsm. This leads to a race that can:
# - fail startup & retry it (leading to a ~10s delay)
# - make graphical services start before river.
# To prevent those issue, simply target the default tty & greetd's inital_session will
# start uwsm & end up reaching graphical.target
systemd.defaultUnit = lib.mkForce "multi-user.target";
xdg.portal = {
enable = true;
wlr.enable = true;

View File

@@ -62,8 +62,6 @@ in {
"${pkgs.river-luatile}/bin/river-luatile"
"wallpaper"
"ags"
"vesktop"
# "youtube-music"
];
default-attach-mode = "top";
@@ -140,12 +138,12 @@ in {
"Super F" = "toggle-fullscreen";
"Super+Shift F" = "toggle-float";
"Super R" = "spawn ${config.home.sessionVariables.BROWSER}";
"Super E" = "spawn ${config.home.sessionVariables.TERMINAL}";
"Super P" = "spawn 'rofi -show drun -show-icons'";
"Super R" = "spawn 'uwsm app -- ${config.home.sessionVariables.BROWSER}'";
"Super E" = "spawn 'uwsm app -- ${config.home.sessionVariables.TERMINAL}'";
"Super P" = ''spawn 'rofi -show drun -show-icons -run-command "uwsm app -- {cmd}"' '';
"Super X" = "spawn '${screenshot}/bin/screenshot'";
"Super+Control X" = "spawn '${screenshot-freeze}/bin/screenshot-freeze'";
"Super+Shift X" = "spawn '${record}/bin/record'";
"Super+Shift X" = "spawn 'uwsm app -- ${record}/bin/record'";
"Super B" = "spawn '${pkgs.hyprpicker}/bin/hyprpicker | wl-copy'";
"Super V" = "spawn '${cliphist} list | rofi -dmenu -display-columns 2 | ${cliphist} decode | wl-copy'";
"Super+Shift L" = "spawn 'loginctl lock-session'";
@@ -180,24 +178,17 @@ in {
riverctl map normal Super+Shift 0 set-view-tags "$all_tags"
# Focus second screen by default (also spawn apps there)
riverctl focus-output DP-2
riverctl focus-output DP-1
riverctl set-focused-tags $((1 << 3))
${pkgs.uwsm}/bin/uwsm finalize DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE
hyprlock --immediate
'';
systemd = {
enable = true;
runInService = true;
extraCommands = [
"${pkgs.systemd}/bin/systemctl --user start xdg-autostart-if-no-desktop-manager.target"
];
};
# we use uwsm instead.
systemd.enable = false;
};
# Run river in systemd directly and not by hand. Failing to do so will make graphical-session.target never stop.
# So a big wait time when shutting down & graphical services are not restarted when starting river again.
home.packages = with pkgs; [
gnome-control-center
gnome-weather