{ config, lib, pkgs, ... }: let get_spotify_status = pkgs.writeShellScript "get_spotify_status.sh" '' #!/bin/bash PARENT_BAR="example" PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1) PLAYER="playerctld" FORMAT="{{ title }} - {{ artist }}" update_hooks() { while IFS= read -r id; do polybar-msg -p "$id" hook spotify-play-pause $2 1>/dev/null 2>&1 done < <(echo "$1") } PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null) EXIT_CODE=$? if [ $EXIT_CODE -eq 0 ]; then STATUS=$PLAYERCTL_STATUS else STATUS="No player is running" fi if [ "$1" == "--status" ]; then echo "$STATUS" else if [ "$STATUS" = "Stopped" ]; then echo "Music Stopped" elif [ "$STATUS" = "Paused" ]; then update_hooks "$PARENT_BAR_PID" 2 playerctl --player=$PLAYER metadata --format "$FORMAT" elif [ "$STATUS" = "No player is running" ]; then echo "Music Off" else update_hooks "$PARENT_BAR_PID" 1 playerctl --player=$PLAYER metadata --format "$FORMAT" fi fi ''; hidePolybarInFullscreen = pkgs.writeShellScript "hidePolybarInFullscreen.sh" '' #!/usr/bin/env bash sleep 1 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 ''; in { services = { xserver = { enable = true; windowManager.i3 = { enable = true; }; }; displayManager.defaultSession = "none+i3"; }; home = { }; }