aboutsummaryrefslogtreecommitdiff
path: root/bg.sh
diff options
context:
space:
mode:
authorkdam0 <me@kumardamani.net>2023-03-13 23:24:56 +0000
committerkdam0 <me@kumardamani.net>2023-03-13 23:24:56 +0000
commit2e7be84c789801304c86a07351621e0503ccdf40 (patch)
tree9c1a2c359f712c7dd6b8a9b2a389cbc3a4018265 /bg.sh
added initial repo files
Diffstat (limited to 'bg.sh')
-rwxr-xr-xbg.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/bg.sh b/bg.sh
new file mode 100755
index 0000000..9bcefa6
--- /dev/null
+++ b/bg.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+WALLPAPERS_HOME=${1:-$HOME/pics/wallpapers}
+
+# Get a random image file from the dir.
+RAND_BG=$(find "$WALLPAPERS_HOME" -type f -name "*.jpeg" -o -name "*.jpg" -o -name "*.png" | shuf | head -n1)
+
+# Set the image file as the background.
+(command -v wbg > /dev/null || (echo "wbg is not installed." && exit 1) && \
+ # else
+ notify-send "Set background." && wbg "${RAND_BG}"
+)