From 27553aea78d0f10eb26f703c2ca5f87b9bc92faf Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sun, 3 May 2020 13:21:44 -0500 Subject: [PATCH 1/5] Included case insensitivity matching to readme --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 37b235c..a059bf8 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,37 @@ define_keymap(lambda wm_class: wm_class not in ("Emacs", "URxvt"), { }, "Emacs-like keys") ``` +### Example of Case Insensitivity Matching + +``` +terminals = ["gnome-terminal","konsole","io.elementary.terminal","sakura"] +terminals = [term.casefold() for term in terminals] +termStr = "|".join(str(x) for x in terminals) + +# [Conditional modmap] Change modifier keys in certain applications +define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals,{ + # Default Mac/Win + Key.LEFT_ALT: Key.RIGHT_CTRL, # WinMac + Key.LEFT_META: Key.LEFT_ALT, # WinMac + Key.LEFT_CTRL: Key.LEFT_META, # WinMac + Key.RIGHT_ALT: Key.RIGHT_CTRL, # WinMac + Key.RIGHT_META: Key.RIGHT_ALT, # WinMac + Key.RIGHT_CTRL: Key.RIGHT_META, # WinMac +}) + +# [Conditional modmap] Change modifier keys in certain applications +define_conditional_modmap(re.compile(termStr, re.IGNORECASE), { + + # Default Mac/Win + Key.LEFT_ALT: Key.RIGHT_CTRL, # WinMac + Key.LEFT_META: Key.LEFT_ALT, # WinMac + Key.LEFT_CTRL: Key.LEFT_CTRL, # WinMac + Key.RIGHT_ALT: Key.RIGHT_CTRL, # WinMac + Key.RIGHT_META: Key.RIGHT_ALT, # WinMac + Key.RIGHT_CTRL: Key.LEFT_CTRL, # WinMac +}) +``` + ## FAQ ### How do I fix Firefox capturing Alt before xkeysnail? From 7b01e9c3110fd7259e6fff73391e7578dcd0366b Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sun, 3 May 2020 13:37:29 -0500 Subject: [PATCH 2/5] Included python3 dev headers pkg for readme. #77 --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a059bf8..4846830 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,9 @@ Requires root privilege and **Python 3**. sudo apt install python3-pip sudo pip3 install xkeysnail + + # If you plan to compile from source + sudo apt install python3-dev ### Fedora @@ -33,6 +36,9 @@ Requires root privilege and **Python 3**. # Add your user to input group if you don't want to run xkeysnail # with sudo (log out and log in again to apply group change) sudo usermod -a -G input $USER + + # If you plan to compile from source + sudo dnf install python3-devel ### From source From f346a2f9b7b4694e0340e2bd609db15d8b4e0168 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Sun, 3 May 2020 13:48:49 -0500 Subject: [PATCH 3/5] Additional Case Insensitivity Info added to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4846830..97fe5ec 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,10 @@ Argument `condition` specifies the condition of activating the `mappings` on an application and takes one of the following forms: - Regular expression (e.g., `re.compile("YYY")`) - Activates the `mappings` if the pattern `YYY` matches the `WM_CLASS` of the application. + - Case Insensitivity matching against `WM_CLASS` via `re.IGNORECASE` (e.g. `re.compile('Gnome-terminal', re.IGNORECASE)`) - `lambda wm_class: some_condition(wm_class)` - Activates the `mappings` if the `WM_CLASS` of the application satisfies the condition specified by the `lambda` function. + - Case Insensitivity matching via `casefold()` or `lambda wm_class: wm_class.casefold()` (see example below to see how to compare to a list of names) - `None`: Refers to no condition. `None`-specified keymap will be a global keymap and is always enabled. Argument `mappings` is a dictionary in the form of `{key: command, key2: From 95ce1d88dbeaa356f91d0e85ae8e295bf49a21cd Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Mon, 11 May 2020 20:14:26 -0500 Subject: [PATCH 4/5] Added info to readme for compiling on Manjaro/Arch --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 97fe5ec..2a31f47 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,13 @@ Requires root privilege and **Python 3**. # If you plan to compile from source sudo dnf install python3-devel + +### Manjaro/Arch + + # Some distros will need to compile evdev components + # and may fail to do so if gcc is not installed. + sudo pacman -Syy + sudo pacman -S gcc ### From source From 84d851073aabe2ab0620f41810ab98b244ac1f2f Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Tue, 12 May 2020 19:12:02 -0500 Subject: [PATCH 5/5] Added Solus info for compiling xkeysnail --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 2a31f47..2abf278 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,13 @@ Requires root privilege and **Python 3**. # and may fail to do so if gcc is not installed. sudo pacman -Syy sudo pacman -S gcc + +### Solus + + # Some distros will need to compile evdev components + # and may fail to do so if gcc is not installed. + sudo eopkg install gcc + sudo eopkg install -c system.devel ### From source