diff options
Diffstat (limited to 'extras/HOME')
| -rwxr-xr-x | extras/HOME/.local/bin/spotify-control | 50 | ||||
| -rw-r--r-- | extras/HOME/.xmobarrc | 4 | ||||
| -rwxr-xr-x | extras/HOME/.xmonad/xmobar-weather | 9 |
3 files changed, 48 insertions, 15 deletions
diff --git a/extras/HOME/.local/bin/spotify-control b/extras/HOME/.local/bin/spotify-control index 751f562..e001eb6 100755 --- a/extras/HOME/.local/bin/spotify-control +++ b/extras/HOME/.local/bin/spotify-control @@ -12,27 +12,63 @@ then exit fi +function mpris2_dbus_player_do { + dbus-send \ + --print-reply \ + --dest=org.mpris.MediaPlayer2.spotify \ + /org/mpris/MediaPlayer2 \ + "org.mpris.MediaPlayer2.Player.$1" +} + +function mpris2_dbus_get_player_property { + dbus-send \ + --print-reply \ + --dest=org.mpris.MediaPlayer2.spotify \ + /org/mpris/MediaPlayer2 \ + org.freedesktop.DBus.Properties.Get \ + string:'org.mpris.MediaPlayer2.Player' "string:$1" +} + case $1 in "play") - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause + mpris2_dbus_player_do PlayPause ;; "next") - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next + mpris2_dbus_player_do Next ;; "prev") - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous + mpris2_dbus_player_do Previous ;; "getTitle") - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 1 "title"|egrep -v "title"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$ + mpris2_dbus_get_player_property 'Metadata' | \ + egrep -A 1 "title" | \ + egrep -v "title" | \ + cut -b 44- | \ + cut -d '"' -f 1 | \ + egrep -v ^$ ;; "getArtist") - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "artist"|egrep -v "artist"|egrep -v "array"|cut -b 27-|cut -d '"' -f 1|egrep -v ^$ + mpris2_dbus_get_player_property 'Metadata' | \ + -A 2 "artist" | \ + egrep -v "artist" | \ + egrep -v "array" | \ + cut -b 27- | \ + cut -d '"' -f 1 | \ + egrep -v ^$ ;; "getAlbum") - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "album"|egrep -v "album"|egrep -v "array"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$ + mpris2_dbus_get_player_property 'Metadata' | \ + egrep -A 2 "album" | \ + egrep -v "album" | \ + egrep -v "array" | \ + cut -b 44- | \ + cut -d '"' -f 1 | \ + egrep -v ^$ ;; "getStatus") - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|grep 'string "[^"]*"'|sed 's/.*"\(.*\)"[^"]*$/\1/' + mpris_dbus_get_player_property 'PlaybackStatus' | \ + grep 'string "[^"]*"' | \ + sed 's/.*"\(.*\)"[^"]*$/\1/' ;; *) echo "Unknown command: " $1 diff --git a/extras/HOME/.xmobarrc b/extras/HOME/.xmobarrc index e2a3e9f..916ba21 100644 --- a/extras/HOME/.xmobarrc +++ b/extras/HOME/.xmobarrc @@ -2,7 +2,7 @@ Config { font = "xft:Monofur Nerd Font:size=12" , additionalFonts = [ "xft:Monofur bold Nerd Font:style=bold:size=12", - "xft:Monofur Nerd Font:size=9", + "xft:Monofur Bold Nerd Font:size=9", "xft:Monofur Nerd Font:size=9", "xft:Monofur Nerd Font:size=6", "xft:Monofur bold Nerd Font:size=15", @@ -30,7 +30,7 @@ Config , template = " %logo% <fc=#a0a0a0><fn=3>%uname%</fn></fc><fc=#404040> │\ \</fc><fc=#a0a0a0> %date%</fc><fc=#404040> │ \ - \</fc>%StdinReader%}<fn=6><fc=#909090>%time%</fc></fn>\ + \</fc>%StdinReader%}<fn=2><fc=#606060>%time%</fc></fn>\ \{ %cpu% %memory% <fc=#404040>\ \│</fc> %weather% <fc=#404040>│\ \</fc> <fc=#a0a0a0>%mpris2%</fc> <fc=#404040>│ \ diff --git a/extras/HOME/.xmonad/xmobar-weather b/extras/HOME/.xmonad/xmobar-weather index d9dc88b..e8ce28e 100755 --- a/extras/HOME/.xmonad/xmobar-weather +++ b/extras/HOME/.xmonad/xmobar-weather @@ -1,18 +1,16 @@ #!/usr/bin/perl -use LWP::Simple; use Time::Local; use POSIX; -$content = get("https://ipinfo.io"); +$content = `curl https://ipinfo.io`; die "Unable to get IP info" unless defined $content; ($city, $lat, $lon) = ($content =~ m/.*"city":\s+"([^"]+)".*"loc":\s+"(-?[0-9.]+),(-?[0-9.]+).*"/ims); -$content = get( - "https://api.sunrise-sunset.org/json?lat=$lat&lng=$lon&formatted=0"); +$content = `curl "https://api.sunrise-sunset.org/json?lat=$lat&lng=$lon&formatted=0"`; die "Unable to get sunrise/sunset data" unless defined $content; @@ -22,8 +20,7 @@ $sunrise_str =~ s#.*"sunrise":"([^"]*)".*#\1#; $sunset_str =~ s#.*"sunset":"([^"]*)".*#\1#; $current_str=strftime "%Y-%m-%dT%H:%M:%S+00:00", gmtime(); -$content = get( - "https://tgftp.nws.noaa.gov/data/observations/metar/decoded/KLMO.TXT"); +$content = `curl "https://tgftp.nws.noaa.gov/data/observations/metar/decoded/KLMO.TXT"`; die "Unable to get weather data" unless defined $content; |