mirror of
https://github.com/ItsDrike/nixdots
synced 2025-01-24 03:24:34 +00:00
Compare commits
No commits in common. "953589075efd900105daa89c9910d45a963d0303" and "8b0bd140dbcbacf42c3cd45c8871e421c2a7bea8" have entirely different histories.
953589075e
...
8b0bd140db
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
# ------------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------------
|
||||||
|
@ -186,9 +186,7 @@ send_notify() {
|
||||||
# Obtain notifications and show them, if they weren't showed (aren't in cache) already
|
# 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
|
# 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)"
|
[ "$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
|
# When no notifications were found, set output to empty string, to avoid 'All caught up!' line
|
||||||
# being treated as notification
|
# being treated as notification
|
||||||
|
@ -218,18 +216,18 @@ if [ "$total" -gt 0 ]; then
|
||||||
[ $VERY_VERY_VERBOSE -eq 1 ] && echo "gh-notify output line: $line"
|
[ $VERY_VERY_VERBOSE -eq 1 ] && echo "gh-notify output line: $line"
|
||||||
|
|
||||||
# Parse out the data from given output lines
|
# Parse out the data from given output lines
|
||||||
issue_type="$(echo "$line" | awk -F ' +' '{print $4}' | 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 -F ' +' '{print $3}' | 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
|
if [ "$issue_type" == "PullRequest" ]; then
|
||||||
issue_id="$(echo "$line" | awk -F ' +' '{print $5}' | sed 's/\x1b\[[0-9;]*m//g' | cut -c2-)"
|
issue_id="$(echo "$line" | awk '{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')"
|
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)"
|
name="$repo_id ($issue_type #$issue_id)"
|
||||||
|
|
||||||
url="https://github.com/$repo_id/pull/$issue_id"
|
url="https://github.com/$repo_id/pull/$issue_id"
|
||||||
elif [ "$issue_type" == "Issue" ]; then
|
elif [ "$issue_type" == "Issue" ]; then
|
||||||
issue_id="$(echo "$line" | awk -F ' +' '{print $5}' | sed 's/\x1b\[[0-9;]*m//g' | cut -c2-)"
|
issue_id="$(echo "$line" | awk '{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')"
|
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)"
|
name="$repo_id ($issue_type #$issue_id)"
|
||||||
|
|
||||||
url="https://github.com/$repo_id/issues/$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
|
# 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
|
# 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
|
# 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)"
|
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
|
# 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
|
# the new release will be the first one there anyway
|
||||||
url="https://github.com/$repo_id/releases"
|
url="https://github.com/$repo_id/releases"
|
||||||
elif [ "$issue_type" == "Commit" ]; then
|
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)"
|
name="$repo_id ($issue_type)"
|
||||||
|
|
||||||
# Because we don't know the commit SHA, just go to the repo itself
|
# Because we don't know the commit SHA, just go to the repo itself
|
||||||
url="https://github.com/$repo_id"
|
url="https://github.com/$repo_id"
|
||||||
elif [ "$issue_type" == "Discussion" ]; then
|
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)"
|
name="$repo_id ($issue_type)"
|
||||||
|
|
||||||
# Annoyingly, the discussion ID isn't included here, so best we can do is go to the discussions section
|
# 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"
|
url="https://github.com/$repo_id/discussions"
|
||||||
elif [ "$issue_type" == "RepositoryDependabotAlertsThread" ]; then
|
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)"
|
name="$repo_id ($issue_type)"
|
||||||
|
|
||||||
# The specific dependabot notification id isn't included, so this just goes to all security warnings for the repo
|
# 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
|
# Add a new-line separator on very verbose to group prints from each iteration
|
||||||
[ $VERY_VERBOSE -eq 1 ] && echo ""
|
[ $VERY_VERBOSE -eq 1 ] && echo ""
|
||||||
done || true
|
done
|
||||||
|
|
||||||
# Recover amount of sent notifications from the temporary file
|
# Recover amount of sent notifications from the temporary file
|
||||||
sent="$(cat "$sent_count_file")"
|
sent="$(cat "$sent_count_file")"
|
||||||
|
|
|
@ -3,6 +3,5 @@ _: {
|
||||||
./dunst.nix
|
./dunst.nix
|
||||||
./hyprpaper.nix
|
./hyprpaper.nix
|
||||||
./hypridle.nix
|
./hypridle.nix
|
||||||
./gh-notify.nix
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
cfg = osConfig.myOptions.home-manager.services.dunst;
|
cfg = osConfig.myOptions.home-manager.services.dunst;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# BUG: Dunst seems to have /usr/bin/xdg-open hardcoded
|
|
||||||
services.dunst = {
|
services.dunst = {
|
||||||
enable = true;
|
enable = true;
|
||||||
iconTheme = {
|
iconTheme = {
|
||||||
|
|
|
@ -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"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -14,9 +14,10 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
general = {
|
general = {
|
||||||
lock_cmd = "hyprlock";
|
lock_cmd = "hyprlock && dunstctl set-paused true";
|
||||||
unlock_cmd = "killall -s SIGUSR1 hyprlock && dustctl set-paused false";
|
unlock_cmd = "killall -s SIGUSR1 hyprlock && dustctl set-paused false";
|
||||||
before_sleep_cmd = "loginctl lock-session && dunstctl set-paused true && sleep 2";
|
before_sleep_cmd = "loginctl lock-session && dunstctl set-paused true && sleep 2";
|
||||||
|
after_sleep_cmd = "dunstctl set-paused false";
|
||||||
ignore_dbus_inhibit = false;
|
ignore_dbus_inhibit = false;
|
||||||
ignore_systemd_inhibit = false;
|
ignore_systemd_inhibit = false;
|
||||||
};
|
};
|
||||||
|
@ -33,8 +34,7 @@ in {
|
||||||
# Lock the session & disable dunst notifications
|
# Lock the session & disable dunst notifications
|
||||||
{
|
{
|
||||||
timeout = 310;
|
timeout = 310;
|
||||||
on-timeout = "loginctl lock-session && dunstctl set-paused true";
|
on-timeout = "loginctl lock-session";
|
||||||
on-resume = "dunstctl set-paused false";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Turn off the screen after another 50s
|
# Turn off the screen after another 50s
|
||||||
|
|
|
@ -101,7 +101,6 @@
|
||||||
".cache/walker/history.gob"
|
".cache/walker/history.gob"
|
||||||
".config/pcmanfm-qt/default/recent-files.conf"
|
".config/pcmanfm-qt/default/recent-files.conf"
|
||||||
".config/qalculate/qalculate-gtk.cfg"
|
".config/qalculate/qalculate-gtk.cfg"
|
||||||
".config/gh/hosts.yml"
|
|
||||||
".local/state/python_history"
|
".local/state/python_history"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,6 @@ in {
|
||||||
"FiraMono"
|
"FiraMono"
|
||||||
"Hack"
|
"Hack"
|
||||||
"HeavyData"
|
"HeavyData"
|
||||||
"Gohu"
|
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue