summaryrefslogtreecommitdiff
path: root/dmenubookmark
diff options
context:
space:
mode:
authornikolaus <nikolaus@fishbox.fritz.box>2022-09-07 13:53:07 +0200
committernikolaus <nikolaus@fishbox.fritz.box>2022-09-07 13:53:07 +0200
commitafe087c85da7bd8456cb7df9f60759242ec41c44 (patch)
tree5b83aa332a149dbaf6a2315df08956afbf841d81 /dmenubookmark
Initial commit & first scripts.
Diffstat (limited to 'dmenubookmark')
-rwxr-xr-xdmenubookmark27
1 files changed, 27 insertions, 0 deletions
diff --git a/dmenubookmark b/dmenubookmark
new file mode 100755
index 0000000..3a99321
--- /dev/null
+++ b/dmenubookmark
@@ -0,0 +1,27 @@
+#!/bin/sh
+if [ -z "$1" ]
+then
+ touch ~/.cache/tmp_bookmarks
+ bookmark_file=~/.cache/bookmarks
+ temp_file=~/.cache/tmp_bookmarks
+ echo 'exit' >> $temp_file &&
+ echo 'remove_bookmark' >> $temp_file &&
+ gawk -F '§§§' '{print($2)}' $bookmark_file >> $temp_file &&
+ choice=$(cat $temp_file | dmenu -p 'Search for Bookmark' -l 20)
+ echo $choice
+ rm ~/.cache/tmp_bookmarks
+ if [ "$choice" == 'remove_bookmark' ]; then
+ mark=$(gawk -F '§§§' '{print($2)}' $bookmark_file | dmenu -p 'Which bookmark to remove?' -l 20)
+ echo $mark | xargs -I '%%§%%' gsed -i 's/^.*%%§%%.*$//' $bookmark_file
+ gsed -i '/^$/d' $bookmark_file
+ elif [ "$choice" == 'exit' ]; then
+ exit
+ else
+ link=$(echo $choice | xargs -I §€§ grep '§€§' $bookmark_file | gawk -F '§§§' '{print($1)}')
+ echo $link
+ linkhandler $link
+ fi
+else
+ name=$(echo $1 | dmenu -p 'Description of the Bookmark:') &&
+ echo $1§§§$name >> ~/.cache/bookmarks
+fi