mirror of
https://github.com/CoolnsX/hyprdots.git
synced 2026-06-17 07:42:07 +05:30
Somebody set up us the bomb.
This commit is contained in:
+8
-4
@@ -1,10 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
notify() {
|
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"
|
env_file="${XDG_CONFIG_HOME:-$HOME/.config}/.env"
|
||||||
|
#shellcheck source=/dev/null
|
||||||
. "$env_file"
|
. "$env_file"
|
||||||
|
|
||||||
ntfy_creds load
|
ntfy_creds load
|
||||||
@@ -16,9 +17,12 @@ trap "ntfy_creds unload" EXIT
|
|||||||
trap "ntfy_creds unload; exit 1" INT HUP
|
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
|
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')
|
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"
|
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
|
done
|
||||||
|
|||||||
@@ -65,3 +65,4 @@ application/x-bittorrent=torrent.desktop;
|
|||||||
application/x-desktop=nvim.desktop;
|
application/x-desktop=nvim.desktop;
|
||||||
application/x-php=firefox.desktop;
|
application/x-php=firefox.desktop;
|
||||||
audio/flac=mpv.desktop;
|
audio/flac=mpv.desktop;
|
||||||
|
image/x-xcf=org.xfce.ristretto.desktop;
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ focus_previous=0
|
|||||||
side_pane_mode=places
|
side_pane_mode=places
|
||||||
view_mode=list
|
view_mode=list
|
||||||
show_hidden=0
|
show_hidden=0
|
||||||
sort=name;ascending;
|
sort=mtime;ascending;
|
||||||
columns=name:200;desc:143;size:76;mtime:1119;
|
columns=name:200;desc:143;size:76;mtime:1134;
|
||||||
toolbar=newtab;navigation;home;
|
toolbar=newtab;navigation;home;
|
||||||
show_statusbar=1
|
show_statusbar=1
|
||||||
pathbar_mode_buttons=0
|
pathbar_mode_buttons=0
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ Description=Ntfy Subscribe Notifications
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=%h/.config/hypr/ntfy_sub
|
ExecStart=%h/.config/hypr/ntfy_sub
|
||||||
Restart=on-failure
|
Restart=always
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
|
|||||||
@@ -315,4 +315,36 @@ vpn() {
|
|||||||
doas systemctl $query openvpn-client@vpn.service && printf "Openvpn %sed" "$query"
|
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
|
# vim: ft=zsh
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ fpath=($HOME/.config/zsh/completions $fpath)
|
|||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
compinit
|
compinit
|
||||||
zstyle ':completion:*' menu select
|
zstyle ':completion:*' menu select
|
||||||
|
trap 'rehash' USR1
|
||||||
eval "$(starship init zsh)"
|
eval "$(starship init zsh)"
|
||||||
|
|
||||||
#plugins
|
#plugins
|
||||||
|
|||||||
Reference in New Issue
Block a user