From 66a8206b42c91051d3f7f3b74e987609ce3b7ca8 Mon Sep 17 00:00:00 2001 From: Dmitry Fedotov Date: Sun, 31 May 2020 18:11:11 +0300 Subject: [PATCH] Add scripts for mpd and emojis. Edit volume and shutdown scripts. --- scripts/dmenu-unicode.sh | 14 ++++++++++++++ scripts/i3mpd.sh | 18 ++++++++++++++++++ scripts/shutdown.sh | 2 +- scripts/volume.sh | 10 +++++----- 4 files changed, 38 insertions(+), 6 deletions(-) create mode 100755 scripts/dmenu-unicode.sh create mode 100755 scripts/i3mpd.sh diff --git a/scripts/dmenu-unicode.sh b/scripts/dmenu-unicode.sh new file mode 100755 index 0000000..94e63b4 --- /dev/null +++ b/scripts/dmenu-unicode.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +choose=$(grep -v "#" ~/.local/share/emoji | \ + dmenu -i -l 20 -fn Monospace-18 | \ + awk '{print $1}') + +if [[ -z ${choose} ]]; then + exit 1 +fi + +echo "${choose}" | tr -d '\n' | xclip -selection clipboard + +pgrep -x dunst > /dev/null && \ +notify-send "$(xclip -o -selection clipboard) copied to clipboard" diff --git a/scripts/i3mpd.sh b/scripts/i3mpd.sh new file mode 100755 index 0000000..a08a561 --- /dev/null +++ b/scripts/i3mpd.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +#Pass the password to the block instance +if [[ -n $BLOCK_INSTANCE ]]; then + password=("-h" "${BLOCK_INSTANCE}@localhost") +fi + +filter() { + tr '\n' ' ' | grep -Po '.*(?= \[playing\])|paused' | tr -d '\n' +} + +case $BLOCK_BUTTON in + 1) mpc $password status | filter && $TERMINAL -e ncmpcpp & disown ;; # right click pause/unpause + 3) mpc $password toggle | filter ;; # right click, pause/unpause + 4) mpc $password prev | filter ;; # scroll up, previous + 5) mpc $password next | filter ;; # scroll down, next + *) mpc $password status | filter ;; +esac diff --git a/scripts/shutdown.sh b/scripts/shutdown.sh index 75c5673..44a74e7 100755 --- a/scripts/shutdown.sh +++ b/scripts/shutdown.sh @@ -1,6 +1,6 @@ #!/bin/bash -font="System San Francisco Display 12" +font="Monospace-18" pgrep -x dmenu && exit diff --git a/scripts/volume.sh b/scripts/volume.sh index e762517..681ab82 100755 --- a/scripts/volume.sh +++ b/scripts/volume.sh @@ -11,17 +11,17 @@ esac muted=$( awk '/muted/ {print $2}' <(pacmd list-sinks | grep '^[[:space:]]muted:' | head -n $(( $sink + 1 )) | tail -n 1 ) ) if [ "$muted" = "yes" ]; then - icon="" + icon="🔇" printf "%s\\n" "$icon" else vol=$( pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $sink + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' ) if [ "$vol" -gt 60 ]; then - icon="" + icon="🔊" elif [[ "$vol" -le 60 && "$vol" -gt 30 ]]; then - icon="" + icon="🔉" else - icon="" + icon="🔈" fi - + printf "%s %s%%\\n" "$icon" "$vol" fi -- 2.39.5