commit 35e0c1017ce06dcdeaaee72d9d96d3b082af613d
parent 9d79aba42bd3fbda9270f308f8c0795cb2687fe3
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 11 Jan 2019 09:18:55 +0100
Use common script for dmenu theming
Diffstat:
7 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/links/.config/i3/config b/links/.config/i3/config
@@ -80,7 +80,7 @@ bindsym $mod+Return exec $term -e tmux
bindsym $mod+Shift+Return exec $term
bindsym $mod+grave exec --no-startup-id ddspawn tmuxdd
bindsym $mod+comma exec signal-desktop
-bindsym $mod+space exec dmenu_run -nb \#222222 -nf \#888888 -sb \#333333 -sf \#ffffff -fn PragmataPro
+bindsym $mod+space exec dmenu_themed run
bindsym $modalt+space exec ducksearch
bindsym $mod+Tab focus mode_toggle
diff --git a/links/bin/dmenu_themed b/links/bin/dmenu_themed
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+dmenuopts="-nb #222222 -nf #888888 -sb #333333 -sf #ffffff -fn PragmataPro-10"
+
+if [[ "$1" = "run" ]]; then
+ dmenu_run $dmenuopts
+else
+ dmenu $dmenuopts "$@"
+fi
diff --git a/links/bin/dmenumount b/links/bin/dmenumount
@@ -3,21 +3,20 @@
# If they're in /etc/fstab, they'll be mounted automatically.
# Otherwise, you'll be prompted to give a mountpoint from already existsing directories.
# If you input a novel directory, it will prompt you to create that directory.
-pgrep -x dmenu && exit
-dmenuopts="-nb #222222 -nf #888888 -sb #333333 -sf #ffffff -fn PragmataPro"
+pgrep -x dmenu_themed && exit 1
getmount() { \
[ -z "$chosen" ] && exit 1
- mp="$(find $1 | dmenu $dmenuopts -i -p "Type in mount point.")"
+ mp="$(find $1 | dmenu_themed -i -p "Type in mount point.")"
[ "$mp" = "" ] && exit 1
if [ ! -d "$mp" ]; then
- mkdiryn=$(printf "No\\nYes" | dmenu $dmenuopts -i -p "$mp does not exist. Create it?")
+ mkdiryn=$(printf "No\\nYes" | dmenu_themed -i -p "$mp does not exist. Create it?")
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}
mountusb() { \
- chosen="$(echo "$usbdrives" | dmenu $dmenuopts -i -p "Mount which drive?" | awk '{print $1}')"
+ chosen="$(echo "$usbdrives" | dmenu_themed -i -p "Mount which drive?" | awk '{print $1}')"
sudo -A mount "$chosen" && notify-send "$chosen mounted." && exit 0
getmount "/mnt /media /mount /home -maxdepth 5 -type d"
partitiontype="$(lsblk -no "fstype" "$chosen")"
@@ -29,14 +28,14 @@ mountusb() { \
}
mountandroid() { \
- chosen=$(echo "$anddrives" | dmenu $dmenuopts -i -p "Which Android device?" | cut -d : -f 1)
+ chosen=$(echo "$anddrives" | dmenu_themed -i -p "Which Android device?" | cut -d : -f 1)
getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp"
notify-send "Android device mounted to $mp."
}
asktype() { \
- case $(printf "USB\\nAndroid" | dmenu $dmenuopts -i -p "Mount a USB drive or Android device?") in
+ case $(printf "USB\\nAndroid" | dmenu_themed -i -p "Mount a USB drive or Android device?") in
USB) mountusb ;;
Android) mountandroid ;;
esac
diff --git a/links/bin/dmenurecord b/links/bin/dmenurecord
@@ -9,8 +9,6 @@
#
# If there is already a running instance, user will be prompted to end it.
-dmenuopts="-nb #222222 -nf #888888 -sb #333333 -sf #ffffff -fn PragmataPro"
-
updateicon() { \
echo "$1" > ~/.recordingicon
pkill -RTMIN+9 i3blocks
@@ -82,7 +80,7 @@ audio() { \
}
askrecording() { \
- choice=$(printf "screencast\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu $dmenuopts -i -p "Select recording style:")
+ choice=$(printf "screencast\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu_themed -i -p "Select recording style:")
case "$choice" in
screencast) screencast;;
audio) audio;;
@@ -93,7 +91,7 @@ askrecording() { \
}
asktoend() { \
- response=$(printf "No\\nYes" | dmenu $dmenuopts -i -p "Recording still active. End recording?") &&
+ response=$(printf "No\\nYes" | dmenu_themed -i -p "Recording still active. End recording?") &&
[ "$response" = "Yes" ] && killrecording
}
diff --git a/links/bin/dmenuumount b/links/bin/dmenuumount
@@ -3,23 +3,21 @@
# Provides you with mounted partitions, select one to unmount.
# Drives mounted at /, /boot and /home will not be options to unmount.
-dmenuopts="-nb #222222 -nf #888888 -sb #333333 -sf #ffffff -fn PragmataPro"
-
unmountusb() {
[ -z "$drives" ] && exit
- chosen=$(echo "$drives" | dmenu $dmenuopts -i -p "Unmount which drive?" | awk '{print $1}')
+ chosen=$(echo "$drives" | dmenu_themed -i -p "Unmount which drive?" | awk '{print $1}')
[ -z "$chosen" ] && exit
sudo -A umount "$chosen" && pgrep -x dunst && notify-send "$chosen unmounted."
}
unmountandroid() { \
- chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu $dmenuopts -i -p "Unmount which device?")
+ chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu_themed -i -p "Unmount which device?")
[ -z "$chosen" ] && exit
fusermount -u "$chosen" && pgrep -x dunst && notify-send "$chosen unmounted."
}
asktype() { \
- case $(printf "USB\\nAndroid" | dmenu $dmenuopts -i -p "Unmount a USB drive or Android device?") in
+ case $(printf "USB\\nAndroid" | dmenu_themed -i -p "Unmount a USB drive or Android device?") in
USB) unmountusb ;;
Android) unmountandroid ;;
esac
diff --git a/links/bin/dmenuunicode b/links/bin/dmenuunicode
@@ -5,9 +5,7 @@
# Must have xclip installed to even show menu.
xclip -h >/dev/null || exit
-dmenuopts="-nb #222222 -nf #888888 -sb #333333 -sf #ffffff -fn PragmataPro-16"
-
-chosen=$(grep -v "#" ~/.emoji | dmenu -i -l 20 $dmenuopts)
+chosen=$(grep -v "#" ~/.emoji | dmenu_themed -i -l 20 $dmenuopts)
[ "$chosen" != "" ] || exit
diff --git a/links/bin/ducksearch b/links/bin/ducksearch
@@ -6,11 +6,9 @@
# Anything else, it search it.
browser=${BROWSER:-firefox}
-pgrep -x dmenu && exit
+pgrep -x dmenu_themed && exit 1
-dmenuopts="-nb #222222 -nf #888888 -sb #333333 -sf #ffffff -fn PragmataPro"
-
-choice=$(echo "🦆" | dmenu $dmenuopts -i -p "Search DuckDuckGo:") || exit 1
+choice=$(echo "🦆" | dmenu_themed -i -p "Search DuckDuckGo:") || exit 1
if [ "$choice" = "🦆" ]; then
$browser "https://duckduckgo.com"