From b3ec39a6baa470dd42d2c2aca91f256c42bc64ca Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 7 Jan 2016 02:16:53 -0600 Subject: [PATCH] bar stuff in place --- arch_linux_init/bar.bash | 14 ++++++++++++++ arch_linux_init/wm.bash | 8 +++++++- bar_variables.bash | 10 ++++++++++ variables.bash | 5 +++++ wm/bspwmrc | 2 ++ wm/extras/bar/start.bash | 33 +++++++++++++++++++++++++++++++ wm/sxhkdrc | 42 ++++++++++++++++++++++++++-------------- 7 files changed, 99 insertions(+), 15 deletions(-) create mode 100755 arch_linux_init/bar.bash create mode 100644 bar_variables.bash create mode 100755 wm/extras/bar/start.bash diff --git a/arch_linux_init/bar.bash b/arch_linux_init/bar.bash new file mode 100755 index 0000000..6c88057 --- /dev/null +++ b/arch_linux_init/bar.bash @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )/.." && pwd) +source "$DIR/variables.bash" + +mkdir -p "$REPOSITORY_PATH" + +git clone https://github.com/LemonBoy/bar.git "$REPOSITORY_PATH/lemonbar" + +cd "$REPOSITORY_PATH/lemonbar" +make +sudo make install +cd - + diff --git a/arch_linux_init/wm.bash b/arch_linux_init/wm.bash index dc3073e..bf918c9 100755 --- a/arch_linux_init/wm.bash +++ b/arch_linux_init/wm.bash @@ -3,13 +3,19 @@ DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )/.." && pwd) source "$DIR/variables.bash" -sudo pacman -S xcb-util xcb-util-keysyms xcb-util-wm feh --noconfirm +sudo pacman -S xcb-util xcb-util-keysyms xcb-util-wm xorg-xrandr xdotool feh --noconfirm mkdir -p "$REPOSITORY_PATH" git clone https://github.com/baskerville/bspwm.git "$REPOSITORY_PATH/bspwm" +git clone https://github.com/baskerville/xdo.git "$REPOSITORY_PATH/xdo" git clone https://github.com/baskerville/sxhkd.git "$REPOSITORY_PATH/sxhkd" +cd "$REPOSITORY_PATH/xdo" +make +sudo make install +cd - + cd "$REPOSITORY_PATH/bspwm" make sudo make install diff --git a/bar_variables.bash b/bar_variables.bash new file mode 100644 index 0000000..08cf398 --- /dev/null +++ b/bar_variables.bash @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +source "variables.bash" + +BAR_FIFO="$DOTFILES_PATH/wm_bar_fifo.lock" +BAR_TOP=1 +BAR_MARGIN=$WINDOW_GAP +BAR_HEIGHT=30 + + diff --git a/variables.bash b/variables.bash index f76abf3..bd5962a 100755 --- a/variables.bash +++ b/variables.bash @@ -8,6 +8,11 @@ REPOSITORY_PATH=$HOME/Documents/Repositories WINDOW_GAP=20 BORDER_WIDTH=2 +BAR_FIFO="$DOTFILES_PATH/wm_bar_fifo.lock" +BAR_TOP=1 +BAR_MARGIN=$WINDOW_GAP +BAR_HEIGHT=30 + # load per-device bashrc_env if it exists if [ -a "$HOME/.bashrc_env" ]; then . "$HOME/.bashrc_env" diff --git a/wm/bspwmrc b/wm/bspwmrc index 1af7d77..0c67a2f 100755 --- a/wm/bspwmrc +++ b/wm/bspwmrc @@ -6,6 +6,8 @@ source "$DOTFILES_PATH/wm/bspwm_config" source "$DOTFILES_PATH/scripts/get_color.sh" source "$DOTFILES_PATH/scripts/get_x_fonts.sh" +bspc wm -o + urxvtd & sxhkd & diff --git a/wm/extras/bar/start.bash b/wm/extras/bar/start.bash new file mode 100755 index 0000000..6f4142c --- /dev/null +++ b/wm/extras/bar/start.bash @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +source "$DOTFILES_PATH/variables.bash" + +trap killbar INT TERM QUIT EXIT + +function killbar() { + if [ $BAR_TOP -eq 1 ]; then + bspc config -m $(bspc query -M | head -n 1) top_padding "0" + else + bspc config -m $(bspc query -M | head -n 1) bottom_padding "0" + fi +} + +if [ $BAR_TOP -eq 1 ]; then + bspc config -m $(bspc query -M | head -n 1) top_padding "$BAR_HEIGHT" +else + bspc config -m $(bspc query -M | head -n 1) bottom_padding "$BAR_HEIGHT" +fi + +# get width of our main monitor +WIDTH=`xrandr -q | egrep '(^| )connected( |$)' | tr 'x' '\n' | head -n 1 | awk '{print $NF}'` +WIDTH=$((WIDTH-BAR_MARGIN-BAR_MARGIN)) +HEIGHT=`xrandr -q | egrep '(^| )connected( |$)' | tr '+' '\n' | tr 'x' '\n' | head -n 2 | tail -n 1` + +POS_Y=0 +if [ $BAR_TOP -eq 1 ]; then + : +else + POS_Y=$((HEIGHT-BAR_HEIGHT)) +fi + +lemonbar -g "$WIDTH"x"$BAR_HEIGHT"+"$BAR_MARGIN"+"$POS_Y" diff --git a/wm/sxhkdrc b/wm/sxhkdrc index 3f89de4..1333aad 100755 --- a/wm/sxhkdrc +++ b/wm/sxhkdrc @@ -4,18 +4,23 @@ super + ctrl + Escape bspc quit -# kill the current application +# close the current application super + c bspc node -c -# balance node surface area on current desktop -super + b - bspc node -B +# kill the current application +super + shift + c + bspc node -k -# toggle floating/fullscreen modes for current node +# focus the node for the given path jump +super + {p,b,comma,period} + bspc node -f @{parent,brother,first,second} + +# set modes to tiled/floating for current node super + {s,f} bspc node -t {tiled,floating} +# set modes to pseudo_tiled/fullscreen for current node super + shift + {s,f} bspc node -t {pseudo_tiled,fullscreen} @@ -39,13 +44,6 @@ super + {_,shift + }{h,j,k,l} super + bracket{left,right} bspc desktop -f {prev,next} -super + {p,n} - bspc desktop -f {prev,next} - -# rotate node placement on current desktop -super + r - bspc node -R 90 - # preselect the splitting area for the current node super + ctrl + {h,j,k,l} bspc node -p {west,south,north,east} @@ -56,16 +54,24 @@ super + ctrl + {_,shift + }space # expand the current node super + alt + {h,j,k,l} - bspc node -e {left -10,down +10,up -10,right +10} + bspc node {@west -r -10,@south -r +10,@north -r -10,@east -r +10} # shrink the current node super + alt + shift + {h,j,k,l} - bspc node -e {right -10,up +10,down -10,left +10} + bspc node {@east -r -10,@north -r +10,@south -r -10,@west -r +10} # set node split ratio super + ctrl + {1-9,0} bspc node -r 0.{1-9,10} +# move a floating window very slowly +super + shift + {Left,Down,Up,Right} + xdo move {-x -1,-y +1,-y -1,-x +1} + +# move a floating window +super + {Left,Down,Up,Right} + xdo move {-x -20,-y +20,-y -20,-x +20} + # focus/move node to the selected desktop super + {_,shift + }{1-9,0} bspc {desktop -f,node -d} ^{1-9,10} @@ -115,6 +121,14 @@ super + alt + minus super + alt + t urxvtc && compton-trans -c -o 0 +# rotate the current node +super + r + bspc node -R 90 + +# balance the current node +super + shift + b + bspc node -B + # make current node transparent super + t compton-trans -c -o 0