Fix startup/shutdown issues

This commit is contained in:
2024-07-10 10:25:27 +07:00
parent 48e2e7d405
commit 69c14309af
5 changed files with 45 additions and 28 deletions
+1 -2
View File
@@ -7,11 +7,10 @@
enable = true; enable = true;
settings = { settings = {
default_session = { default_session = {
command = "agreety --cmd /bin/sh"; command = "${pkgs.greetd.greetd}/bin/agreety --cmd zsh";
user = "greeter"; user = "greeter";
}; };
initial_session = { initial_session = {
# TODO: Start river in locked mode or exit if locker crashes.
# zsh -c is to give river access to profile variables # zsh -c is to give river access to profile variables
command = "zsh -c river"; command = "zsh -c river";
user = "zoriya"; user = "zoriya";
+20 -1
View File
@@ -28,11 +28,15 @@ in {
wayland.windowManager.river = { wayland.windowManager.river = {
enable = true; enable = true;
extraSessionVariables = {
XDG_CURRENT_DESKTOP = "river";
};
settings = { settings = {
default-layout = "rivercarro"; default-layout = "rivercarro";
spawn = [ spawn = [
"${pkgs.rivercarro}/bin/rivercarro" "${pkgs.rivercarro}/bin/rivercarro"
"wallpaper" "wallpaper"
"ags"
"discord" "discord"
"youtube-music" "youtube-music"
]; ];
@@ -131,11 +135,26 @@ in {
riverctl map normal Super+Shift 0 set-view-tags "$all_tags" riverctl map normal Super+Shift 0 set-view-tags "$all_tags"
''; '';
systemd.extraCommands = [ systemd.extraCommands = [
"trap 'systemctl --user stop river-session.target' INT TERM" "systemctl --user reset-failed"
# "systemctl --user import-environment $VARIABLES"
"systemctl --user start river-session.target"
"trap 'systemctl --user start --job-mode=replace-irreversibly river-session-shutdown.target' INT TERM"
# && systemctl --user unset-environment $VARIABLES (in trap)
"hyprlock --immediate"
"sleep infinity" "sleep infinity"
]; ];
}; };
systemd.user.targets.river-session-shutdown = {
Unit = {
Description = "shutdown river compositor session";
DefaultDependencies = "no";
StopWhenUnneeded = true;
Conflicts = ["graphical-session.target" "graphical-session-pre.target" "river-session.target"];
After = ["graphical-session.target" "graphical-session-pre.target" "river-session.target"];
};
};
home.packages = with pkgs; [ home.packages = with pkgs; [
gnome-control-center gnome-control-center
gnome.gnome-weather gnome.gnome-weather
+17 -19
View File
@@ -15,40 +15,38 @@
]; ];
installPhase = "install -Dm755 ${./covercolors.py} $out/bin/covercolors"; installPhase = "install -Dm755 ${./covercolors.py} $out/bin/covercolors";
}; };
systemdTarget = "graphical-session.target"; # systemdTarget = "graphical-session.target";
ags = pkgs.ags.overrideAttrs (_: prev: { ags = pkgs.ags.overrideAttrs (_: prev: {
buildInputs = buildInputs =
prev.buildInputs prev.buildInputs
++ [ ++ [
pkgs.bash
pkgs.libdbusmenu-gtk3 pkgs.libdbusmenu-gtk3
inputs.astal-river.packages.x86_64-linux.default inputs.astal-river.packages.x86_64-linux.default
]; ];
}); });
in { in {
home.packages = with pkgs; [ home.packages = with pkgs; [
# TODO: Remove this after testing
ags ags
# TODO: Find a way to add this for ags only # TODO: Find a way to add this for ags only
covercolors covercolors
brightnessctl brightnessctl
]; ];
systemd.user.services.ags = { # systemd.user.services.ags = {
Unit = { # Unit = {
Description = " A customizable and extensible shell "; # Description = " A customizable and extensible shell ";
PartOf = systemdTarget; # PartOf = systemdTarget;
Requires = systemdTarget; # Requires = systemdTarget;
After = systemdTarget; # After = systemdTarget;
}; # };
#
Service = { # Service = {
Type = "simple"; # Type = "simple";
ExecStart = "${ags}/bin/ags"; # ExecStart = "${ags}/bin/ags";
Restart = "always"; # Restart = "always";
}; # };
#
Install = {WantedBy = [systemdTarget];}; # Install = {WantedBy = [systemdTarget];};
}; # };
xdg.configFile."ags".source = ./.; xdg.configFile."ags".source = ./.;
} }
+1 -1
View File
@@ -79,7 +79,7 @@ const Header = () =>
name: "shutdown", name: "shutdown",
icon: "system-shutdown-symbolic", icon: "system-shutdown-symbolic",
title: "Shutdown?", title: "Shutdown?",
command: "shutdown --now", command: "shutdown now",
}), }),
], ],
}); });
+6 -5
View File
@@ -22,7 +22,8 @@ in {
settings = { settings = {
general = { general = {
grace = 3; grace = 3;
ignore_emauthpty_input = true; ignore_empty_input = true;
immediate_render = true;
}; };
background = { background = {
monitor = ""; monitor = "";
@@ -33,7 +34,7 @@ in {
size = "250, 50"; size = "250, 50";
outline_thickness = 0; outline_thickness = 0;
dots_size = 0.26; dots_size = 0.26;
inner_color = "#ff0000"; inner_color = "rgb(255, 0, 0)";
dots_spacing = 0.64; dots_spacing = 0.64;
dots_center = true; dots_center = true;
fade_on_empty = true; fade_on_empty = true;
@@ -48,7 +49,7 @@ in {
{ {
monitor = ""; monitor = "";
text = ''cmd[update:1000] echo "<b><big> $(${pkgs.coreutils}/bin/date +"%H:%M") </big></b>"''; text = ''cmd[update:1000] echo "<b><big> $(${pkgs.coreutils}/bin/date +"%H:%M") </big></b>"'';
color = "#ff0000"; color = "rgb(255, 0, 0)";
font_size = 64; font_size = 64;
font_family = "monospace"; font_family = "monospace";
@@ -61,7 +62,7 @@ in {
{ {
monitor = ""; monitor = "";
text = ''cmd[update:18000000] echo "<b> "$(${pkgs.coreutils}/bin/date +'%A, %-d %B %Y')" </b>"''; text = ''cmd[update:18000000] echo "<b> "$(${pkgs.coreutils}/bin/date +'%A, %-d %B %Y')" </b>"'';
color = "#ff0000"; color = "rgb(255, 0, 0)";
font_size = 24; font_size = 24;
font_family = "monospace"; font_family = "monospace";
@@ -84,7 +85,7 @@ in {
listener = [ listener = [
{ {
timeout = 1800; timeout = 900; # 15min
on-timeout = "${pkgs.procps}/bin/pidof hyprlock && ${pkgs.systemd}/bin/systemctl suspend"; on-timeout = "${pkgs.procps}/bin/pidof hyprlock && ${pkgs.systemd}/bin/systemctl suspend";
} }
]; ];