diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-25 02:08:33 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-25 02:08:33 +0200 |
commit | 463499131a1b4ca41fea56030f77f4794cdca071 (patch) | |
tree | 54f2efea637c9762711db4140ff42ae833a0900e /res | |
parent | 790e937795746563246808abaf4b0b25f4a5d0fe (diff) | |
download | chawan-463499131a1b4ca41fea56030f77f4794cdca071.tar.gz |
Add M-p as "load page on clipboard"
Diffstat (limited to 'res')
-rw-r--r-- | res/chawan.html | 2 | ||||
-rw-r--r-- | res/config.toml | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/res/chawan.html b/res/chawan.html index c2ba5b61..81f9bbea 100644 --- a/res/chawan.html +++ b/res/chawan.html @@ -34,6 +34,8 @@ the meta key may be called Alt or Escape.) <li><b>U</b>: reload page <li><b>,</b> (comma), <b>.</b> (period): previous/next buffer <li><b>D</b>: discard current buffer +<li><b>M-y</b>: copy current buffer's URL to clipboard (needs xsel) +<li><b>M-p</b>: go to the URL currently on the clipboard (needs xsel) <li><b>[</b>, <b>]</b>: move cursor to the previous/next hyperlink <li><b>C-d</b>, <b>C-u</b>: scroll up/down by half a page <li><b>C-f</b>, <b>C-b</b> (or <b>PgDn</b>, <b>PgUp</b>)</b>: scroll up/down by an entire page diff --git a/res/config.toml b/res/config.toml index 3374e7d8..89b42cbe 100644 --- a/res/config.toml +++ b/res/config.toml @@ -132,10 +132,22 @@ config.search.wrap = !config.search.wrap; pager.alert("Wrap search " + (config.search.wrap ? "on" : "off")); ''' M-y = ''' -pager.extern('printf \'%s\\n\' "$CHA_URL" | xsel -bi', - {suspend: false, setenv: true}) ? - pager.alert("Copied URL to clipboard.") : - pager.alert("Failed to copy URL to clipboard. (Is xsel installed?)"); +() => { + if (pager.extern('printf \'%s\\n\' "$CHA_URL" | xsel -bi', + {suspend: false, setenv: true})) + pager.alert("Copied URL to clipboard."); + else + pager.alert("Failed to copy URL to clipboard. (Is xsel installed?)"); +} +''' +M-p = ''' +() => { + const s = pager.externCapture('xsel -bo'); + if (s === null) + pager.alert("Failed to read URL from clipboard. (Is xsel installed?)"); + else + pager.load(s + '\n'); +} ''' [line] |