copy urls with alt-y

This commit is contained in:
Luke Smith 2019-05-03 20:11:37 -04:00
parent e196d09b86
commit d9575acb88
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252
3 changed files with 10 additions and 1 deletions

View file

@ -10,6 +10,7 @@ The [suckless terminal (st)](https://st.suckless.org/) with some additional feat
+ Copy is alt-c, paste is alt-v or alt-p pastes from primary selection + Copy is alt-c, paste is alt-v or alt-p pastes from primary selection
+ Alt-l feeds all urls on screen to dmenu, so they user can choose and + Alt-l feeds all urls on screen to dmenu, so they user can choose and
follow one (requires dmenu installed). follow one (requires dmenu installed).
+ Alt-y does the same as above, but copies the url with xclip.
+ Zoom in/out or increase font size with Alt+Shift+k/j or u/d for larger intervals. + Zoom in/out or increase font size with Alt+Shift+k/j or u/d for larger intervals.
+ Hold alt and press either ↑/↓ or the vim keys k/j to move up/down in the terminal. + Hold alt and press either ↑/↓ or the vim keys k/j to move up/down in the terminal.
+ Shift+Mouse wheel do the same. + Shift+Mouse wheel do the same.

View file

@ -207,7 +207,11 @@ MouseKey mkeys[] = {
}; };
static char *openurlcmd[] = { "/bin/sh", "-c", static char *openurlcmd[] = { "/bin/sh", "-c",
"sed 's/.*│//g' | tr -d '\n' | grep -aEo '((http|https)://|www\\.)[a-zA-Z0-9./?=_-]*' | uniq | sed 's/^www./http:\\/\\/www\\./g' | dmenu -l 10 | xargs -r xdg-open", "sed 's/.*│//g' | tr -d '\n' | grep -aEo '((http|https)://|www\\.)[a-zA-Z0-9./?=_-]*' | uniq | sed 's/^www./http:\\/\\/www\\./g' | dmenu -p 'Follow which url?' -l 10 | xargs -r xdg-open",
"externalpipe", NULL };
static char *copyurlcmd[] = { "/bin/sh", "-c",
"sed 's/.*│//g' | tr -d '\n' | grep -aEo '((http|https)://|www\\.)[a-zA-Z0-9./?=_-]*' | uniq | sed 's/^www./http:\\/\\/www\\./g' | dmenu -p 'Copy which url?' -l 10 | tr -d '\n' | xclip -selection clipboard",
"externalpipe", NULL }; "externalpipe", NULL };
static Shortcut shortcuts[] = { static Shortcut shortcuts[] = {
@ -242,6 +246,7 @@ static Shortcut shortcuts[] = {
{ MODKEY|ShiftMask, XK_U, zoom, {.f = +2} }, { MODKEY|ShiftMask, XK_U, zoom, {.f = +2} },
{ MODKEY|ShiftMask, XK_D, zoom, {.f = -2} }, { MODKEY|ShiftMask, XK_D, zoom, {.f = -2} },
{ MODKEY, XK_l, externalpipe, { .v = openurlcmd } }, { MODKEY, XK_l, externalpipe, { .v = openurlcmd } },
{ MODKEY, XK_y, externalpipe, { .v = copyurlcmd } },
}; };
/* /*

3
st.1
View file

@ -149,6 +149,9 @@ Paste/input primary selection.
.B Alt-l .B Alt-l
Show dmenu menu of all URLs on screen and choose one to open. Show dmenu menu of all URLs on screen and choose one to open.
.TP .TP
.B Alt-y
Show dmenu menu of all URLs on screen and choose one to copy.
.TP
.B Break .B Break
Send a break in the serial line. Send a break in the serial line.
Break key is obtained in PC keyboards Break key is obtained in PC keyboards