diff options
| author | Natasha Nightshade <31557030-TashaTheInnkeeper@users.noreply.gitlab.com> | 2026-02-02 13:35:20 +0100 |
|---|---|---|
| committer | Natasha Nightshade <31557030-TashaTheInnkeeper@users.noreply.gitlab.com> | 2026-02-02 13:35:20 +0100 |
| commit | 0ed5c638945192dc5e4a099fded4db164ba603a2 (patch) | |
| tree | 9d8a1a934ecf582502f556cc61af0da687840d70 | |
| parent | 154093573c13cdba63a6077710f4e09ccbe2ade3 (diff) | |
| parent | 5c741252de752af281628dd7c8c780c746236088 (diff) | |
Merge branch 'main' into 'master'
# Conflicts:
# configuration.nix
# hardware-configuration.nix
# mun.nix
| -rw-r--r-- | enviroments/i3wm.nix | 71 | ||||
| -rwxr-xr-x | modules/polybar.nix | 0 |
2 files changed, 71 insertions, 0 deletions
diff --git a/enviroments/i3wm.nix b/enviroments/i3wm.nix new file mode 100644 index 0000000..0421853 --- /dev/null +++ b/enviroments/i3wm.nix @@ -0,0 +1,71 @@ +{ 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 = { + + }; + +}
\ No newline at end of file diff --git a/modules/polybar.nix b/modules/polybar.nix new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/modules/polybar.nix |
