diff options
| author | 2019-11-22 12:28:55 +0530 | |
|---|---|---|
| committer | 2019-11-22 13:50:00 +0530 | |
| commit | 085bda03305ffd5cb502743a06ac6b2513b7234e (patch) | |
| tree | 3c872e55ac3ececdc3ed9f20d8121e0f047c377e /plugins/wall | |
| parent | a34200a7475a2d21b274dbcef353de9a9f3a6ca4 (diff) | |
| download | nnn-085bda03305ffd5cb502743a06ac6b2513b7234e.tar.gz | |
Integrate similar plugins, diff should begin at start of file
Diffstat (limited to 'plugins/wall')
| -rwxr-xr-x | plugins/wall | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/wall b/plugins/wall new file mode 100755 index 0000000..0fc6de7 --- /dev/null +++ b/plugins/wall @@ -0,0 +1,30 @@ +#!/usr/bin/env sh + +# Description: Set the selected image as wallpaper using nitrogen or pywal. +# Usage: Hover on an image and run the script to set it as wallpaper. +# +# Shell: POSIX Compliant +# Author: juacq97 + +cmd_exists () { + which "$1" > /dev/null 2>&1 + echo $? +} + +if ! [ -z "$1" ]; then + if [ "$(mimetype --output-format %m "$1" | awk -F '/' '{print $1}')" = "image" ]; then + if [ "$(cmd_exists nitrogen)" -eq "0" ]; then + nitrogen --set-zoom-fill --save "$1" + elif [ "$(cmd_exists wal)" -eq "0" ]; then + wal -i "$1" + else + printf "nitrogen ir pywal missing" + read -r _ + fi + + # If you want a system notification, uncomment the next 3 lines. + # notify-send -a "nnn" "Wallpaper changed!" + # else + # notify-send -a "nnn" "No image selected" + fi +fi |