diff options
| author | Natasha Nightshade <31557030-TashaTheInnkeeper@users.noreply.gitlab.com> | 2026-02-02 13:35:51 +0100 |
|---|---|---|
| committer | Natasha Nightshade <31557030-TashaTheInnkeeper@users.noreply.gitlab.com> | 2026-02-02 13:35:51 +0100 |
| commit | 0423ac08769fce26e4a75ea382874c06d97526f6 (patch) | |
| tree | 9d8a1a934ecf582502f556cc61af0da687840d70 /modules/home/i3wm/scripts.nix | |
| parent | 5c741252de752af281628dd7c8c780c746236088 (diff) | |
| parent | 0ed5c638945192dc5e4a099fded4db164ba603a2 (diff) | |
Merge branch 'master' into 'main'
merge master into main
See merge request natasha-linux/nixos/dots!1
Diffstat (limited to 'modules/home/i3wm/scripts.nix')
| -rw-r--r-- | modules/home/i3wm/scripts.nix | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/modules/home/i3wm/scripts.nix b/modules/home/i3wm/scripts.nix new file mode 100644 index 0000000..4eb0b61 --- /dev/null +++ b/modules/home/i3wm/scripts.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: + +{ + home.packages = [ + (pkgs.writeShellScriptBin "get-spotify-status" '' + PARENT_BAR="example" + PLAYER="playerctld" + FORMAT="{{ title }} - {{ artist }}" + + PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null) + + if [ "$PLAYERCTL_STATUS" = "Playing" ]; then + playerctl --player=$PLAYER metadata --format "$FORMAT" + elif [ "$PLAYERCTL_STATUS" = "Paused" ]; then + echo "Paused" + else + echo "No music" + fi + '') + + (pkgs.writeShellScriptBin "polybar-hide-on-fullscreen" '' + i3-msg -t subscribe -m '[ "window" ]' | while read -r event; do + if echo "$event" | grep -q '"fullscreen_mode":[[:space:]]*1'; then + polybar-msg cmd hide + elif echo "$event" | grep -q '"fullscreen_mode":[[:space:]]*0'; then + polybar-msg cmd show + fi + done + '') + ]; +}
\ No newline at end of file |
