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
antigen bundle git
antigen bundle zsh-users/zsh-completions
antigen bundle pip
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-history-substring-search
#antigen bundle git
#antigen bundle zsh-users/zsh-completions
#antigen bundle pip
#antigen bundle zsh-users/zsh-syntax-highlighting
#antigen bundle zsh-users/zsh-history-substring-search
antigen bundle command-not-found
@@ -24,4 +24,4 @@ POWERLEVEL9K_ANACONDA_FOREGROUND='111'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
antigen theme bhilburn/powerlevel9k powerlevel9k
antigen apply
#antigen apply

View File

@@ -1,8 +1,8 @@
export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
[[ -s ${ZIM_HOME}/init.zsh ]] && source ${ZIM_HOME}/init.zsh
# source $HOME/bin/antigen.zsh
# antigen init $HOME/.antigenrc
#export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
#[[ -s ${ZIM_HOME}/init.zsh ]] && source ${ZIM_HOME}/init.zsh
#source $HOME/bin/antigen.zsh
#antigen init $HOME/.antigenrc
source "${HOME}/.zgenrc"
# source other dotfiles
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"
# snakemake autocomplete
if hash snakemake 2>/dev/null; then
compdef _gnu_generic snakemake
fi
#if hash snakemake 2>/dev/null; then
# compdef _gnu_generic snakemake
#fi

View File

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

View File

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

View File

@@ -1,13 +1,26 @@
#!/usr/bin/python2
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:
bus = dbus.SessionBus()
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
try:
out = str(props['xesam:artist'][0]) + " - " + str(props['xesam:title'])
try:
out = format_output((props['xesam:artist'][0]), str(props['xesam:title']), fmt)
except IndexError:
out = ''
print(out)