I also confirmed my Bluetooth keyboard’s change by the setxkbmap
and xmodmap
is reset after disconnect and connect
I am using Fedora 34.
$ cat /etc/fedora-release
Fedora release 34 (Thirty Four)
My kernel version is
$ uname -r
5.13.19-200.fc34.x86_64
And other tools versions are
$ rpm -qf /bin/bluetoothctl
bluez-5.61-1.fc34.x86_64
$ rpm -qf /bin/setxkbmap
setxkbmap-1.3.2-3.fc34.x86_64
$ rpm -qf /bin/xmodmap
xmodmap-1.0.10-1.fc34.x86_64
In the case of compose key, I did set like this connecting the bluetooth keyboard.
$ setxkbmap -layout us -option
$ setxkbmap -option compose:caps
$ setxkbmap -query
rules: evdev
model: pc105
layout: us
options: compose:caps
Then both my laptop’s keyboard and the bluetooth keyboard work with the compose setting.
That is that I could type ů by typing caps (switch) + o + u by both laptop’s keyboard and the buletooth keyboard.
$ ů
Then
(Masking the bluetooth’s MAC address for privacy)
$ sudo bluetoothctl
[Trust Bluetooth Keyboard]# devices
Device XX:XX:XX:XX:XX:E2 Trust Bluetooth Keyboard
[Trust Bluetooth Keyboard]# disconnect XX:XX:XX:XX:XX:E2
Attempting to disconnect from XX:XX:XX:XX:XX:E2
[CHG] Device XX:XX:XX:XX:XX:E2 ServicesResolved: no
Successful disconnected
[CHG] Device XX:XX:XX:XX:XX:E2 Connected: no
[bluetooth]# connect XX:XX:XX:XX:XX:E2
Attempting to connect to XX:XX:XX:XX:XX:E2
[bluetooth]# quit
Then while the laptop’s keyboard works with the compose setting, the bluetooth keyboard doesn’t work for the compose setting.
I also tested with the xmodmap too. For example, here is the case to swap Escape key with Caps look key.
xmodmap -e "remove Lock = Caps_Lock"
xmodmap -e "add Lock = Escape"
xmodmap -e "keysym Caps_Lock = Escape"
xmodmap -e "keysym Escape = Caps_Lock"
~/.Xmodmap
remove Lock = Caps_Lock
add Lock = Escape
keysym Caps_Lock = Escape
keysym Escape = Caps_Lock
I haven’t tried @robin217 's way yet.