mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
Enable kdeconnect-indicator; only show spotify info if spotify is running
This commit is contained in:
@@ -141,7 +141,10 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.kdeconnect.enable = true;
|
services.kdeconnect = {
|
||||||
|
enable = true;
|
||||||
|
indicator = true;
|
||||||
|
};
|
||||||
|
|
||||||
services.dunst = with import ./theme.nix; {
|
services.dunst = with import ./theme.nix; {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@@ -1,28 +1,30 @@
|
|||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
let
|
let
|
||||||
spotify_info = pkgs.writeBash "spotify.info" ''
|
spotify_info = pkgs.writeBash "spotify.info" ''
|
||||||
STATUS=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|egrep -A 1 "string"|cut -b 26-|cut -d '"' -f 1|egrep -v ^$)
|
if $(pgrep spotify); then
|
||||||
|
STATUS=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|egrep -A 1 "string"|cut -b 26-|cut -d '"' -f 1|egrep -v ^$)
|
||||||
|
|
||||||
if [[ "$STATUS" == 'Playing' ]]; then
|
if [[ "$STATUS" == 'Playing' ]]; then
|
||||||
printf '\uf1bc '
|
printf '\uf1bc '
|
||||||
printf '\uf04b'
|
printf '\uf04b'
|
||||||
elif [[ "$STATUS" == 'Paused' ]]; then
|
elif [[ "$STATUS" == 'Paused' ]]; then
|
||||||
printf '\uf1bc '
|
printf '\uf1bc '
|
||||||
printf '\uf04c'
|
printf '\uf04c'
|
||||||
elif [[ "$STATUS" == 'Stopped' ]]; then
|
elif [[ "$STATUS" == 'Stopped' ]]; then
|
||||||
printf '\uf1bc '
|
printf '\uf1bc '
|
||||||
printf '\uf04d'
|
printf '\uf04d'
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf ' '
|
||||||
|
|
||||||
|
METADATA=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata')
|
||||||
|
ARTIST=$(echo "$METADATA" | egrep -A 2 "artist" | egrep -v "artist" | egrep -v "array" | cut -b 27- | cut -d '"' -f 1 | egrep -v ^$)
|
||||||
|
TITLE=$(echo "$METADATA" | egrep -A 1 "title" | egrep -v "title" | cut -b 44- | cut -d '"' -f 1 | egrep -v ^$)
|
||||||
|
|
||||||
|
printf "%s \u2237 %s" "$ARTIST" "$TITLE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf ' '
|
|
||||||
|
|
||||||
METADATA=$(${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata')
|
|
||||||
ARTIST=$(echo "$METADATA" | egrep -A 2 "artist" | egrep -v "artist" | egrep -v "array" | cut -b 27- | cut -d '"' -f 1 | egrep -v ^$)
|
|
||||||
TITLE=$(echo "$METADATA" | egrep -A 1 "title" | egrep -v "title" | cut -b 44- | cut -d '"' -f 1 | egrep -v ^$)
|
|
||||||
|
|
||||||
printf "%s \u2237 %s" "$ARTIST" "$TITLE"
|
|
||||||
'';
|
'';
|
||||||
battery_info = pkgs.writeBash "battery.info" ''
|
battery_info = pkgs.writeBash "battery.info" ''
|
||||||
BAT_DIR="/sys/class/power_supply/$BLOCK_INSTANCE/"
|
BAT_DIR="/sys/class/power_supply/$BLOCK_INSTANCE/"
|
||||||
|
|||||||
Reference in New Issue
Block a user