aboutsummaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2021-11-08 09:43:39 -0700
committerJosh Rahm <rahm@google.com>2021-11-08 09:43:39 -0700
commit909665a8e8938de4e6f62b2da3e32f6597b3a8a5 (patch)
treefb697ba94b73283ce4dcc962e7ae87df02bf230b /extras
parent278cf20058ad788676a7abe82a65083f41f84e17 (diff)
parentefef2ad31b0a1ce7ebcc2a635114f5a1d3f82ec8 (diff)
downloadrde-909665a8e8938de4e6f62b2da3e32f6597b3a8a5.tar.gz
rde-909665a8e8938de4e6f62b2da3e32f6597b3a8a5.tar.bz2
rde-909665a8e8938de4e6f62b2da3e32f6597b3a8a5.zip
Merge remote-tracking branch 'josher/master'master
Diffstat (limited to 'extras')
-rwxr-xr-xextras/HOME/.local/bin/spotify-control50
-rw-r--r--extras/HOME/.xmobarrc4
-rwxr-xr-xextras/HOME/.xmonad/xmobar-weather9
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;