Xfce4-terminal: Enable "Disable all menu access keys" in all qubes

Original forum link
https://forum.qubes-os.org/t/32996
Original poster
kimsmi
Created at
2025-03-22 19:26:20
Posts count
3
Likes count
1

Something that really bothered me is that in Xfce Terminal Emulator, by default, Alt+f opens the File menu. I am expecting Alt+f to make the cursor move forward by one word. This configuration option is written in the home directory, so I needed a way to set the option on all the qubes.

I am a newbie to Salt and also Qubes, so if someone can tell me any improvements, do let me know.

To set up, in dom0, make sure /srv/user_salt exists. If not, follow the setup steps at https://forum.qubes-os.org/t/qubes-salt-beginners-guide/20126.

In dom0 /srv/user_salt/xfceterminalsettings.sls, put:

Code
Merge config:
  cmd.script:
    - name: xfceterminalsettings.sh
    - source: salt://xfceterminalsettings.py

In dom0 /srv/user_salt/xfceterminalsettings.py, put:

Code
#!/usr/bin/env python3

from pathlib import Path
import configparser

def get_config_path() -> Path:
    # Hard code the user because I think salt runs as a different user
    return Path("/home/user/.config/xfce4/terminal/terminalrc")

def config_path_mkdirp():
    p = get_config_path()
    if not p.parent.exists():
        p.parent.mkdir(parents=True)

def main():
    config = configparser.ConfigParser()
    config.optionxform = str # xfce4-terminal requires the option to be case sensitive
    config.read(get_config_path())

    CONFIGURATION = 'Configuration'
    if CONFIGURATION not in config:
        config[CONFIGURATION] = {}

    configurationSection = config[CONFIGURATION]

    SHORTCUTSNOMNEMONICS = 'ShortcutsNoMnemonics'

    if (SHORTCUTSNOMNEMONICS in configurationSection and
        configurationSection[SHORTCUTSNOMNEMONICS] == 'TRUE'):
        print("No work needed.")
        return

    configurationSection[SHORTCUTSNOMNEMONICS] = 'TRUE'

    config_path_mkdirp()
    with open(get_config_path(), "w") as f:
        config.write(f)
        print("Updated.")

if __name__ == "__main__":
    main()

After you have the files in place, you can apply the configuration by running in dom0:

sudo qubesctl --show-output --skip-dom0 --targets vault,personal state.sls xfceterminalsettings saltenv=user

You can specify which target qubes to apply the settings to by modifying the command. You can also omit --skip-dom0 to apply the setting to dom0 also.