Update 2023-11-05 12:22 OpenBSD/amd64-x13

This commit is contained in:
c0dev0id
2023-11-05 12:22:05 +01:00
parent cd7fa30038
commit 356d7e8bc3
14 changed files with 742 additions and 12 deletions

45
.config/bspwm/bspwmrc Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
#export MIXERDEVICE=/dev/audioctl0
pgrep -q polybar || polybar &
# start hotkey daemon
pgrep -q sxhkd || sxhkd -c $HOME/.config/bspwm/sxhkdrc &
# configure bspwm
bspc monitor -d 1 2 3 4 5 6 7 8 9 10
bspc config border_width 1
bspc config window_gap 12
remove_disabled_monitors true
remove_unplugged_monitors true
bspc config split_ratio 0.52
bspc config focus_follows_pointer true
bspc config borderless_monocle false
bspc config gapless_monocle true
bspc config focused_border_color "#FF6A00"
bspc config presel_feedback_color "#FF6A00"
bspc config presel_feedback false
# automatic tiling
bspc config automatic_scheme longest_side
bspc config honor_size_hints false
# mouse can resize/move floating nodes
bspc config pointer_modifier mod1
bspc config pointer_action1 move
bspc config pointer_action2 resize_corner
RES=$(xrandr | grep "*+" | awk '{print $1}')
GAP=150
H=$(( ${RES%x*} - 2 * GAP ))
V=$(( ${RES#*x} - 2 * GAP ))
bspc rule -a mpv sticky=on state=floating rectangle=$GAP,$GAP,$H,$V
bspc rule -a Screenkey manage=off
bspc rule -a scratchpad sticky=on state=floating rectangle=$GAP,$GAP,$H,$V

253
.config/bspwm/lemonbar.sh Executable file
View File

@@ -0,0 +1,253 @@
#!/bin/ksh
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
FONT="-zevv-peep-medium-r-normal--14-130-75-75-c-70-iso8859-15"
DEFAULT_FG="#222222"
DEFAULT_BG="#CCCCCC"
MONITOR_FG="#8dbcdf"
MONITOR_BG="#333232"
FOCUSED_MONITOR_FG="#b1d0e8"
FOCUSED_MONITOR_BG="#144b6c"
FREE_FG="#737171"
FREE_BG="#333232"
FOCUSED_FREE_FG="#000000"
FOCUSED_FREE_BG="#504e4e"
OCCUPIED_FG="#a7a5a5"
OCCUPIED_BG="#333232"
FOCUSED_OCCUPIED_FG="#d6d3d2"
FOCUSED_OCCUPIED_BG="#504e4e"
URGENT_FG="#f15d66"
URGENT_BG="#333232"
FOCUSED_URGENT_FG="#501d1f"
FOCUSED_URGENT_BG="#d5443e"
STATE_FG="#89b09c"
STATE_BG="#333232"
TITLE_FG="#a8a2c0"
TITLE_BG="#333232"
SYS_FG="#b1a57d"
SYS_BG="#333232"
BG="%{F#CCCCCC}"
FG="%{F#222222}"
CLEAR="%{F-}%{B-}"
_battery() {
ADAPTER=$(apm -a)
if [ $ADAPTER = 0 ] ; then
printf ">"
elif [ $ADAPTER = 1 ] ; then
printf "="
else
printf "?"
fi
BATTERY=$(apm -l)
if [ $BATTERY -gt 66 ] ; then
printf "$BATTERY%%"
elif [ $BATTERY -gt 33 ] ; then
printf "$BATTERY%%"
else
printf "$BATTERY%%"
fi
BATTERY=$(apm -m)
[[ "$BATTERY" != "unknown" ]] && printf " ($BATTERY m)"
}
_cputemp() {
printf "$(sysctl -n hw.sensors.cpu0.temp0 | cut -d"." -f1)°C"
}
_netload() {
set -A if_load $(ifstat -n -i trunk0 -b 0.1 1 | sed '1,2d')
printf "In: ${if_load[0]} kb/s Out: ${if_load[1]} kb/s "
}
_backlight() {
LIGHT=$(xbacklight | cut -d"." -f1)
printf "$LIGHT%%"
}
_volume() {
MUTE=$(mixerctl outputs.master.mute | awk -F '=' '{ print $2 }')
#LSPK=$(($(mixerctl outputs.master | awk -F '(=|,)' '{ print $2 }')*100/255))
RSPK=$(($(mixerctl outputs.master | awk -F '(=|,)' '{ print $2 }')*100/255))
if [ "$MUTE" = "on" ] ; then
printf "muted"
else
printf "$RSPK%%"
fi
}
_wlan() {
WLANSTAT=$(ifconfig iwn0 | awk '/status:/ { print $2 }')
WLANID=$(ifconfig iwn0 | awk '/(nwid|join)/ { print $3 }')
if [ "$WLANSTAT" = "active" ] ; then
printf '%s' "$WLANID"
else
printf '%s' "no-wifi"
fi
}
_datetime() {
printf '%s' "$(date +"%Y-%m-%d %H:%M")"
}
num_mon=$(bspc query -M | wc -l)
# INITIAL SETUP
cputemp=$(_cputemp)
battery=$(_battery)
date=$(_datetime)
backlight=$(_backlight)
volume=$(_volume)
wlan=$(_wlan)
netload=$(_netload)
datetime=$(_datetime)
mkfifo /tmp/panel-fifo
bspc subscribe report > /tmp/panel-fifo &
# TICK COUNTER FOR AUTOMATIC UPDATES
while true;
do
TICK=$(($TICK + 1))
case $TICK in
1)
printf '%s\n' "UBAT" > "$PANEL_FIFO"
printf '%s\n' "UBL" > "$PANEL_FIFO"
printf '%s\n' "UNETLOAD" > "$PANEL_FIFO"
;;
2)
printf '%s\n' "UCPU" > "$PANEL_FIFO"
;;
5)
printf '%s\n' "UWLAN" > "$PANEL_FIFO"
;;
10)
printf '%s\n' "UDATE" > "$PANEL_FIFO"
TICK=0
;;
esac
sleep 5
done &
# READ FIFO EVENTS
while read -r line;
do
case $line in
UVOL)
volume=$(_volume) ;;
UDATE)
datetime=$(_datetime) ;;
UBAT)
battery=$(_battery) ;;
UBL)
backlight=$(_backlight) ;;
UCPU)
cputemp=$(_cputemp) ;;
UWLAN)
wlan=$(_wlan) ;;
UNETLOAD)
netload=$(_netload) ;;
S*)
sys=${line#?}
;;
W*)
# BSPWM STATE
wm=
IFS=':'
set -- ${line#?}
while [ $# -gt 0 ] ; do
item=$1
name=${item#?}
case $item in
[mM]*)
case $item in
m*)
# monitor
FG=$MONITOR_FG
BG=$MONITOR_BG
on_focused_monitor=
;;
M*)
# focused monitor
FG=$FOCUSED_MONITOR_FG
BG=$FOCUSED_MONITOR_BG
on_focused_monitor=1
;;
esac
[ $num_mon -lt 2 ] && shift && continue
wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc monitor -f ${name}:} ${name} %{A}%{B-}%{F-}"
;;
[fFoOuU]*)
case $item in
f*)
# free desktop
FG=$FREE_FG
BG=$FREE_BG
UL=$BG
;;
F*)
if [ "$on_focused_monitor" ] ; then
# focused free desktop
FG=$FOCUSED_FREE_FG
BG=$FOCUSED_FREE_BG
UL=$BG
else
# active free desktop
FG=$FREE_FG
BG=$FREE_BG
UL=$FOCUSED_FREE_BG
fi
;;
o*)
# occupied desktop
FG=$OCCUPIED_FG
BG=$OCCUPIED_BG
UL=$BG
;;
O*)
if [ "$on_focused_monitor" ] ; then
# focused occupied desktop
FG=$FOCUSED_OCCUPIED_FG
BG=$FOCUSED_OCCUPIED_BG
UL=$BG
else
# active occupied desktop
FG=$OCCUPIED_FG
BG=$OCCUPIED_BG
UL=$FOCUSED_OCCUPIED_BG
fi
;;
u*)
# urgent desktop
FG=$URGENT_FG
BG=$URGENT_BG
UL=$BG
;;
U*)
if [ "$on_focused_monitor" ] ; then
# focused urgent desktop
FG=$FOCUSED_URGENT_FG
BG=$FOCUSED_URGENT_BG
UL=$BG
else
# active urgent desktop
FG=$URGENT_FG
BG=$URGENT_BG
UL=$FOCUSED_URGENT_BG
fi
;;
esac
wm="${wm}%{F${FG}}%{B${BG}}%{U${UL}}%{+u}%{A:bspc desktop -f ${name}:} ${name} %{A}%{B-}%{F-}%{-u}"
;;
[LTG]*)
# layout, state and flags
wm="${wm}%{F$STATE_FG}%{B$STATE_BG} ${name} %{B-}%{F-}"
esac
shift
done
;;
esac
printf "%s\n" "%{l}${wm}%{c}%{r}$cputemp $backlight $volume $wlan $netload $battery $datetime "
done < "$PANEL_FIFO" | lemonbar -f "$FONT" -B "$DEFAULT_FG" -F "$DEFAULT_BG" -u 8 | sh

18
.config/bspwm/pidgin.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/ksh -x
ID=$(xdotool search --name "Buddy List")
if [ "$ID" == "" ]; then
pidgin &
else
for pid in $ID;
do
bspc node "$pid" --flag hidden --layer above -f
done
fi
#_pad=$(bspc config -m LVDS1 right_padding)
#if [ $_pad -gt 0 ]; then
# bspc config -m LVDS1 right_padding 0
#else
# bspc config -m LVDS1 right_padding 322
#fi

7
.config/bspwm/scratchpad.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/ksh
ID=$(xdotool search --class scratchpad)
if [ -e $ID ]; then
sterm -c scratchpad &
else
bspc node "$ID" --flag hidden -f
fi

175
.config/bspwm/sxhkdrc Normal file
View File

@@ -0,0 +1,175 @@
#
# wm independent hotkeys
#
# terminal emulator
alt + Return
sterm
alt + shift + Return
bterm
alt + control + Return
hterm
alt + b
$HOME/.config/bspwm/pidgin.sh
# program launcher
alt + d
dexec
alt + s
dexec_ssh
alt + shift + f
dexec_browser
alt + shift + p
dexec_pass
alt + a
dexec_apps
alt + p
dexec_pim
#
# bspwm hotkeys
#
#XF86AudioRaiseVolume
# pkill -sigusr1 bspwmbar
#
#XF86AudioLowerVolume
# printf '%s\n' "UVOL" > "$PANEL_FIFO"
#
#XF86AudioMute
# printf '%s\n' "UVOL" > "$PANEL_FIFO"
# quit/restart bspwm
alt + shift + r
bspc wm -r
pkill -SIGUSR1 polybar
pkill -SIGUSR1 sxhkd
# close and kill
alt + q
bspc node -c
alt + shift + q
bspc node -c
# alternate between the tiled and monocle layout
alt + f
bspc node -t "~"{fullscreen,tiled}
# send the newest marked node to the newest preselected node
alt + y
bspc node newest.marked.local -n newest.!automatic.local
# swap the current node and the biggest node
alt + g
bspc node -s biggest
alt + space
bspc node -t "~"{floating,tiled}
Print
xpick_copy
alt + Print
sshot
#
# state/flags
#
# set the window state
#alt + {t,shift + t,s,f}
# bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
# set the node flags
#alt + ctrl + {m,x,y,z}
# bspc node -g {marked,locked,sticky,private}
#
# focus/swap
#
# focus the node in the given direction
alt + {_,shift + }{h,j,k,l}
bspc node -{f,s} {west,south,north,east}
# focus the node in the given direction
alt + {_,shift + }{Left,Down,Up,Right}
bspc node -{f,s} {west,south,north,east}
# focus the node for the given path jump
alt + {p,b,comma,period}
bspc node -f @{parent,brother,first,second}
# focus the next/previous node in the current desktop
#alt + {o,i}
ctrl + {Prior,Next}
bspc node -f {next,prev}.local
# focus the next/previous desktop in the current monitor
alt + {Prior,Next}
bspc desktop -f {prev,next}.local
# focus the last node/desktop
alt + {grave,Tab}
bspc {node,desktop} -f last
# focus the older or newer node in the focus history
alt + {_,shift + }c
bspc wm -h off; \
bspc node {older,newer} -f; \
bspc wm -h on
# focus or send to the given desktop
alt + {_,shift + }{1-9,0}
bspc {desktop -f,node -d} '^{1-9,10}'
ctrl + alt + shift + {1-9,0}
bspc desktop -f '^{1-9,10}'
#
# preselect
#
# preselect the direction
alt + ctrl + {h,j,k,l}
bspc node -p {west,south,north,east}
alt + ctrl + {Left,Down,Up,Right}
bspc node -p {west,south,north,east}
# preselect the ratio
alt + ctrl + {1-9}
bspc node -o 0.{1-9}
# cancel the preselection for the focused node
alt + ctrl + space
bspc node -p cancel
# cancel the preselection for the focused desktop
alt + ctrl + shift + space
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
#
# move/resize
#
# expand a window by moving one of its side outward
#shift + alt + {h,j,k,l}
# bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
# contract a window by moving one of its side inward
#shift + alt + shift + {h,j,k,l}
# bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
## move a floating window
#alt + {Left,Down,Up,Right}
# bspc node -v {-20 0,0 20,0 -20,20 0}

4
.config/bspwm/updatebar.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
if [ ! -z "$PANEL_FIFO" ]; then
printf '%s\n' "$1" > "$PANEL_FIFO"
fi