# hal and ctrl:swapcaps

## qacek

I've been trying to get hal to swap my caps lock and control keys. With xorg, this was easy but I haven't figured out how to do this with hal (if it's possible?). Anyway here's my current /etc/hal/fdi/policy/10-x11-input.fdi file

```

<?xml version="1.0" encoding="ISO-8859-1"?>

<deviceinfo version="0.2">

  <device>

    <!-- FIXME: Support tablets too. -->

                <!--

    <match key="info.capabilities" contains="input.mouse">

      <merge key="input.x11_driver" type="string">mouse</merge>

      <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"

             string="Linux">

        <merge key="input.x11_driver" type="string">evdev</merge>

      </match>

    </match>

    <match key="info.capabilities" contains="input.touchpad">

      <merge key="input.x11_driver" type="string">mouse</merge>

      <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"

             string="Linux">

        <merge key="input.x11_driver" type="string">evdev</merge>

      </match>

    </match>

                -->

                <!--

    <match key="info.capabilities" contains="input.keys">

      <!-- If we're using Linux, we use evdev by default (falling back to

           keyboard otherwise). -->

      <merge key="input.x11_driver" type="string">keyboard</merge>

      <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"

             string="Linux">

        <merge key="input.x11_driver" type="string">evdev</merge>

      </match>

    </match>

                -->

                <match key="info.capabilities" contains="input.keys">

                        <!--<merge key="input.xkb.options" type="string">ctrl:swapcaps</merge>-->

                        <merge key="input.x11_options.XkbOptions" type="string">ctrl:swapcaps</merge>

                </match>

  </device>

</deviceinfo>

```

I've tried "input.keys" and "input.keyboard" and both attempts at merging ctrl:swapcaps to xkb options.

Any suggestions?

----------

## pianosaurus

I simply run setxkbmap -option "ctrl:swapcaps" on session startup. This makes more sense anyway, since my keyboard buttons aren't actually swapped and the swapping is a user preference.

----------

## VoidMage

However, that doesn't mean this should not work.

Then again, you really can't tell if that file gets applied.

So, please check if it is.

----------

## GreenPenInc

For whatever reason, that didn't work for me.  But "re"-setting the layout to "us", using setxkbmap, did the trick!

https://forums.gentoo.org/viewtopic-t-753515.html

----------

## VoidMage

Well, I do have an idea, what may have gone wrong.

----------

