mirror of
https://github.com/CoolnsX/hyprdots.git
synced 2025-12-20 07:15:23 +05:30
things occurred
This commit is contained in:
33
hypr/dmenu_run_history
Executable file
33
hypr/dmenu_run_history
Executable 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
|
||||
Reference in New Issue
Block a user