fix(hyprland): make services more reliable
This commit is contained in:
parent
35ddc6a33c
commit
6fad257d5b
1 changed files with 36 additions and 25 deletions
|
@ -44,6 +44,7 @@ in
|
|||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
package = hyprland;
|
||||
recommendedEnvironment = true;
|
||||
extraConfig = import ./config.nix args;
|
||||
};
|
||||
};
|
||||
|
@ -59,7 +60,7 @@ in
|
|||
# start using systemd service
|
||||
systemd = {
|
||||
enable = true;
|
||||
target = "hyprland-session.target";
|
||||
target = "graphical-session.target";
|
||||
};
|
||||
|
||||
settings = {
|
||||
|
@ -87,11 +88,11 @@ in
|
|||
events = [
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = "${pkgs.swaylock-effects}/bin/swaylock -fF";
|
||||
command = "${pkgs.swaylock}/bin/swaylock -fF";
|
||||
}
|
||||
{
|
||||
event = "lock";
|
||||
command = "${pkgs.swaylock-effects}/bin/swaylock -fF";
|
||||
command = "${pkgs.swaylock}/bin/swaylock -fF";
|
||||
}
|
||||
];
|
||||
timeouts = [
|
||||
|
@ -105,10 +106,8 @@ in
|
|||
command = "${pkgs.systemd}/bin/loginctl lock-session";
|
||||
}
|
||||
];
|
||||
systemdTarget = "hyprland-session.target";
|
||||
};
|
||||
|
||||
# start swayidle as part of hyprland, not sway
|
||||
systemd.user.services.swayidle.Install.WantedBy = lib.mkForce [ "hyprland-session.target" ];
|
||||
};
|
||||
|
||||
# adds pam module for swaylock
|
||||
|
@ -116,27 +115,28 @@ in
|
|||
|
||||
|
||||
# start hyprpaper daemon using systemd unit (to set wallpaper)
|
||||
systemd.user.services.hyprpaper = {
|
||||
enable = true;
|
||||
path = [ pkgs.hyprpaper ];
|
||||
wantedBy = [ "hyprland-session.target" ];
|
||||
after = [ "hyprland-session.target" ];
|
||||
script = "hyprpaper";
|
||||
};
|
||||
|
||||
# set hyprpaper conf (for setting initial background)
|
||||
home-manager.users.moritz.xdg.configFile."hypr/hyprpaper.conf" = {
|
||||
text =
|
||||
let
|
||||
setWallpaper = wallpaper: ''
|
||||
systemd.user.services.hyprpaper =
|
||||
let
|
||||
wallpaper = "/home/moritz/.config/wallpapers/a_short_walk.png";
|
||||
config = pkgs.writeTextFile {
|
||||
name = "hyprpaper.conf";
|
||||
text = ''
|
||||
preload = ${wallpaper}
|
||||
wallpaper = ,${wallpaper}
|
||||
'';
|
||||
in
|
||||
setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png";
|
||||
onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service";
|
||||
};
|
||||
|
||||
};
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
partOf = [ "graphical-session.target" ];
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
after = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.hyprpaper}/bin/hyprpaper -c ${config}";
|
||||
RestartSec = "1s";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
||||
# only consider graphical-session.target started when hyprland-sesstion.target is reached
|
||||
systemd.user.targets.hyprland-session = {
|
||||
|
@ -144,6 +144,17 @@ in
|
|||
before = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
systemd.user.services.xdg-desktop-portal-hyprland = {
|
||||
after = [ "hyprland-session.target" ];
|
||||
wantedBy = [ "hyprland-session.target" ];
|
||||
};
|
||||
|
||||
home-manager.users.moritz.systemd.user.services.nextcloud-client = {
|
||||
Service = {
|
||||
RestartSec = "1s";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
||||
# add user packages for wayland and hyprland in particular
|
||||
users.users.moritz.packages = with pkgs; [
|
||||
|
@ -206,7 +217,7 @@ in
|
|||
# dekstop portal (for screensharing)
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
wlr.enable = true;
|
||||
wlr.enable = mkForce false;
|
||||
extraPortals = [ pkgs.xdg-desktop-portal-hyprland ];
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue