Skip to content

Commit

Permalink
hyprland/uwsm: part 1
Browse files Browse the repository at this point in the history
Switch to UWSM to automatically manage systemd session.

Many services wrongfully require `graphical-session-pre.target` while
also requiring WAYLAND_DISPLAY to work. Will need to change this in HM.

Part 2 will encompass switching from run-as-service (see
home/terminal/programs/transient-services) to `uwsm app` or some
[other helper](https://github.com/Vladimir-csp/app2unit).
  • Loading branch information
fufexan committed Nov 7, 2024
1 parent c05edf9 commit a6084b9
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 3 deletions.
4 changes: 4 additions & 0 deletions home/programs/wayland/hyprland/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
lib,
inputs,
pkgs,
...
Expand Down Expand Up @@ -31,11 +32,14 @@ in {
];

systemd = {
enable = false;
variables = ["--all"];
extraCommands = [
"systemctl --user stop graphical-session.target"
"systemctl --user start hyprland-session.target"
];
};
};

systemd.user.targets.tray.Unit.Requires = lib.mkForce ["graphical-session.target"];
}
2 changes: 2 additions & 0 deletions home/programs/wayland/hyprland/settings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ in {
];

exec-once = [
# finalize startup
"uwsm finalize"

This comment has been minimized.

Copy link
@Vladimir-csp

Vladimir-csp Nov 8, 2024

For Hyprland this may not be needed if Hyprland itself puts env vars along with WAYLAND_DESKTOP into systemd activation environment. It did in 0.41, but does not in 0.44.1. (related? hyprwm/Hyprland#8204).

Anyway, it does not hurt to have this. Better safe than sorry.

# set cursor for HL itself
"hyprctl setcursor ${cursorName} ${toString pointer.size}"
"hyprlock"
Expand Down
1 change: 1 addition & 0 deletions home/services/ags/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ in {
"tray.target"
"graphical-session.target"
];
After = "graphical-session.target";
};
Service = {
Environment = "PATH=/run/wrappers/bin:${lib.makeBinPath dependencies}";
Expand Down
7 changes: 6 additions & 1 deletion home/services/system/kdeconnect.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
{lib, ...}: {
services.kdeconnect = {
enable = true;
indicator = true;
};

systemd.user.services = {
kdeconnect.Unit.After = lib.mkForce ["graphical-session.target"];
kdeconnect-indicator.Unit.After = lib.mkForce ["graphical-session.target"];
};
}
2 changes: 2 additions & 0 deletions home/services/wayland/hypridle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ in {
];
};
};

systemd.user.services.hypridle.Unit.After = lib.mkForce "graphical-session.target";
}
3 changes: 3 additions & 0 deletions home/services/wayland/hyprpaper.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
lib,
pkgs,
inputs,
config,
Expand All @@ -13,4 +14,6 @@
wallpaper = [", ${config.theme.wallpaper}"];
};
};

systemd.user.services.hyprpaper.Unit.After = lib.mkForce "graphical-session.target";
}
14 changes: 12 additions & 2 deletions system/services/greetd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# greetd display manager
services.greetd = let
session = {
command = "${lib.getExe config.programs.hyprland.package}";
command = "${lib.getExe config.programs.uwsm.package} start hyprland-uwsm.desktop";
user = "mihai";
};
in {
Expand All @@ -18,6 +18,16 @@
};
};

programs.uwsm = {
enable = true;
waylandCompositors.hyprland = {
binPath = "/run/current-system/sw/bin/Hyprland";
prettyName = "Hyprland";
comment = "Hyprland managed by UWSM";
};
};

# unlock GPG keyring on login
security.pam.services.greetd.enableGnomeKeyring = true;
# disabled as it doesn't work with autologin
# security.pam.services.greetd.enableGnomeKeyring = true;
}

0 comments on commit a6084b9

Please sign in to comment.