antigen and laptop polybar

This commit is contained in:
danijoo
2020-03-13 11:30:10 +01:00
parent c51f76c8ab
commit 35f9301aaf
5 changed files with 33 additions and 20 deletions

View File

@@ -1,11 +1,11 @@
antigen use oh-my-zsh --debug antigen use oh-my-zsh
# bundles # bundles
antigen bundle git #antigen bundle git
antigen bundle zsh-users/zsh-completions #antigen bundle zsh-users/zsh-completions
antigen bundle pip #antigen bundle pip
antigen bundle zsh-users/zsh-syntax-highlighting #antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-history-substring-search #antigen bundle zsh-users/zsh-history-substring-search
antigen bundle command-not-found antigen bundle command-not-found
@@ -24,4 +24,4 @@ POWERLEVEL9K_ANACONDA_FOREGROUND='111'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true POWERLEVEL9K_PROMPT_ON_NEWLINE=true
antigen theme bhilburn/powerlevel9k powerlevel9k antigen theme bhilburn/powerlevel9k powerlevel9k
antigen apply #antigen apply

View File

@@ -1,8 +1,8 @@
export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim #export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
[[ -s ${ZIM_HOME}/init.zsh ]] && source ${ZIM_HOME}/init.zsh #[[ -s ${ZIM_HOME}/init.zsh ]] && source ${ZIM_HOME}/init.zsh
#source $HOME/bin/antigen.zsh #source $HOME/bin/antigen.zsh
#antigen init $HOME/.antigenrc #antigen init $HOME/.antigenrc
source "${HOME}/.zgenrc"
# source other dotfiles # source other dotfiles
source $HOME/.environment source $HOME/.environment
@@ -42,6 +42,6 @@ eval "$(fasd --init auto)"
[[ -s "$HOME/.local/share/marker/marker.sh" ]] && source "$HOME/.local/share/marker/marker.sh" [[ -s "$HOME/.local/share/marker/marker.sh" ]] && source "$HOME/.local/share/marker/marker.sh"
# snakemake autocomplete # snakemake autocomplete
if hash snakemake 2>/dev/null; then #if hash snakemake 2>/dev/null; then
compdef _gnu_generic snakemake # compdef _gnu_generic snakemake
fi #fi

View File

@@ -6,7 +6,7 @@ killall -q polybar
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch bar1 and bar2 # Launch bar1 and bar2
polybar -c ~/.config/polybar/config workstation & polybar -c ~/.config/polybar/config laptop &
polybar -c ~/.config/polybar/config workstation2 & polybar -c ~/.config/polybar/config laptop_extern &
echo "Bars launched..." echo "Bars launched..."

View File

@@ -333,7 +333,7 @@ format=GPU <label>
[module/spotify] [module/spotify]
type=custom/script type=custom/script
exec=python3 ~/.config/polybar/spotify.py exec=python3 ~/.config/polybar/spotify.py "{artist} - {title}"
interval=1 interval=1
tail=false tail=false
format= <label> format= <label>

View File

@@ -1,13 +1,26 @@
#!/usr/bin/python2 #!/usr/bin/python2
import dbus import dbus
from sys import argv
if len(argv) > 1:
fmt = argv[1]
else:
fmt = None
def format_output(artist, title, fmt=None):
if fmt is None:
fmt = "{artist} - {title}"
return fmt.format(artist=artist, title=title)
try: try:
bus = dbus.SessionBus() bus = dbus.SessionBus()
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2") spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties') spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata') props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
try: try:
out = str(props['xesam:artist'][0]) + " - " + str(props['xesam:title']) out = format_output((props['xesam:artist'][0]), str(props['xesam:title']), fmt)
except IndexError: except IndexError:
out = '' out = ''
print(out) print(out)