diff --git a/modules/hosts/t480/dwm/blocks.nix b/modules/hosts/t480/dwm/blocks.nix deleted file mode 100644 index 34b1f165..00000000 --- a/modules/hosts/t480/dwm/blocks.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - flake.modules.homeManager.gui = { pkgs, ... }: { - home.packages = [ pkgs.dwmblocks ]; - }; -} diff --git a/modules/hosts/t480/dwm/dwmblocks/audio.nix b/modules/hosts/t480/dwm/dwmblocks/audio.nix new file mode 100644 index 00000000..ddefba39 --- /dev/null +++ b/modules/hosts/t480/dwm/dwmblocks/audio.nix @@ -0,0 +1,21 @@ +{ + flake.modules.homeManager.gui = + { pkgs, ... }: + { + home.packages = [ + (pkgs.writeShellApplication { + name = "status-audio"; + + runtimeInputs = with pkgs; [ pulseaudio ]; + + text = '' + device="$(pactl list sinks | grep -A2 "$(pactl get-default-sink)" | grep "Description:" | awk '{print $2}')" + + test "$device" == "Dummy" && exit 0 + + echo "$device"; + ''; + }) + ]; + }; +} diff --git a/modules/hosts/t480/dwm/dwmblocks/battery.nix b/modules/hosts/t480/dwm/dwmblocks/battery.nix new file mode 100644 index 00000000..5abd5630 --- /dev/null +++ b/modules/hosts/t480/dwm/dwmblocks/battery.nix @@ -0,0 +1,23 @@ +{ + flake.modules.homeManager.gui = + { pkgs, ... }: + { + home.packages = [ + (pkgs.writeShellApplication { + name = "status-battery"; + + runtimeInputs = with pkgs; [ gawk ]; + + text = '' + percentage=$(battery | grep "percentage:" | awk '{print $2}') + + test "$percentage" == "100%" && exit 0 + + state=$(battery | grep "state:" | awk '{print $2}') + + echo "$percentage ($state)"; + ''; + }) + ]; + }; +} diff --git a/modules/hosts/t480/dwm/dwmblocks/default.nix b/modules/hosts/t480/dwm/dwmblocks/default.nix new file mode 100644 index 00000000..2522e214 --- /dev/null +++ b/modules/hosts/t480/dwm/dwmblocks/default.nix @@ -0,0 +1,24 @@ +{ + flake.modules.homeManager.gui = + { pkgs, ... }: + { + home.packages = [ + (pkgs.dwmblocks.override { + conf = '' + static const Block blocks[] = { + {"", "status-audio", 10, 0}, + + {"", "status-battery", 60, 0}, + + {"Mem: ", "free -h | awk '/^Mem/ { print $3\"/\"$2 }' | sed s/i//g", 30, 0}, + + {"", "date '+%x %R'", 30, 0}, + }; + + static char delim[] = " | "; + static unsigned int delimLen = 5; + ''; + }) + ]; + }; +} diff --git a/todo.txt b/todo.txt index 8c365f92..8f5d84dd 100644 --- a/todo.txt +++ b/todo.txt @@ -9,7 +9,6 @@ forgejo Create a Home Manager module for bluetuith. Enable tree-fmt -Configure dwmblocks. Error detected while processing BufWritePost Autocommands for "*": Error running vale: ENOENT: no such file or directory