From 5b462ad76dee4e37aa5606409b2fb4771034deea Mon Sep 17 00:00:00 2001 From: Peter Hofmann Date: Sun, 16 Jun 2024 06:06:20 +0200 Subject: [PATCH] Clipboard: Switch C-y and C-Y First, this behavior now matches that of dmenu. People switching over from dmenu might be used to this. I would argue, though, that it is more comfortable in general anyway: The "primary" selection is often easier to access, you can just select some text and be done with it, no need to reach for C-c (or even C-S-c in terminals). Some programs like XTerm can't even put text into the "clipboard" selection without special configuration. It thus makes sense to make this selection available with a hotkey that's easier to reach (I find C-y to be much more comfortable than C-Y). Only in rare circumstances do I need to access the "clipboard" selection. In practice, this change is *probably* not a (very) breaking change for users, because you very often have to select some text first using a mouse (thus putting it into the "primary" selection) before you can put it into the "clipboard" selection using something like C-c. This means that pasting from "primary" almost acts as a "magic" hotkey that does "the right thing". --- lib/renderers/wayland/wayland.c | 4 ++-- lib/renderers/x11/x11.c | 4 ++-- man/bemenu.1.scd.in | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/renderers/wayland/wayland.c b/lib/renderers/wayland/wayland.c index d765ebc..f2b8fdd 100644 --- a/lib/renderers/wayland/wayland.c +++ b/lib/renderers/wayland/wayland.c @@ -203,10 +203,10 @@ poll_key(const struct bm_menu *menu, unsigned int *unicode) return (mods & MOD_CTRL ? BM_KEY_RETURN : BM_KEY_UNICODE); case XKB_KEY_y: - return (mods & MOD_CTRL ? BM_KEY_PASTE_CLIPBOARD : BM_KEY_UNICODE); + return (mods & MOD_CTRL ? BM_KEY_PASTE_PRIMARY : BM_KEY_UNICODE); case XKB_KEY_Y: - return (mods & MOD_CTRL ? BM_KEY_PASTE_PRIMARY : BM_KEY_UNICODE); + return (mods & MOD_CTRL ? BM_KEY_PASTE_CLIPBOARD : BM_KEY_UNICODE); case XKB_KEY_1: if ((mods & MOD_ALT)) return BM_KEY_CUSTOM_1; diff --git a/lib/renderers/x11/x11.c b/lib/renderers/x11/x11.c index 6a62693..3fb8a37 100644 --- a/lib/renderers/x11/x11.c +++ b/lib/renderers/x11/x11.c @@ -150,10 +150,10 @@ poll_key(const struct bm_menu *menu, unsigned int *unicode) return (mods & MOD_CTRL ? BM_KEY_WORD_DELETE : BM_KEY_UNICODE); case XK_y: - return (mods & MOD_CTRL ? BM_KEY_PASTE_CLIPBOARD : BM_KEY_UNICODE); + return (mods & MOD_CTRL ? BM_KEY_PASTE_PRIMARY : BM_KEY_UNICODE); case XK_Y: - return (mods & MOD_CTRL ? BM_KEY_PASTE_PRIMARY : BM_KEY_UNICODE); + return (mods & MOD_CTRL ? BM_KEY_PASTE_CLIPBOARD : BM_KEY_UNICODE); case XK_j: return (mods & MOD_ALT ? BM_KEY_DOWN : BM_KEY_UNICODE); diff --git a/man/bemenu.1.scd.in b/man/bemenu.1.scd.in index e1e4256..ea695aa 100644 --- a/man/bemenu.1.scd.in +++ b/man/bemenu.1.scd.in @@ -299,7 +299,7 @@ In the following examples, *C-x* means **, *M-x* means ** and Clear the filter. *C-y, C-Y* - Paste selection (*C-y* for "clipboard", *C-Y* for "primary"). + Paste selection (*C-y* for "primary", *C-Y* for "clipboard"). *M-[1-9]* Print selected items and exit with a custom error code 10 (*M-1*)