feat: replace conky by sbar and pactl by wpctl
This commit is contained in:
parent
897a049f47
commit
ae3db45cc7
@ -1,14 +0,0 @@
|
|||||||
conky.config = {
|
|
||||||
background = false,
|
|
||||||
out_to_console = true,
|
|
||||||
out_to_x = false,
|
|
||||||
short_units = true,
|
|
||||||
top_cpu_separate = true,
|
|
||||||
total_run_times = 0,
|
|
||||||
update_interval = 2,
|
|
||||||
use_spacer = 'none',
|
|
||||||
};
|
|
||||||
|
|
||||||
conky.text = [[
|
|
||||||
${loadavg 1} | $memeasyfree | $acpitemp | $pa_sink_volume | ${battery_percent BAT1} | ${time %a %m/%d %R}
|
|
||||||
]]
|
|
@ -1 +1 @@
|
|||||||
Subproject commit 902d6aa31450d26e11bedcbef8af5b6fe2e1ffe8
|
Subproject commit aeb76066212b09c7c01a3abb42fe82f0130ef402
|
@ -1 +1 @@
|
|||||||
Subproject commit f0a70e0993acbb348c32a52a88058cc60c160992
|
Subproject commit a55d0b62326341bf6ac0538d2d88836ac1cd77e5
|
@ -1 +1 @@
|
|||||||
Subproject commit 69867ffe7e05559fdb055f6b5a2589fc6bee1070
|
Subproject commit f6df07be122de665fb363476cc3680c90f5bdf05
|
@ -1 +1 @@
|
|||||||
Subproject commit f8bf8f0029a475831ebfba0799975ede20e08742
|
Subproject commit 041c35ffc8cd97dd6327f44e35fa777af6f8e845
|
10
.xinitrc
10
.xinitrc
@ -9,8 +9,8 @@ numlockx
|
|||||||
|
|
||||||
xrandr \
|
xrandr \
|
||||||
--output "${LAPTOP_SCREEN}" --mode 1920x1080 --rate 60 --primary
|
--output "${LAPTOP_SCREEN}" --mode 1920x1080 --rate 60 --primary
|
||||||
# --output DisplayPort-1-1 --auto --right-of eDP \
|
# --output DisplayPort-1-1 --auto --pos 1920x0 \
|
||||||
# --output DisplayPort-1-2 --auto --right-of DisplayPort-1-1
|
# --output DisplayPort-1-2 --auto --pos 3840x0
|
||||||
)
|
)
|
||||||
|
|
||||||
# startup
|
# startup
|
||||||
@ -19,11 +19,9 @@ picom &
|
|||||||
redshift &
|
redshift &
|
||||||
feh --bg-tile "$XDG_CONFIG_HOME/wallpapers/landscape.png" --no-fehbg
|
feh --bg-tile "$XDG_CONFIG_HOME/wallpapers/landscape.png" --no-fehbg
|
||||||
dunst &
|
dunst &
|
||||||
|
sbar &
|
||||||
|
|
||||||
xset dpms 300 15 # dim 5m, lock 5m15s
|
xset dpms 300 15 # dim 5m, lock 5m15s
|
||||||
xss-lock lock &
|
xss-lock lock &
|
||||||
|
|
||||||
#bar
|
exec dbus-launch dwm
|
||||||
(conky | while read LINE; do xsetroot -name "$LINE"; done) &
|
|
||||||
|
|
||||||
exec dwm
|
|
||||||
|
84
bin/sbar
Executable file
84
bin/sbar
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# INIT
|
||||||
|
printf "$$" > "$HOME/.cache/pidofbar"
|
||||||
|
|
||||||
|
# MODULES
|
||||||
|
update_crypto() {
|
||||||
|
crypto="$(crypto)"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_cpu() {
|
||||||
|
cpu=" $(grep -o "^[^ ]*" /proc/loadavg)"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_memory() {
|
||||||
|
memory=" $(free -h | sed -n '2s/\([^ ]* *\)\{2\}\([^ ]*\).*/\2/p')"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_bat() {
|
||||||
|
bat="$(grep -q Charging /sys/class/power_supply/BAT1/status && printf '' || printf '')"
|
||||||
|
bat="$bat $(cat /sys/class/power_supply/BAT1/capacity)%"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_vol() {
|
||||||
|
local v="$(wpctl get-volume '@DEFAULT_AUDIO_SINK@')"
|
||||||
|
|
||||||
|
if grep -q 'MUTED' <<< "$v"; then
|
||||||
|
vol='🔇'
|
||||||
|
else
|
||||||
|
vol=" $((10#$(tr -dc '[0-9]' <<< "$v")))"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
update_backlight() {
|
||||||
|
local actual_brightness
|
||||||
|
local max_brightness
|
||||||
|
|
||||||
|
read -r actual_brightness </sys/class/backlight/*/actual_brightness
|
||||||
|
read -r max_brightness </sys/class/backlight/*/max_brightness
|
||||||
|
backlight=" $((actual_brightness * 100 / max_brightness))%"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_time() {
|
||||||
|
time="$(date "+%a %m/%d %R")"
|
||||||
|
}
|
||||||
|
|
||||||
|
# For calcurse users, refer https://github.com/pystardust/automeet
|
||||||
|
#update_event () {
|
||||||
|
# event="$(calcurse -n | sed 1d | \
|
||||||
|
# sed -E "s_^ *\[(.*):(.*)\] ([^\t]*)\t?.*_[\1h \2m->\3]_")"
|
||||||
|
# [ "[]" = "$event" ] && event=""
|
||||||
|
#}
|
||||||
|
|
||||||
|
|
||||||
|
# modules that don't update on their own need to be run at the start for getting their initial value
|
||||||
|
update_vol
|
||||||
|
update_backlight
|
||||||
|
|
||||||
|
display() {
|
||||||
|
xsetroot -name "$crypto | $cpu | $memory | $vol | $backlight | $bat | $time"
|
||||||
|
}
|
||||||
|
|
||||||
|
# SIGNALING
|
||||||
|
# trap "<function>;display" "RTMIN+n"
|
||||||
|
trap "update_vol;display" "RTMIN"
|
||||||
|
trap "update_backlight;display" "RTMIN+1"
|
||||||
|
trap "update_bat;display" "RTMIN+2"
|
||||||
|
# to update it from external commands
|
||||||
|
## kill -m "$(cat ~/.cache/pidofbar)"
|
||||||
|
# where m = 34 + n
|
||||||
|
|
||||||
|
sec=0
|
||||||
|
while true; do
|
||||||
|
sleep 1 & wait && {
|
||||||
|
[ $((sec % 3600)) -eq 0 ] && update_crypto
|
||||||
|
[ $((sec % 1 )) -eq 0 ] && update_time
|
||||||
|
[ $((sec % 5 )) -eq 0 ] && update_cpu
|
||||||
|
[ $((sec % 5 )) -eq 0 ] && update_memory
|
||||||
|
[ $((sec % 5 )) -eq 0 ] && update_bat
|
||||||
|
[ $((sec % 5 )) -eq 0 ] && display
|
||||||
|
|
||||||
|
sec="$((sec + 1))"
|
||||||
|
}
|
||||||
|
done
|
@ -41,6 +41,9 @@ done
|
|||||||
|
|
||||||
echo "$NEW" > "$CUR_FILE"
|
echo "$NEW" > "$CUR_FILE"
|
||||||
|
|
||||||
|
# update sbar
|
||||||
|
kill -35 "$(cat "$HOME/.cache/pidofbar")"
|
||||||
|
|
||||||
if [ -t 1 ]; then
|
if [ -t 1 ]; then
|
||||||
echo "$NEW"
|
echo "$NEW"
|
||||||
fi
|
fi
|
||||||
|
45
bin/set-vol
45
bin/set-vol
@ -1,29 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SINK='@DEFAULT_SINK@'
|
SINK='@DEFAULT_AUDIO_SINK@'
|
||||||
|
|
||||||
VOL="$(pactl get-sink-volume "$SINK")"
|
if [ "$1" == 'm' ]; then
|
||||||
VOL="$(grep -Po '\d+(?=%)' <<< "$VOL" | head -n 1)"
|
wpctl set-mute "$SINK" toggle
|
||||||
VOL="$((VOL - VOL % "$1"))"
|
else
|
||||||
|
VOL="$((10#$(wpctl get-volume "$SINK" | tr -dc '[0-9]')))"
|
||||||
|
[ -n "$1" ] && VOL="$((VOL - VOL % $1))"
|
||||||
|
|
||||||
case "${1:0:1}" in
|
case "${1:0:1}" in
|
||||||
'')
|
'')
|
||||||
exit 1
|
echo "$VOL"
|
||||||
;;
|
exit
|
||||||
'+'|'-')
|
;;
|
||||||
VOL="$((VOL + "$1"))"
|
'+'|'-')
|
||||||
;;
|
VOL="$((VOL + $1))"
|
||||||
*)
|
;;
|
||||||
VOL="$1"
|
*)
|
||||||
;;
|
VOL="$1"
|
||||||
esac
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
[ "$VOL" -lt 0 ] && VOL=0
|
[ "$VOL" -lt 0 ] && VOL=0
|
||||||
[ "$VOL" -gt 100 ] && VOL=100
|
[ "$VOL" -gt 100 ] && VOL=100
|
||||||
|
|
||||||
pactl set-sink-volume "$SINK" "$VOL%"
|
wpctl set-volume "$SINK" "$VOL%"
|
||||||
pactl set-sink-mute "$SINK" 0
|
wpctl set-mute "$SINK" 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# update sbar
|
||||||
|
kill -34 "$(cat "$HOME/.cache/pidofbar")"
|
||||||
|
|
||||||
if [ -t 1 ]; then
|
if [ -t 1 ]; then
|
||||||
echo "$VOL"
|
echo "$VOL"
|
||||||
|
Loading…
Reference in New Issue
Block a user