From 84c2c7a6a6c3e358737f896f8dcc9efd61b53a0d Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 8 Aug 2024 13:27:14 +0200 Subject: [PATCH 1/6] Fix gh-notify script --- .../scripts/packages/gh-notify/gh-notify.sh | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh b/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh index 206cfc8..5f31015 100644 --- a/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh +++ b/home/packages/cli/scripts/packages/gh-notify/gh-notify.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # Parse arguments # ------------------------------------------------------------------------------------ @@ -186,7 +186,9 @@ send_notify() { # Obtain notifications and show them, if they weren't showed (aren't in cache) already # ------------------------------------------------------------------------------------ # Request unread notifications with gh-notify extension for github-cli +[ $VERY_VERBOSE -eq 1 ] && echo "Requesting notifications..." [ "$ALL" -eq 1 ] && out="$(gh notify -s -a -n "$MAX_AMOUNT" 2>/dev/null)" || out="$(gh notify -s -n "$MAX_AMOUNT" 2>/dev/null)" +[ $VERY_VERBOSE -eq 1 ] && echo "Notifications received" # When no notifications were found, set output to empty string, to avoid 'All caught up!' line # being treated as notification @@ -216,18 +218,18 @@ if [ "$total" -gt 0 ]; then [ $VERY_VERY_VERBOSE -eq 1 ] && echo "gh-notify output line: $line" # Parse out the data from given output lines - issue_type="$(echo "$line" | awk '{print $4}' | sed 's/\x1b\[[0-9;]*m//g')" - repo_id="$(echo "$line" | awk '{print $3}' | sed 's/\x1b\[[0-9;]*m//g')" + issue_type="$(echo "$line" | awk -F ' +' '{print $4}' | sed 's/\x1b\[[0-9;]*m//g')" + repo_id="$(echo "$line" | awk -F ' +' '{print $3}' | sed 's/\x1b\[[0-9;]*m//g')" if [ "$issue_type" == "PullRequest" ]; then - issue_id="$(echo "$line" | awk '{print $5}' | sed 's/\x1b\[[0-9;]*m//g' | cut -c2-)" - description="$(echo "$line" | awk '{for (i=6; i Date: Thu, 8 Aug 2024 13:27:35 +0200 Subject: [PATCH 2/6] Persist github cli accounts --- hosts/voyager/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/voyager/default.nix b/hosts/voyager/default.nix index f63d250..753c0d9 100644 --- a/hosts/voyager/default.nix +++ b/hosts/voyager/default.nix @@ -101,6 +101,7 @@ ".cache/walker/history.gob" ".config/pcmanfm-qt/default/recent-files.conf" ".config/qalculate/qalculate-gtk.cfg" + ".config/gh/hosts.yml" ".local/state/python_history" ]; From afe36153298cebc06b4d153b2d7a0803d5cb2bb4 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 8 Aug 2024 13:35:09 +0200 Subject: [PATCH 3/6] Add gh-notify service & timer --- home/services/default.nix | 1 + home/services/gh-notify.nix | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 home/services/gh-notify.nix diff --git a/home/services/default.nix b/home/services/default.nix index d1a6cb7..20e9699 100644 --- a/home/services/default.nix +++ b/home/services/default.nix @@ -3,5 +3,6 @@ _: { ./dunst.nix ./hyprpaper.nix ./hypridle.nix + ./gh-notify.nix ]; } diff --git a/home/services/gh-notify.nix b/home/services/gh-notify.nix new file mode 100644 index 0000000..1b2a894 --- /dev/null +++ b/home/services/gh-notify.nix @@ -0,0 +1,31 @@ +{ + lib, + pkgs, + ... +}: let + inherit (lib) getExe; + + scriptPkgs = import ../packages/cli/scripts/packages {inherit pkgs;}; +in { + systemd.user = { + services.gh-notify = { + Unit = { + Description = "Show unread GitHub notifications"; + After = ["dunst.service"]; + }; + Install.WantedBy = ["graphical-session.target"]; + Service = { + ExecStart = "${getExe scriptPkgs.gh-notify} -vv"; + Type = "oneshot"; + RemainAfterExit = false; + Restart = "on-failure"; + RestartSec = "3s"; + }; + }; + timers.gh-notify = { + Unit.Description = "Timer of GitHub notification sendout"; + Timer.OnUnitActiveSec = "1m"; + Install.WantedBy = ["graphical-session.target"]; + }; + }; +} From ac41a455ca7c5874158df669bdddf7793ce6cd39 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 8 Aug 2024 13:35:20 +0200 Subject: [PATCH 4/6] Add gohu nerd font --- system/roles/workstation/fonts.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/system/roles/workstation/fonts.nix b/system/roles/workstation/fonts.nix index 03b5586..395a27b 100644 --- a/system/roles/workstation/fonts.nix +++ b/system/roles/workstation/fonts.nix @@ -106,6 +106,7 @@ in { "FiraMono" "Hack" "HeavyData" + "Gohu" ]; }) ]; From 190aa4f69b2d5ce5937640cf4b9213ce85978322 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 8 Aug 2024 13:35:32 +0200 Subject: [PATCH 5/6] Add bug notice for dunst having hard-coded xdg-open --- home/services/dunst.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/services/dunst.nix b/home/services/dunst.nix index 5293437..6c265d9 100644 --- a/home/services/dunst.nix +++ b/home/services/dunst.nix @@ -9,6 +9,7 @@ cfg = osConfig.myOptions.home-manager.services.dunst; in { config = mkIf cfg.enable { + # BUG: Dunst seems to have /usr/bin/xdg-open hardcoded services.dunst = { enable = true; iconTheme = { From 953589075efd900105daa89c9910d45a963d0303 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 8 Aug 2024 13:39:19 +0200 Subject: [PATCH 6/6] Don't auto-pause dunst notifications (causes issues) --- home/services/hypridle.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home/services/hypridle.nix b/home/services/hypridle.nix index 9c4f053..3353ec4 100644 --- a/home/services/hypridle.nix +++ b/home/services/hypridle.nix @@ -14,10 +14,9 @@ in { enable = true; settings = { general = { - lock_cmd = "hyprlock && dunstctl set-paused true"; + lock_cmd = "hyprlock"; unlock_cmd = "killall -s SIGUSR1 hyprlock && dustctl set-paused false"; before_sleep_cmd = "loginctl lock-session && dunstctl set-paused true && sleep 2"; - after_sleep_cmd = "dunstctl set-paused false"; ignore_dbus_inhibit = false; ignore_systemd_inhibit = false; }; @@ -34,7 +33,8 @@ in { # Lock the session & disable dunst notifications { timeout = 310; - on-timeout = "loginctl lock-session"; + on-timeout = "loginctl lock-session && dunstctl set-paused true"; + on-resume = "dunstctl set-paused false"; } # Turn off the screen after another 50s