diff --git a/.config/conky/conky.conf b/.config/conky/conky.conf deleted file mode 100644 index 7802bd0..0000000 --- a/.config/conky/conky.conf +++ /dev/null @@ -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} -]] diff --git a/.config/nvim/pack/plugins/opt/lspconfig b/.config/nvim/pack/plugins/opt/lspconfig index 902d6aa..aeb7606 160000 --- a/.config/nvim/pack/plugins/opt/lspconfig +++ b/.config/nvim/pack/plugins/opt/lspconfig @@ -1 +1 @@ -Subproject commit 902d6aa31450d26e11bedcbef8af5b6fe2e1ffe8 +Subproject commit aeb76066212b09c7c01a3abb42fe82f0130ef402 diff --git a/.config/nvim/pack/plugins/opt/onedark b/.config/nvim/pack/plugins/opt/onedark index f0a70e0..a55d0b6 160000 --- a/.config/nvim/pack/plugins/opt/onedark +++ b/.config/nvim/pack/plugins/opt/onedark @@ -1 +1 @@ -Subproject commit f0a70e0993acbb348c32a52a88058cc60c160992 +Subproject commit a55d0b62326341bf6ac0538d2d88836ac1cd77e5 diff --git a/.config/nvim/pack/plugins/opt/treesitter b/.config/nvim/pack/plugins/opt/treesitter index 69867ff..f6df07b 160000 --- a/.config/nvim/pack/plugins/opt/treesitter +++ b/.config/nvim/pack/plugins/opt/treesitter @@ -1 +1 @@ -Subproject commit 69867ffe7e05559fdb055f6b5a2589fc6bee1070 +Subproject commit f6df07be122de665fb363476cc3680c90f5bdf05 diff --git a/.config/zsh/ohmyzsh b/.config/zsh/ohmyzsh index f8bf8f0..041c35f 160000 --- a/.config/zsh/ohmyzsh +++ b/.config/zsh/ohmyzsh @@ -1 +1 @@ -Subproject commit f8bf8f0029a475831ebfba0799975ede20e08742 +Subproject commit 041c35ffc8cd97dd6327f44e35fa777af6f8e845 diff --git a/.xinitrc b/.xinitrc index 2886f49..5ae4844 100644 --- a/.xinitrc +++ b/.xinitrc @@ -9,8 +9,8 @@ numlockx xrandr \ --output "${LAPTOP_SCREEN}" --mode 1920x1080 --rate 60 --primary -# --output DisplayPort-1-1 --auto --right-of eDP \ -# --output DisplayPort-1-2 --auto --right-of DisplayPort-1-1 +# --output DisplayPort-1-1 --auto --pos 1920x0 \ +# --output DisplayPort-1-2 --auto --pos 3840x0 ) # startup @@ -19,11 +19,9 @@ picom & redshift & feh --bg-tile "$XDG_CONFIG_HOME/wallpapers/landscape.png" --no-fehbg dunst & +sbar & xset dpms 300 15 # dim 5m, lock 5m15s xss-lock lock & -#bar -(conky | while read LINE; do xsetroot -name "$LINE"; done) & - -exec dwm +exec dbus-launch dwm diff --git a/bin/sbar b/bin/sbar new file mode 100755 index 0000000..a30b003 --- /dev/null +++ b/bin/sbar @@ -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 \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 ";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 diff --git a/bin/set-light b/bin/set-light index 24a4029..6bf819a 100755 --- a/bin/set-light +++ b/bin/set-light @@ -41,6 +41,9 @@ done echo "$NEW" > "$CUR_FILE" +# update sbar +kill -35 "$(cat "$HOME/.cache/pidofbar")" + if [ -t 1 ]; then echo "$NEW" fi diff --git a/bin/set-vol b/bin/set-vol index 7929f8d..9ac03bf 100755 --- a/bin/set-vol +++ b/bin/set-vol @@ -1,29 +1,36 @@ #!/bin/bash set -e -SINK='@DEFAULT_SINK@' +SINK='@DEFAULT_AUDIO_SINK@' -VOL="$(pactl get-sink-volume "$SINK")" -VOL="$(grep -Po '\d+(?=%)' <<< "$VOL" | head -n 1)" -VOL="$((VOL - VOL % "$1"))" +if [ "$1" == 'm' ]; then + wpctl set-mute "$SINK" toggle +else + VOL="$((10#$(wpctl get-volume "$SINK" | tr -dc '[0-9]')))" + [ -n "$1" ] && VOL="$((VOL - VOL % $1))" -case "${1:0:1}" in - '') - exit 1 - ;; - '+'|'-') - VOL="$((VOL + "$1"))" - ;; - *) - VOL="$1" - ;; -esac + case "${1:0:1}" in + '') + echo "$VOL" + exit + ;; + '+'|'-') + VOL="$((VOL + $1))" + ;; + *) + VOL="$1" + ;; + esac -[ "$VOL" -lt 0 ] && VOL=0 -[ "$VOL" -gt 100 ] && VOL=100 + [ "$VOL" -lt 0 ] && VOL=0 + [ "$VOL" -gt 100 ] && VOL=100 -pactl set-sink-volume "$SINK" "$VOL%" -pactl set-sink-mute "$SINK" 0 + wpctl set-volume "$SINK" "$VOL%" + wpctl set-mute "$SINK" 0 +fi + +# update sbar +kill -34 "$(cat "$HOME/.cache/pidofbar")" if [ -t 1 ]; then echo "$VOL"