add bspwm config and use as default WM

This commit is contained in:
Łukasz Pankowski 2020-07-12 00:46:31 +02:00
parent 17bd71ac37
commit 25a350d962
4 changed files with 217 additions and 1 deletions

21
.config/bspwm/bspwmrc Executable file
View File

@ -0,0 +1,21 @@
#! /bin/sh
sxhkd &
~/.config/bspwm/panel &
xdo lower $(xdo id -a panel)
bspc monitor -d 1 2 3 4 5 6 7 8 9 0
bspc config border_width 2
bspc config window_gap 12
bspc config normal_border_color '#808080'
bspc config focused_border_color '#3585ce'
bspc config presel_feedback_color '#3585ce'
bspc config split_ratio 0.50
bspc config single_monocle true
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc rule -a Gimp desktop='^8' state=floating follow=on

64
.config/bspwm/panel Executable file
View File

@ -0,0 +1,64 @@
#!/bin/sh
BAR_BG='#1a343a'
BAR_FG='#e2f6e1'
ACTIVE_BG='#3585ce'
URGENT_BG='#ff0000'
FREE_FG='#808080'
PANEL_FIFO=~/.panel-fifo
[ -e "$PANEL_FIFO" ] && rm -f "$PANEL_FIFO"
mkfifo "$PANEL_FIFO"
bspc subscribe > "$PANEL_FIFO" &
xtitle -sf 'T%s\n' > "$PANEL_FIFO" &
while true; do
echo "C$(date '+%H:%M')"
sleep 1
done > "$PANEL_FIFO" &
while read -r line ; do
case "$line" in
C*)
clock="${line#?}"
;;
T*)
title="${line#?}"
;;
W*)
wm=
IFS=':' set -- ${line#?}
while [ $# -gt 0 ]; do
item="$1"
name="${item#?}"
case "$item" in
[fFOoUu]*)
case "$item" in
[OF]*)
BG="${ACTIVE_BG}"
FG="-"
;;
o*)
BG="-"
FG="-"
;;
f*)
BG="-"
FG="${FREE_FG}"
;;
[uU]*)
BG="${URGENT_BG}"
FG="-"
;;
esac
wm="${wm}%{B${BG}}%{F${FG}}%{A:bspc desktop -f ${name}:} ${name} %{A}%{B-}%{F-}"
esac
shift
done
;;
esac
printf "%s\n" " ${wm} ${title}%{r}${clock} "
done < "$PANEL_FIFO" | lemonbar -B "${BAR_BG}" -F "${BAR_FG}" -n panel -f Iosevka:pixelsize=30:antialias=true:autohint=true | sh

130
.config/sxhkd/sxhkdrc Normal file
View File

@ -0,0 +1,130 @@
#
# wm independent hotkeys
#
# terminal emulator
super + shift + Return
alacritty
# program launcher
super + p
dmenu_run -nb '#1a343a' -nf '#a0a0a0' -sb '#3585ce' -sf '#e0e0e0' -fn Iosevka:pixelsize=30
# make sxhkd reload its configuration files:
super + Escape
pkill -USR1 -x sxhkd
super + e
emacsclient -n -c
super + ctrl + p
bspc node -f $(xtitle -f '%u %s\n' $(bspc query -N -n .window) | dmenu -i -l 20 -nb '#1a343a' -nf '#a0a0a0' -sb '#3585ce' -sf '#e0e0e0' -fn Iosevka:pixelsize=30 | cut -f 1 -d ' ')
super + semicolon
echo -e 'slock\nsystemctl suspend\nsystemctl hibernate\n' | dmenu -l 20 -nb '#1a343a' -nf '#a0a0a0' -sb '#3585ce' -sf '#e0e0e0' -fn Iosevka:pixelsize=30 | sh
#
# bspwm hotkeys
#
# quit/restart bspwm
super + alt + {q,r}
bspc {quit,wm -r}
# close and kill
super + {_,shift + }w
bspc node -{c,k}
# alternate between the tiled and monocle layout
super + m
bspc desktop -l next
# send the newest marked node to the newest preselected node
super + y
bspc node newest.marked.local -n newest.!automatic.local
# swap the current node and the biggest node
super + g
bspc node -s biggest
#
# state/flags
#
# set the window state
super + {t,shift + t,s,f}
bspc node -t {tiled,pseudo_tiled,floating,'~fullscreen'}
# set the node flags
super + ctrl + {m,x,y,z}
bspc node -g {marked,locked,sticky,private}
#
# focus/swap
#
# focus the node in the given direction
super + {_,shift + }{h,j,k,l}
bspc node -{f,s} {west,south,north,east}
# focus the node for the given path jump
super + {shift + p,b,comma,period}
bspc node -f @{parent,brother,first,second}
# focus the next/previous node in the current desktop
super + {_,shift + }c
bspc node -f {next,prev}.local
# focus the next/previous desktop in the current monitor
super + bracket{left,right}
bspc desktop -f {prev,next}.local
# focus the last node/desktop
super + {grave,Tab}
bspc {node,desktop} -f last
# focus the older or newer node in the focus history
super + {o,i}
bspc wm -h off; \
bspc node {older,newer} -f; \
bspc wm -h on
# focus or send to the given desktop
super + {_,shift + }{1-9,0}
bspc {desktop -f,node -d} '^{1-9,10}'
#
# preselect
#
# preselect the direction
super + ctrl + {h,j,k,l}
bspc node -p {west,south,north,east}
# preselect the ratio
super + ctrl + {1-9}
bspc node -o 0.{1-9}
# cancel the preselection for the focused node
super + ctrl + space
bspc node -p cancel
# cancel the preselection for the focused desktop
super + 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
super + 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
super + 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
super + {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}

View File

@ -6,7 +6,7 @@ fi
xrandr --auto xrandr --auto
xrandr --output HDMI1 --right-of DP1 xrandr --output HDMI1 --right-of DP1
xsetroot -solid '#424242' xsetroot -solid '#224242'
xrdb -merge ~/.Xresources xrdb -merge ~/.Xresources
setxkbmap pl -option ctrl:nocaps setxkbmap pl -option ctrl:nocaps
@ -20,6 +20,7 @@ fi
# run emacs daemon if not running # run emacs daemon if not running
emacsclient --eval nil -a '' & emacsclient --eval nil -a '' &
exec /usr/bin/bspwm
exec /usr/bin/i3 exec /usr/bin/i3
dwm-clock & dwm-clock &
exec /usr/local/bin/dwm exec /usr/local/bin/dwm