diff options
author | shmibs <shmibs@shmibbles.me> | 2018-10-19 04:54:51 -0700 |
---|---|---|
committer | shmibs <shmibs@shmibbles.me> | 2018-10-19 04:54:51 -0700 |
commit | ad04ec6996ecd91ac2378069c99e73f54ac18cf3 (patch) | |
tree | ea16b3d6581f4b45619b303e60f8d187fd647ce7 | |
parent | c68e0d757ec0ee5baf9bf94ddd9634edf998d24f (diff) | |
download | dotfiles-ad04ec6996ecd91ac2378069c99e73f54ac18cf3.tar.gz |
merge tablet configs
-rwxr-xr-x | .config/herbstluftwm/autostart | 18 | ||||
-rwxr-xr-x | .config/herbstluftwm/panel.sh | 59 | ||||
-rw-r--r-- | .config/init/vars | 3 | ||||
-rw-r--r-- | .config/mpv/config | 3 | ||||
-rw-r--r-- | .vimrc | 1 | ||||
-rw-r--r-- | .zshrc | 2 | ||||
-rw-r--r-- | .zshrc-freebsd | 3 | ||||
-rw-r--r-- | .zshrc-linux | 2 |
8 files changed, 73 insertions, 18 deletions
diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart index 266b679..ffc9e10 100755 --- a/.config/herbstluftwm/autostart +++ b/.config/herbstluftwm/autostart @@ -200,6 +200,24 @@ hc rule class~'(VBoxSDL|SleepIsDeathApp|freeciv-sdl|FTL|pinentry)' pseudotile=on hc rule class~'(Tegaki-recognize|PlayOnLinux|PCSX2|Tilem2|Wine|explorer.exe)' pseudotile=on focus=on hc rule class~'(mednafen)' pseudotile=on focus=on + +################# +# TABLET MODE # +################# + +if [[ $tablet_mode ]]; then + hc rule class~'(onboard|Onboard)' manage=off + hc keybind XF86AudioLowerVolume spawn onboard -m + + hc keybind Mod4-equal spawn xbacklight +10 + hc keybind Mod4-minus spawn xbacklight -10 + hc keybind XF86AudioRaiseVolume spawn ~/.config/herbstluftwm/backlight.sh + + hc keybind Mod4-bracketright spawn ~/.config/herbstluftwm/pvol.sh up + hc keybind Mod4-bracketleft spawn ~/.config/herbstluftwm/pvol.sh down +fi + + # unlock, just to be sure hc unlock diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh index 41708a6..0f92899 100755 --- a/.config/herbstluftwm/panel.sh +++ b/.config/herbstluftwm/panel.sh @@ -1,4 +1,4 @@ -#!/bin/bash +!/bin/bash ########### # SETUP # @@ -91,7 +91,7 @@ update_winlist() { done | while read -ra line do # is it focussed? - if [[ $((16#${line[0]})) -eq $((16#$focus_id)) ]]; then + if [[ "$((16#${line[0]}))" -eq "$((16#$focus_id))" ]]; then echo -n "%{B${bg_focus} F${fg_focus}} " else echo -n "%{B${bg_normal} F${fg_normal}} " @@ -132,10 +132,12 @@ fields[3]="%{r}" fields[4]="" # mpd fields[5]="" -# conky stats +# battery (if tablet mode) fields[6]="" +# conky stats +fields[7]="" # date -fields[7]="$(update_date)" +fields[8]="$(update_date)" unique_line() { stdbuf -i0 -o0 uniq @@ -159,20 +161,20 @@ event_tick() { event_mpd() { while true; do - echo -en "mpd\t" + echo -en 'mpd\t' mpc status >/dev/null 2>&1 if [[ $? -ne 0 ]]; then - echo "disconnected" + echo 'disconnected' sleep 5 else if [[ -z "$(mpc status | grep '\[playing\]')" ]]; then if [[ -z "$(mpc status | grep '\[paused\]')" ]]; then - echo "stopped" + echo 'stopped' else - echo "paused" + echo 'paused' fi else - echo "playing" + echo 'playing' fi mpc idle player >/dev/null 2>&1 fi @@ -194,6 +196,15 @@ event_when() { done > >(unique_line) } +event_battery() { + while true; do + echo -en 'battery\t' + acpi -b | head -1 | cut -d ' ' -f 3-4 \ + | sed -E -e 's/(,|\%)//g' -e 's/ /\t/' \ + | tr '[:upper:]' '[:lower:]' + sleep 4 + done > >(unique_line) +} ####################### @@ -205,9 +216,10 @@ event_when() { { event_tick & + event_mpd & event_stats & event_when & - event_mpd & + [[ "$tablet_mode" != "" ]] && event_battery & hc --idle } 2> /dev/null | { @@ -232,7 +244,7 @@ event_when() { # accordingly case "${event[0]}" in tick) - fields[7]=$(update_date) + fields[8]=$(update_date) ;; mpd) @@ -257,7 +269,7 @@ event_when() { stats) event[1]=$(printf "%-4s" ${event[1]}) event[2]=$(printf "%-4s" ${event[2]}) - fields[6]=$( + fields[7]=$( echo -n "${sep}%{A:stats:} " echo -n "%{F${light_blue}}\uE023%{F${fg_normal}} ${event[1]} " echo -n "%{F${light_cyan}}\uE020%{F${fg_normal}} ${event[2]} " @@ -273,6 +285,29 @@ event_when() { fi ;; + battery) + if [[ "${event[1]}" == "discharging" ]]; then + fields[6]=$( + echo -n "$sep %{F${light_red}}" + echo "floor(abs((${event[2]}-1)/25))+57488" \ + | calc -p | xargs printf '\\u%X' + echo -n "%{F${fg_normal}} %" + printf '%-3d ' "${event[2]}") + fi + if [[ "${event[1]}" == "charging" ]]; then + fields[6]=$( + echo -n "$sep %{F${light_magenta}}\uE040" + echo -n "%{F${fg_normal}} %" + printf '%-3d ' "${event[2]}") + fi + if [[ "${event[1]}" == "full" ]]; then + fields[6]=$( + echo -n "$sep %{F${light_green}}\uE040" + echo -n "%{F${fg_normal}} %" + printf '%-3d ' "${event[2]}") + fi + ;; + # hc events focus_changed|window_title_changed) fields[2]=$(update_winlist) diff --git a/.config/init/vars b/.config/init/vars index f21735a..ac59a2e 100644 --- a/.config/init/vars +++ b/.config/init/vars @@ -368,6 +368,9 @@ befont_off='-1' # monitor dpi can be on-the-fly overridden by using "startx" instead of alias sx dpi=92 +# is this computer a tablet? +tablet_mode="" + kbrate=25 kbdelay=300 diff --git a/.config/mpv/config b/.config/mpv/config index 2e5a9ec..3771d68 100644 --- a/.config/mpv/config +++ b/.config/mpv/config @@ -1,8 +1,9 @@ screenshot-format=png +no-window-dragging # video fs=yes -profile=opengl-hq +profile=opengl interpolation=yes blend-subtitles=yes video-sync=display-resample @@ -20,6 +20,7 @@ Plugin 'gmarik/Vundle.vim' Plugin 'kchmck/vim-coffee-script' Plugin 'elixir-lang/vim-elixir' Plugin 'plasticboy/vim-markdown' +Plugin 'shmibs/mips.vim' Plugin 'zah/nim.vim' Plugin 'wlangstroth/vim-racket' Plugin 'rust-lang/rust.vim' @@ -143,6 +143,8 @@ bindkey '^N' down-history ################### ALIASES ################## alias :q='exit' +alias less='less -R' +export PAGER="less -R" if [[ ! -z $(whence vim) ]] then export EDITOR='vim' diff --git a/.zshrc-freebsd b/.zshrc-freebsd index 7292e28..62b19f0 100644 --- a/.zshrc-freebsd +++ b/.zshrc-freebsd @@ -3,9 +3,6 @@ alias ls='ls -G' alias ll='ls -lGh' alias grep='grep --color=auto' alias diff='colordiff' -alias less='less -R' - -export PAGER="less -R" ################## FUNCTIONS ################## diff --git a/.zshrc-linux b/.zshrc-linux index 9338086..366e6fe 100644 --- a/.zshrc-linux +++ b/.zshrc-linux @@ -6,8 +6,6 @@ alias less='less -R' alias ls='ls --color=auto' alias ll='ls -lh --color=auto' -export PAGER='less -R' - if [[ ! -z $(whence yay) ]] then alias yay='yay --editmenu' fi |