mirror of
https://github.com/Ahwxorg/nixos-config.git
synced 2025-12-04 23:00:14 +01:00
feat: adds ncspot module for waybar
This commit is contained in:
parent
1d755b2d52
commit
1dc166065b
2 changed files with 472 additions and 433 deletions
|
|
@ -29,6 +29,7 @@
|
|||
"modules-left": [
|
||||
"privacy",
|
||||
"group/network",
|
||||
"custom/spotify",
|
||||
"tray",
|
||||
],
|
||||
|
||||
|
|
@ -91,6 +92,14 @@
|
|||
"tooltip-format-disconnected": "Disconnected"
|
||||
},
|
||||
|
||||
"custom/spotify": {
|
||||
"interval": 1,
|
||||
"return-type": "json",
|
||||
"exec": "~/.local/bin/waybar-music",
|
||||
"on-click": "playerctl play-pause",
|
||||
"escape": true
|
||||
},
|
||||
|
||||
// "custom/vpn": {
|
||||
// "format": "{icon} VPN <span color='#aaaaaa'>{}</span>",
|
||||
// "format-icons": {
|
||||
|
|
@ -464,6 +473,11 @@
|
|||
background: #f9409d;
|
||||
}
|
||||
|
||||
#custom-spotify {
|
||||
color: #ffffff;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -152,10 +152,35 @@
|
|||
echo $(( (24 - $(date +%H)) * 60 - $(date +%M) ))
|
||||
'';
|
||||
};
|
||||
"/home/${username}/.local/bin/waybar-music" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
class=$(playerctl metadata --player=ncspot --format '{{lc(status)}}')
|
||||
|
||||
if [[ $class == "playing" ]]; then
|
||||
info=$(playerctl metadata --player=ncspot --format '{{artist}} - {{title}}')
|
||||
if [[ $\{#info} > 40 ]]; then
|
||||
info=$(echo $info | cut -c1-40)"..."
|
||||
fi
|
||||
text="$info"
|
||||
elif [[ $class == "paused" ]]; then
|
||||
info=$(playerctl metadata --player=ncspot --format '{{artist}} - {{title}}')
|
||||
if [[ $\{#info} > 40 ]]; then
|
||||
info=$(echo $info | cut -c1-40)"..."
|
||||
fi
|
||||
text=" $info"
|
||||
elif [[ $class == "stopped" ]]; then
|
||||
text=""
|
||||
fi
|
||||
|
||||
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"
|
||||
'';
|
||||
};
|
||||
};
|
||||
home.packages = with pkgs; [
|
||||
wf-recorder
|
||||
bemenu
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue