From 319e9336db09e6025ce3c32bbecbcb8f758d86f2 Mon Sep 17 00:00:00 2001 From: Ahwx Date: Thu, 1 Jan 2026 14:40:25 +0100 Subject: [PATCH] feat: adds pomodoro package for waybar --- modules/home/waybar/scripts.nix | 8 ++--- .../home/waybar/waybar-module-pomodoro.nix | 31 +++++++++++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 modules/home/waybar/waybar-module-pomodoro.nix diff --git a/modules/home/waybar/scripts.nix b/modules/home/waybar/scripts.nix index c3723c0..b5ab0c7 100644 --- a/modules/home/waybar/scripts.nix +++ b/modules/home/waybar/scripts.nix @@ -1,12 +1,11 @@ { pkgs, username, - config, + lib, ... }: let - # homeExternalIPv4 = "${pkgs.coreutils}/bin/cat ${config.sops.secrets.homeExternalIPv4.path}"; - homeExternalIPv4 = "92.118.0.69"; + waybar-module-pomodoro = pkgs.callPackage ./waybar-module-pomodoro.nix { }; in { home.file = { @@ -242,7 +241,7 @@ in NODE="$(mullvad status | grep -Ei 'relay' | awk '{print $2}' | tr '[:upper:]' '[:lower:]')" LOCATION="$(mullvad status | grep -Ei 'location' | cut -d':' -f2 | cut -d'.' -f1 | sed 's/ //g')" IPV4="$(mullvad status | grep 'IPv4' | cut -d':' -f3 | sed 's/ //g')" - echo "$IPV4" | grep -q "${homeExternalIPv4}" && LOCATION="home" + echo "$IPV4" | grep -q "92.118.0.69" && LOCATION="home" echo "$STATUS" | grep -Eioq 'connected|connecting' && TEXT="{\"text\":\"$STATUS ($LOCATION)\",\"location\":\"$LOCATION\",\"node\":\"$NODE\"}" # || ip address show tailscale0 | grep "global tailscale0" && TEXT="{\"text\":\"tailscale ($LOCATION)\",\"location\":\"$LOCATION\",\"node\":\"$NODE\"}" echo "$STATUS" | grep -Eioq 'disconnected' && TEXT="{\"text\":\"$STATUS\",\"location\":\"$LOCATION\",\"node\":\"$NODE\"}" @@ -255,5 +254,6 @@ in wf-recorder bemenu ncspot + waybar-module-pomodoro ]; } diff --git a/modules/home/waybar/waybar-module-pomodoro.nix b/modules/home/waybar/waybar-module-pomodoro.nix new file mode 100644 index 0000000..170a50e --- /dev/null +++ b/modules/home/waybar/waybar-module-pomodoro.nix @@ -0,0 +1,31 @@ +{ + lib, + pkgs, + rustPlatform, + fetchFromGitHub, + writableTmpDirAsHomeHook, + ... +}: +rustPlatform.buildRustPackage { + pname = "waybar-module-pomodoro"; + version = "0.0.1"; + + src = fetchFromGitHub { + owner = "Andeskjerf"; + repo = "waybar-module-pomodoro"; + hash = "sha256-vB5WROn/GmaJyLNHnyfhTZItjQlJ+LMXMw8gOT1GM0s="; + rev = "3867b25ab691c4a697ee2ffca76d7cc9408675cc"; + }; + + cargoHash = "sha256-FTzqNkGn1dk+pdee8U07NI/uqUR6/gs51ZWOpYro3j8="; + + nativeCheckInputs = [ + writableTmpDirAsHomeHook + ]; + + meta = { + description = "waybar module that provides a pomodoro timer"; + homepage = "https://github.com/Andeskjerf/waybar-module-pomodoro"; + maintainers = [ ]; + }; +}