Fix hyprland background
This commit is contained in:
parent
c6cae00eba
commit
02d9349a03
3 changed files with 24 additions and 29 deletions
|
|
@ -229,7 +229,7 @@ in
|
||||||
"SUPER, J, togglesplit, # dwindle"
|
"SUPER, J, togglesplit, # dwindle"
|
||||||
"SUPER ALT, E, exec, wofi-emoji"
|
"SUPER ALT, E, exec, wofi-emoji"
|
||||||
"SUPER ALT, P, exec, wl-clipedit"
|
"SUPER ALT, P, exec, wl-clipedit"
|
||||||
"SUPER ALT, B, exec, wl-update-background"
|
"SUPER ALT, B, exec, systemctl --user reload-or-restart wl-update-background"
|
||||||
",Print, exec, grimblast copy"
|
",Print, exec, grimblast copy"
|
||||||
"SHIFT, Print, exec, grimblast copy area"
|
"SHIFT, Print, exec, grimblast copy area"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
{ pkgs, ... }: {
|
{ pkgs, nixosConfig, ... }:
|
||||||
|
let
|
||||||
|
inherit (nixosConfig.networking) hostName;
|
||||||
|
backgrounds_directory = if hostName == "sif" then "$HOME/Pictures/Wallpapers/2160+" else "$HOME/Immagini/Sfondi/2160+";
|
||||||
|
in
|
||||||
|
{
|
||||||
home.packages = [ pkgs.wl-update-background ];
|
home.packages = [ pkgs.wl-update-background ];
|
||||||
|
|
||||||
systemd.user.services."wl-update-background" = {
|
systemd.user.services."wl-update-background" = {
|
||||||
|
|
@ -6,7 +11,6 @@
|
||||||
Description = "Set random desktop background using swww";
|
Description = "Set random desktop background using swww";
|
||||||
After = [ "graphical-session.pre.target" ];
|
After = [ "graphical-session.pre.target" ];
|
||||||
PartOf = [ "graphical-session.target" ];
|
PartOf = [ "graphical-session.target" ];
|
||||||
RequiresMountsFor = [ "/home/bertof/Immagini" ];
|
|
||||||
};
|
};
|
||||||
Install = {
|
Install = {
|
||||||
WantedBy = [ "graphical-session.target" ];
|
WantedBy = [ "graphical-session.target" ];
|
||||||
|
|
@ -14,7 +18,8 @@
|
||||||
Service = {
|
Service = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
IOSchedulingClass = "idle";
|
IOSchedulingClass = "idle";
|
||||||
ExecStart = "${pkgs.wl-update-background}/bin/wl-update-background";
|
StartLimitBurst = 0;
|
||||||
|
ExecStart = "${pkgs.wl-update-background.override {inherit backgrounds_directory;}}/bin/wl-update-background";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,19 @@
|
||||||
{ findutils
|
{ coreutils
|
||||||
, coreutils
|
, findutils
|
||||||
, writeShellScriptBin
|
|
||||||
, hyprland
|
, hyprland
|
||||||
|
, lib
|
||||||
|
, writeShellScriptBin
|
||||||
, backgrounds_directory ? "$HOME/Immagini/Sfondi/"
|
, backgrounds_directory ? "$HOME/Immagini/Sfondi/"
|
||||||
}: writeShellScriptBin "wl-update-background"
|
}: writeShellScriptBin "wl-update-background" ''
|
||||||
|
|
||||||
# ''
|
|
||||||
# set -e
|
|
||||||
# if [ $# -eq 0 ]; then
|
|
||||||
# image=`${findutils}/bin/find ${backgrounds_directory} -type f | ${gnugrep}/bin/grep -v "/\." | ${coreutils}/bin/shuf -n 1`
|
|
||||||
# else
|
|
||||||
# image="$1"
|
|
||||||
# fi
|
|
||||||
# echo "image: $image"
|
|
||||||
# ${swww}/bin/swww img "$image"
|
|
||||||
# ''
|
|
||||||
|
|
||||||
''
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
PATH=$PATH:${lib.makeBinPath [findutils coreutils hyprland]}
|
||||||
WALLPAPER_DIR=${backgrounds_directory}
|
WALLPAPER_DIR=${backgrounds_directory}
|
||||||
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
|
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
|
||||||
|
CURRENT_WALL=$(basename "$CURRENT_WALL")
|
||||||
|
|
||||||
# Get a random wallpaper that is not the current one
|
# Get a random wallpaper that is not the current one
|
||||||
WALLPAPER=$(${findutils}/bin/find "$WALLPAPER_DIR" -type f ! -name "$(${coreutils}/bin/basename "$CURRENT_WALL")" | ${coreutils}/bin/shuf -n 1)
|
NEW_WALLPAPER=$(find "$WALLPAPER_DIR" -type f ! -name "$CURRENT_WALL" | shuf -n 1)
|
||||||
|
|
||||||
# Apply the selected wallpaper
|
# Apply the selected wallpaper
|
||||||
${hyprland}/bin/hyprctl hyprpaper reload ,"$WALLPAPER"
|
hyprctl hyprpaper reload ,"$NEW_WALLPAPER"
|
||||||
''
|
''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue