From 7b889e0f0946bdb84b07c8a6f30ff96dfdb2e71c Mon Sep 17 00:00:00 2001
From: Egbert Eich <eich@sles11.(none)>
Date: Fri, 31 Jul 2009 10:45:55 +0200
Subject: [PATCH] Add option rule to specify if shift/caps lock should trigger caps lock led.

Most keyboards have only 3 indicators which by convention are
Num, Caps and Scroll Lock. Shift lock usually occupies the 4th
indicator which is not present on most keyboards.
This patch treats Shift Lock like the other lockings and adds
a rule to let Shift Lock toggle the Caps Lock LED.
To do so simply add the XKB option: "caps_led:shiftlock".
---
 compat/Makefile.am  |    1 +
 compat/basic        |    6 +-----
 compat/ledshift     |   23 +++++++++++++++++++++++
 rules/base          |    2 ++
 rules/base.lst      |    2 ++
 rules/base.o_c.part |    2 ++
 rules/base.xml.in   |   15 +++++++++++++++
 7 files changed, 46 insertions(+), 5 deletions(-)
 create mode 100644 compat/ledshift

Index: xkeyboard-config-1.5/compat/Makefile.am
===================================================================
--- xkeyboard-config-1.5.orig/compat/Makefile.am
+++ xkeyboard-config-1.5/compat/Makefile.am
@@ -4,6 +4,7 @@ dist_compat_DATA = \
 accessx basic complete \
 default iso9995 \
 japan keypad ledcaps \
+ledshift \
 lednum ledscroll level5 \
 misc mousekeys norepeat \
 olpc pc pc98 xfree86 \
Index: xkeyboard-config-1.5/compat/basic
===================================================================
--- xkeyboard-config-1.5.orig/compat/basic
+++ xkeyboard-config-1.5/compat/basic
@@ -44,9 +44,5 @@ default xkb_compatibility "basic"  {
 
     include "ledcaps"
     include "lednum"
-    indicator "Shift Lock" {
-	!allowExplicit;
-	whichModState= Locked;
-	modifiers= Shift;
-    };
+    include "ledshift"
 };
Index: xkeyboard-config-1.5/compat/ledshift
===================================================================
--- /dev/null
+++ xkeyboard-config-1.5/compat/ledshift
@@ -0,0 +1,23 @@
+// Use Shift Lock LED to show either Shift Lock, Group, or Caps Lock state
+
+default partial xkb_compatibility "shift_lock"   {
+   indicator "Shift Lock" {
+       !allowExplicit;
+       whichModState= Locked;
+       modifiers= Shift;
+   };
+};
+
+partial xkb_compatibility "group_lock"   {
+   indicator "Shift Lock" {
+       modifiers= None;
+       groups=All-group1;
+   };
+};
+
+partial xkb_compatibility "caps_lock"   {
+   indicator "Shift Lock" {
+       whichModState= Locked;
+       modifiers= Lock;
+   };
+};
Index: xkeyboard-config-1.5/rules/base.o_c.part
===================================================================
--- xkeyboard-config-1.5.orig/rules/base.o_c.part
+++ xkeyboard-config-1.5/rules/base.o_c.part
@@ -4,4 +4,6 @@
   grp:caps_toggle	=	+ledcaps(group_lock)
   japan:kana_lock	=	+japan(kana_lock)
   caps:shiftlock	=	+ledcaps(shift_lock)
+  caps_led:capslock	=	+ledcaps(caps_lock)
+  caps_led:shiftlock	=	+ledcaps(shift_lock)
 
Index: xkeyboard-config-1.5/rules/base.xml.in
===================================================================
--- xkeyboard-config-1.5.orig/rules/base.xml.in
+++ xkeyboard-config-1.5/rules/base.xml.in
@@ -4915,5 +4915,20 @@
        </configItem>
       </option>
     </group>
+    <group allowMultipleSelection="false">
+      <!--  set which indicator is toggled by CapsLock -->
+      <option>
+        <configItem>
+          <name>caps_led:capslock</name>
+          <description>CapsLock toggles Caps Lock indicator.</description>
+        </configItem>
+      </option>
+      <option>
+        <configItem>
+          <name>caps_led:shiftlock</name>
+          <description>CapsLock toggles Shift Lock indicator.</description>
+        </configItem>
+      </option>
+    </group>
   </optionList>
 </xkbConfigRegistry>
Index: xkeyboard-config-1.5/compat/Makefile.in
===================================================================
--- xkeyboard-config-1.5.orig/compat/Makefile.in
+++ xkeyboard-config-1.5/compat/Makefile.in
@@ -192,6 +192,7 @@ dist_compat_DATA = \
 accessx basic complete \
 default iso9995 \
 japan keypad ledcaps \
+ledshift \
 lednum ledscroll level5 \
 misc mousekeys norepeat \
 olpc pc pc98 xfree86 \
