From 0cd456a7efbe738c2fceb139948de9e36054e34e Mon Sep 17 00:00:00 2001 From: Jake Ginesin Date: Fri, 3 Jan 2025 00:20:13 -0500 Subject: [PATCH] 171 current 2025-01-03 00:20:05 25.05.20241217.d3c42f1 6.6.66 * --- home/programs/polybar/default.nix | 6 ++++++ home/programs/polybar/scripts/bluetooth.sh | 16 ++++++++++++++++ home/scripts/nixos-rebuild.sh | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 home/programs/polybar/scripts/bluetooth.sh diff --git a/home/programs/polybar/default.nix b/home/programs/polybar/default.nix index 357a213..8f4be87 100644 --- a/home/programs/polybar/default.nix +++ b/home/programs/polybar/default.nix @@ -29,4 +29,10 @@ in { systemd.user.services.polybar = { Install.WantedBy = ["graphical-session.target"]; }; + + home.activation.copyPolybarScriptsDir = lib.mkAfter '' + mkdir -p ~/.config/polybar/scripts + cp -r ${./scripts}/* ~/.config/polybar/scripts + chmod -R u+w ~/.config/polybar/scripts + ''; } diff --git a/home/programs/polybar/scripts/bluetooth.sh b/home/programs/polybar/scripts/bluetooth.sh new file mode 100644 index 0000000..1fe52a7 --- /dev/null +++ b/home/programs/polybar/scripts/bluetooth.sh @@ -0,0 +1,16 @@ +if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ] +then + echo "" +else + if [ $(echo info | bluetoothctl | grep 'Device' | wc -c) -eq 0 ] + then + echo "" + fi + device=$(bluetoothctl info | grep "Name" | cut -d ' ' -f 2-) + if [[ "$device" == "" ]] + then + echo "%{F#2193ff}" + else + echo "%{F#2193ff} %{F#ffffff}[$device]" + fi +fi diff --git a/home/scripts/nixos-rebuild.sh b/home/scripts/nixos-rebuild.sh index c4cfefa..0284f37 100644 --- a/home/scripts/nixos-rebuild.sh +++ b/home/scripts/nixos-rebuild.sh @@ -10,6 +10,7 @@ pushd /home/synchronous/nix-cfg # Early return if no changes were detected (thanks @singiamtel!) +git --git-dir /home/synchronous/nix-cfg/.git add . if git --git-dir /home/synchronous/nix-cfg/.git diff --quiet; then echo "No changes detected, exiting." popd @@ -45,7 +46,7 @@ fi current=$(nixos-rebuild list-generations | grep current) # Commit all changes witih the generation metadata -git --git-dir /home/synchronous/nix-cfg/.git add . +# git --git-dir /home/synchronous/nix-cfg/.git add . git --git-dir /home/synchronous/nix-cfg/.git commit -am "$current" # Back to where you were