about summary refs log tree commit diff stats
path: root/res
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-27 21:59:42 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-27 22:00:30 +0100
commit869c65a02e04db05e83f21cc77fe45e4f8e95513 (patch)
treef232d600457bb5db416da03c9bae502ac44fa521 /res
parent50436a9176f0b5a5239d4f3180f4e69c3dc350c1 (diff)
downloadchawan-869c65a02e04db05e83f21cc77fe45e4f8e95513.tar.gz
config: add yI for yanking image URLs
Diffstat (limited to 'res')
-rw-r--r--res/chawan.html3
-rw-r--r--res/config.toml13
2 files changed, 14 insertions, 2 deletions
diff --git a/res/chawan.html b/res/chawan.html
index d27f4689..cc5d0a95 100644
--- a/res/chawan.html
+++ b/res/chawan.html
@@ -60,7 +60,8 @@ up/down by one row
 <li><kbd>D</kbd>: discard current buffer
 <li><kbd>M-y</kbd>: copy current buffer's URL to clipboard (needs xsel)
 <li><kbd>yu</kbd>: copy the link currently under the cursor to clipboard (needs
-xsel)
+<li><kbd>yI</kbd>: copy the image link currently under the cursor to clipboard
+(needs xsel)
 <li><kbd>M-p</kbd>: go to the URL currently on the clipboard (needs xsel)
 <li><kbd>[</kbd>, <kbd>]</kbd>: move cursor to the previous/next hyperlink
 <li><kbd>C-d</kbd>, <kbd>C-u</kbd>: scroll up/down by half a page
diff --git a/res/config.toml b/res/config.toml
index 0cee0b87..7fed5b93 100644
--- a/res/config.toml
+++ b/res/config.toml
@@ -220,7 +220,7 @@ M-y = '''
 yc = '() => pager.alert("Please use `yu` to copy URLs instead!");'
 yu = '''
 () => {
-	const link = pager.hoverLink
+	const link = pager.hoverLink;
 	if (!link)
 		pager.alert("Please move the cursor above a link and try again.");
 	else if (pager.externInto('xsel -bi', link))
@@ -229,6 +229,17 @@ yu = '''
 		pager.alert("Failed to copy URL to clipboard. (Is xsel installed?)");
 }
 '''
+yI = '''
+() => {
+	const link = pager.hoverImage;
+	if (!link)
+		pager.alert("Please move the cursor above an image and try again.");
+	else if (pager.externInto('xsel -bi', link))
+		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');