Change summary
dot_config/polybar/caffeine.sh | 22 --------------------
dot_config/polybar/config.ini.tmpl | 14 +++++++++++-
dot_config/polybar/executable_caffeine.sh | 25 +++++++++++++++++++++++
dot_config/polybar/executable_mic-toggle.sh | 13 +++++++++++
4 files changed, 50 insertions(+), 24 deletions(-)
Detailed changes
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-case $1 in
- "toggle-mode")
- status=`xset -q | grep 'DPMS is' | awk '{ print $3 }'`
- if [ $status == 'Enabled' ]; then
- xset -dpms
- xset s off
- else
- xset +dpms
- xset s on
- fi
- ;;
- "show-mode")
- status=`xset -q | grep 'DPMS is' | awk '{ print $3 }'`
- if [ $status == 'Enabled' ]; then
- echo "Disabled"
- else
- echo "Enabled"
- fi
- ;;
-esac
@@ -25,12 +25,12 @@ module-margin-left = 1
module-margin-right = 3
font-0 = "{{ .font }}:pixelsize=11;1"
-font-1 = "JetBrainsMono NF:style=Regular"
+font-1 = "JetBrainsMono NF:style=Regular:size=12;2"
modules-left = i3
modules-center = xwindow
{{- if ne .chezmoi.hostname "glade" }}
-modules-right = updates caffeine wlan pulseaudio cpu memory date time {{ if eq .chezmoi.hostname "sidhe" }}battery{{ end }}
+modules-right = updates caffeine wlan mic pulseaudio cpu memory date time {{ if eq .chezmoi.hostname "sidhe" }}battery{{ end }}
{{- else }}
modules-right = wlan pulseaudio cpu memory date battery
{{- end }}
@@ -234,4 +234,14 @@ exec = ~/.config/polybar/caffeine.sh
click-left = ~/.config/polybar/caffeine.sh toggle
format = <label>
+[module/mic]
+type = custom/script
+exec = ~/.config/polybar/mic-toggle.sh
+interval = 1
+click-left = ~/.config/polybar/mic-toggle.sh toggle
+
+env-color_background = ${colors.background}
+env-color_primary = ${colors.primary}
+env-color_foreground = ${colors.foreground}
+
; vim:ft=dosini
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Show caffeine status
+
+coffee=$(pgrep -f caffeine-ng | grep -q . && echo "running" || echo "not")
+
+if [ -n "$1" ]; then
+ if [ "$1" = "toggle" ]; then
+ if [ "$coffee" = "running" ]; then
+ caffeine kill
+ echo ""
+ exit 1
+ elif [ "$coffee" = "not" ]; then
+ caffeine start &
+ echo ""
+ exit 1
+ fi
+ fi
+else
+ if [ "$coffee" = "running" ]; then
+ echo ""
+ elif [ "$coffee" = "not" ]; then
+ echo ""
+ fi
+fi
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+default_source=$(pactl get-default-source)
+
+pactl set-source-mute "$default_source" toggle
+
+is_muted=$(pactl get-source-mute "$default_source" | grep -q "yes" && echo "true" || echo "false")
+
+if [ "$is_muted" = "true" ]; then
+ echo "%{F${color_background}}%{B${color_primary}} %{B- F-}"
+else
+ echo "%{F${color_foreground}}%{B${color_background}} %{B- F-}"
+fi