Permalink
Browse files

pulse audio thing

  • Loading branch information...
neeasade committed Jan 25, 2019
1 parent 80b1bae commit 2e24124daa37eed0df214fa27a7c35e914828c48
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# shut off mpc when other things start to play

while sleep 1; do
chrome_open_before=${chrome_open:-false}
mpv_playing_before=${mpv_playing:-false}
mpc_playing_before=${mpc_playing:-false}
qutebrowser_open_before=${qutebrowser_open:-false}

export clients="$(pactl list short clients)"
# always on when grabbed, eg youtube
# one for chrome, one per tab with handle
chrome_open=$(iif "[ $(echo "$clients" | rg -c chrome || echo 0) -gt 1 ]")
qutebrowser_open=$(iif 'echo "$clients" | rg python')
mpv_playing=$(iif 'mpvc | rg playing')
mpc_playing=$(iif 'mpc | rg playing')

# debug
# echo chrome: $chrome_open
# echo mpv: $mpv_playing
# echo qutebrowser: $qutebrowser_open
# echo chrome_before: $chrome_open_before
# echo mpv_before: $mpv_playing_before
# echo qutebrowser_before: $qutebrowser_open_before

if $chrome_open || $mpv_playing || $qutebrowser_open; then
# I generally turn the volume up for mpv things? idk
$mpv_playing && $mpc_playing_before && ponymix increase 45
$mpc_playing && mpc pause
else
if $chrome_open_before || $mpv_playing_before || $qutebrowser_open_before; then
$mpv_playing_before && ! $mpv_playing && ponymix decrease 45
$mpc_playing || mpc play
fi
fi
done
@@ -4,7 +4,10 @@ super + {_,shift} + w
bspc node -{c,k}

super + s
bspc node -t $(bspc query -N -n -n .tiled >/dev/null && echo floating || echo tiled)
bspc config pointer_follows_focus true; \
bspc node -t $(bspc query -N -n -n .tiled >/dev/null && echo floating || echo tiled); \
bspc node -f; \
bspc config pointer_follows_focus false

super + f
bspc node -t ~fullscreen
@@ -30,7 +30,7 @@ bspc config remove_unplugged_monitors true
bspc config remove_disabled_monitors true

bspc config pointer_modifier mod4
bspc config removal_adjustment none
bspc config removal_adjustment false

# external rules
bspc config external_rules_command "{{`echo -n $(which external_rules.sh)`}}"
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
# neeasade
# all switcher dmenu

switch=""
@@ -19,16 +18,10 @@ done
# emacs buffers
buffers="$(
elisp '(-remove (lambda (buffer)
(or
(s-match "magit" buffer)
(s-match "\*.*" buffer)
)
)
(mapcar
(function buffer-name)
(buffer-list)
)
)
(or (s-match "magit" buffer)
(s-match "\*.*" buffer)))
(mapcar (function buffer-name)
(buffer-list)))
' | sed 's/" "/\n/g;s/("//;s/")//'
)"

@@ -1,6 +1,5 @@
#!/bin/sh

bspc config pointer_follows_focus true
dir=$1
node=$(bspc query -N -n)

@@ -38,6 +37,7 @@ tiled_move() {
fi
}

bspc config pointer_follows_focus true
$(bspc query -T -n | jq -r .client.state)_move

bspc node -f
bspc config pointer_follows_focus false
@@ -28,12 +28,20 @@ targetNode=${targetNode:-focused}
moveArgs="$sign$(echo "$percent/100*$(bspc query -T -m | jq .rectangle.$targetProp)" | bc -l)"
[ $targetProp = "height" ] && moveArgs="0 $moveArgs" || moveArgs="$moveArgs 0"


bspc config pointer_follows_focus true

# note current state, initial move attempt.
beforeVal=$(dim $targetProp)
bspc node $targetNode -z $dir $moveArgs


# if we're floating, this is all that is needed.
bspc query -N -n focused.floating && exit 0
if bspc query -N -n focused.floating; then
bspc node -f
bspc config pointer_follows_focus false
exit 0
fi

# if we weren't successful, try resizing the other way
[ "$beforeVal" = "$(dim $targetProp)" ] && bspc node $targetNode -z $fallDir $moveArgs
@@ -51,3 +59,6 @@ if [ "$beforeVal" = "$(dim $targetProp)" ]; then
esac
bspc node $targetNode -z $dir $moveArgs &
fi

bspc node -f
bspc config pointer_follows_focus false
@@ -90,13 +90,14 @@ p_mpd_scroll_up="mpc seek +00:00:02"
p_mpd_scroll_down="mpc seek -00:00:02"
p_mpd_mouse_left="player.sh toggle"
p_mpd_mouse_right="player.sh next"
p_mpd_mouse_middle="mpc clear"

p_dynamicmpd_scroll_up="mpc seek +00:00:02"
p_dynamicmpd_scroll_down="mpc seek -00:00:02"
p_dynamicmpd_mouse_left="player.sh toggle"
p_dynamicmpd_mouse_right="player.sh next"

emacs_theme="spacemacs-dark"
emacs_theme="xresources"
emacs_powerline_scale="1.6"

# options
@@ -163,6 +164,16 @@ EOF
music_dir="$HOME/Music"
mpd_dir="$HOME/.config/mpd"

# 2bspwm script overrides
border_width_in_normal=$(( border_width_current/2 ))
border_width_out_normal=$(( (border_width_current/2) + (border_width_current%2) ))
border_width_in_focused=$border_width_in_normal
border_width_out_focused=$border_width_out_normal
border_color_out_normal=$(bspc config normal_border_color | tr -d \#)
border_color_in_normal=$(greaten $border_color_out_normal 30)
border_color_out_focused=$(bspc config focused_border_color | tr -d \#)
border_color_in_focused=$(greaten $border_color_out_focused 30)

# default template targets
# this allows themes to replace template files with different targets, by defining ${target}_template
for template in $(ls $HOME/.dotfiles/templates); do

0 comments on commit 2e24124

Please sign in to comment.