sbar changed and rm sxhkd

This commit is contained in:
krolyxon 2022-09-11 14:01:32 +05:30
parent 87bf632f55
commit 3df92328cd
6 changed files with 41 additions and 45 deletions

View File

@ -33,7 +33,7 @@ RemoveMake
# #
# Binary OPTIONS # Binary OPTIONS
# #
#[bin] #$[bin]
FileManager = lf #FileManager = lf
#MFlags = --skippgpcheck #MFlags = --skippgpcheck
#Sudo = doas #Sudo = doas

View File

@ -1,35 +0,0 @@
#
# wm independent hotkeys
#
#emoji menu
# super + period
super + grave
unicode_emoji
# swap cap if stops working
super + c
xset r rate 300 50
# ncmpcpp
super + shift + n
$TERMINAL -e ncmpcpp
# Screenshot tool
Print
maimshot
# file explorer
super + shift + f
pcmanfm
# web browser
super + shift + b
firefox
# make sxhkd reload its configuration files:
super + Escape
pkill -USR1 -x sxhkd
# Volume
XF86Audio{RaiseVolume,LowerVolume,Mute}
pamixer -{i,d,t} 2; kill -34 $(cat ~/.cache/pidofbar)

View File

@ -1,13 +1,10 @@
#!/bin/sh #!/bin/sh
#setwall & #setwall &
xwallpaper --zoom ~/.local/share/wallpaper.jpg xwallpaper --zoom ~/.local/share/wallpaper.jpg &
xcompmgr & xcompmgr &
xset r rate 300 50 xset r rate 300 50
sbar & sbar &
dunst & dunst &
sxhkd &
# setxkbmap -option caps:swapescape
# exec dwm > /dev/null 2>&1 # exec dwm > /dev/null 2>&1
while type dwm > /dev/null ; do dwm && continue || break ; done while type dwm > /dev/null ; do dwm && continue || break ; done
$exec dwm

8
.local/bin/sb-mpdup Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
# This loop will update the mpd statusbar module whenever a command changes the
# music player's status. mpd must be running on X's start for this to work.
while : ; do
mpc idle >/dev/null && kill -44 $(cat ~/.cache/pidofbar) || break
done

19
.local/bin/sb-music Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
filter() { mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -;}
pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 &
case $BLOCK_BUTTON in
1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # right click, pause/unpause
2) mpc toggle | filter ;; # right click, pause/unpause
3) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing.
- ⏸ when paused.
- Left click opens ncmpcpp.
- Middle click pauses.
- Scroll changes track.";; # right click, pause/unpause
4) mpc prev | filter ;; # scroll up, previous
5) mpc next | filter ;; # scroll down, next
6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;;
*) mpc status | filter ;;
esac

View File

@ -17,6 +17,10 @@ update_time () {
time="$(date "+[  %a %d %b ] [  %I:%M %P ]")" time="$(date "+[  %a %d %b ] [  %I:%M %P ]")"
} }
update_music () {
music="[ $(sb-music) ] "
}
# update_bat () { # update_bat () {
# # you might need to change the path depending on your device # # you might need to change the path depending on your device
# read -r bat_status </sys/class/power_supply/BAT1/status # read -r bat_status </sys/class/power_supply/BAT1/status
@ -37,16 +41,17 @@ update_vol () {
# modules that don't update on their own need to be run at the start for getting their initial value # modules that don't update on their own need to be run at the start for getting their initial value
update_vol # update_vol
display () { display () {
#printf "%s\n" " $event [$weather] [$memory $cpu] [$bat] [$backlight] [$vol] $time " #printf "%s\n" " $event [$memory $cpu] [$bat] [$backlight] [$vol] $time "
xsetroot -name " [ $vol ] [ $memory $cpu ] $time " xsetroot -name "$music[ $vol ] [ $memory $cpu ] $time "
} }
# SIGNALLING # SIGNALLING
# trap "<function>;display" "RTMIN+n" # trap "<function>;display" "RTMIN+n"
trap "update_vol;display" "RTMIN" trap "update_vol;display" "RTMIN"
trap "update_music;display" "RTMIN+10"
# trap "update_bat;display" "RTMIN+2" # trap "update_bat;display" "RTMIN+2"
# to update it from external commands # to update it from external commands
## kill -m "$(cat ~/.cache/pidofbar)" ## kill -m "$(cat ~/.cache/pidofbar)"
@ -58,8 +63,10 @@ do
# to update item ever n seconds with a offset of m # to update item ever n seconds with a offset of m
## [ $((sec % n)) -eq m ] && udpate_item ## [ $((sec % n)) -eq m ] && udpate_item
[ $((sec % 5 )) -eq 0 ] && update_time # update time every 5 seconds [ $((sec % 5 )) -eq 0 ] && update_time # update time every 5 seconds
[ $((sec % 5 )) -eq 0 ] && update_vol # update vol every 5 seconds
[ $((sec % 5 )) -eq 0 ] && update_music # update music every 5 seconds
[ $((sec % 5)) -eq 0 ] && update_cpu # update cpu every 15 seconds [ $((sec % 5)) -eq 0 ] && update_cpu # update cpu every 15 seconds
[ $((sec % 15)) -eq 0 ] && update_memory [ $((sec % 5)) -eq 0 ] && update_memory
# [ $((sec % 60)) -eq 0 ] && update_bat # [ $((sec % 60)) -eq 0 ] && update_bat
#[ $((sec % 300)) -eq 1 ] && update_event #[ $((sec % 300)) -eq 1 ] && update_event