swaybg systemd service
This commit is contained in:
parent
3ffd1c7822
commit
a5f9c29669
6 changed files with 64 additions and 10 deletions
|
|
@ -8,14 +8,32 @@ let
|
|||
+ concatStringsSep "\n" (map displayHyprlandSetting displays);
|
||||
|
||||
displayHyprlandSetting = display:
|
||||
"monitor = " + display.name +
|
||||
"monitor = " + specificDisplay display +
|
||||
", " + resToString display.resolution +
|
||||
", " + display.position +
|
||||
", " + toString display.scaling +
|
||||
(if ( display.wallpaper != "" ) then ''
|
||||
", " + toString display.scaling;
|
||||
|
||||
exec-once = ${pkgs.swaybg}/bin/swaybg -o ${display.name} -i ${display.wallpaper} &
|
||||
'' else "");
|
||||
swaybgJob = displays:
|
||||
{
|
||||
Unit = {
|
||||
Description = "SwayBG";
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${pkgs.swaybg}/bin/swaybg " +
|
||||
concatStringsSep " " (map swaybgCmd displays);
|
||||
};
|
||||
Install = {
|
||||
WantedBy = ["graphical-session.target"];
|
||||
};
|
||||
};
|
||||
|
||||
swaybgCmd = display:
|
||||
if (display.wallpaper != "") then "-o ${display.name} -i ${display.wallpaper}" else "";
|
||||
|
||||
specificDisplay = display:
|
||||
if display.description == ""
|
||||
then display.name
|
||||
else "desc:" + display.description;
|
||||
|
||||
resolutionType = types.submodule ({ x, y, freq, ... }:
|
||||
{
|
||||
|
|
@ -43,6 +61,10 @@ let
|
|||
name = mkOption {
|
||||
description = "name of the display";
|
||||
};
|
||||
description = mkOption {
|
||||
description = "description of display from hyprctl monitors";
|
||||
default = "";
|
||||
};
|
||||
scaling = mkOption {
|
||||
type = types.float;
|
||||
default = 1.0;
|
||||
|
|
@ -83,6 +105,8 @@ in
|
|||
{
|
||||
wayland.windowManager.hyprland.extraConfig = mkIf (cfg.displays != [ ])
|
||||
(renderDisplaysForHyprland cfg.displays);
|
||||
|
||||
systemd.user.services.swaybg = swaybgJob cfg.displays;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue