Compare commits

..

No commits in common. "953589075efd900105daa89c9910d45a963d0303" and "8b0bd140dbcbacf42c3cd45c8871e421c2a7bea8" have entirely different histories.

7 changed files with 15 additions and 52 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# Parse arguments
# ------------------------------------------------------------------------------------
@ -186,9 +186,7 @@ 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
@ -218,18 +216,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 -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')"
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')"
if [ "$issue_type" == "PullRequest" ]; then
issue_id="$(echo "$line" | awk -F ' +' '{print $5}' | sed 's/\x1b\[[0-9;]*m//g' | cut -c2-)"
description="$(echo "$line" | awk -F ' +' '{for (i=6; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
issue_id="$(echo "$line" | awk '{print $5}' | sed 's/\x1b\[[0-9;]*m//g' | cut -c2-)"
description="$(echo "$line" | awk '{for (i=6; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
name="$repo_id ($issue_type #$issue_id)"
url="https://github.com/$repo_id/pull/$issue_id"
elif [ "$issue_type" == "Issue" ]; then
issue_id="$(echo "$line" | awk -F ' +' '{print $5}' | sed 's/\x1b\[[0-9;]*m//g' | cut -c2-)"
description="$(echo "$line" | awk -F ' +' '{for (i=6; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
issue_id="$(echo "$line" | awk '{print $5}' | sed 's/\x1b\[[0-9;]*m//g' | cut -c2-)"
description="$(echo "$line" | awk '{for (i=6; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
name="$repo_id ($issue_type #$issue_id)"
url="https://github.com/$repo_id/issues/$issue_id"
@ -238,26 +236,26 @@ if [ "$total" -gt 0 ]; then
# this means if the name is the same, they will be treated as the same release
# and they could end up being ignored, this could be fixed by using github API and
# searching for that release's commit, but that's too much work here for little benefit
description="$(echo "$line" | awk -F ' +' '{for (i=5; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
description="$(echo "$line" | awk '{for (i=5; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
name="$repo_id ($issue_type)"
# Because we don't know the tag or commit ID, best we can do is use the page for all releases
# the new release will be the first one there anyway
url="https://github.com/$repo_id/releases"
elif [ "$issue_type" == "Commit" ]; then
description="$(echo "$line" | awk -F ' +' '{for (i=5; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
description="$(echo "$line" | awk '{for (i=5; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
name="$repo_id ($issue_type)"
# Because we don't know the commit SHA, just go to the repo itself
url="https://github.com/$repo_id"
elif [ "$issue_type" == "Discussion" ]; then
description="$(echo "$line" | awk -F ' +' '{for (i=5; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
description="$(echo "$line" | awk '{for (i=5; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
name="$repo_id ($issue_type)"
# Annoyingly, the discussion ID isn't included here, so best we can do is go to the discussions section
url="https://github.com/$repo_id/discussions"
elif [ "$issue_type" == "RepositoryDependabotAlertsThread" ]; then
description="$(echo "$line" | awk -F ' +' '{for (i=5; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
description="$(echo "$line" | awk '{for (i=5; i<NF; i++) printf $i " "; print $NF}' | sed 's/\x1b\[[0-9;]*m//g')"
name="$repo_id ($issue_type)"
# The specific dependabot notification id isn't included, so this just goes to all security warnings for the repo
@ -311,7 +309,7 @@ if [ "$total" -gt 0 ]; then
# Add a new-line separator on very verbose to group prints from each iteration
[ $VERY_VERBOSE -eq 1 ] && echo ""
done || true
done
# Recover amount of sent notifications from the temporary file
sent="$(cat "$sent_count_file")"

View file

@ -3,6 +3,5 @@ _: {
./dunst.nix
./hyprpaper.nix
./hypridle.nix
./gh-notify.nix
];
}

View file

@ -9,7 +9,6 @@
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 = {

View file

@ -1,31 +0,0 @@
{
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"];
};
};
}

View file

@ -14,9 +14,10 @@ in {
enable = true;
settings = {
general = {
lock_cmd = "hyprlock";
lock_cmd = "hyprlock && dunstctl set-paused true";
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;
};
@ -33,8 +34,7 @@ in {
# Lock the session & disable dunst notifications
{
timeout = 310;
on-timeout = "loginctl lock-session && dunstctl set-paused true";
on-resume = "dunstctl set-paused false";
on-timeout = "loginctl lock-session";
}
# Turn off the screen after another 50s

View file

@ -101,7 +101,6 @@
".cache/walker/history.gob"
".config/pcmanfm-qt/default/recent-files.conf"
".config/qalculate/qalculate-gtk.cfg"
".config/gh/hosts.yml"
".local/state/python_history"
];

View file

@ -106,7 +106,6 @@ in {
"FiraMono"
"Hack"
"HeavyData"
"Gohu"
];
})
];