I also confirmed my Bluetooth keyboard’s change by the
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
And other tools versions are
$ rpm -qf /bin/bluetoothctl
$ rpm -qf /bin/setxkbmap
$ rpm -qf /bin/xmodmap
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
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.
(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
[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
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"
remove Lock = Caps_Lock
add Lock = Escape
keysym Caps_Lock = Escape
keysym Escape = Caps_Lock
I haven’t tried @robin217 's way yet.