refactor: use systemd services instead of start script

This is probably what I should've done from the beginning, but I didn't
really know how `systemd` worked when I started writing this config.
This commit is contained in:
Kiana Sheibani 2024-10-15 03:30:13 -04:00
parent 5f95f0ffba
commit af0e27630f
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
4 changed files with 42 additions and 18 deletions

View file

@ -4,11 +4,6 @@ let
modifier = "SUPER"; modifier = "SUPER";
terminal = "alacritty"; terminal = "alacritty";
in { in {
home.packages = with pkgs; [
swaybg
swayidle
];
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
@ -28,10 +23,6 @@ in {
"$terminal" = terminal; "$terminal" = terminal;
"$menu" = "rofi -show drun"; "$menu" = "rofi -show drun";
exec-once = [
"background=${../../assets/background.png} platform=${config.platform} ${scripts}/autostart"
];
general = { general = {
layout = "hy3"; layout = "hy3";

View file

@ -1,7 +0,0 @@
#!/usr/bin/env bash
# Background
swaybg -o '*' -i "$background" -m fill &
# Status Bar
eww open "$platform"_bar --screen 0

View file

@ -60,6 +60,25 @@
]; ];
}; };
# Swaybg
systemd.user.services.swaybg = {
Install.WantedBy = [ "graphical-session.target" ];
Unit = {
Description = "Sway background manager";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
ConditionEnvironment = "WAYLAND_DISPLAY";
};
Service = {
ExecStart = "${lib.getExe pkgs.swaybg} -o '*' -i ${../../assets/background.png} -m fill";
Restart = "always";
RestartSec = "5";
};
};
# Rofi # Rofi
programs.rofi.enable = true; programs.rofi.enable = true;
@ -72,6 +91,27 @@
programs.eww.enable = true; programs.eww.enable = true;
programs.eww.configDir = ./eww; programs.eww.configDir = ./eww;
systemd.user.services.eww =
let eww = lib.getExe config.programs.eww.package;
in {
Install.WantedBy = [ "graphical-session.target" ];
Unit = {
Description = "GTK-based custom widgets";
Documentation = "https://github.com/elkowar/eww";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
ConditionEnvironment = "WAYLAND_DISPLAY";
};
Service = {
ExecStart = "${eww} daemon --no-daemonize";
ExecStartPost = "${eww} open ${config.machine}_bar --screen 0";
Restart = "always";
RestartSec = "5";
};
};
# Mako # Mako
services.mako = { services.mako = {