commit 57d2327ee40c1b9cc2c1c9ffde5da3737de2975a
parent 39035bd75c56e9e20f988cfab7afd87996cfd91a
Author: juacq97 <juacq97@gmail.com>
Date: Tue, 16 Apr 2019 19:50:16 -0600
Added two scripts to change the wallpaper.
The one named "nitrogen" allow to change the wallpaper using
nitrogen. The one named "pywal" allows to change the wallpaper and the
terminal color scheme using pywal.
Both of them need to put the cursor over an image, there's no need to
select the file with space.
Diffstat:
3 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/user-scripts/README.md b/user-scripts/README.md
@@ -1,16 +1,18 @@
-| Script (a-z) | Description |
-| --- | --- |
-| copier | Copy selection to clipboard |
-| edit | Fuzzy find a file in directory subtree with fzy and edit in vim |
-| fzy | Fuzzy find a file in directory subtree with fzy and open using xdg-open |
-| hexview | view a file in hex; needs xxd and $PAGER |
-| imgresize | Resize images in directory to screen resolution (needs [imgp](https://github.com/jarun/imgp)) |
-| imgur | Upload an image file to imgur |
-| kdeconnect | Send selected files to Android device using kdeconnect-cli |
-| ndiff | File and directory diff for selection using vimdiff |
-| nlaunch | Drop-down independent app launcher (needs fzy), drop in `$PATH`; fallback regular prompt |
-| paste | Paste contents of current (text) file to paste.ubuntu.com (needs [pastebinit](https://launchpad.net/pastebinit)) |
-| picker | Pick files and pipe the newline-separated list to another utility |
-| sxiv | Open images in current directory in sxiv |
-| transfer | Upload current file to transfer.sh |
-| upgrade | Check and update to latest version of nnn manually on Debian 9 Stretch |
+| Script (a-z) | Description |
+| --- | --- |
+| copier | Copy selection to clipboard |
+| edit | Fuzzy find a file in directory subtree with fzy and edit in vim |
+| fzy | Fuzzy find a file in directory subtree with fzy and open using xdg-open |
+| hexview | view a file in hex; needs xxd and $PAGER |
+| imgresize | Resize images in directory to screen resolution (needs [imgp](https://github.com/jarun/imgp)) |
+| imgur | Upload an image file to imgur |
+| kdeconnect | Send selected files to Android device using kdeconnect-cli |
+| ndiff | File and directory diff for selection using vimdiff |
+| nitrogen | Set the selected image as wallpaper using nitrogen. |
+| nlaunch | Drop-down independent app launcher (needs fzy), drop in `$PATH`; fallback regular prompt |
+| paste | Paste contents of current (text) file to paste.ubuntu.com (needs [pastebinit](https://launchpad.net/pastebinit)) |
+| picker | Pick files and pipe the newline-separated list to another utility |
+| pywal | Set the selected image as wallpaper using pywal and change the terminal color schemes. |
+| sxiv | Open images in current directory in sxiv |
+| transfer | Upload current file to transfer.sh |
+| upgrade | Check and update to latest version of nnn manually on Debian 9 Stretch |
diff --git a/user-scripts/nitrogen b/user-scripts/nitrogen
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+# Description: Set the selected image as wallpaper using nitrogen. Just put the cursor on a image and run the script.
+#
+# Shell: POSIX Compliant
+# Author: juacq97
+
+if ! [ -z "$1" ]; then
+ if [ $(mimetype --output-format %m $1 | awk -F '/' '{print $1}') == "image" ]; then
+ nitrogen --set-zoom-fill --save $1
+ notify-send -a "nnn" "Wallpaper changed!"
+ else
+ notify-send -a "nnn" "You need to select a image"
+ fi
+fi
diff --git a/user-scripts/pywal b/user-scripts/pywal
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+# Description: Set the selected image as wallpaper using pywal and change the terminal color schemes. Just put the cursor on a image and run the script.
+#
+# Shell: POSIX Compliant
+# Author: juacq97
+
+if ! [ -z "$1" ]; then
+ if [ $(mimetype --output-format %m $1 | awk -F '/' '{print $1}') == "image" ]; then
+ wal -i $1
+ notify-send -a "nnn" "Wallpaper changed!"
+ else
+ notify-send -a "nnn" "You need to select a image"
+ fi
+fi