From 590e1b8feeab5949cc94dbfb7237676186fc0527 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Sun, 16 Dec 2018 19:24:40 +0100 Subject: Several changes. --- bgBrowser.sh | 17 +++++++++-------- dmenuTerm.sh | 6 ++++-- i3blocks/i3battery.sh | 33 +++++++++++++++++---------------- i3blocks/i3internet.sh | 22 +++++++++++----------- i3blocks/i3music.sh | 16 ++++++++++++---- i3blocks/i3vol.sh | 6 ++++++ vol.sh | 5 +++-- 7 files changed, 62 insertions(+), 43 deletions(-) diff --git a/bgBrowser.sh b/bgBrowser.sh index 3608e30..bddcd27 100755 --- a/bgBrowser.sh +++ b/bgBrowser.sh @@ -1,17 +1,18 @@ #!/bin/bash # _ _ -# __ ____ _| | |_ __ __ _ _ __ ___ _ __ +# __ ____ _| | |_ __ __ _ _ __ ___ _ __ # \ \ /\ / / _` | | | '_ \ / _` | '_ \ / _ \ '__| -# \ V V / (_| | | | |_) | (_| | |_) | __/ | -# \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_| -# _ |_| |_| -# | |__ _ __ _____ _____ ___ _ __ +# \ V V / (_| | | | |_) | (_| | |_) | __/ | +# \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_| +# _ |_| |_| +# | |__ _ __ _____ _____ ___ _ __ # | '_ \| '__/ _ \ \ /\ / / __|/ _ \ '__| -# | |_) | | | (_) \ V V /\__ \ __/ | -# |_.__/|_| \___/ \_/\_/ |___/\___|_| +# | |_) | | | (_) \ V V /\__ \ __/ | +# |_.__/|_| \___/ \_/\_/ |___/\___|_| # -folder="/home/inigo/images/wallpapers/" +#folder="/home/inigo/images/wallpapers/" +folder="$1" indexSet=0 function updateFiles { diff --git a/dmenuTerm.sh b/dmenuTerm.sh index fdf1909..b34e72f 100755 --- a/dmenuTerm.sh +++ b/dmenuTerm.sh @@ -1,7 +1,7 @@ #!/bin/bash # dmenu script for opening console programs and scripts directly -options="neofetch\ncmus\ncmus (float)\nnewsboat\nneomutt\nsyncthing\nbrightFirst\nresetConnection\nwifiDown\nyears\nmonths\nbg selection\nshowColors\npython" +options="neofetch\ncmus\ncmus (float)\nnewsboat\nneomutt\nsyncthing\nbrightFirst\nresetConnection\nwifiDown\nyears\nmonths\nbg selection\nshowColors\npython\nemojis" chosen=$(echo -e "$options" | dmenu -i -p "~$ urxvt -e") @@ -11,7 +11,7 @@ case "$chosen" in showColors) urxvt -title floating -sh 10 -cr black -geometry 43x9 -e ~/scripts/showColors.sh ;; years) urxvt -title floating -sh 20 -cr black -geometry 66x39 -e ~/scripts/years.sh ;; months) urxvt -title floating -sh 20 -cr black -geometry 22x9 -e ~/scripts/months.sh ;; - "bg selection") urxvt -title floating -sh 20 -cr black -geometry "45x6-5-5" -e ~/scripts/bgBrowser.sh ;; + "bg selection") urxvt -title floating -sh 20 -cr black -geometry "45x6-5-5" -e ~/scripts/bgBrowser.sh "/home/inigo/images/wallpapers/" ;; python) urxvt -title floating -geometry 80x28 -e python ;; #programs cmus) urxvt -cd ~/music -e cmus ;; @@ -23,4 +23,6 @@ case "$chosen" in brightFirst) urxvt -title floating -geometry 32x1 -e sudo ~/scripts/brightFirst.sh ;; resetConnection) urxvt -title floating -geometry 32x1 -e sudo ~/scripts/resetConnection.sh ;; wifiDown) urxvt -title floating -geometry 32x1 -e sudo ~/scripts/wifiDown.sh ;; + # other + emojis) ~/scripts/dmenuUnicode.sh ;; esac diff --git a/i3blocks/i3battery.sh b/i3blocks/i3battery.sh index 34c461a..0db8daf 100755 --- a/i3blocks/i3battery.sh +++ b/i3blocks/i3battery.sh @@ -2,7 +2,7 @@ # Give a battery name (e.g. BAT1) as an argument. case $BLOCK_BUTTON in - 3) pgrep -x dunst >/dev/null && notify-send "🔋 Battery module: + 3) pgrep -x dunst >/dev/null && notify-send -t 5000 "🔋 Battery module: 🔋: discharging ♻: stagnant charge 🔌: charging @@ -14,24 +14,25 @@ esac capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit status=$(cat /sys/class/power_supply/"$1"/status) -#if [ "$capacity" -ge 80 ]; then -# color="#b8bb26" -#elif [ "$capacity" -ge 60 ]; then -# color="#ebdbb2" -#elif [ "$capacity" -ge 40 ]; then -# color="#fabd2f" -#elif [ "$capacity" -ge 20 ]; then -# color="#fe8019" -#else -# color="#fb4934" -# warn="❗" -#fi +if [ "$capacity" -ge 80 ]; then + color="#b8bb26" +elif [ "$capacity" -ge 60 ]; then + color="#ebdbb2" +elif [ "$capacity" -ge 40 ]; then + color="#fabd2f" +elif [ "$capacity" -ge 20 ]; then + color="#fe8019" +else + color="#fb4934" + warn="❗" +fi -[ ! "$capacity" -gt 15 ] && warn="❗" +#[ ! "$capacity" -gt 15 ] && warn="❗" [ -z $warn ] && warn="" -#[ "$status" = "Charging" ] && color="#FFF" +[ "$status" = "Charging" ] && color="#1fffaf" -printf "%s%s%s%s" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" "$warn" +#printf "%s%s%s%s" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" "$warn" +printf "%s%s%s" "$color" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" echo "" diff --git a/i3blocks/i3internet.sh b/i3blocks/i3internet.sh index 536b242..049a479 100755 --- a/i3blocks/i3internet.sh +++ b/i3blocks/i3internet.sh @@ -1,15 +1,15 @@ #!/bin/sh -#case $BLOCK_BUTTON in -# 1) $TERMINAL -e nmtui ;; -# 3) pgrep -x dunst >/dev/null && notify-send "🌐 Internet module: -#- Click for \`nmtui\` for wifi access -#📡: no wifi connection -#📶: wifi connection with quality -#❎: no ethernet -#🌐: ethernet working -#" ;; -#esac +case $BLOCK_BUTTON in + 1) i3-msg "exec urxvt -e nmtui" >/dev/null ;; + 3) pgrep -x dunst >/dev/null && notify-send "🌐 Internet module: +- Click for 'nmtui' for wifi access +📡: no wifi connection +📶: wifi connection with quality +❎: no ethernet +🌐: ethernet working +" ;; +esac # #[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡" # @@ -23,4 +23,4 @@ wifi="$(nmcli | grep "wlp2s0: conectado to " | cut -d' ' -f4-) ($(ip addr show w en=$(ip addr show enp3s0 | grep "inet " | cut -d' ' -f6) [ $wstatus = "down" ] && wifi="down" [ $estatus = "down" ] && en="down" -echo "W: 📶 $wifi - E: 🌐 $en" +echo "📶 $wifi | 🌐 $en" diff --git a/i3blocks/i3music.sh b/i3blocks/i3music.sh index 6cb9f10..3aa764e 100755 --- a/i3blocks/i3music.sh +++ b/i3blocks/i3music.sh @@ -1,12 +1,20 @@ #!/bin/bash +case $BLOCK_BUTTON in + 1) cmus-remote -r ;; + 2) cmus-remote -u ;; + 3) cmus-remote -n ;; +esac + status=$(cmus-remote -Q | grep status | awk '{print $2}') +artist=$(cmus-remote -Q | grep "tag artist " | cut -d' ' -f3-) +title=$(cmus-remote -Q | grep "tag title " | cut -d' ' -f3-) +[ -z $artist ] && artist="(unknown)" +[ -z $title ] && title=$(cmus-remote -Q | grep "file " | cut -d'/' -f5-) if [ $status = "playing" ]; then - artist=$(cmus-remote -Q | grep "tag artist " | cut -d' ' -f3-) - title=$(cmus-remote -Q | grep "tag title " | cut -d' ' -f3-) - [ -z $artist ] && artist="(unknown)" - [ -z $title ] && title=$(cmus-remote -Q | grep "file " | cut -d'/' -f5-) echo "$artist ─ $title" +elif [ $status = "paused" ]; then + echo "( $artist ─ $title )" else echo "$status" fi diff --git a/i3blocks/i3vol.sh b/i3blocks/i3vol.sh index 5f91bde..f702656 100755 --- a/i3blocks/i3vol.sh +++ b/i3blocks/i3vol.sh @@ -1,4 +1,10 @@ #!/bin/bash + +case $BLOCK_BUTTON in + 1) i3-msg "exec urxvt -e alsamixer" >/dev/null ;; + 3) pgrep -x dunst >/dev/null && notify-send -t 2000 "Click for alsamixer" ;; +esac + vol=$(pactl list sinks | grep Volumen: | awk '{print $5}') mute=$(pactl list sinks | grep Silencio: | cut -d' ' -f2) if [ $mute = "no" ]; then diff --git a/vol.sh b/vol.sh index 827bf7b..61fbe6f 100755 --- a/vol.sh +++ b/vol.sh @@ -1,8 +1,9 @@ #!/bin/bash +sink=$(pactl list sinks | grep "Receptor " | cut -d'#' -f2) if [ $1 = "mute" ]; then - pactl set-sink-mute 0 toggle + pactl set-sink-mute $sink toggle else - pactl set-sink-volume 0 $1% + pactl set-sink-volume $sink $1% fi notify-send -t 500 "$(~/scripts/i3blocks/i3vol.sh)" -- cgit v1.2.1