modify feh-wallpaper-changer to kill previous instance
This commit is contained in:
parent
08f1789b50
commit
97ff165b02
|
@ -10,7 +10,7 @@
|
|||
Hidden=false
|
||||
Name[en_GB]=feh-wallpaper-changer
|
||||
Comment[en_GB]=Periodically changes the wallpaper using feh
|
||||
X-GNOME-Autostart-Delay=0
|
||||
X-GNOME-Autostart-Delay=5
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,6 +2,15 @@
|
|||
{
|
||||
home.packages = with pkgs; [
|
||||
(writeShellScriptBin "feh-wallpaper-changer" ''
|
||||
|
||||
# Kill previous instance if exists
|
||||
script_name=''${BASH_SOURCE[0]}
|
||||
for pid in $(pidof -x $script_name); do
|
||||
if [ $pid != $$ ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
done
|
||||
|
||||
wallpaper_dir="$HOME/.local/share/bg/"
|
||||
if [ ! -d "$wallpaper_dir" ]; then
|
||||
echo "No wallpapers in $wallpaper_dir, cloning from remote"
|
||||
|
|
Loading…
Reference in New Issue