2015-06-04 20:59:35 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
qutemarks="/home/felix/.config/qutebrowser/qutemarks"
|
|
|
|
commands="$(echo -e "add\ndelete\ntabopen\nopen")"
|
|
|
|
|
|
|
|
# Select a command
|
|
|
|
command="$(dmenu <<<"$commands")"
|
|
|
|
case "$command" in
|
|
|
|
"add")
|
|
|
|
echo "$QUTE_URL $QUTE_TITLE" >> "$qutemarks"
|
|
|
|
;;
|
|
|
|
"delete")
|
|
|
|
to_remove="$(cat -n "$qutemarks" | sed 's/^ *//' | dmenu)"
|
2015-06-04 23:26:41 +02:00
|
|
|
if [[ "$to_remove" =~ "[0-9]* .*" ]]; then
|
|
|
|
sed -i "${to_remove%% *}d" "$qutemarks"
|
|
|
|
fi
|
2015-06-04 20:59:35 +02:00
|
|
|
;;
|
2015-06-04 23:26:41 +02:00
|
|
|
"tabopen"|"open")
|
2015-06-04 20:59:35 +02:00
|
|
|
opener="open"
|
|
|
|
if [ "$command" = "tabopen" ]; then
|
|
|
|
opener="open -t"
|
|
|
|
fi
|
|
|
|
to_open="$(dmenu < "$qutemarks")"
|
2015-06-04 23:26:41 +02:00
|
|
|
echo "$command ${to_open%% *}" >> "$QUTE_FIFO"
|
2015-06-04 20:59:35 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|