1
0
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:
Kierán Meinhardt
2018-09-22 20:21:09 +02:00
parent 2de1088a89
commit 98b56b0cb0
2 changed files with 26 additions and 21 deletions

View File

@@ -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;

View File

@@ -1,6 +1,7 @@
{ pkgs, lib, config, ... }: { pkgs, lib, config, ... }:
let let
spotify_info = pkgs.writeBash "spotify.info" '' spotify_info = pkgs.writeBash "spotify.info" ''
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 ^$) 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
@@ -23,6 +24,7 @@ let
TITLE=$(echo "$METADATA" | egrep -A 1 "title" | egrep -v "title" | cut -b 44- | 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" printf "%s \u2237 %s" "$ARTIST" "$TITLE"
fi
''; '';
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/"