mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-25 13:42:23 +00:00
Some cleanup in bar
This commit is contained in:
parent
48850415d8
commit
a009bbe470
3 changed files with 38 additions and 20 deletions
31
eww-bar/.config/eww-bar/audio.sh
Normal file → Executable file
31
eww-bar/.config/eww-bar/audio.sh
Normal file → Executable file
|
@ -1,10 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
|
||||
|
||||
speaker_sink_id=$(pamixer --list-sinks | grep "Komplete_Audio_6" | awk '{print $1}')
|
||||
game_sink_id=$(pamixer --list-sinks | grep "stereo-game" | awk '{print $1}')
|
||||
|
||||
volume=$(pamixer --get-volume)
|
||||
|
||||
case "$1" in
|
||||
"symbol")
|
||||
pactl subscribe | grep --line-buffered "Event 'change' on client" | while read -r; do
|
||||
case "$(pactl get-default-sink)" in
|
||||
*Arctis_9*) echo "🎧";;
|
||||
*) echo "📢";;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
"volume")
|
||||
pamixer --get-volume;
|
||||
pactl subscribe | grep --line-buffered "Event 'change' on sink " | while read -r evt;
|
||||
do pamixer --get-volume;
|
||||
done
|
||||
;;
|
||||
"toggle")
|
||||
speaker_sink_id=$(pamixer --list-sinks | grep "Komplete_Audio_6" | awk '{print $1}')
|
||||
game_sink_id=$(pamixer --list-sinks | grep "stereo-game" | awk '{print $1}')
|
||||
case "$(pactl get-default-sink)" in
|
||||
*Arctis_9*) pactl set-default-sink $speaker_sink_id;;
|
||||
*) pactl set-default-sink $game_sink_id ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
:class "segment-bottom"
|
||||
(bottom)))))
|
||||
|
||||
|
||||
|
||||
(defwidget top []
|
||||
(workspaces :wsp_yuck {screen == 0 ? workspaces_0_yuck : screen == 1 ? workspaces_1_yuck : workspaces_2_yuck}))
|
||||
|
||||
|
@ -57,8 +55,10 @@
|
|||
(box :orientation "v"
|
||||
:valign "fill"
|
||||
:vexpand true
|
||||
(large-sym :sym "🎧")
|
||||
"${volume}%")))
|
||||
(button :onclick "./audio.sh toggle"
|
||||
(large-sym :sym audio_sink))
|
||||
(button :onclick "pavucontrol &"
|
||||
"${volume}%"))))
|
||||
|
||||
|
||||
(defwidget large-sym [sym]
|
||||
|
@ -69,18 +69,14 @@
|
|||
:halign "center"
|
||||
day_word day month year))
|
||||
|
||||
(deflisten volume
|
||||
`
|
||||
pamixer --get-volume;
|
||||
pactl subscribe | grep --line-buffered "Event 'change' on sink " | while read -r evt;
|
||||
do pamixer --get-volume;
|
||||
done`)
|
||||
(deflisten audio_sink "./audio.sh symbol")
|
||||
(deflisten volume :initial "0" "./audio.sh volume")
|
||||
|
||||
(defpoll hour :interval "1s" "date +%H")
|
||||
(defpoll min :interval "1s" "date +%M")
|
||||
(defpoll sec :interval "1s" "date +%S")
|
||||
|
||||
(defpoll day_word :interval "10m" "date +%a")
|
||||
(defpoll day_word :interval "10m" "date +%a | tr [:upper:] [:lower:]")
|
||||
(defpoll day :interval "10m" "date +%d")
|
||||
(defpoll month :interval "1h" "date +%m")
|
||||
(defpoll year :interval "1h" "date +%y")
|
||||
|
|
|
@ -10,6 +10,7 @@ gib_workspace_names() {
|
|||
}
|
||||
|
||||
gib_workspace_yuck() {
|
||||
buffered=""
|
||||
gib_workspace_names | while read -r id active name; do
|
||||
name="${name#*_}"
|
||||
if [ "$active" == '*' ]; then
|
||||
|
@ -25,10 +26,14 @@ gib_workspace_yuck() {
|
|||
button_class="empty"
|
||||
button_name="◇"
|
||||
fi
|
||||
echo -n '(button :class "'$button_class' '$active_class'" :onclick "wmctrl -s '$id'" "'$button_name'")'
|
||||
buffered+="(button :class \"$button_class $active_class\" :onclick \"wmctrl -s $id\" \"$button_name\")"
|
||||
if [ $button_class = "occupied" -o $active_class = "active" ]; then
|
||||
echo -n "$buffered"
|
||||
buffered=""
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
xprop -spy -root _NET_CURRENT_DESKTOP | while read -r; do
|
||||
echo '(box :orientation "v" :class "workspaces" :space-evenly true :halign "start" :valign "center" :vexpand true '"$(gib_workspace_yuck)"')'
|
||||
echo '(box :orientation "v" :class "workspaces" :space-evenly true :halign "center" :valign "center" :vexpand true '"$(gib_workspace_yuck)"')'
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue