Add neato BitBar plugins to the repo, since I'm basically writing my own anyway
This commit is contained in:
parent
49554fad86
commit
6d4334d189
7 changed files with 96 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.pyc
|
48
config/bitbar/bin/mpd-control.1h.zsh
Executable file
48
config/bitbar/bin/mpd-control.1h.zsh
Executable file
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
path+=(/usr/local/bin)
|
||||||
|
mpc==mpc
|
||||||
|
print -n ♫
|
||||||
|
|
||||||
|
state=$(mpc status | sed '/^[^\[]/d; s/^\[\(.*\)\].*$/\1/')
|
||||||
|
i=$(mpc current -f %position%)
|
||||||
|
|
||||||
|
if [[ $state == playing ]]; then
|
||||||
|
icon=' ▶ '
|
||||||
|
menu=("Ⅱ Pause | terminal=false bash=$mpc param1=pause")
|
||||||
|
else
|
||||||
|
icon=' Ⅱ '
|
||||||
|
menu=("▶ Play | terminal=false bash=$mpc param1=play")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $state ]]; then
|
||||||
|
print -n $icon
|
||||||
|
menu=(
|
||||||
|
"⏪ Previous | terminal=false bash=$mpc param1=prev"
|
||||||
|
$menu
|
||||||
|
"⏩ Next | terminal=false bash=$mpc param1=next"
|
||||||
|
"⏹ Stop | terminal=false bash=$mpc param1=stop"
|
||||||
|
)
|
||||||
|
else
|
||||||
|
i=0
|
||||||
|
print
|
||||||
|
fi
|
||||||
|
menu=(--- $menu "🔀 Shuffle | terminal=false bash=$mpc param1=shuffle" ---)
|
||||||
|
|
||||||
|
format=()
|
||||||
|
for field in position title artist; format+=($field %$field%)
|
||||||
|
|
||||||
|
songs=( ${(f)"$(mpc playlist -f ${(j-::-)format})"} )
|
||||||
|
typeset -A song
|
||||||
|
for s in $songs; do
|
||||||
|
song=(${(s/::/)s})
|
||||||
|
song[menu]="$song[title] - $song[artist] | length=50"
|
||||||
|
if (( $song[position] == $i )); then
|
||||||
|
print "$song[title] | length=30"
|
||||||
|
else
|
||||||
|
song[menu]+=" terminal=false bash=$mpc param1=play param2=$song[position]"
|
||||||
|
fi
|
||||||
|
menu+=($song[menu])
|
||||||
|
done
|
||||||
|
|
||||||
|
print -l -- $menu
|
9
config/bitbar/bin/taskpaper-ecoach.10s.py
Executable file
9
config/bitbar/bin/taskpaper-ecoach.10s.py
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
import sys
|
||||||
|
from os.path import abspath, dirname, join
|
||||||
|
|
||||||
|
LIB = join(dirname(dirname(abspath(sys.argv[0]))), 'lib')
|
||||||
|
sys.path.insert(0, LIB)
|
||||||
|
|
||||||
|
import taskpaper
|
||||||
|
taskpaper.count('~/Dropbox/Tasks/eCoach.taskpaper', icon='ecoach')
|
9
config/bitbar/bin/taskpaper-personal.10s.py
Executable file
9
config/bitbar/bin/taskpaper-personal.10s.py
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
import sys
|
||||||
|
from os.path import abspath, dirname, join
|
||||||
|
|
||||||
|
LIB = join(dirname(dirname(abspath(sys.argv[0]))), 'lib')
|
||||||
|
sys.path.insert(0, LIB)
|
||||||
|
|
||||||
|
import taskpaper
|
||||||
|
taskpaper.count('~/Dropbox/Tasks/Personal.taskpaper')
|
29
config/bitbar/lib/taskpaper/__init__.py
Normal file
29
config/bitbar/lib/taskpaper/__init__.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import base64
|
||||||
|
import inspect
|
||||||
|
import os.path as p
|
||||||
|
import sys
|
||||||
|
|
||||||
|
PATH = p.dirname(p.abspath(inspect.getfile(inspect.currentframe())))
|
||||||
|
|
||||||
|
def count(file, icon='default'):
|
||||||
|
project = ''
|
||||||
|
items = []
|
||||||
|
with open(p.expanduser(file)) as f:
|
||||||
|
for line in f:
|
||||||
|
if project.lower() == 'archive': break
|
||||||
|
line = line.strip()
|
||||||
|
if line.endswith(':'):
|
||||||
|
project = line[:-1]
|
||||||
|
elif line.startswith('- ') and '@done' not in line:
|
||||||
|
items.append('%s (%s)' % (line[2:], project))
|
||||||
|
|
||||||
|
if not items: return
|
||||||
|
|
||||||
|
with open(p.join(PATH, icon + '.png')) as img:
|
||||||
|
icon = base64.b64encode(img.read())
|
||||||
|
|
||||||
|
print("%d | templateImage='%s'" % (len(items), icon))
|
||||||
|
print('---')
|
||||||
|
print("%s | terminal=false bash=/usr/bin/open param1='%s'" % (file, p.expanduser(file)))
|
||||||
|
print('---')
|
||||||
|
for item in items: print(item)
|
BIN
config/bitbar/lib/taskpaper/default.png
Normal file
BIN
config/bitbar/lib/taskpaper/default.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 413 B |
BIN
config/bitbar/lib/taskpaper/ecoach.png
Normal file
BIN
config/bitbar/lib/taskpaper/ecoach.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 468 B |
Loading…
Reference in a new issue