Make mail counts clickable
This commit is contained in:
parent
8881d790b6
commit
46c1f3be9d
2 changed files with 20 additions and 9 deletions
12
panel/panel
12
panel/panel
|
|
@ -15,9 +15,15 @@ trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
|
||||||
|
|
||||||
bspc config bottom_padding $PANEL_HEIGHT
|
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
|
wid=$(xdo id -a bar)
|
||||||
xdo lower $(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
|
wait
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@ DIVIDER = '|'
|
||||||
def color_string(string, fg=PANEL_FOREGROUND, bg=PANEL_BACKGROUND):
|
def color_string(string, fg=PANEL_FOREGROUND, bg=PANEL_BACKGROUND):
|
||||||
return "%%{F%s}%%{B%s} %s %%{B-}%%{F-}" % (fg, bg, string)
|
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')
|
divider = color_string(DIVIDER, fg='#FF444444')
|
||||||
|
|
||||||
def status_update(data):
|
def status_update(data):
|
||||||
|
|
@ -114,13 +117,15 @@ def mail_update(_):
|
||||||
if message_count:
|
if message_count:
|
||||||
colors['bg'] = color
|
colors['bg'] = color
|
||||||
colors['fg'] = '#FFFFFF'
|
colors['fg'] = '#FFFFFF'
|
||||||
counts.append(color_string(str(message_count), **colors))
|
mutt_config_path = os.path.expanduser('~/.mutt/{}'.format(account))
|
||||||
return 'mail', color_string(''.join(counts))
|
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):
|
def make_string(status, clock, volume, battery, wifi, mail):
|
||||||
print("%%{1}%s%%{c}%%{r}%s%s%s%s%s%s%s%s%s" %
|
bar = "%%{1}%s%%{c}%%{r}%s%s%s%s%s%s%s%s%s" % \
|
||||||
(status, mail, divider, wifi, divider, volume, divider, battery, divider, clock))
|
(status, mail, divider, wifi, divider, volume, divider, battery, divider, clock)
|
||||||
|
print(bar)
|
||||||
|
|
||||||
def open_socket(address):
|
def open_socket(address):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue