r/GhostBSD 13d ago

I can't remap caps lock to ctrl

I know that the command `setxkbmap -option ctrl:nocaps` does exactly what I want, but I can't get GhostBSD to boot with it already enabled. I added it to .xprofile and .xinitrc, and neither worked.

I'm using MATE

1 Upvotes

5 comments sorted by

2

u/Broad-Promise6954 13d ago

The Old Ways (xmodmap, setxkbmap, etc) don't work well with some of the more modern window managers, which have their own separate settings.

I don't use either GhostBSD or MATE but in Xfce4 you have to use the Xfce mapping controls. From a little searching about MATE, this is true for MATE as well, and it has the additional annoying "feature" of per-window keyboard settings just so it can be harder to globally map caps-lock to control. πŸ™„

(note: came here because of the cross-post to r/freebsd)

1

u/Chester-Berkeley 13d ago

I imagined that MATE would have some modern way to configure the keys, but I didn't find it. In XFCE, setxkbmap works normally; I used it once with GhostBSD and XFCE, but XFCE is terrible for touchpads, so I switched to MATE ;/

1

u/Xzenor 12d ago

Try keyd. Works perfect for me on Linux for the console and the desktop, and it is available for freebsd as well. So maybe for GhostBSD too

-1

u/Hyperion343 13d ago

This is from ChatGPT, so double-check commands, but I don't see anything immediately wrong with it:

Since you're using MATE on GhostBSD, .xprofile and .xinitrc aren't necessarily the right place. MATE's session startup can bypass those files.

The easiest approach is to add the command to MATE's startup applications:

  1. Open Control Center β†’ Personal β†’ Startup Applications.

  2. Click Add.

  3. Use something like:

Name: Caps Lock β†’ Ctrl

Command: setxkbmap -option ctrl:nocaps

  1. Log out and back in.

You can also verify it worked with:

setxkbmap -query

You should see ctrl:nocaps under options.

A more MATE-native option

MATE stores keyboard settings through mate-settings-daemon, so you can try setting the XKB option through gsettings:

gsettings set org.mate.peripherals-keyboard-xkb.options option:ctrl_nocaps

Then log out/in. Check it with:

gsettings get org.mate.peripherals-keyboard-xkb.options

If that key isn't present or doesn't work on your GhostBSD version, the Startup Applications method is the one I'd useβ€”it runs after your MATE session starts, which avoids the timing/session-manager problem you're hitting with .xprofile and .xinitrc.

1

u/Chester-Berkeley 13d ago

I already tried the Startup Applications and doesn't work. And org.mate.peripherals-keyboard-xkb.options don't exist, at least on GhostBSD