Added bspwm

This commit is contained in:
Carolyn Saunders 2016-12-11 15:43:09 -08:00
parent f4a9282b99
commit d3179d9345
13 changed files with 430 additions and 42 deletions

View file

@ -1,11 +1,4 @@
Xft.autohint: 0 st.font: Gohufont:size=12:antialias=false
Xft.lcdfilter: lcddefault
Xft.hintstyle: hintslight
Xft.hinting: 1
Xft.antialias: 1
Xft.rgba: rgb
UXTerm*faceName: Source Code Pro for Powerline:size=11:antialias=true
! special ! special
*.foreground: #aeb1b7 *.foreground: #aeb1b7
@ -43,3 +36,4 @@ UXTerm*faceName: Source Code Pro for Powerline:size=11:antialias=true
! white ! white
*.color7: #9a9da3 *.color7: #9a9da3
*.color15: #b4b7bb *.color15: #b4b7bb

View file

@ -0,0 +1,40 @@
[admiral]
items = ["left", "padding", "workspaces", "padding", "title", "right", "network", "padding", "volume", "padding", "battery", "padding", "clock", "padding"]
[left]
path = "echo '%{l}'"
static = true
[center]
path = "echo '%{c}'"
static = true
[right]
path = "echo '%{r}'"
static = true
[padding]
path = "echo ' '"
static = true
[battery]
path = "$HOME/.scripts/battery.sh"
reload = 3
[network]
path = "$HOME/.scripts/networkname.sh"
reload = 5
[volume]
path = "$HOME/.scripts/volume.sh"
reload = 0.05
[workspaces]
path = "$HOME/.scripts/workspaces.sh"
[title]
path = "xtitle -s | scroller -o -l 60"
[clock]
path = "date '+%D %H:%M' "
reload = 1

View file

@ -0,0 +1,60 @@
#!/usr/bin/env bash
if ! type bspc &> /dev/null; then
echo "bspc not found"
exit 1
fi
while read -r line; do
echo -n "%{A4:bspc desktop -f prev:}%{A5:bspc desktop -f next:}"
case $line in
W*)
IFS=':'
set -- ${line#?}
while [ $# -gt 0 ]; do
item="$1"
name="${item#?}"
case $item in
f*)
# free desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "f"
echo -n "%{A} "
;;
F*)
# focused free desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "F"
echo -n "%{A} "
;;
o*)
# occupied desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "o"
echo -n "%{A} "
;;
O*)
# focused occupied desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "O"
echo -n "%{A} "
;;
u*)
# urgent desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "u"
echo -n "%{A} "
;;
U*)
# focused urgent desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "U"
echo -n "%{A} "
;;
esac
shift
done
esac
echo -n "%{A}%{A}"
echo
done < <(bspc subscribe report)

View file

@ -0,0 +1,40 @@
[admiral]
items = ["left", "padding", "workspaces", "right", "network", "padding", "volume", "padding", "battery", "padding", "clock", "padding"]
[left]
path = "echo '%{l}'"
static = true
[center]
path = "echo '%{c}'"
static = true
[right]
path = "echo '%{r}'"
static = true
[padding]
path = "echo ' '"
static = true
[battery]
path = "./battery.sh"
reload = 3
[network]
path = "$HOME/.scripts/networkname.sh"
reload = 5
[volume]
path = "./volume.sh"
reload = 0.05
[workspaces]
path = "./bspwm_workspaces.sh"
[title]
path = "xtitle -s | scroller -o -l 60"
[clock]
path = "date '+%D %H:%M' "
reload = 1

View file

@ -0,0 +1,60 @@
#!/usr/bin/env bash
if ! type bspc &> /dev/null; then
echo "bspc not found"
exit 1
fi
while read -r line; do
echo -n "%{A4:bspc desktop -f prev:}%{A5:bspc desktop -f next:}"
case $line in
W*)
IFS=':'
set -- ${line#?}
while [ $# -gt 0 ]; do
item="$1"
name="${item#?}"
case $item in
f*)
# free desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "f"
echo -n "%{A} "
;;
F*)
# focused free desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "F"
echo -n "%{A} "
;;
o*)
# occupied desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "o"
echo -n "%{A} "
;;
O*)
# focused occupied desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "O"
echo -n "%{A} "
;;
u*)
# urgent desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "u"
echo -n "%{A} "
;;
U*)
# focused urgent desktop
echo -n " %{A:bspc desktop -f $name:}"
echo -n "U"
echo -n "%{A} "
;;
esac
shift
done
esac
echo -n "%{A}%{A}"
echo
done < <(bspc subscribe report)

View file

@ -20,8 +20,6 @@ Plug 'mileszs/ack.vim'
Plug 'easymotion/vim-easymotion' Plug 'easymotion/vim-easymotion'
Plug 'neomake/neomake' Plug 'neomake/neomake'
Plug 'chrisbra/Colorizer' Plug 'chrisbra/Colorizer'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive' Plug 'tpope/vim-fugitive'
Plug 'nathanaelkane/vim-indent-guides' Plug 'nathanaelkane/vim-indent-guides'
Plug 'rust-lang/rust.vim', {'for' : 'rust'} Plug 'rust-lang/rust.vim', {'for' : 'rust'}
@ -42,13 +40,16 @@ Plug 'Shougo/denite.nvim'
Plug 'fmoralesc/vim-tutor-mode', {'on' : 'Tutor'} Plug 'fmoralesc/vim-tutor-mode', {'on' : 'Tutor'}
Plug 'Shougo/neosnippet' Plug 'Shougo/neosnippet'
Plug 'Shougo/neosnippet-snippets' Plug 'Shougo/neosnippet-snippets'
Plug 'wikitopian/hardmode'
Plug 'majutsushi/tagbar', {'on' : 'Tagbar'} Plug 'majutsushi/tagbar', {'on' : 'Tagbar'}
Plug 'chrisbra/improvedft' Plug 'chrisbra/improvedft'
Plug 'haya14busa/incsearch.vim' Plug 'haya14busa/incsearch.vim'
Plug 'haya14busa/incsearch-fuzzy.vim' Plug 'haya14busa/incsearch-fuzzy.vim'
Plug 'haya14busa/incsearch-easymotion.vim' Plug 'haya14busa/incsearch-easymotion.vim'
Plug 'mhinz/vim-startify' Plug 'mhinz/vim-startify'
Plug 'chrisbra/Colorizer'
Plug 'itchyny/lightline.vim'
Plug 'bling/vim-bufferline'
Plug 'reedes/vim-litecorrect'
call plug#end() call plug#end()
let g:ft_improved_ignorecase = 1 let g:ft_improved_ignorecase = 1
@ -83,18 +84,20 @@ let g:elm_detailed_complete = 1
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>" inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
autocmd VimEnter,BufNewFile,BufReadPost * silent! call HardMode() let g:bufferline_echo = 0
autocmd FileType typescript nmap <buffer> <Leader>i : <C-u>echo tsuquyomi#hint()<CR> autocmd FileType typescript nmap <buffer> <Leader>i : <C-u>echo tsuquyomi#hint()<CR>
autocmd FileType elm nmap <buffer> <Leader>i :ElmShowDocs<CR> autocmd FileType elm nmap <buffer> <Leader>i :ElmShowDocs<CR>
let g:quantum_black = 1 let g:quantum_black = 1
let g:quantum_italics = 1
colorscheme quantum colorscheme quantum
if has("termguicolors") if has("termguicolors")
set termguicolors set termguicolors
endif endif
let g:vim_markdown_folding_disabled = 1
augroup pencil augroup pencil
autocmd! autocmd!
autocmd FileType markdown,mkd call pencil#init() autocmd FileType markdown,mkd call pencil#init()
@ -179,21 +182,6 @@ nmap <leader>k <c-w>k
nmap <leader>h <c-w>h nmap <leader>h <c-w>h
nmap <leader>l <c-w>l nmap <leader>l <c-w>l
"Airline
let g:airline_theme = "quantum"
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
au FileType go nmap <leader>rt <Plug>(go-run-tab)
au FileType go nmap <Leader>rs <Plug>(go-run-split)
au FileType go nmap <Leader>rv <Plug>(go-run-vertical)
"tagbar "tagbar
let g:tagbar_type_elixir = { let g:tagbar_type_elixir = {
\ 'ctagstype' : 'elixir', \ 'ctagstype' : 'elixir',
@ -212,19 +200,11 @@ let g:tagbar_type_elixir = {
\ ] \ ]
\ } \ }
"Incsearch "incsearch
function! s:config_fuzzyall(...) abort
return extend(copy({
\ 'converters': [
\ incsearch#config#fuzzy#converter(),
\ incsearch#config#fuzzyspell#converter()
\ ],
\ }), get(a:, 1, {}))
endfunction
noremap <silent><expr> / incsearch#go(<SID>config_fuzzyall()) map / <Plug>(incsearch-forward)
noremap <silent><expr> ? incsearch#go(<SID>config_fuzzyall({'command': '?'})) map ? <Plug>(incsearch-backward)
noremap <silent><expr> g? incsearch#go(<SID>config_fuzzyall({'is_stay': 1})) map g/ <Plug>(incsearch-stay)
"Easymotion "Easymotion
function! s:config_easyfuzzymotion(...) abort function! s:config_easyfuzzymotion(...) abort
@ -238,3 +218,81 @@ function! s:config_easyfuzzymotion(...) abort
endfunction endfunction
noremap <silent><expr> <Space>/ incsearch#go(<SID>config_easyfuzzymotion()) noremap <silent><expr> <Space>/ incsearch#go(<SID>config_easyfuzzymotion())
"Lightline
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'filename' ], ['bufferline']]
\ },
\ 'component_function': {
\ 'fugitive': 'LightlineFugitive',
\ 'readonly': 'LightlineReadonly',
\ 'modified': 'LightlineModified',
\ 'filename': 'LightlineFilename',
\ 'bufferline': 'MyBufferline'
\ },
\ 'separator': { 'left': '', 'right': ''},
\ 'subseparator': { 'left': '|', 'right': '|' }
\ }
function! LightlineModified()
if &filetype == "help"
return ""
elseif &modified
return "+"
elseif &modifiable
return ""
else
return ""
endif
endfunction
function! LightlineReadonly()
if &filetype == "help"
return ""
elseif &readonly
return ""
else
return ""
endif
endfunction
function! LightlineFugitive()
if exists("*fugitive#head")
let branch = fugitive#head()
return branch !=# '' ? branch : ''
endif
return ''
endfunction
function! LightlineFilename()
let fname = expand('%:t')
return fname == '__Tagbar__' ? g:lightline.fname :
\ fname =~ 'NERD_tree' ? '' :
\ &ft == 'denite' ? denite#get_status_string() :
\ ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
\ ('' != fname ? fname : '[No Name]') .
\ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
endfunction
function! MyBufferline()
call bufferline#refresh_status()
let b = g:bufferline_status_info.before
let c = g:bufferline_status_info.current
let a = g:bufferline_status_info.after
let alen = strlen(a)
let blen = strlen(b)
let clen = strlen(c)
let w = winwidth(0) * 4 / 9
if w < alen+blen+clen
let whalf = (w - strlen(c)) / 2
let aa = alen > whalf && blen > whalf ? a[:whalf] : alen + blen < w - clen || alen < whalf ? a : a[:(w - clen - blen)]
let bb = alen > whalf && blen > whalf ? b[-(whalf):] : alen + blen < w - clen || blen < whalf ? b : b[-(w - clen - alen):]
return (strlen(bb) < strlen(b) ? '...' : '') . bb . c . aa . (strlen(aa) < strlen(a) ? '...' : '')
else
return b . c . a
endif
endfunction

39
.scripts/bar.sh Executable file
View file

@ -0,0 +1,39 @@
#!/bin/bash
pkill admiral
font="Gohufont:size=10"
fallback_font="FontAwesome:size=8"
background="#cc111314"
foreground="#bcbdc3"
a=30
monitors=$(xrandr | grep -o "^.* connected" | sed "s/ connected//")
if [[ $1 == "-f" ]]; then
# full width, no padding
x=1920
y=40
x_offset=0
y_offset=0
elif [[ $1 == "-h" ]]; then
# half width
x=900
y=40
x_offset=500
y_offset=15
else
x=1880
y=40
x_offset=20
y_offset=15
fi
for m in $monitors; do
#admiral | lemonbar -a $a -g "${x}x${y}+${x_offset}+${y_offset}" -f $font -f $fallback_font -B $background -F $foreground | sh &
admiral | lemonbar -a $a -f $font -f $fallback_font -B $background -F $foreground | sh &
# the following line gets the width of the current monitor
monitor_width=$(xrandr | grep '*' | ruby -e "puts gets.strip.split[0].split('x')" | head -n 1)
let x_offset+=$monitor_width
echo "Started bar on $m"
done

28
.scripts/battery.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
status="$(cat /sys/class/power_supply/BAT0/status)"
capacity="$(cat /sys/class/power_supply/BAT0/capacity)"
color=false
echo -n "%{F#e5c078}"
if [[ $status == "Charging" ]]; then
echo -en "\uf0e7"
elif [[ $capacity -ge "85" ]]; then
echo -en "\uf240"
elif [[ $capacity -ge "65" ]]; then
echo -en "\uf241"
elif [[ $capacity -ge "45" ]]; then
echo -en "\uf242"
elif [[ $capacity -ge "15" ]]; then
echo -en "\uf243"
elif [[ $capacity -ge "0" ]]; then
color=true
echo -en "%{F#cc6666}\uf244"
fi
echo -n "%{F-}"
echo -n "Bat: $capacity%"
if [[ color ]]; then
echo "%{F-}"
else
echo
fi

10
.scripts/networkname.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
nname=$(nmcli connection show --active | grep wireless | awk '{print $1;}')
echo -en "%{A:connman-gtk:}%{F#7d8fa3}\uf1eb%{F-} "
if [[ $nname != "" ]]; then
echo -n "$nname"
else
echo -n "Not connected"
fi
echo "%{A}"

2
.scripts/volume.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
echo -e "Vol: %{A:pavucontrol:}%{F#95b47b}\uf027%{F-} $(awk -F[][] '{ print $2 }' <(amixer sget Master) | tail -n 1)%{A}"

48
.scripts/workspaces.sh Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash
chds() {
echo -en "%{A:bspc desktop -f $1:}$2%{A} "
}
while read -r line; do
echo -n "%{A4:bspc desktop -f prev:}%{A5:bspc desktop -f next:}"
case $line in
W*)
IFS=':'
set -- ${line#?}
while [ $# -gt 0 ]; do
item="$1"
name="${item#?}"
case $item in
f*)
# free desktop
chds $name $name
;;
F*)
# focused free desktop
chds $name "%{F#f5f0f6}$name%{F-}"
;;
o*)
# occupied desktop
chds $name "[$name]"
;;
O*)
# focused occupied desktop
chds $name "%{F#f5f0f6}[$name]%{F-}"
;;
u*)
# urgent desktop
chds $name $name
;;
U*)
# focused urgent desktop
chds $name "%{F#f5f0f6}$name%{F-}"
;;
esac
shift
done
;;
esac
echo -n "%{A}%{A}"
echo
done < <(bspc subscribe report)

9
.xprofile Executable file
View file

@ -0,0 +1,9 @@
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?* ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
[[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources
exec xmonad

4
.zshrc
View file

@ -41,8 +41,6 @@ fi
zplug load zplug load
export EDITOR="nvim" export EDITOR="nvim"
export BLOX_BLOCK__SYMBOL_SYMBOL=">"
BLOX_BLOCK__SYMBOL_EXIT_SYMBOL=">"
eval "$(hub alias -s)" eval "$(hub alias -s)"
alias vi="nvim" alias vi="nvim"
@ -53,3 +51,5 @@ alias prm=". $HOME/.prm/prm.sh"
. $HOME/.asdf/completions/asdf.bash . $HOME/.asdf/completions/asdf.bash
export PATH="$HOME/.apps/Elm-Platform/0.18/.cabal-sandbox/bin/":$PATH export PATH="$HOME/.apps/Elm-Platform/0.18/.cabal-sandbox/bin/":$PATH
export PATH="$HOME/.apps/admiral/target/release/":$PATH
export PATH="$HOME/.apps/roller/target/release":$PATH