Somebody set up us the bomb.

This commit is contained in:
2026-06-06 18:44:07 +05:30
parent cc05650362
commit 09fc56d597
6 changed files with 45 additions and 7 deletions
+8 -4
View File
@@ -1,10 +1,11 @@
#!/bin/sh
notify() {
notify-send -i "$icon_path" -e -h "string:x-canonical-private-synchronous:${0##*/}" "[$1] ${2}" "$3"
notify-send -i "${4:-$icon_path}" -e "[$1] ${2}" "$3"
}
env_file="${XDG_CONFIG_HOME:-$HOME/.config}/.env"
#shellcheck source=/dev/null
. "$env_file"
ntfy_creds load
@@ -16,9 +17,12 @@ trap "ntfy_creds unload" EXIT
trap "ntfy_creds unload; exit 1" INT HUP
websocat --no-close "wss://${NTFY_URL#https://}/$NTFY_TOPIC_LISTEN/ws?auth=$token" | while IFS= read -r line; do
title=$(printf '%s' "$line" | sed -nE 's|.*,"title":"([^"]*)",.*|\1|p')
title=$(printf '%s' "$line" | sed -nE 's|.*,"title":"([^"]*)",?.*|\1|p')
topic=$(printf '%s' "$line" | sed -nE 's|.*,"topic":"([^"]*)",?.*|\1|p')
message=$(printf '%s' "$line" | sed -nE 's|.*,"message":"([^"]*)",.*|\1|p')
message=$(printf '%s' "$line" | sed -nE 's|.*,"message":"([^"]*)",?.*|\1|p')
icon=$(printf '%s' "$line" | sed -nE 's|.*,"icon":"([^"]*)",?.*|\1|p')
[ -n "$icon" ] && curl -sL "$icon" -o "/tmp/default.jpg" && icon="/tmp/default.jpg"
printf '%s' "$line" | grep -q '"open"' && notify "NTFY" "Listening" "$topic"
[ -z "$message" ] || notify "$topic" "${title:-NO TITLE}" "$message"
[ -z "$message" ] || notify "$topic" "${title:-NO TITLE}" "$message" "$icon"
[ -n "$icon" ] && unset icon
done
+1
View File
@@ -65,3 +65,4 @@ application/x-bittorrent=torrent.desktop;
application/x-desktop=nvim.desktop;
application/x-php=firefox.desktop;
audio/flac=mpv.desktop;
image/x-xcf=org.xfce.ristretto.desktop;
+2 -2
View File
@@ -25,8 +25,8 @@ focus_previous=0
side_pane_mode=places
view_mode=list
show_hidden=0
sort=name;ascending;
columns=name:200;desc:143;size:76;mtime:1119;
sort=mtime;ascending;
columns=name:200;desc:143;size:76;mtime:1134;
toolbar=newtab;navigation;home;
show_statusbar=1
pathbar_mode_buttons=0
+1 -1
View File
@@ -4,5 +4,5 @@ Description=Ntfy Subscribe Notifications
[Service]
Type=simple
ExecStart=%h/.config/hypr/ntfy_sub
Restart=on-failure
Restart=always
RestartSec=5
+32
View File
@@ -315,4 +315,36 @@ vpn() {
doas systemctl $query openvpn-client@vpn.service && printf "Openvpn %sed" "$query"
}
command_not_found_handler() {
local purple='\e[1;35m' bright='\e[0;1m' green='\e[1;32m' reset='\e[0m'
printf 'zsh: command not found: %s\n' "$1"
local entries=(
${(f)"$(/usr/bin/pacman -F --machinereadable -- "/usr/bin/$1")"}
)
if (( ${#entries[@]} ))
then
printf "${bright}$1${reset} may be found in the following packages:\n"
local pkg
for entry in "${entries[@]}"
do
# (repo package version file)
local fields=(
${(0)entry}
)
if [[ "$pkg" != "${fields[2]}" ]]
then
printf "${purple}%s/${bright}%s ${green}%s${reset}\n" "${fields[1]}" "${fields[2]}" "${fields[3]}"
fi
printf ' /%s\n' "${fields[4]}"
pkg="${fields[2]}"
done
fi
return 127
}
gen_string() {
head /dev/urandom | tr -cd "${2:-[:alnum:]}" | cut -c-${1:-12}
}
# vim: ft=zsh
+1
View File
@@ -45,6 +45,7 @@ fpath=($HOME/.config/zsh/completions $fpath)
autoload -Uz compinit
compinit
zstyle ':completion:*' menu select
trap 'rehash' USR1
eval "$(starship init zsh)"
#plugins