Using two keyboards - any way to have two sets of settings?


I use a Mac keyboard on desk, and the built in Dell keyboard on my 5420. I spent ages setting things up to work nice for me on the mac keyboard, moved super key, flipped alt and ctrl, etc etc. It’s all working beautifully. Then i pulled plugs out and went mobile, only to find keyboard doesn’t ‘work’ on laptop properly. Duh, then I realised why!! My customisations!

I REALLY want to stick with this mac keyboard now. Is there any way to have TWO keyboard ‘options’ in the OS? So I can choose KB1 or KB2 depending on whether I am at desk or using laptop keyboard, and have different customisations for each?

(I see input selection options in settings but don’t understand it. )

Hey @joeyjonnson That’s really the way. In Gnome Settings, it’ll require some tinkering but I believe it’s doable.

Thanks HC, the thing is I did try it before in Gnome Settings and could not make any sense of it. I tried adding another input device but it didn’t detect any changes in which keyboard I was using. I will have another go now but really not sure it works for what I am trying to do

1 Like

No, it doesn’t work like that, from what I can tell anyway.

I had one keyboard already of course. So i added one, I switched to that second input source/keyboard, and set a new shortcut of shift alt H to launch Home Folder. It worked, but it still worked when I switched to the other input source.

So it seems any changes you make apply to all input sources, which I don’t get as it surely defeats the whole purpose of having different input sources? I must be missing something.

I am gutted, don’t understand the purpose of multiple input devices (unless it’s just to give a head start when using certain pre-defined keyboard layouts). I was hoping to be able to set one input source up with certain shortcuts/keycombos, then add another input source with different key combos. I will have to see if I can find any guidance docs for ‘input sources’ and see what its for.

If anyone has any suggestions before I have to dump this keyboard and go back to a windows one (and there isn’t a single one I am happy with!), I’d be grateful. thanks

Hmm, I guess i could test. . . I need to bring up my Bluetooth keyboard some time later this week. There might be other ways with config files to manage this, but I believe it’s doable.

Thanks as always, I’d be VERY pleased if I could find a way to do it. I like the Mac keyboard on desk (it’s almost a necessity at this point), but I can’t change the laptop keyboard!)
Please shout if you have any solutions!

1 Like

I could test this on Saturday. I’ll bring my Bluetooth Keyboard and play around with Gnome’s settings.

1 Like

THANK YOU very much.

1 Like

I will update this thread so to continue the conversation here and hopefully other can contribute.

I imagine a way to have two profiles which would replace one another in the dconf database. It would involve some tweaking though.

For example, say I have a standard PC keyboard and a mac keyboard (truth be told, I only use mac keyboards :slight_smile: ).

Let’s assume I am happy with the PC keyboard’s key mappings, but I want to swap the cmd and ctrl keys on my mac keyboard (so that cmd works as ctrl). For such a remapping, I am using Gnome Tweaks. The results of this change is being written in a configuration database called dconf.

Going further with my example, I would do the following:

  • backup the dconf database with the command dconf dump / > ~/Documents/dconf/my-settings.dconf
  • open the file my-settings.dconf with your preferred text editor
  • find the directory path referring to the changes in question. In my case it is [org/gnome/desktop/input-sources], and it contains this:
current=uint32 0
mru-sources=[('xkb', 'us'), ('xkb', 'us+alt-intl')]
sources=[('xkb', 'us'), ('xkb', 'us+alt-intl')]
xkb-options=['ctrl:swap_lwin_lctl', 'ctrl:swap_rwin_rctl', 'lv3:ralt_switch']
  • observe the last line referring to my previous remapping of keys
  • I would create a new text file in the same folder, called mac-keyboard.dconf, and copy the contents above (5 lines)
  • I would create a new text file in the same folder, called pc-keyboard.dconf, and copy the contents above, except for the last line containing the remapping (which would be adjusted to the PC keyboard. E.g. xkb-options=['lv3:ralt_switch'])
  • when I am using the mac keyboard, I would load the correspontding dconf keys with the command dconf load -f / < ~/Documents/dconf/mac-keyboard.dconf
  • when I am using the PC keyboard, I would load the corresponding dconf keys with the command dconf load -f / < ~/Documents/dconf/pc-keyboard.dconf

So basically after the initial setup is done, you would need to run one single command each time you change keboards. No logout-login needed.

If you have changes in more sections (different tree structures) in the dconf database (e.g. different shortcuts, as you have mentioned), you would need to find those too, and put them in the 2 profile files. Afterwards the same two command lines needed.

Of course, you should only do this if you feel comfortable with it. If not, you could save it for later.


Could a udev rule be written to accommodate the change in keyboards?

1 Like

Yes, using dconf editor is indeed easier, I thought about that too. I found 2 inconveniences though:

  1. Disabling a key (the 5th line in my example) with the toggle switch had the effect of totally removing the key values after saving. So the next time, when I want to activate the previous setup, I would have to copy them from a backup file.
  2. It gets a bit more complicated if your custom key values reside in different tree structures.

But yes, it seems safer from a user point of view.

1 Like

Probably, I am not very familiar with udev rules though. If possible, I imagine the effect would be system wide and not user-based.

1 Like

Thanks very much, some great effort and time invested in my query there, really appreciate it.

Sadly it does sound quite a bit more complex than I am looking for (read: capable of :slight_smile: )

If it comes to the crunch and I can’t find any other way, then it may be less of an upheaval than getting rid of the Mac keyboad altogether, I really need it. I work 8 hours a day on a Mac keyboard, which I have used since, well let’s just say ‘forever’.

I have done a lot of remapping and custom shortcuts to make Fedora work (keyboard wise) as much like Mac as possible, because moving between Mac and Fedora daily is causing my ageing brain some troubles when my finger muscle memory doesn’t achieve what I expect! Left Thumb and X (variable) - does just about everything I need from switch apps (TAB) to closing a window (W) to printing (P) to sending windows to left or right (arrow left/right) or maximize minimize (arrow up/down) and so on!

I didn’t fully follow the instructions above, the first part I did (in principle anyway). I understand (i think) that we are looking at the file where the changes we make in the GUI (keyboard settings) are saved in code form, and we can therefore suss what each change produces in code, then code our own respective files, one per keyboard. Sounce great in principle, and I may find my way to doing it eventually, but with so many customisations, I suspect it may just turn into a bit of a nightmare for me!

I have to say, I am quite surprised there isn’t a solution for this. Maybe I should do some web searches, I never think of ‘extensions’ or third party apps as I moved to Fedora with the intention of staying as ‘clean’ as possible, i.e. installing what’s in the Fedora Software repo (and Flathub on occasion maybe) rather than just pasting installation commands found online. Aside from the security/privacy risk, I fear getting confused with that so want to keep things as simple as possible.

That said, if there is a reasonably-safe looking third party app/extension that can provide a simple GUI switch from Mac to Win keyboards (invoking each one’s desired customisations), that would be very cool indeed. I may have to get looking, but I am surprised this functionality isn’t already included in the OS to be honest, not for Mac to Windows, but for different keyboards as many people use a laptop on a desktop and even Windows keyboards vary a fair bit in my experience (media keys, FN location etc)

Thanks again Mike B and HC for caring and sharing the knowledge :slight_smile:


I think @mblasko 's proposal is very doable, and once it’s set up can be easily managed by 1 command. It’s a lot to go through, but manageable. Very nice solution from my point of view, without trying it yet.


I need to make a small correction to the workaround presented above. Apparently, once there is a key=value combination in the dconf database, it won’t be deleted just because the loaded path ([org/gnome/desktop/input-sources] in our example) doesn’t contain it (e.g. xkb-options) anymore.

So in our case it should be there also for the second dconf snippet file, except with the other set of values. I have edited my initial post to reflect the changes and for the solution to be usable.

1 Like

Hiya, I don’t suppose you had a chance to try it out by any chance?

1 Like

I’d have to try again. As my setup didn’t work out. I need to get @mblasko 's and re-take those steps. It’s a holiday week here so It’d be closer to Friday before I can try it again. ( aligns with me testing it out for a shortcuts project too. My keyboard has more keys than than a normal large keykoard)