switch from mpvpaper to awww, refactor wallpaper
This commit is contained in:
parent
a913b1d4d8
commit
5efde713b1
5 changed files with 142 additions and 59 deletions
62
flake.lock
generated
62
flake.lock
generated
|
|
@ -40,6 +40,28 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"awww": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770895252,
|
||||
"narHash": "sha256-TUGZVDcC5xsrWVnpBNosAG1cTy+aWchCWXPyeLZdnGM=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "2c86d41d07471f518e24f5cd1f586e4d2a32d12c",
|
||||
"revCount": 1331,
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/LGFae/awww.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/LGFae/awww.git"
|
||||
}
|
||||
},
|
||||
"base16": {
|
||||
"inputs": {
|
||||
"fromYaml": "fromYaml"
|
||||
|
|
@ -138,6 +160,22 @@
|
|||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1761588595,
|
||||
"narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_3": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1767039857,
|
||||
|
|
@ -331,7 +369,7 @@
|
|||
"inputs": {
|
||||
"cachyos-kernel": "cachyos-kernel",
|
||||
"cachyos-kernel-patches": "cachyos-kernel-patches",
|
||||
"flake-compat": "flake-compat_2",
|
||||
"flake-compat": "flake-compat_3",
|
||||
"flake-parts": "flake-parts_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
|
|
@ -550,6 +588,7 @@
|
|||
"inputs": {
|
||||
"aerothemeplasma-nix": "aerothemeplasma-nix",
|
||||
"apple-silicon": "apple-silicon",
|
||||
"awww": "awww",
|
||||
"base16": "base16",
|
||||
"base16-discord": "base16-discord",
|
||||
"catppuccin-discord": "catppuccin-discord",
|
||||
|
|
@ -570,6 +609,27 @@
|
|||
"tt-schemes": "tt-schemes"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"awww",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764038373,
|
||||
"narHash": "sha256-M6w2wNBRelcavoDAyFL2iO4NeWknD40ASkH1S3C0YGM=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "ab3536fe850211a96673c6ffb2cb88aab8071cc9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"spicetify-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
|
|
|||
|
|
@ -81,6 +81,11 @@
|
|||
# inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
awww = {
|
||||
url = "git+https://codeberg.org/LGFae/awww.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
openmw = {
|
||||
url = "gitlab:OpenMW/openmw";
|
||||
flake = false;
|
||||
|
|
@ -109,6 +114,7 @@
|
|||
nur,
|
||||
nixvim,
|
||||
apple-silicon,
|
||||
awww,
|
||||
openmw,
|
||||
catppuccin-discord,
|
||||
...
|
||||
|
|
@ -152,6 +158,7 @@
|
|||
niri.overlays.niri
|
||||
noctalia.overlays.default
|
||||
nur.overlays.default
|
||||
awww.overlays.default
|
||||
(final: prev: {
|
||||
openmw-git = openmw;
|
||||
catppuccin-discord-git = catppuccin-discord;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
input = {
|
||||
focus-follows-mouse.enable = true;
|
||||
focus-follows-mouse.max-scroll-amount = "0%";
|
||||
warp-mouse-to-focus.enable = true;
|
||||
mod-key = "Super";
|
||||
keyboard = {
|
||||
numlock = false;
|
||||
|
|
@ -187,6 +186,14 @@
|
|||
open-maximized = true;
|
||||
open-focused = true;
|
||||
}
|
||||
{
|
||||
matches = [
|
||||
{
|
||||
app-id = "mpv";
|
||||
}
|
||||
];
|
||||
opacity = 1.0;
|
||||
}
|
||||
];
|
||||
layer-rules = [
|
||||
{
|
||||
|
|
@ -195,7 +202,7 @@
|
|||
namespace = "^wpaperd.*";
|
||||
}
|
||||
{
|
||||
namespace = "^mpvpaper";
|
||||
namespace = "^awww-daemon";
|
||||
}
|
||||
];
|
||||
place-within-backdrop = true;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
bar = {
|
||||
autoHideDelay = 500;
|
||||
autoShowDelay = 150;
|
||||
backgroundOpacity = 1;
|
||||
backgroundOpacity = 0.975;
|
||||
monitors = [ ];
|
||||
showCapsule = true;
|
||||
barType = "simple";
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
outerCorners = false;
|
||||
screenOverrides = [ ];
|
||||
showOutline = false;
|
||||
useSeparateOpacity = false;
|
||||
useSeparateOpacity = true;
|
||||
widgets = {
|
||||
center = [ ];
|
||||
left = [
|
||||
|
|
@ -206,7 +206,7 @@
|
|||
deviceNativePath = "__default__";
|
||||
displayMode = "icon-hover";
|
||||
hideIfIdle = false;
|
||||
hideIfNotDetected = false;
|
||||
hideIfNotDetected = true;
|
||||
id = "Battery";
|
||||
showNoctaliaPerformance = false;
|
||||
showPowerProfiles = true;
|
||||
|
|
|
|||
|
|
@ -3,68 +3,77 @@
|
|||
...
|
||||
}:
|
||||
{
|
||||
systemd.user.services.mpvpaper = {
|
||||
Unit = {
|
||||
Description = "Modern wallpaper daemon for Wayland";
|
||||
PartOf = [ "niri.service" ];
|
||||
Requires = [ "niri.service" ];
|
||||
After = [ "niri.service" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = ''
|
||||
${pkgs.mpvpaper}/bin/mpvpaper '*' \
|
||||
'/home/sckova/.local/share/wallpaper/daily.jpg' -o \
|
||||
'--keep-open=always --save-position-on-quit --panscan=1.0' \
|
||||
'';
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "niri.service" ];
|
||||
};
|
||||
systemd.user.services.awww-daemon = {
|
||||
Unit.Description = "Wallpaper service using awww (daemon)";
|
||||
Service.ExecStart = "${pkgs.awww}/bin/awww-daemon";
|
||||
Unit.After = [ "graphical-session.target" ];
|
||||
Unit.PartOf = [ "graphical-session.target" ];
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
systemd.user.services.awww-setter = {
|
||||
Unit.Description = "Wallpaper service using awww (setter)";
|
||||
Unit.Requires = [ "awww-daemon.service" ];
|
||||
Unit.After = [ "awww-daemon.service" ];
|
||||
Service.Type = "oneshot";
|
||||
Service.ExecStart = ''
|
||||
${pkgs.awww}/bin/awww img \
|
||||
%h/.local/share/wallpaper/daily.jpg \
|
||||
--transition-step 2 \
|
||||
--transition-fps 60
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.user.services.bing-wallpaper = {
|
||||
Unit = {
|
||||
Description = "Download and set Bing wallpaper of the day";
|
||||
After = [ "network-online.target" ];
|
||||
Wants = [ "network-online.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = pkgs.writeShellScript "bing-wallpaper" ''
|
||||
OUT="''${XDG_DATA_HOME:-$HOME/.local/share}/wallpaper/daily.jpg"
|
||||
Unit.Description = "Download and set Bing wallpaper of the day";
|
||||
Unit.StartLimitBurst = 5;
|
||||
Unit.StartLimitIntervalSec = "10m";
|
||||
Service.Restart = "on-failure";
|
||||
Service.RestartSec = "1m";
|
||||
Service.Type = "oneshot";
|
||||
Service.ExecStart = pkgs.lib.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "bing-wallpaper";
|
||||
runtimeInputs = with pkgs; [
|
||||
wget
|
||||
jq
|
||||
coreutils
|
||||
libnotify
|
||||
];
|
||||
text = ''
|
||||
set -euo pipefail
|
||||
|
||||
API_RESP=$(${pkgs.wget}/bin/wget -qO- "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&mkt=en-US&n=1") || exit 1
|
||||
OUT_DIR="''${XDG_DATA_HOME:-$HOME/.local/share}/wallpaper"
|
||||
OUT_FILE="$OUT_DIR/daily.jpg"
|
||||
|
||||
URL_BASE=$(echo "$API_RESP" | ${pkgs.gnugrep}/bin/grep -oP 'urlbase":"[^"]*' | cut -d '"' -f 3)
|
||||
TITLE=$(echo "$API_RESP" | ${pkgs.gnugrep}/bin/grep -oP 'title":"[^"]*' | cut -d '"' -f 3)
|
||||
API_URL="https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&mkt=en-US&n=1"
|
||||
API_RESP=$(wget -qO- "$API_URL")
|
||||
|
||||
${pkgs.coreutils}/bin/mkdir -p "$(dirname "$OUT")"
|
||||
${pkgs.wget}/bin/wget -qO "$OUT" "https://www.bing.com$URL_BASE\_UHD.jpg" || \
|
||||
${pkgs.wget}/bin/wget -qO "$OUT" "https://www.bing.com$(echo "$API_RESP" | ${pkgs.gnugrep}/bin/grep -oP 'url":"[^"]*' | cut -d '"' -f 3)"
|
||||
URL_BASE=$(echo "$API_RESP" | jq -r '.images[0].urlbase')
|
||||
URL_FALLBACK=$(echo "$API_RESP" | jq -r '.images[0].url')
|
||||
TITLE=$(echo "$API_RESP" | jq -r '.images[0].title')
|
||||
|
||||
${pkgs.libnotify}/bin/notify-send \
|
||||
-a "Bing Wallpaper Service" \
|
||||
-u low \
|
||||
-i preferences-desktop-wallpaper \
|
||||
"$TITLE"
|
||||
'';
|
||||
ExecStartPost = "${pkgs.systemd}/bin/systemctl --user restart mpvpaper.service";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "niri.service" ];
|
||||
};
|
||||
mkdir -p "$OUT_DIR"
|
||||
|
||||
if ! wget -qO "$OUT_FILE" "https://www.bing.com''${URL_BASE}_UHD.jpg"; then
|
||||
wget -qO "$OUT_FILE" "https://www.bing.com$URL_FALLBACK"
|
||||
fi
|
||||
|
||||
notify-send \
|
||||
-a "wallpaper of the day" \
|
||||
-u low \
|
||||
-i preferences-desktop-wallpaper \
|
||||
"$TITLE"
|
||||
'';
|
||||
}
|
||||
);
|
||||
Service.ExecStartPost = "${pkgs.systemd}/bin/systemctl --user restart awww-setter.service";
|
||||
};
|
||||
|
||||
systemd.user.timers.bing-wallpaper = {
|
||||
Unit = {
|
||||
Description = "Run bing wallpaper retrieval daily";
|
||||
};
|
||||
Timer = {
|
||||
OnCalendar = "*-*-* 10:00:00 GMT";
|
||||
Persistent = true;
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "timers.target" ];
|
||||
};
|
||||
Unit.Description = "Run bing wallpaper retrieval daily";
|
||||
Timer.OnCalendar = "*-*-* 10:00:00 GMT";
|
||||
Timer.Persistent = true;
|
||||
Install.WantedBy = [ "timers.target" ];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue