From 09fc56d597bca5eaa6ebb8d08abd338b266aeda8 Mon Sep 17 00:00:00 2001 From: coolnsx Date: Sat, 6 Jun 2026 18:44:07 +0530 Subject: [PATCH] Somebody set up us the bomb. --- hypr/ntfy_sub | 12 ++++++++---- mimeapps.list | 1 + pcmanfm/default/pcmanfm.conf | 4 ++-- systemd/user/ntfy_sub.service | 2 +- zsh/functions | 32 ++++++++++++++++++++++++++++++++ zsh/zshrc | 1 + 6 files changed, 45 insertions(+), 7 deletions(-) diff --git a/hypr/ntfy_sub b/hypr/ntfy_sub index d33d079..1b2ab29 100755 --- a/hypr/ntfy_sub +++ b/hypr/ntfy_sub @@ -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 diff --git a/mimeapps.list b/mimeapps.list index 93f119d..58a1d3a 100644 --- a/mimeapps.list +++ b/mimeapps.list @@ -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; diff --git a/pcmanfm/default/pcmanfm.conf b/pcmanfm/default/pcmanfm.conf index 29b506d..eaa6f6d 100644 --- a/pcmanfm/default/pcmanfm.conf +++ b/pcmanfm/default/pcmanfm.conf @@ -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 diff --git a/systemd/user/ntfy_sub.service b/systemd/user/ntfy_sub.service index 731225c..7af0dcc 100644 --- a/systemd/user/ntfy_sub.service +++ b/systemd/user/ntfy_sub.service @@ -4,5 +4,5 @@ Description=Ntfy Subscribe Notifications [Service] Type=simple ExecStart=%h/.config/hypr/ntfy_sub -Restart=on-failure +Restart=always RestartSec=5 diff --git a/zsh/functions b/zsh/functions index c48b4b2..5ec4c9e 100644 --- a/zsh/functions +++ b/zsh/functions @@ -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 diff --git a/zsh/zshrc b/zsh/zshrc index d0f6569..7c61e70 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -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