things occurred

This commit is contained in:
Coolnsx
2023-11-29 12:15:20 +05:30
parent 61d772b93d
commit e50df74288
16 changed files with 317 additions and 43 deletions

33
hypr/dmenu_run_history Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/sh
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
cache=$cachedir/dmenu_run
historyfile=$cachedir/dmenu_history
ls /bin > "$cache"
cut -f2 "$historyfile" "$cache" | bemenu --fixed-height --fn 'JetBrainsMono Nerd Font 15' -i -c -W 0.5 -B 3 -p "RUN: " -l 15 -P ">>" \
| awk -v histfile=$historyfile '
BEGIN {
FS=OFS="\t"
while ( (getline < histfile) > 0 ) {
count=$1
sub("^[0-9]+\t","")
fname=$0
history[fname]=count
}
close(histfile)
}
{
history[$0]++
print
}
END {
if(!NR) exit
for (f in history)
print history[f],f | "sort -t '\t' -k1rn >" histfile
}
' \
| while read cmd; do ${SHELL:-"/bin/sh"} -c "$cmd" & done