1
0
Fork 0

Make mail counts clickable

This commit is contained in:
Jeremy Kaplan 2016-07-30 21:28:37 -04:00
commit 46c1f3be9d
2 changed files with 20 additions and 9 deletions

View file

@ -15,9 +15,15 @@ trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
bspc config bottom_padding $PANEL_HEIGHT
$XDG_CONFIG_HOME/panel/panel_bar.py | lemonbar -g x$PANEL_HEIGHT -f "$PANEL_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" -b &
$XDG_CONFIG_HOME/panel/panel_bar.py | lemonbar -g x$PANEL_HEIGHT -f "$PANEL_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" -b | while read -r line; do sh -c "$line"; done &
sleep 1
xdo lower $(xdo id -a bar)
wid=$(xdo id -a bar)
tries_left=20
while [ -z "$wid" -a "$tries_left" -gt 0 ] ; do
sleep 0.05
wid=$(xdo id -a "$PANEL_WM_NAME")
tries_left=$((tries_left - 1))
done
[ -n "$wid" ] && xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid"
wait

View file

@ -26,6 +26,9 @@ DIVIDER = '|'
def color_string(string, fg=PANEL_FOREGROUND, bg=PANEL_BACKGROUND):
return "%%{F%s}%%{B%s} %s %%{B-}%%{F-}" % (fg, bg, string)
def button(text, executable):
return '%{A:' + os.path.expanduser(executable) + ':}' + text + '%{A}'
divider = color_string(DIVIDER, fg='#FF444444')
def status_update(data):
@ -114,13 +117,15 @@ def mail_update(_):
if message_count:
colors['bg'] = color
colors['fg'] = '#FFFFFF'
counts.append(color_string(str(message_count), **colors))
return 'mail', color_string(''.join(counts))
mutt_config_path = os.path.expanduser('~/.mutt/{}'.format(account))
text = button(str(message_count), 'urxvt -e mutt -F {}'.format(mutt_config_path))
counts.append(color_string(text, **colors))
return 'mail', ''.join(counts)
def make_string(status, clock, volume, battery, wifi, mail):
print("%%{1}%s%%{c}%%{r}%s%s%s%s%s%s%s%s%s" %
(status, mail, divider, wifi, divider, volume, divider, battery, divider, clock))
bar = "%%{1}%s%%{c}%%{r}%s%s%s%s%s%s%s%s%s" % \
(status, mail, divider, wifi, divider, volume, divider, battery, divider, clock)
print(bar)
def open_socket(address):
try: