wip
This commit is contained in:
parent
308bdbebf9
commit
badcf3aa40
43 changed files with 1972 additions and 253 deletions
33
home-manager/scripts/notification/default.nix
Normal file
33
home-manager/scripts/notification/default.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
notif =
|
||||
pkgs.writeShellScriptBin "notif" # bash
|
||||
''
|
||||
# Shell script to send custom notifications
|
||||
# Usage: notif "sender_id" "message" ["description"]
|
||||
NOTIF_FOLDER="/tmp/notif"
|
||||
sender_id=$1 # To overwrite existing notifications
|
||||
title=$2
|
||||
description=$3
|
||||
|
||||
[[ -d "$NOTIF_FOLDER" ]] || mkdir $NOTIF_FOLDER
|
||||
[[ -f "$NOTIF_FOLDER/$sender_id" ]] || (echo "0" > "$NOTIF_FOLDER/$sender_id")
|
||||
|
||||
old_notification_id=$(cat "$NOTIF_FOLDER/$sender_id")
|
||||
[[ -z "$old_notification_id" ]] && old_notification_id=0
|
||||
|
||||
${pkgs.libnotify}/bin/notify-send \
|
||||
--replace-id="$old_notification_id" --print-id \
|
||||
--app-name="$sender_id" \
|
||||
"$title" \
|
||||
"$description" \
|
||||
> "$NOTIF_FOLDER/$sender_id"
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.libnotify
|
||||
notif
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue