summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-18 16:34:43 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-18 16:34:43 +0200
commit679e08d63883028c5b620d890084ee4362b081a1 (patch)
tree3591fcf6e97e05b7c35257c2d29935084b83b9b8
parentRemoved some scripts (diff)
downloaddotfiles-bsd-679e08d63883028c5b620d890084ee4362b081a1.tar.gz
dotfiles-bsd-679e08d63883028c5b620d890084ee4362b081a1.tar.bz2
dotfiles-bsd-679e08d63883028c5b620d890084ee4362b081a1.tar.xz
dotfiles-bsd-679e08d63883028c5b620d890084ee4362b081a1.tar.zst
dotfiles-bsd-679e08d63883028c5b620d890084ee4362b081a1.zip
Added bspwm and sxhkd
-rw-r--r--.config/bspwm/README.org195
-rwxr-xr-x.config/bspwm/bspwmrc138
-rw-r--r--.config/sxhkd/sxhkdrc175
3 files changed, 508 insertions, 0 deletions
diff --git a/.config/bspwm/README.org b/.config/bspwm/README.org
new file mode 100644
index 0000000..bfe55d9
--- /dev/null
+++ b/.config/bspwm/README.org
@@ -0,0 +1,195 @@
+#+TITLE: BSPWM config
+#+PROPERTY: header-args :tangle bspwmrc
+
+* Table of contents :toc:
+- [[#about][About]]
+- [[#the-shebang][The shebang]]
+- [[#restart-safety][Restart safety]]
+ - [[#no-rerun-function][No-rerun function]]
+ - [[#killing][Killing]]
+- [[#detecting-screens][Detecting screens]]
+- [[#basic-bspwm-configurations][Basic BSPWM configurations]]
+- [[#applications-workspaces-assignations][Applications workspaces assignations]]
+- [[#startup-applications][Startup applications]]
+ - [[#background-applications][Background applications]]
+ - [[#foreground-applications][Foreground applications]]
+ - [[#network-applications][Network applications]]
+
+* About
+ The following is my ~bspwm~ init script.
+
+* The shebang
+ For my ~bspwm~ init script, I am using the ~dash~ shell for it is very fast.
+ #+BEGIN_SRC shell
+#!/usr/local/bin/dash
+ #+END_SRC
+
+* Restart safety
+** No-rerun function
+ The following function helps me not restart a specific program in case it is already running,
+ avoiding creating a new instance everytime I restart ~bspwm~.
+ #+BEGIN_SRC shell
+run() {
+ if ! pgrep "$1";
+ then
+ "$@"
+ fi
+}
+ #+END_SRC
+
+** Killing
+ Now let's kill all terminal emulators and compton.
+ #+BEGIN_SRC shell
+pkill alacritty
+pkill compton
+ #+END_SRC
+
+* Detecting screens
+ This detects if more screens are attached to the terminal. The init script will act differently
+ depending on the number of screens linked.
+
+ #+BEGIN_SRC shell
+screens=1
+if xrandr | grep VGA1 | grep " connected"; then
+ screens=3
+ /usr/home/jozan/.local/bin/triplescreen
+elif xrandr | grep DP1 | grep " connected"; then
+ screens=2
+ /usr/home/jozan/.local/bin/dualscreen
+fi
+sleep 1
+if [ $screens -eq 1 ]; then
+ bspc monitor LVDS1 -d 01 02 03 04 05 06 07 08 09 10 11 12
+fi
+ #+END_SRC
+
+* Basic BSPWM configurations
+ #+BEGIN_SRC shell
+bspc config border_width 1
+bspc config window_gap 0
+
+bspc config focused_border_color \#b92121
+
+bspc config split_ratio 0.50
+bspc config borderless_monocle true
+bspc config gapless_monocle true
+bspc config single_monocle true
+ #+END_SRC
+
+* Applications workspaces assignations
+ #+BEGIN_SRC shell
+if [ $screens -eq 3 ]; then
+ bspc rule -a Emacs desktop=01 follow=true
+ bspc rule -a Firefox desktop=08 follow=true
+ bspc rule -a Wine desktop=07 state=floating
+elif [ $screens -eq 2 ]; then
+ bspc rule -a Emacs desktop=01 follow=true
+ bspc rule -a Firefox desktop=08 follow=true
+ bspc rule -a Wine desktop=07 state=floating
+elif [ $screens -eq 1 ]; then
+ bspc rule -a Emacs desktop=01 follow=true
+ bspc rule -a Firefox desktop=08 follow=true
+ bspc rule -a Wine desktop=04 state=floating
+fi
+bspc rule -a Dunst layer=above
+bspc rule -a Zathura state=tiled
+bspc rule -a qTox desktop=12
+bspc rule -a DergodsRealmII desktop=4 state=floating
+ #+END_SRC
+
+* Startup applications
+** Background applications
+ #+BEGIN_SRC shell
+run compton >/dev/null 2>&1 &
+if [ $screens -eq 3 ]; then
+ feh --bg-fill /usr/home/jozan/Pictures/wallpaper.jpg --bg-fill /usr/home/jozan/Pictures/wallpaper.jpg >/dev/null 2>&1
+elif [ $screens -eq 2 ]; then
+ feh --bg-fill /usr/home/jozan/Pictures/wallpaper.jpg --bg-fill /usr/home/jozan/Pictures/wallpaper.jpg >/dev/null 2>&1
+else
+ feh --bg-fill /usr/home/jozan/Pictures/wallpaper.jpg >/dev/null 2>&1
+fi
+xset r rate 200 100 >/dev/null 2>&1
+setxkbmap -layout us,fr -option grp:alt_shift_toggle
+run dunst > /dev/null 2>&1 &
+run lowbat --say "You're low, partner" >/dev/null 2>&1 &
+sleep 2
+ #+END_SRC
+
+** Foreground applications
+ #+BEGIN_SRC shell
+run emacs &
+sleep 12
+if [ $screens -eq 3 ]; then
+ bspc desktop -f 09
+ alacritty -e dash -c 'clear; cowsay "Welcome back, partner! And remember to try glest!"; zsh -i' &
+ sleep 1
+ alacritty -e htop &
+ sleep 1
+ alacritty -e gotop &
+ sleep 1
+ bspc node -f west
+ alacritty -e vifm &
+ sleep 1
+ bspc node -z right 180 0
+ bspc node -z top 0 70
+ bspc node -f east
+ bspc node -f north
+ bspc node -z bottom 0 -280
+ bspc node -f north
+ bspc node -f west
+elif [ $screens -eq 2 ]; then
+ bspc desktop -f 09
+ alacritty -e dash -c 'clear; cowsay "Welcome back, partner! And remember to try glest!"; zsh -i' &
+ sleep 1
+ alacritty -e htop &
+ sleep 1
+ alacritty -e gotop &
+ sleep 1
+ bspc node -f west
+ alacritty -e vifm &
+ sleep 1
+ bspc node -z right 180 0
+ bspc node -z top 0 70
+ bspc node -f east
+ bspc node -f north
+ bspc node -z bottom 0 -280
+ bspc node -f north
+ bspc node -f west
+elif [ $screens -eq 1 ]; then
+ bspc desktop -f 09
+ alacritty -e dash -c 'clear; cowsay "Welcome back, partner!"; zsh -i' &
+ sleep 1
+ bspc node -p west
+ alacritty -e htop &
+ sleep 1
+ alacritty -e gotop &
+ sleep 1
+ bspc node -f east
+ alacritty -e vifm &
+ sleep 1
+ bspc node -f west
+ bspc node -f north
+ bspc node -z bottom 0 -280
+ bspc node -z right -220 0
+ bspc node -f east
+ bspc node -z top 0 70
+ bspc node -f north
+fi
+sleep 1
+ #+END_SRC
+
+** Network applications
+ In case the terminal is linked to the Internet, the following commands are run.
+ #+BEGIN_SRC shell
+if curl https://www.freebsd.org/ >/dev/null 2>&1; then
+ git -C ~/.elfeed pull origin master >/dev/null 2>&1 &
+ run qtox &
+ if [ $screens -eq 3 ]; then
+ bspc desktop -f 09
+ elif [ $screens -eq 2 ]; then
+ bspc desktop -f 09
+ elif [ $screens -eq 1 ]; then
+ bspc desktop -f 09
+ fi
+fi
+ #+END_SRC
diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc
new file mode 100755
index 0000000..3566e84
--- /dev/null
+++ b/.config/bspwm/bspwmrc
@@ -0,0 +1,138 @@
+#!/usr/local/bin/dash
+
+run() {
+ if ! pgrep "$1";
+ then
+ "$@"
+ fi
+}
+
+pkill alacritty
+pkill compton
+
+screens=1
+if xrandr | grep VGA1 | grep " connected"; then
+ screens=3
+ /usr/home/jozan/.local/bin/triplescreen
+elif xrandr | grep DP1 | grep " connected"; then
+ screens=2
+ /usr/home/jozan/.local/bin/dualscreen
+fi
+sleep 1
+if [ $screens -eq 1 ]; then
+ bspc monitor LVDS1 -d 01 02 03 04 05 06 07 08 09 10 11 12
+fi
+
+bspc config border_width 1
+bspc config window_gap 0
+
+bspc config focused_border_color \#b92121
+
+bspc config split_ratio 0.50
+bspc config borderless_monocle true
+bspc config gapless_monocle true
+bspc config single_monocle true
+
+if [ $screens -eq 3 ]; then
+ bspc rule -a Emacs desktop=01 follow=true
+ bspc rule -a Firefox desktop=08 follow=true
+ bspc rule -a Wine desktop=07 state=floating
+elif [ $screens -eq 2 ]; then
+ bspc rule -a Emacs desktop=01 follow=true
+ bspc rule -a Firefox desktop=08 follow=true
+ bspc rule -a Wine desktop=07 state=floating
+elif [ $screens -eq 1 ]; then
+ bspc rule -a Emacs desktop=01 follow=true
+ bspc rule -a Firefox desktop=08 follow=true
+ bspc rule -a Wine desktop=04 state=floating
+fi
+bspc rule -a Dunst layer=above
+bspc rule -a Zathura state=tiled
+bspc rule -a qTox desktop=12
+bspc rule -a DergodsRealmII desktop=4 state=floating
+
+run compton >/dev/null 2>&1 &
+if [ $screens -eq 3 ]; then
+ feh --bg-fill /usr/home/jozan/Pictures/wallpaper.jpg --bg-fill /usr/home/jozan/Pictures/wallpaper.jpg >/dev/null 2>&1
+elif [ $screens -eq 2 ]; then
+ feh --bg-fill /usr/home/jozan/Pictures/wallpaper.jpg --bg-fill /usr/home/jozan/Pictures/wallpaper.jpg >/dev/null 2>&1
+else
+ feh --bg-fill /usr/home/jozan/Pictures/wallpaper.jpg >/dev/null 2>&1
+fi
+xset r rate 200 100 >/dev/null 2>&1
+setxkbmap -layout us,fr -option grp:alt_shift_toggle
+run dunst > /dev/null 2>&1 &
+run lowbat --say "You're low, partner" >/dev/null 2>&1 &
+sleep 2
+
+run emacs &
+sleep 12
+if [ $screens -eq 3 ]; then
+ bspc desktop -f 09
+ alacritty -e dash -c 'clear; cowsay "Welcome back, partner! And remember to try glest!"; zsh -i' &
+ sleep 1
+ alacritty -e htop &
+ sleep 1
+ alacritty -e gotop &
+ sleep 1
+ bspc node -f west
+ alacritty -e vifm &
+ sleep 1
+ bspc node -z right 180 0
+ bspc node -z top 0 70
+ bspc node -f east
+ bspc node -f north
+ bspc node -z bottom 0 -280
+ bspc node -f north
+ bspc node -f west
+elif [ $screens -eq 2 ]; then
+ bspc desktop -f 09
+ alacritty -e dash -c 'clear; cowsay "Welcome back, partner! And remember to try glest!"; zsh -i' &
+ sleep 1
+ alacritty -e htop &
+ sleep 1
+ alacritty -e gotop &
+ sleep 1
+ bspc node -f west
+ alacritty -e vifm &
+ sleep 1
+ bspc node -z right 180 0
+ bspc node -z top 0 70
+ bspc node -f east
+ bspc node -f north
+ bspc node -z bottom 0 -280
+ bspc node -f north
+ bspc node -f west
+elif [ $screens -eq 1 ]; then
+ bspc desktop -f 09
+ alacritty -e dash -c 'clear; cowsay "Welcome back, partner!"; zsh -i' &
+ sleep 1
+ bspc node -p west
+ alacritty -e htop &
+ sleep 1
+ alacritty -e gotop &
+ sleep 1
+ bspc node -f east
+ alacritty -e vifm &
+ sleep 1
+ bspc node -f west
+ bspc node -f north
+ bspc node -z bottom 0 -280
+ bspc node -z right -220 0
+ bspc node -f east
+ bspc node -z top 0 70
+ bspc node -f north
+fi
+sleep 1
+
+if curl https://www.freebsd.org/ >/dev/null 2>&1; then
+ git -C ~/.elfeed pull origin master >/dev/null 2>&1 &
+ run qtox &
+ if [ $screens -eq 3 ]; then
+ bspc desktop -f 09
+ elif [ $screens -eq 2 ]; then
+ bspc desktop -f 09
+ elif [ $screens -eq 1 ]; then
+ bspc desktop -f 09
+ fi
+fi
diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
new file mode 100644
index 0000000..1465f10
--- /dev/null
+++ b/.config/sxhkd/sxhkdrc
@@ -0,0 +1,175 @@
+#
+# wm independent hotkeys
+#
+
+# terminal emulator
+super + Return
+ alacritty
+
+# program launcher
+super + p
+ dmenu_run -c -l 5 -m 0 -fn "UbuntuMono:size=13" -nb "#222222" -nf "#bbbbbb" -sb "#b92121" -sf "#eeeeee"
+
+# make sxhkd reload its configuration files:
+super + control + r
+ pkill -USR1 -x sxhkd
+
+#
+# bspwm hotkeys
+#
+
+# quit/restart bspwm
+super + shift + {e,r}
+ bspc {quit,wm -r}
+
+# close and kill
+super + {_,shift + }q
+ 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 + {s,shift + t,space,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 + { ,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
+alt + {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 + }{F1}
+ bspc {desktop -f,node -d} 01
+super + {_,shift + }{F2}
+ bspc {desktop -f,node -d} 02
+super + {_,shift + }{F3}
+ bspc {desktop -f,node -d} 03
+super + {_,shift + }{F4}
+ bspc {desktop -f,node -d} 04
+super + {_,shift + }{F5}
+ bspc {desktop -f,node -d} 05
+super + {_,shift + }{F6}
+ bspc {desktop -f,node -d} 06
+super + {_,shift + }{F7}
+ bspc {desktop -f,node -d} 07
+super + {_,shift + }{F8}
+ bspc {desktop -f,node -d} 08
+super + {_,shift + }{F9}
+ bspc {desktop -f,node -d} 09
+super + {_,shift + }{F10}
+ bspc {desktop -f,node -d} 10
+super + {_,shift + }{F11}
+ bspc {desktop -f,node -d} 11
+super + {_,shift + }{F12}
+ bspc {desktop -f,node -d} 12
+#
+# 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,Escape}
+ 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
+ctrl + alt + {Left,Down,Up,Right}
+ 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 + ctrl + {Left,Down,Up,Right}
+ 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}
+
+#
+# some quick start apps
+#
+super + 1
+ st -e vifm
+super + 2
+ st
+super + 3
+ firefox --kiosk https://start.duckduckgo.com/
+super + 4
+ st -e w3m https://start.duckduckgo.com/
+
+#
+# XF86Keys
+#
+{XF86AudioRaiseVolume}
+ /home/jozan/.local/bin/mixer-set raise >/dev/null 2>&1
+
+{XF86AudioLowerVolume}
+ /home/jozan/.local/bin/mixer-set lower >/dev/null 2>&1
+
+{XF86AudioMute}
+ /home/jozan/.local/bin/mixer-set toggle >/dev/null 2>&1
+
+{XF86MonBrightnessUp}
+ xbacklight -inc 4
+
+{XF86MonBrightnessDown}
+ xbacklight -dec 4
+
+{XF86Sleep}
+ /home/jozan/.local/bin/gotosleep