others/xselgo.sh

24 lines
619 B
Bash
Raw Normal View History

2023-05-04 07:10:19 +02:00
#!/bin/sh
2024-01-21 04:09:33 +01:00
## open web browser with the content of x selection ##
2023-05-04 07:10:19 +02:00
2024-01-21 04:09:33 +01:00
. $HOME/.config/wms/wms_var
2023-05-04 07:10:19 +02:00
2024-01-21 04:09:33 +01:00
COLORS="-menu-background-color 0x$BC \
2023-05-04 07:10:19 +02:00
-menu-foreground-color 0x$AC \
-scroll-bar-bar-color 0x$AC \
2024-01-21 04:09:33 +01:00
-scroll-bar-frame-color 0x$IC \
-html-g-background-color 0x$BC
"
2023-05-04 07:10:19 +02:00
2023-08-04 20:22:54 +02:00
BROWSER="links -g $COLORS"
2023-05-27 06:16:58 +02:00
XSEL=$(xclip -o)
2023-05-04 07:10:19 +02:00
2023-08-04 20:22:54 +02:00
echo $XSEL | grep -Eq "^https://|^http://|^www." && $BROWSER $XSEL \
2023-05-04 07:10:19 +02:00
|| $BROWSER "https://duckduckgo.com/?q=$XSEL"
## xselection ##
# under xprop: XSEL=$(xprop -root | awk -F "=" '/CUT_BUFFER0/ {gsub("\"","",$2); print $2}')
# under wmutils: XSEL=$(atomx CUT_BUFFER0 $(lsw -r))
2023-05-27 06:16:58 +02:00
# with xclip: XSEL=$(xclip -o)