Skip to content

Instantly share code, notes, and snippets.

@panther03
Created February 19, 2019 04:51
Show Gist options
  • Save panther03/c16eb74e43ce048a83844c47744908f2 to your computer and use it in GitHub Desktop.
Save panther03/c16eb74e43ce048a83844c47744908f2 to your computer and use it in GitHub Desktop.
its both lol woah
#!/bin/sh
w1=1
w2=2
w3=3
w4=4
w5=5
w6=1
w7=7
w8=8
w9=9
# Set environment
export BSPWM_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/bspwm"
export MONITOR=LVDS-1
bspc config border_width 5
bspc config window_gap 8
bspc config top_padding 0
bspc config split_ratio 0.50
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config focus_follows_pointer false
bspc config history_aware_focus true
bspc monitor --reset-desktops term www edit util chat mult play admn ext
# Launch keybinding daemon
sxhkd &
# Use monocle layout on desktop 1
bspc desktop '^2' --layout monocle
# Make windows float on specific desktops
# https://github.com/baskerville/bspwm/issues/325
bspc subscribe node_manage | while read event monitor desktop nodeid ipid; do
case "$desktop" in
www|play|6|play|7|9)
bspc node "$nodeid" --state floating
;;
esac
done &
# Script for external rules
bspc config external_rules_command "$BSPWM_CONFIG/scripts/external_rules"
# Send to www desktop
bspc rule --add Firefox desktop='www' follow=on
bspc rule --add Iceweasel desktop='www' follow=on
# Send to dev desktop
#bspc rule --add Atom desktop='dev' follow=on
#bspc rule --add Brackets desktop='dev' follow=on
#bspc rule --add Eclipse desktop='dev' follow=on
#bspc rule --add LightTable desktop='dev' follow=on
#bspc rule --add Ltbin desktop='dev' follow=on
#bspc rule --add Gvim desktop='dev' follow=on
#bspc rule --add Mysql-workbench-bin desktop='dev' follow=on
#bspc rule --add sun-awt-X11-XFramePeer desktop='dev' follow=on
bspc rule --add Emacs desktop='edit' follow=on
# Send to chat desktop
bspc rule --add gomuks desktop='chat' --one-shot follow=on
# Send to play desktop
bspc rule --add mGBA desktop='play' follow=on
# Floating windows
bspc rule --add feh state=floating
bspc rule --add mpv state=floating
bspc rule --add Pavucontrol state=floating
bspc rule --add Pcmanfm state=floating
bspc rule --add Remmina state=floating
# source the colors.
. "${HOME}/.cache/wal/colors.sh"
# Set the border colors.
bspc config normal_border_color "$color1"
bspc config active_border_color "$color2"
bspc config focused_border_color "$color15"
# Use the line below if you are on bspwm >= 0.9.4
bspc config presel_feedback_color "$color1"
# Use the line below if you are on bspwm < 0.9.4
#bspc config presel_border_color "$color1"
# Set wallpaper and load pywal
wpg -s wallhaven-549900.jpg
wal -R
# Load Polybar
$HOME/.config/polybar/launch.sh
# Load session
#. "$BSPWM_CONFIG/restore.cfg"
#if [ -e "$BSPWM_STATE" ] ; then
# bspc wm --load-state "$BSPWM_STATE"
# bspc wm --adopt-orphans
# rm "$BSPWM_STATE"
#fi
# Play startup sound
paplay $HOME/theme_include/startup.wav
#
# bspwm hotkeys
#
# Exit bspwm
super + shift + e
bspc quit
# Close window
super + shift + q
bspc node --close
# Rotate desktop
super + {_,shift + }r
bspc node @/ --rotate {90,-90}
# Circulate the leaves of the tree
super + {_,shift + }c
bspc node @/ --circulate {backward,forward}
# Make split ratios equal
super + equal
bspc node @/ --equalize
# Make split ratios balanced
super + minus
bspc node @/ --balance
# Toogle tiling of window
super + space
bspc query --nodes -n focused.tiled && state=floating || state=tiled; \
bspc node --state \~$state
# Toogle pseudo tiling of window
super + p
bspc node --state \~pseudo_tiled
# Toggle fullscreen of window
super + f
bspc node --state \~fullscreen
# Focus last window/desktop
alt + {grave, asciitilde}
bspc node --{focus, swap} last
super + grave
bspc desktop --focus last.local
# Focus next/previous window
alt + {shift,_} + Tab
bspc node --focus {prev,next}
# Focus next/previous desktop
super + {shift,_} + Tab
bspc desktop --focus {prev,next}.occupied
# Navigate to older/newer window in history
#super + {o,n}
# bspc wm --record-history off; \
# bspc node --focus {older,newer}; \
# bspc wm --record-history on
# Focus/move window to the biggest space
#super + {_,shift + }m
# bspc node --{focus,swap} biggest
# Focus/swap windows by direction
super + {_,shift + }{Left, Down, Up, Right}
bspc node --{focus,swap} {west,south,north,east}
# Move window to last split
# super + y
# bspc query --nodes -n focused.automatic \
# && bspc node -n last.\!automatic \
# || bspc node last.leaf -n focused
# Flip layout vertically/horizontally
#super + {_,shift + }s
# bspc node @/ --flip {vertical,horizontal}
# Focus parent/brother/first/second for preselection
super + ctrl + {p,b,comma,period}
bspc node --focus @{parent,brother,first,second}
# Preselect the splitting area for next window on leaf/parent
super + ctrl + {Left,Down,Up,Right}
bspc node --presel-dir \~{west,south,north,east}
# Define splitting ratio for next window on leaf/parent
super + ctrl + {_,shift +}{1-9}
bspc node {_,@/} --presel-ratio 0.{1-9}
# Cancel preselection
super + ctrl + space
bspc node --presel-dir cancel
# Expand tiled space
super + alt + {Left,Down,Up,Right}
bspc node {@west -r -10,@south -r +10,@north -r -10,@east -r +10}
# Contract tiled space
super + alt + shift + {Left,Down,Up,Right}
bspc node {@east -r -10,@north -r +10,@south -r -10,@west -r +10}
# Move window to selected desktop
super + shift + {1-9,0}
bspc node --to-desktop ^{1-9,10} --focus
# Move window to left/right desktop
super + shift + {Left,Right}
bspc node --to-desktop {prev,next} --focus
# Move window to left/right desktop
ctrl + alt + shift + {Left,Right}
bspc node --to-desktop {prev,next} --focus
# Focus selected desktop
super + {1-9,0}
bspc desktop --focus ^{1-9,10}
# Focus left/right occupied desktop
ctrl + alt + {Left,Right}
bspc desktop --focus {prev,next}.occupied
# Increase/decrease window gap on focused desktop
super + bracket{left,right}
bspc config -d focused window_gap $((`bspc config -d focused window_gap` {-,+} 5 ))
# Focus when clicking
~button1
bspc pointer --grab focus
# Move/resize windows
alt + button{1-3}
; bspc pointer --grab {move,resize_side,resize_corner}
# Ungrab when releasing a mouse button
alt + @button{1-3}
bspc pointer --ungrab
#
# wm independent hotkeys
#
# Launch rofi
# with .desktop files
super + d
rofi -show drun
# with commands
super + t
rofi -show run
# with ssh
super + s
rofi -show ssh
# with window
super + w
rofi -show window
# Lock & sleep the system
super + Escape
$HOME/Scripts/bspexit suspend
super + alt + Escape
$HOME/Scripts/power_options
super + Insert
$HOME/.config/bspwm/bspwmrc
super + alt + Insert
pkill -USR1 -x sxhkd
# Launch terminal
super + Return
exec $TERMINAL
# Move floating window
super + alt + {_,shift + }{Left,Down,Up,Right}
$BSPWM_CONFIG/scripts/move-window {_,edge-}{west,south,north,east}
# Emulate i3's scratchpad
F12
xdotool search --onlyvisible --classname scratchpad windowunmap \
|| ( xdotool search --classname scratchpad windowmap; xdotool search --classname scratchpad windowraise; ) \
|| ( urxvtc -name scratchpad -geometry 220x20+400+0; xdotool search --classname scratchpad windowraise; )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment