mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 23:00:39 +02:00
feat: add random wallpaper change
This commit is contained in:
parent
71bd2f8054
commit
364632a89a
3 changed files with 39 additions and 28 deletions
|
@ -7,8 +7,6 @@
|
||||||
writeShellApplication {
|
writeShellApplication {
|
||||||
name = "brightness";
|
name = "brightness";
|
||||||
text = ''
|
text = ''
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
${brightnessctl}/bin/brightnessctl "$1" "$2"
|
${brightnessctl}/bin/brightnessctl "$1" "$2"
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"+"*) image=${./assets}/brightness-increase.svg ;;
|
"+"*) image=${./assets}/brightness-increase.svg ;;
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
writeShellApplication {
|
writeShellApplication {
|
||||||
name = "volume";
|
name = "volume";
|
||||||
text = ''
|
text = ''
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
${wireplumber}/bin/wpctl "$1" "$2" "$3"
|
${wireplumber}/bin/wpctl "$1" "$2" "$3"
|
||||||
current_volume=$(${wireplumber}/bin/wpctl get-volume "$2")
|
current_volume=$(${wireplumber}/bin/wpctl get-volume "$2")
|
||||||
case "''${2,,}" in
|
case "''${2,,}" in
|
||||||
|
|
|
@ -1,7 +1,30 @@
|
||||||
{pkgs, ...}: {
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
swww-update-wallpaper = pkgs.writeShellApplication {
|
||||||
|
name = "swww-update-wallpaper";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.swww
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
FILES=("$HOME/.local/share/wallpapers/"*)
|
||||||
|
TYPES=("wipe" "wave" "any")
|
||||||
|
ANGLES=(0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345)
|
||||||
|
|
||||||
|
swww img "''${FILES[RANDOM%''${#FILES[@]}]}" \
|
||||||
|
--transition-type "''${TYPES[RANDOM%''${#TYPES[@]}]}" \
|
||||||
|
--transition-angle "''${ANGLES[RANDOM%''${#ANGLES[@]}]}" \
|
||||||
|
--transition-fps 144 \
|
||||||
|
--transition-duration 1.5
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in {
|
||||||
systemd.user = {
|
systemd.user = {
|
||||||
services = {
|
services = {
|
||||||
swww = {
|
swww = {
|
||||||
|
Install.WantedBy = ["graphical-session.target"];
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Wayland wallpaper daemon";
|
Description = "Wayland wallpaper daemon";
|
||||||
PartOf = ["graphical-session.target"];
|
PartOf = ["graphical-session.target"];
|
||||||
|
@ -10,30 +33,22 @@
|
||||||
ExecStart = "${pkgs.swww}/bin/swww-daemon";
|
ExecStart = "${pkgs.swww}/bin/swww-daemon";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
};
|
};
|
||||||
Install.WantedBy = ["graphical-session.target"];
|
|
||||||
};
|
};
|
||||||
#swww-random = {
|
swww-update-wallpaper = {
|
||||||
# Unit = {
|
Install.WantedBy = ["default.target"];
|
||||||
# Description = "switch random wallpaper powered by swww";
|
Unit.Description = "Update the wallpaper";
|
||||||
# };
|
Service = {
|
||||||
# Service = {
|
Type = "oneshot";
|
||||||
# Type = "oneshot";
|
Restart = "on-failure";
|
||||||
# ExecStart = "${pkgs.swww-switch}/bin/swww-switch random";
|
RestartSec = "2m";
|
||||||
# };
|
ExecStart = lib.getExe swww-update-wallpaper;
|
||||||
# Install = {
|
};
|
||||||
# WantedBy = ["default.target"];
|
};
|
||||||
# };
|
};
|
||||||
#};
|
timers.swww-update-wallpaper = {
|
||||||
|
Install.WantedBy = ["timers.target"];
|
||||||
|
Unit.Description = "Periodically switch to a new wallpaper";
|
||||||
|
Timer.OnCalendar = "*:0/5"; # Every 5 minutes
|
||||||
};
|
};
|
||||||
#timers.swww-random = {
|
|
||||||
# Unit = {
|
|
||||||
# Description = "switch random wallpaper powered by swww timer";
|
|
||||||
# };
|
|
||||||
# Timer = {
|
|
||||||
# OnUnitActiveSec = "60min";
|
|
||||||
# OnBootSec = "60min";
|
|
||||||
# };
|
|
||||||
# Install = {WantedBy = ["timers.target"];};
|
|
||||||
#};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue