-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface_dmenu.sh
executable file
·60 lines (51 loc) · 1.26 KB
/
interface_dmenu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# - - - - - - - - - - - - - - - - ARGS - - - - - - - - - - - - - - - - -
show_help() {
printf "
Usage:
1. Copy the desired URL to your clipboard
2. ./interface_dmenu.sh BOOKMARKS
Options:
--help Display this help message"
exit 1
}
if [ "$#" -eq 0 ]; then
printf "Nothing happened, I need a file of bookmarks to edit."
show_help
fi
while [ "$#" -gt 0 ]; do
case "$1" in
--help)
show_help
;;
-*)
printf "Error: Unknown option: $1" >&2
show_help
;;
esac
shift
done
dmenu_style() {
local font='junicode-18'
local normal_bg='#000000'
local normal_fg='#FFFFFF'
local selected_bg='#AAAAAA'
local selected_fg='#000000'
echo "-fn $font -nb $normal_bg -nf $normal_fg -sb $selected_bg -sf $selected_fg"
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --
URL=$(xclip -o -selection clipboard)
if [ "${URL#"http"}" != "$URL" ]; then
DESC=$(dmenu -p "$URL · description →" $(dmenu_style))
TAGS=$(dmenu -p "$URL · $DESC · tags →" $(dmenu_style))
cat <<- EOF > signet
URL: $URL
Description: $DESC
Tags: $TAGS
Date: $(date +%g/%m/%d)
EOF
./edit.sh
else
printf "Text in clipboard is not a url"
exit
fi