Mic handling script with polybar integration

This commit is contained in:
Daniel Flanagan 2019-08-08 16:45:42 -05:00
parent 40f78e442c
commit a031cd1636
8 changed files with 61 additions and 12 deletions

View file

@ -154,3 +154,5 @@ hi Search cterm=NONE ctermbg=blue ctermfg=black
highlight LineNr ctermbg=none ctermfg=8
highlight CursorLineNr ctermbg=18 ctermfg=gray
hi IndentGuidesEven ctermbg=18
hi Normal ctermbg=NONE

36
de/bar/mic.bash Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env bash
pidfile="/var/run/user/$UID/polybar-mic-script.pid"
if [ -e "$pidfile" ]; then
kill "$(cat "${pidfile}")" > /dev/null 2>&1
cleanup
fi
cleanup() {
rm -f "$pidfile"
}
print_status() {
if amixer get Capture | grep -q '\[off\]'; then
echo ""
else
echo " "
fi
}
toggle() {
amixer set Capture toggle > /dev/null 2>&1
print_status
}
trap "cleanup" EXIT
trap "toggle" USR1
echo $$ > "$pidfile"
while true; do
print_status
sleep 1 &
wait
done

View file

@ -4,7 +4,7 @@
[colors]
foreground = ${xrdb:color7:#222222}
background = ${xrdb:color0:#111111}
background = #bb111111
tray-bg = #222222
@ -68,7 +68,7 @@ font-1 = ${env:BAR_ICON_FONT_DECLARATION}
modules-left = bspwm
modules-center = date
modules-right = cpu filesystem memory volume xbacklight xkeyboard temperature battery
modules-right = cpu filesystem memory volume microphone xbacklight xkeyboard temperature battery
tray-position = right
tray-padding = 0
@ -385,3 +385,11 @@ compositing-border = source
[global/wm]
margin-top = ${env:WINDOW_GAP}
margin-bottom = ${env:WINDOW_GAP}
[module/microphone]
type = custom/script
exec = $DOTFILES_PATH/de/bar/mic.bash
tail = true
format = <label>
label = %output%
click-left = kill -USR1 %pid%

View file

@ -1,6 +1,4 @@
shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
clearshadow = true;
shadow-radius = 20;
shadow-offset-x = -20;
@ -11,7 +9,6 @@ shadow-green = 0.0;
shadow-blue = 0.0;
shadow-ignore-shaped = false;
menu-opacity = 1.0;
inactive-opacity = 1.0;
active-opacity = 1.0;
frame-opacity = 1.0;
@ -20,7 +17,6 @@ inactive-opacity-override = false;
fading = true;
fade-in-step = 0.06;
fade-out-step = 0.06;
alpha-step = 0.1;
inactive-dim = 0.2;
focus-exclude = [ "n:e:rofi" ]
@ -28,19 +24,18 @@ focus-exclude = [ "n:e:rofi" ]
mark-wmwin-focused = true;
mark-ovredir-focused = false;
detect-rounded-corners = true;
detect-client-opacity = true;
detect-client-opacity = false;
vsync = "opengl-swc";
vsync = true;
backend = "glx";
refresh-rate = 0;
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
glx-copy-from-front = false;
xrender-sync-fence = true;
glx-swap-method = "buffer-age";
use-damage = true;
dbe = false;
paint-on-overlay = true;
detect-transient = true;
detect-client-leader = true;
invert-color-include = [ ];
@ -50,5 +45,7 @@ blur-background-frame = false;
wintypes :
{
tooltip : { fade = false; shadow = false; opacity = 0.75; };
dock : { fade = false; shadow = false; opacity = 1.0; };
dnd : { fade = false; shadow = false; opacity = 0.75; };
};

View file

@ -253,3 +253,6 @@ super + d
super + ctrl + c
bspc rule -a '*' -o state=floating && urxvtc --geometry 80x16 -e sh -c "khal calendar && bash"
super + shift + v
kill -USR1 $(cat "/var/run/user/$UID/polybar-mic-script.pid")

View file

@ -18,6 +18,8 @@
URxvt.font: xft:Iosevka:pixelsize=14,xft:Noto Emoji,xft:Font Awesome 5 Free:pixelsize=14,xft:FreeSans:pixelsize=14
URxvt.faceName: xft:Iosevka:pixelsize=14,xft:Font Awesome 5 Free:pixelsize=14,xft:FreeSans:pixelsize=14
URxvt.boldFont: xft:Iosevka:pixelsize=14:style=bold,xft:Font Awesome 5 Free:pixelsize=14,xft:FreeSans:pixelsize=14
# URxvt.transparent: true
# URxvt.shading: 70
URxvt.letterSpace: 0
## rxvt-unicode configuration
@ -36,7 +38,6 @@ URxvt.resize-font.smaller: C-Down
URxvt.resize-font.bigger: C-Up
URxvt.url-launcher: /usr/bin/xdg-open
URxvt.matcher.button: 1
URxvt.depth: 0
URxvt.iso14755: False
## Other Xorg configuration

View file

@ -122,3 +122,5 @@ _make_paths
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
[[ -s "/home/daniel/usr/.gvm/scripts/gvm" ]] && source "/home/daniel/usr/.gvm/scripts/gvm"

View file

@ -5,7 +5,7 @@ bind-key s send-prefix
bind-key T source-file ~/.tmux.conf \; display-message "source-file done"
# set-option -g mouse on
set-option -g mouse on
# honestly not sure
set -g escape-time 10