add dmenu script for url bar and find
This commit is contained in:
parent
2088e156df
commit
1d015d7f25
2
readme
2
readme
|
@ -10,7 +10,7 @@ In order to build surf you need gtk4 and webkit2gtk-5.0.
|
||||||
|
|
||||||
In order to use the functionalities:
|
In order to use the functionalities:
|
||||||
- video support: gst-libav, gst-plugins-good
|
- video support: gst-libav, gst-plugins-good
|
||||||
- url bar: dmenu
|
- url bar and find: dmenu
|
||||||
- tabs: tabbed
|
- tabs: tabbed
|
||||||
|
|
||||||
installation
|
installation
|
||||||
|
|
65
scripts/rose-open.sh
Executable file
65
scripts/rose-open.sh
Executable file
|
@ -0,0 +1,65 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
BOOKMARKS_PATH=~/.cache/rose/bookmarks
|
||||||
|
|
||||||
|
search()
|
||||||
|
{
|
||||||
|
[ -f $BOOKMARKS_PATH ] || touch $BOOKMARKS_PATH
|
||||||
|
BOOKMARKS=$(cat ~/.cache/rose/bookmarks)
|
||||||
|
CURRENT_ID=$(xdotool getactivewindow)
|
||||||
|
SEARCH=$(printf "Add\nRemove\n$(printf "$BOOKMARKS" | cut -f1 -d" ")" | dmenu -p SEARCH:)
|
||||||
|
|
||||||
|
[ "$SEARCH" = Add ] && {
|
||||||
|
printf "" | dmenu -p Url: | sed 's/\./ /g' >> $BOOKMARKS_PATH
|
||||||
|
$0 & exit
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$SEARCH" = Remove ] && {
|
||||||
|
printf "$(grep -v "$(printf "$BOOKMARKS" | dmenu -p Select:)" $BOOKMARKS_PATH)" > $BOOKMARKS_PATH
|
||||||
|
$0 & exit
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -z "$SEARCH" ] && exit
|
||||||
|
|
||||||
|
ROSE_GO=$(xprop -id "$CURRENT_ID" | grep _ROSE_URI)
|
||||||
|
|
||||||
|
[ -z "$1" ] || ROSE_GO=''
|
||||||
|
|
||||||
|
[ -z "$ROSE_GO" ] || {
|
||||||
|
[ -z "$(printf "$BOOKMARKS" | grep -w "$SEARCH")" ] && {
|
||||||
|
xprop -id "$CURRENT_ID" -f "_ROSE_GO" 8u -set "_ROSE_GO" $SEARCH
|
||||||
|
exit
|
||||||
|
} || {
|
||||||
|
FULL_URL=$(printf "$BOOKMARKS" | grep -w "$SEARCH" | sed 's/ /\./g')
|
||||||
|
xprop -id "$CURRENT_ID" -f "_ROSE_GO" 8u -set "_ROSE_GO" https://"$FULL_URL"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -z "$(printf "$BOOKMARKS" | grep -w "$SEARCH")" ] && {
|
||||||
|
rose https://duckduckgo.com/?q="$SEARCH"
|
||||||
|
} || {
|
||||||
|
FULL_URL="$(printf "$BOOKMARKS" | grep "$SEARCH" | sed 's/ /\./g')"
|
||||||
|
rose https://"$FULL_URL"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
find()
|
||||||
|
{
|
||||||
|
FIND=$(printf "" | dmenu -p Find:)
|
||||||
|
CURRENT_ID=$(xdotool getactivewindow)
|
||||||
|
ROSE_FIND=$(xprop -id "$CURRENT_ID" | grep _ROSE_URI)
|
||||||
|
|
||||||
|
[ -z "$ROSE_FIND" ] || xprop -id "$CURRENT_ID" -f "_ROSE_FIND" 8u -set "_ROSE_FIND" "$FIND"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -z "$1" ] && search || {
|
||||||
|
INSTALL_PATH=/usr/local/bin/dmenu_rose
|
||||||
|
case "$1" in
|
||||||
|
install) (set -x; cp $0 $INSTALL_PATH);;
|
||||||
|
uninstall) (set -x; rm $INSTALL_PATH);;
|
||||||
|
add_bookmark) echo "$2" >> $BOOKMARKS_PATH;;
|
||||||
|
new_window) search new;;
|
||||||
|
find) find;;
|
||||||
|
esac
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user