summaryrefslogtreecommitdiff
path: root/dmenubookmark
diff options
context:
space:
mode:
authornikolaus <nikolaus@fishbox.fritz.box>2022-12-24 06:38:12 +0100
committernikolaus <nikolaus@fishbox.fritz.box>2022-12-24 06:38:12 +0100
commit130939ba4e650bff9ef43434e28d55ec7ac30d5e (patch)
treeb40f734dea0747c792772859657c69e2e57a26dd /dmenubookmark
parentb251d8db5c6e683ccf7d81c2a47e80c8d113aa38 (diff)
Update in the bookmark Script; making it suck less.
Diffstat (limited to 'dmenubookmark')
-rwxr-xr-xdmenubookmark20
1 files changed, 3 insertions, 17 deletions
diff --git a/dmenubookmark b/dmenubookmark
index 3a99321..660272b 100755
--- a/dmenubookmark
+++ b/dmenubookmark
@@ -1,26 +1,12 @@
#!/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
+ choice=$(gawk -F '§§§' '{print($2)}' $bookmark_file | dmenu -p 'Search for Bookmark' -l 20)
+ [ -z "$choice" ] && exit ||
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