From 642c009520d9ba5b327602fd60e2fff014aa49fa Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 11 Jan 2016 09:22:54 -0600 Subject: [PATCH] work on bar --- arch_linux_init/bar.bash | 12 +----- arch_linux_init/gmusic.bash | 13 +++++++ arch_linux_init/utils.bash | 1 + misc/thunner/.gitignore | 1 + misc/thunner/example_thunnerrc | 6 +++ misc/thunner/link.bash | 8 ++++ variables.bash | 5 ++- vim/config/init.vim | 12 ++++++ wm/extras/bar/colors.bash | 6 +++ wm/extras/bar/formatter.bash | 67 ++++++++++++++++++++++++++++++++++ wm/extras/bar/start.bash | 18 ++++++--- 11 files changed, 131 insertions(+), 18 deletions(-) create mode 100644 arch_linux_init/gmusic.bash create mode 100644 misc/thunner/.gitignore create mode 100644 misc/thunner/example_thunnerrc create mode 100755 misc/thunner/link.bash create mode 100644 wm/extras/bar/colors.bash create mode 100755 wm/extras/bar/formatter.bash diff --git a/arch_linux_init/bar.bash b/arch_linux_init/bar.bash index 6c88057..61b05e3 100755 --- a/arch_linux_init/bar.bash +++ b/arch_linux_init/bar.bash @@ -1,14 +1,4 @@ #!/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 - +pacaur -S lemonbar-xft-git diff --git a/arch_linux_init/gmusic.bash b/arch_linux_init/gmusic.bash new file mode 100644 index 0000000..458a91f --- /dev/null +++ b/arch_linux_init/gmusic.bash @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )/.." && pwd) +source $DIR/variables.bash + +sudo pacman -S mplayer --noconfirm + +git clone https://github.com/malcolmstill/thunner.git "$REPOSITORY_PATH/thunner" + +sudo pip2 install gmusicapi + +sudo ln -s "$REPOSITORY_PATH/thunner/thunner" /usr/bin/thunner + diff --git a/arch_linux_init/utils.bash b/arch_linux_init/utils.bash index 5f6d7b4..3855aac 100755 --- a/arch_linux_init/utils.bash +++ b/arch_linux_init/utils.bash @@ -9,6 +9,7 @@ sudo pacman -S \ the_silver_searcher \ thunar \ luakit \ + alsa-utils \ --noconfirm pacaur -S \ diff --git a/misc/thunner/.gitignore b/misc/thunner/.gitignore new file mode 100644 index 0000000..ef888f6 --- /dev/null +++ b/misc/thunner/.gitignore @@ -0,0 +1 @@ +thunnerrc diff --git a/misc/thunner/example_thunnerrc b/misc/thunner/example_thunnerrc new file mode 100644 index 0000000..8bc056e --- /dev/null +++ b/misc/thunner/example_thunnerrc @@ -0,0 +1,6 @@ +email your@gmail.account +pass app_specific_password +color mycolor blue default +assign mycolor header-text +mobile-id your_android_device_id + diff --git a/misc/thunner/link.bash b/misc/thunner/link.bash new file mode 100755 index 0000000..566c06c --- /dev/null +++ b/misc/thunner/link.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )/../.." && pwd) +source "$DIR/variables.bash" + +rm -f "$HOME/.thunnerrc" +ln -s "$DOTFILES_PATH/misc/thunner/thunnerrc" "$HOME/.thunnerrc" + diff --git a/variables.bash b/variables.bash index f1737d4..5726a7a 100755 --- a/variables.bash +++ b/variables.bash @@ -11,7 +11,10 @@ BORDER_WIDTH=2 BAR_FIFO="$DOTFILES_PATH/wm_bar_fifo.lock" BAR_TOP=0 BAR_MARGIN=$WINDOW_GAP -BAR_HEIGHT=30 +BAR_HEIGHT=28 +BAR_BORDER_WIDTH=2 +BAR_FONT_FAMILY="$PRIMARY_FONT_FAMILY_WITH_SIZE" +BAR_UNDERLINE=1 # load per-device bashrc_env if it exists if [ -a "$HOME/.bashrc_env" ]; then diff --git a/vim/config/init.vim b/vim/config/init.vim index 9458a9f..00924a8 100644 --- a/vim/config/init.vim +++ b/vim/config/init.vim @@ -327,6 +327,18 @@ map :cnext " keep that dumb window from popping up map q: :q +" sane n/N behavior +nnoremap n 'Nn'[v:searchforward] +nnoremap N 'nN'[v:searchforward] + +" better command history navigation +cnoremap +cnoremap + +" keep selection after indenting visual +xnoremap < >gv + command! UseFoldMarkers set foldmethod=marker " compile & link c code (alt+ write + compile, ctrl+ compile + run) (c.vim plugin) diff --git a/wm/extras/bar/colors.bash b/wm/extras/bar/colors.bash new file mode 100644 index 0000000..af81f1a --- /dev/null +++ b/wm/extras/bar/colors.bash @@ -0,0 +1,6 @@ +export COLOR_FOREGROUND="#ff$(get_color 05)" +export COLOR_DARK="#ff$(get_color 03)" +export COLOR_BACKGROUND="#ff$(get_color 00)" +export COLOR_HIGHLIGHT="#ff$(get_color 0D)" +export COLOR_URGENT="#ff$(get_color 08)" + diff --git a/wm/extras/bar/formatter.bash b/wm/extras/bar/formatter.bash new file mode 100755 index 0000000..96e9007 --- /dev/null +++ b/wm/extras/bar/formatter.bash @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +source "$DOTFILES_PATH/variables.bash" +source "$DOTFILES_PATH/wm/extras/bar/colors.bash" + +ul="u" +if [ $BAR_UNDERLINE -eq 1 ]; then + : +else + ul="o" +fi + +while read -r line; do + case $line in + # bspwm + W*) + wm_info="" + IFS=':' # this is some magic variable... you need it + set -- ${line#?} + while [ $# -gt 0 ]; do + item=$1 + name=${item#?} + cname="$name" + case $item in + M*) + # active monitor + # do nothing + ;; + m*) + # inactive monitor + # do nothing + ;; + O*) + # focused occupied desktop + wm_info="${wm_info} %{F$COLOR_HIGHLIGHT}%{U$COLOR_HIGHLIGHT}%{+${ul}}${cname}%{-${ul}}%{U-}%{F-}" + ;; + F*) + # focused free desktop + wm_info="${wm_info} %{F$COLOR_DARK}%{U$COLOR_DARK}%{+${ul}}${cname}%{-${ul}}%{U-}%{F-}" + ;; + U*) + # focused occupied desktop + wm_info="${wm_info} %{F$COLOR_URGENT}%{U$COLOR_URGENT}%{+${ul}}${cname}%{-${ul}}%{U-}%{F-}" + ;; + o*) + # occupied desktop + wm_info="${wm_info} %{F$COLOR_FOREGROUND}${cname}%{F-}" + ;; + f*) + # free desktop + wm_info="${wm_info} %{F$COLOR_DARK}${cname}%{F-}" + ;; + u*) + # urgent desktop + wm_info="${wm_info} %{F$COLOR_URGENT}${cname}%{F-}" + ;; + L*) + # layout + ;; + esac + shift + done + ;; + esac + printf " %s \n" "%{T1}What up, bar? %{c}${wm_info} %{r}Clock here or something" +done + diff --git a/wm/extras/bar/start.bash b/wm/extras/bar/start.bash index 6f4142c..65a5538 100755 --- a/wm/extras/bar/start.bash +++ b/wm/extras/bar/start.bash @@ -2,8 +2,6 @@ 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" @@ -12,22 +10,30 @@ function killbar() { fi } +trap killbar INT TERM QUIT EXIT + +rm -f "$BAR_FIFO" +mkfifo "$BAR_FIFO" + 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 +bspc subscribe all > "$BAR_FIFO" & + # 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 +BAR_B="" if [ $BAR_TOP -eq 1 ]; then : else - POS_Y=$((HEIGHT-BAR_HEIGHT)) + BAR_B="-b" fi -lemonbar -g "$WIDTH"x"$BAR_HEIGHT"+"$BAR_MARGIN"+"$POS_Y" +source "$DOTFILES_PATH/wm/extras/bar/colors.bash" + +cat "$BAR_FIFO" | "$DOTFILES_PATH/wm/extras/bar/formatter.bash" | lemonbar $BAR_B -d -g "$WIDTH"x"$BAR_HEIGHT"+"$BAR_MARGIN"+"$POS_Y" -u "$BAR_BORDER_WIDTH" -f "$BAR_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND"