added remmina, changes in niri
This commit is contained in:
41
bin/fuzzel-remmina
Executable file
41
bin/fuzzel-remmina
Executable file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
read -r -d '' awkscript <<- 'EOF'
|
||||
{
|
||||
if ($1 == "name") {
|
||||
print FILENAME":"$2;
|
||||
}
|
||||
if ($1 == "protocol") {
|
||||
print "("$2")";
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
getentry() {
|
||||
awk -F'=' "$awkscript" "$1" | paste -sd' '
|
||||
}
|
||||
|
||||
export awkscript
|
||||
export -f getentry
|
||||
|
||||
groups=$(ls -1 ~/.local/share/remmina/ | cut -d_ -f1 | uniq)
|
||||
groupcnt=$(wc -l <<<$groups)
|
||||
|
||||
while true; do
|
||||
if [ "$groupcnt" -eq 1 ]; then
|
||||
group=$groups
|
||||
else
|
||||
group=$(echo -e "$groups" | fuzzel --dmenu)
|
||||
fi
|
||||
[ -z "$group" ] && exit
|
||||
|
||||
entries=$(find ~/.local/share/remmina/ -name "$group*" -type f -exec bash -c "getentry {}" \; )
|
||||
#echo -e "$entries"
|
||||
|
||||
fuzcmd="fuzzel --dmenu --terminal='' --with-nth=2 --accept-nth=1 --nth-delimiter=: --hide-prompt"
|
||||
selected=$(echo -e "$entries" | $fuzcmd 2>/dev/null | tail -n1)
|
||||
[[ $selected =~ delim ]] && [ "$groupcnt" -gt 1 ] && continue
|
||||
break
|
||||
done
|
||||
|
||||
remmina -c "$selected"
|
||||
Reference in New Issue
Block a user