Permalink
Browse files

consolidate border targets to have single source of truth

  • Loading branch information...
neeasade committed Nov 24, 2018
1 parent 27abd6d commit 94091845c934846ec653db667679190766dedb74
@@ -0,0 +1,13 @@
#!/bin/sh
# get targets for drawing borders on in bspwm
target="${1:-active}"
case "$target" in
active)
bspc query -N -n .active.descendant_of.window.leaf.!fullscreen
;;
inactive)
bspc query -N -n .active.!descendant_of.window.leaf.!fullscreen
;;
esac
@@ -1,5 +1,4 @@
#!/bin/sh
# todo: grep for '*ERROR*: Quit' for exit status as well?
trim=false
[ "$1" = "-r" ] && trim=true && shift
@@ -4,7 +4,6 @@
# sort here is a hack for emacs. /run/ comes after /home/.
mpv="$(type -a mpv | sort | awk 'END{print $3}')"
# todo: account for multiple instances here
mpc pause >/dev/null
$mpv --input-ipc-server=/tmp/mpvsocket "$@"
@@ -39,6 +39,7 @@ shuffle() {
append() {
echo append "$*"
echo "none" > "$musicdir/playlist/current"
mpc listall | grep -i "$*" | mpc add
}
@@ -107,7 +108,7 @@ info() {
length="$(wc -L <<< "$name")"
percent="$(mpc | awk 'match($0,/([0-9]+)%/, groups) {print groups[1]}')"
progress="$("$HOME/.wm/panel/tools/mkb" $percent $length )"
progress="$("$HOME/.wm/panel/tools/mkb" $percent $length)"
cat<<EOF
$name
@@ -1,6 +1,6 @@
# -*- mode: sh -*-
export ESHELL=$(iif '[ -n "$INSIDE_EMACS" ]')
ESHELL=$(iif '[ -n "$INSIDE_EMACS" ] && [ "$TERM" = "dumb" ]')
if $ESHELL; then
succ .emacs.d/scripts
@@ -33,3 +33,14 @@ fi
# redir ncurses
# redir nethack
# fi
path_remove() {
PATH=${PATH//":$1:"/":"} # middle
PATH=${PATH/#"$1:"/} # beginning
PATH=${PATH/%":$1"/} # end
}
sxhkd() {
path_remove "$HOME/.emacs.d/scripts"
$(type -a sxhkd | sort | awk 'END{print $3}')
}
@@ -70,7 +70,7 @@ super + {_,shift} + slash
# ~/.wm/scripts/i3blur.sh
super + Return
elisp t >/dev/null 2>&1 && elisp '(ns/spawn-terminal)' || $TERMINAL
elisp '(ns/spawn-terminal)' || $TERMINAL
super + o
$BROWSER
@@ -34,10 +34,10 @@ width_normal=$((border_width_in_normal+border_width_out_normal))
width_focused=$((border_width_in_focused+border_width_out_focused))
bspc config border_width "$width_normal"
_chwb2 focused $(bspc query -N -n .active.descendant_of.window.!fullscreen)
_chwb2 normal $(bspc query -N -n .active.!descendant_of.window.!fullscreen)
_chwb2 focused $(bspwindows)
_chwb2 normal $(bspwindows inactive)
bspc subscribe node_state node_geometry node_focus | while read msg; do
_chwb2 focused $(bspc query -N -n .active.descendant_of.window.!fullscreen) &
_chwb2 normal $(bspc query -N -n .active.!descendant_of.window.!fullscreen) &
_chwb2 focused $(bspwindows) &
_chwb2 normal $(bspwindows inactive) &
done
@@ -4,25 +4,30 @@
# needs even borders, 4 parts, middle is 2 parts
# set border widths, if odd outer is 1px larger
border_width=`bspc config border_width`
border_width=$(bspc config border_width)
if [ $border_width -lt 4 ]; then
border_width=4
bspc config border_width 4
fi
border_add=$((border_width%4))
border_width=$(( border_width - border_add ))
border_part=$((border_width/4))
border_middle=$((border_part * 2 + border_add))
focused=`bspc config focused_border_color | tr -d \#`
normal=`bspc config normal_border_color | tr -d \#`
focused=$(bspc config focused_border_color | tr -d \#)
normal=$(bspc config normal_border_color | tr -d \#)
draw() {
chwbb -i $border_part -o $border_part -m $border_middle -c $normal `bspc query -N -n .!descendant_of.window`
chwbb -i $border_part -o $border_part -m $border_middle -c $focused `bspc query -N -n .descendant_of.window`
chwbb -i $border_part -o $border_part -m $border_middle -c $normal $(bspwindows inactive)
chwbb -i $border_part -o $border_part -m $border_middle -c $focused $(bspwindows)
}
# initial draw
draw
# reactive draw
bspc subscribe node_{geometry,focus} | while read msg; do
bspc subscribe node_geometry node_focus | while read msg; do
draw
done
@@ -52,16 +52,12 @@ non_terminals() {
}
draw() {
non_terminals $border_color_active $(bspc query -N -n .active.descendant_of.window.leaf.!fullscreen)
non_terminals $border_color_normal $(bspc query -N -n .active.!descendant_of.window.leaf.!fullscreen)
non_terminals $border_color_active $(bspwindows)
non_terminals $border_color_normal $(bspwindows inactive)
}
draw
# bspc subscribe node_{geometry,focus} | while read msg; do
bspc subscribe node_state node_geometry node_focus | while read msg; do
echo $msg
draw
done

0 comments on commit 9409184

Please sign in to comment.