From d49c79933e7b85a24238f6f373261de1d71d7072 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sat, 20 Jan 2024 03:41:29 -0500 Subject: Wallpapers from lf + fix shortcutgen --- .local/bin/setbg | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 .local/bin/setbg (limited to '.local/bin/setbg') diff --git a/.local/bin/setbg b/.local/bin/setbg new file mode 100755 index 0000000..6608d7a --- /dev/null +++ b/.local/bin/setbg @@ -0,0 +1,28 @@ +#!/bin/sh + +# Make sure given file is an image +[ -z "$1" ] && exit +[ ! -f "$1" ] && exit +[ -z "$(file "$1" | grep -o 'image data')" ] && exit + +displays=$(xrandr | grep " connected" | sed 's/^\([a-Z,0-9,-]*\).*/\1/') + +# selected="$(echo "$displays" | dmenu -w "$(xdotool getactivewindow)" -p "󰍹 Select monitor:")" + +# Same as above but use dmenu only if there are multiple displays +if [ "$(echo "$displays" | wc -l)" -gt 1 ]; then + selected="$(echo "$displays" | dmenu -w "$(xdotool getactivewindow)" -p "󰍹 Select monitor:")" +else + selected="$displays" +fi + +[ -z "$selected" ] && exit + +src="$1" +extension="${1##*.}" +dest="$XDG_CONFIG_HOME/wallpapers/${selected}.$extension" + +ln -sf "$src" "$dest" && notify-send -a "Wallpaper" -i "$src" "Changed monitor: $selected" + +# Re-render all wallpapers +makewall -- cgit v1.2.3