Add systemd user service to update swww every hour
Swap hyprpaper for swww Move swww up a level into it's own file
This commit is contained in:
parent
bbf827c1e4
commit
1d954615cb
|
@ -13,6 +13,7 @@
|
|||
./mako.nix
|
||||
./avizo.nix
|
||||
./wlogout.nix
|
||||
./swww.nix
|
||||
];
|
||||
home.packages = [
|
||||
(pkgs.writeShellScriptBin "protonmail-setup-bridge" ''
|
||||
|
@ -22,7 +23,6 @@
|
|||
'')
|
||||
];
|
||||
services = {
|
||||
hyprpaper.enable = true;
|
||||
kanshi.systemdTarget = "hyprland-session.target";
|
||||
gpg-agent.pinentryPackage = pkgs.pinentry-gnome3;
|
||||
hypridle = {
|
||||
|
@ -147,6 +147,7 @@
|
|||
"${config.wayland.windowManager.hyprland.finalPackage}/bin/hyprctl setcursor ${config.gtk.cursorTheme.name} ${toString config.gtk.cursorTheme.size}"
|
||||
"${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"
|
||||
"PASSWORD_STORE_DIR=/dev/null ${pkgs.protonmail-bridge}/bin/protonmail-bridge -n"
|
||||
"${pkgs.swww}/bin/swww-daemon"
|
||||
"sleep 5; ${pkgs.dex}/bin/dex -a"
|
||||
];
|
||||
gestures.workspace_swipe = true;
|
||||
|
@ -415,9 +416,5 @@
|
|||
];
|
||||
};
|
||||
};
|
||||
xdg.configFile."hypr/hyprpaper.conf".text = ''
|
||||
preload = ${config.stylix.image}
|
||||
wallpaper = ,${config.stylix.image}
|
||||
'';
|
||||
|
||||
}
|
||||
|
|
51
system/home/swww.nix
Normal file
51
system/home/swww.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
swwwMorning = "${pkgs.swww}/bin/swww img ${../wallpapers/tropic_island_morning.jpg}";
|
||||
swwwDay = "${pkgs.swww}/bin/swww img ${../wallpapers/tropic_island_day.jpg}";
|
||||
swwwEvening = "${pkgs.swww}/bin/swww img ${../wallpapers/tropic_island_evening.jpg}";
|
||||
swwwNight = "${pkgs.swww}/bin/swww img ${../wallpapers/tropic_island_night.jpg}";
|
||||
dynamicWallpaper = pkgs.writeShellScriptBin "dynamic-wallpaper" ''
|
||||
swww query || exit 1 # Check SWWW daemon is actually running
|
||||
case $(date +%H) in
|
||||
06 | 07 | 08) # Morning
|
||||
${swwwMorning}
|
||||
;;
|
||||
09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17) # Day
|
||||
${swwwDay}
|
||||
;;
|
||||
18 | 19 | 20) # Evening
|
||||
${swwwEvening}
|
||||
;;
|
||||
21 | 22 | 23 | 00 | 01 | 02 | 03 | 04 | 05) # Night
|
||||
${swwwNight}
|
||||
;;
|
||||
esac
|
||||
|
||||
'';
|
||||
in
|
||||
{
|
||||
systemd.user = {
|
||||
timers.dynamic-wallpaper = {
|
||||
Install.WantedBy = [ "timers.target" ];
|
||||
Timer = {
|
||||
OnCalendar = "*:0";
|
||||
Unit = "dynamic-wallpaper.service";
|
||||
};
|
||||
};
|
||||
services.dynamic-wallpaper = {
|
||||
Unit = {
|
||||
Description = "Change wallpaper based on time of day";
|
||||
Wants = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${dynamicWallpaper}/bin/dynamic-wallpaper";
|
||||
};
|
||||
};
|
||||
};
|
||||
home.packages = [
|
||||
pkgs.swww
|
||||
dynamicWallpaper
|
||||
];
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
swwwMorning = "${pkgs.swww}/bin/swww img ${../../wallpapers/tropic_island_morning.jpg}";
|
||||
swwwDay = "${pkgs.swww}/bin/swww img ${../../wallpapers/tropic_island_day.jpg}";
|
||||
swwwEvening = "${pkgs.swww}/bin/swww img ${../../wallpapers/tropic_island_evening.jpg}";
|
||||
swwwNight = "${pkgs.swww}/bin/swww img ${../../wallpapers/tropic_island_night.jpg}";
|
||||
dynamicWallpaper = pkgs.writeShellScriptBin "dynamic-wallpaper" ''
|
||||
case $(date +%H) in
|
||||
06 | 07 | 08) # Morning
|
||||
${swwwMorning}
|
||||
;;
|
||||
09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17) # Day
|
||||
${swwwDay}
|
||||
;;
|
||||
18 | 19 | 20) # Evening
|
||||
${swwwEvening}
|
||||
;;
|
||||
21 | 22 | 23 | 00 | 01 | 02 | 03 | 04 | 05) # Night
|
||||
${swwwNight}
|
||||
;;
|
||||
esac
|
||||
|
||||
'';
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.swww
|
||||
dynamicWallpaper
|
||||
];
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This allows you to control which image to init the daemon with according
|
||||
# to the time of day. You may change the match cases as you see fit.
|
||||
# This currently only takes hours into account, but it should be easy to
|
||||
# modify to also use minutes, or days of the week, if you want.
|
||||
#
|
||||
# Use it simply by calling this script instead of swww-daemon
|
||||
|
||||
case $(date +%H) in
|
||||
00 | 01 | 02 | 03 | 04 | 05 | 06 | 07) # First 8 hours of the day
|
||||
# Uncomment below to setup the image you wish to display as your
|
||||
# wallpaper if you run this script during the first 8 hours of the
|
||||
# day
|
||||
|
||||
# swww-daemon && swww img path/to/img
|
||||
;;
|
||||
08 | 09 | 10 | 11 | 12 | 13 | 14 | 15) # Middle 8 hours of the day
|
||||
# Same as above, but for the middle 8 hours of the day
|
||||
|
||||
# swww-daemon && swww img path/to/img
|
||||
;;
|
||||
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23) # Final 8 hours of the day
|
||||
# Same as above, but for the final 8 hours of the day
|
||||
|
||||
# swww-daemon && swww img path/to/img
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue