Skip to content

Instantly share code, notes, and snippets.

@MohamedElashri
Created September 25, 2024 22:12
Show Gist options
  • Save MohamedElashri/60822f96f07b4a8748367dffb3cca7af to your computer and use it in GitHub Desktop.
Save MohamedElashri/60822f96f07b4a8748367dffb3cca7af to your computer and use it in GitHub Desktop.
Enable Input Source Switching in Cosmic Desktop by System76

Description

At present, Cosmic Desktop by System76 lacks a GUI to configure input source switching. However, the system uses the XKB (X Keyboard Extension) system, which allows manual configuration of input switching by modifying the relevant XKB settings.

The grp:win_space_toggle option defines a key combination (Super+Space or Win+Space) for switching between input sources. The provided workaround manually sets this option by editing the xkb_config file.

This approach gives users the flexibility to switch between keyboard layouts without waiting for native support in Cosmic Desktop.

Notes

  • This workaround is temporary and may become obsolete if future updates to Cosmic Desktop include native support for input source switching.
  • For users with different preferences, other XKB options can be configured similarly.

Step-by-step Guide

1. Locate the XKB Configuration File

The XKB configuration file for Cosmic Desktop is located at:

~/.config/cosmic/com.system76.CosmicComp/v1/xkb_config

This file contains the keyboard layout settings used by Cosmic Desktop.

2. Edit the XKB Configuration

Open the XKB configuration file in your preferred text editor.

nano ~/.config/cosmic/com.system76.CosmicComp/v1/xkb_config
3. Modify the options Key

By default, the options key is set to None, which means no custom keyboard options are configured. To enable switching between input sources using the Super+Space hotkey, modify the options field as follows:

Before:

options: None,

After:

options: Some(",grp:win_space_toggle"),

This change maps the Super+Space (Win+Space) key combination to toggle between keyboard layouts.

4. Log Out and Log In

After saving the changes to the configuration file, log out of your session and log back in for the changes to take effect.

5. Verify the Hotkey

To verify that the Super+Space hotkey is correctly set up, you can inspect the available XKB options by running the following command:

cat /usr/share/X11/xkb/rules/base.lst | grep space

This command will list the available spacebar-related options, and grp:win_space_toggle should be included in the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment