summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Miru Kim <hanmiru.kim@gmail.com>2024-02-20 10:40:41 +0000
committerMarge Bot <emma+marge@anholt.net>2024-07-30 15:59:19 +0000
commit6bf17ba73bd94dd02e036a8c99c4a684a83f13fb (patch)
tree156a4157abde3c8c4900be52e97a0ed0a24c3423
parentf419847f9079f0500e1bcdcb58a03c8df9a303b3 (diff)
Add option `caps:ctrl_shifted_capslock`
Make `Caps Lock` an additional `Ctrl` and `Shift + Caps Lock` the regular `Caps Lock`. Part-of: <https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/673>
-rw-r--r--changes/options/447.bugfix.md4
-rw-r--r--rules/base.xml6
-rw-r--r--symbols/capslock11
3 files changed, 21 insertions, 0 deletions
diff --git a/changes/options/447.bugfix.md b/changes/options/447.bugfix.md
new file mode 100644
index 00000000..9ef3a1db
--- /dev/null
+++ b/changes/options/447.bugfix.md
@@ -0,0 +1,4 @@
+Added `caps:ctrl_shifted_capslock`: make `Caps Lock` an additional `Ctrl`
+and `Shift + Caps Lock` the regular `Caps Lock`.
+
+Contributed by Han-Miru Kim
diff --git a/rules/base.xml b/rules/base.xml
index 3bd6de56..aa0d98b7 100644
--- a/rules/base.xml
+++ b/rules/base.xml
@@ -7655,6 +7655,12 @@
</option>
<option>
<configItem>
+ <name>caps:ctrl_shifted_capslock</name>
+ <description>Make Caps Lock an additional Ctrl and Shift + Caps Lock the regular Caps Lock</description>
+ </configItem>
+ </option>
+ <option>
+ <configItem>
<name>caps:ctrl_modifier</name>
<description>Make Caps Lock act as an additional Ctrl modifier, but keep identifying as Caps Lock</description>
</configItem>
diff --git a/symbols/capslock b/symbols/capslock
index 19914384..328bf818 100644
--- a/symbols/capslock
+++ b/symbols/capslock
@@ -66,6 +66,17 @@ xkb_symbols "numlock" {
key <CAPS> { [ Num_Lock ], type[group1] = "ONE_LEVEL" };
};
+hidden partial modifier_keys
+xkb_symbols "ctrl_shifted_capslock" {
+ key <CAPS> {
+ type[Group1] = "TWO_LEVEL",
+ symbols[Group1] = [ Control_L, Caps_Lock ],
+ // Explicit actions are preferred over modMap None/Control { Caps_Lock }
+ // because they have no side effect
+ actions[Group1] = [ SetMods(modifiers=Control), LockMods(modifiers=Lock) ]
+ };
+};
+
// This changes the <CAPS> key to become a Control modifier,
// but it will still produce the Caps_Lock keysym; this is
// useful for apps that need to distinguish it from usual