From d3179d93456559e25e00024eddcc56cd43bfb3a4 Mon Sep 17 00:00:00 2001 From: Carolyn Saunders Date: Sun, 11 Dec 2016 15:43:09 -0800 Subject: [PATCH] Added bspwm --- .Xresources | 10 +- .config/admiral.d/admiral.d/admiral.toml | 40 ++++++ .../admiral.d/admiral.d/bspwm_workspaces.sh | 60 +++++++++ .config/admiral.d/admiral.toml | 40 ++++++ .config/admiral.d/bspwm_workspaces.sh | 60 +++++++++ .config/nvim/init.vim | 122 +++++++++++++----- .scripts/bar.sh | 39 ++++++ .scripts/battery.sh | 28 ++++ .scripts/networkname.sh | 10 ++ .scripts/volume.sh | 2 + .scripts/workspaces.sh | 48 +++++++ .xprofile | 9 ++ .zshrc | 4 +- 13 files changed, 430 insertions(+), 42 deletions(-) create mode 100644 .config/admiral.d/admiral.d/admiral.toml create mode 100755 .config/admiral.d/admiral.d/bspwm_workspaces.sh create mode 100644 .config/admiral.d/admiral.toml create mode 100755 .config/admiral.d/bspwm_workspaces.sh create mode 100755 .scripts/bar.sh create mode 100755 .scripts/battery.sh create mode 100755 .scripts/networkname.sh create mode 100755 .scripts/volume.sh create mode 100755 .scripts/workspaces.sh create mode 100755 .xprofile diff --git a/.Xresources b/.Xresources index 3acd862..53fc087 100644 --- a/.Xresources +++ b/.Xresources @@ -1,11 +1,4 @@ -Xft.autohint: 0 -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 +st.font: Gohufont:size=12:antialias=false ! special *.foreground: #aeb1b7 @@ -43,3 +36,4 @@ UXTerm*faceName: Source Code Pro for Powerline:size=11:antialias=true ! white *.color7: #9a9da3 *.color15: #b4b7bb + diff --git a/.config/admiral.d/admiral.d/admiral.toml b/.config/admiral.d/admiral.d/admiral.toml new file mode 100644 index 0000000..8dde2e1 --- /dev/null +++ b/.config/admiral.d/admiral.d/admiral.toml @@ -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 diff --git a/.config/admiral.d/admiral.d/bspwm_workspaces.sh b/.config/admiral.d/admiral.d/bspwm_workspaces.sh new file mode 100755 index 0000000..667d75a --- /dev/null +++ b/.config/admiral.d/admiral.d/bspwm_workspaces.sh @@ -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) diff --git a/.config/admiral.d/admiral.toml b/.config/admiral.d/admiral.toml new file mode 100644 index 0000000..3d28624 --- /dev/null +++ b/.config/admiral.d/admiral.toml @@ -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 diff --git a/.config/admiral.d/bspwm_workspaces.sh b/.config/admiral.d/bspwm_workspaces.sh new file mode 100755 index 0000000..667d75a --- /dev/null +++ b/.config/admiral.d/bspwm_workspaces.sh @@ -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) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 3154a04..b276093 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -20,8 +20,6 @@ Plug 'mileszs/ack.vim' Plug 'easymotion/vim-easymotion' Plug 'neomake/neomake' Plug 'chrisbra/Colorizer' -Plug 'vim-airline/vim-airline' -Plug 'vim-airline/vim-airline-themes' Plug 'tpope/vim-fugitive' Plug 'nathanaelkane/vim-indent-guides' Plug 'rust-lang/rust.vim', {'for' : 'rust'} @@ -42,13 +40,16 @@ Plug 'Shougo/denite.nvim' Plug 'fmoralesc/vim-tutor-mode', {'on' : 'Tutor'} Plug 'Shougo/neosnippet' Plug 'Shougo/neosnippet-snippets' -Plug 'wikitopian/hardmode' Plug 'majutsushi/tagbar', {'on' : 'Tagbar'} Plug 'chrisbra/improvedft' Plug 'haya14busa/incsearch.vim' Plug 'haya14busa/incsearch-fuzzy.vim' Plug 'haya14busa/incsearch-easymotion.vim' Plug 'mhinz/vim-startify' +Plug 'chrisbra/Colorizer' +Plug 'itchyny/lightline.vim' +Plug 'bling/vim-bufferline' +Plug 'reedes/vim-litecorrect' call plug#end() let g:ft_improved_ignorecase = 1 @@ -83,18 +84,20 @@ let g:elm_detailed_complete = 1 autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif inoremap pumvisible() ? "\" : "\" -autocmd VimEnter,BufNewFile,BufReadPost * silent! call HardMode() +let g:bufferline_echo = 0 autocmd FileType typescript nmap i : echo tsuquyomi#hint() autocmd FileType elm nmap i :ElmShowDocs let g:quantum_black = 1 -let g:quantum_italics = 1 + colorscheme quantum if has("termguicolors") set termguicolors endif +let g:vim_markdown_folding_disabled = 1 + augroup pencil autocmd! autocmd FileType markdown,mkd call pencil#init() @@ -179,21 +182,6 @@ nmap k k nmap h h nmap l 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 rt (go-run-tab) -au FileType go nmap rs (go-run-split) -au FileType go nmap rv (go-run-vertical) - "tagbar let g:tagbar_type_elixir = { \ 'ctagstype' : 'elixir', @@ -212,19 +200,11 @@ let g:tagbar_type_elixir = { \ ] \ } -"Incsearch -function! s:config_fuzzyall(...) abort - return extend(copy({ - \ 'converters': [ - \ incsearch#config#fuzzy#converter(), - \ incsearch#config#fuzzyspell#converter() - \ ], - \ }), get(a:, 1, {})) -endfunction +"incsearch -noremap / incsearch#go(config_fuzzyall()) -noremap ? incsearch#go(config_fuzzyall({'command': '?'})) -noremap g? incsearch#go(config_fuzzyall({'is_stay': 1})) +map / (incsearch-forward) +map ? (incsearch-backward) +map g/ (incsearch-stay) "Easymotion function! s:config_easyfuzzymotion(...) abort @@ -238,3 +218,81 @@ function! s:config_easyfuzzymotion(...) abort endfunction noremap / incsearch#go(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 diff --git a/.scripts/bar.sh b/.scripts/bar.sh new file mode 100755 index 0000000..0cd3650 --- /dev/null +++ b/.scripts/bar.sh @@ -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 diff --git a/.scripts/battery.sh b/.scripts/battery.sh new file mode 100755 index 0000000..1e56f98 --- /dev/null +++ b/.scripts/battery.sh @@ -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 diff --git a/.scripts/networkname.sh b/.scripts/networkname.sh new file mode 100755 index 0000000..ae3d0f2 --- /dev/null +++ b/.scripts/networkname.sh @@ -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}" + diff --git a/.scripts/volume.sh b/.scripts/volume.sh new file mode 100755 index 0000000..2c3dd43 --- /dev/null +++ b/.scripts/volume.sh @@ -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}" diff --git a/.scripts/workspaces.sh b/.scripts/workspaces.sh new file mode 100755 index 0000000..671a111 --- /dev/null +++ b/.scripts/workspaces.sh @@ -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) diff --git a/.xprofile b/.xprofile new file mode 100755 index 0000000..c9511bc --- /dev/null +++ b/.xprofile @@ -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 diff --git a/.zshrc b/.zshrc index 44dc77c..da7eed1 100644 --- a/.zshrc +++ b/.zshrc @@ -41,8 +41,6 @@ fi zplug load export EDITOR="nvim" -export BLOX_BLOCK__SYMBOL_SYMBOL=">" -BLOX_BLOCK__SYMBOL_EXIT_SYMBOL=">" eval "$(hub alias -s)" alias vi="nvim" @@ -53,3 +51,5 @@ alias prm=". $HOME/.prm/prm.sh" . $HOME/.asdf/completions/asdf.bash 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