I’m trying to get GNOME Files to open my preffered terminal application. Since the default GNOME terminal, kgx/“Console”, is hardcoded into nautilus, some working around is needed. I’m documenting my attempts here, maybe it will help someone to not waste so much time with this problem.
Attempt 1: add a script in ~/.local/share/nautilus/scripts/open-alacritty.sh(made executable withchmod a+x open-alacritty.sh) → No additional context menu entry appears.- Source code: in
nautilus_get_scripts_directory_path,g_get_user_data_diris called to get the XDG data home$XDG_DATA_HOME→ I thought maybe setting it manually viaXDG_DATA_HOME=$HOME/.local/share nautiluswill make nautilus recognize my script, but no
- Script contents:
#!/usr/bin/env bash alacritty --working-directory "$(pwd)" - In 2024, this still worked on NixOS
- Tutorial that I followed
- Source code: in
Attempt 2: Nautilus calls org.gnome.Consoleby default to open a terminal. Override its behavior by adding a custom~/.local/share/applications/org.gnome.Console.desktopwhich calls alacritty? → “Open in Console” still opens the gnome console. Desktop file contents:[Desktop Entry] Name=Console Exec=alacritty
Attempt 3: add nautilus-open-any-terminalextension to NixOS: I followed the instructions for NixOS by addingprograms.nautilus.open-any-terminal = {enable = true; terminal = "alacritty";};→
After reboot, a new context menu entry appears! However, I cannot set a keybinding because the schema does not exist in dconf-editor, and the default keybinding<Ctrl><Alt>tdoes nothing.- The relevant schema is located in
$out/share/gsettings-schemas/python3.13-nautilus-open-any-terminal-0.8.1/glib-2.0/schemas. - Calling
XDG_DATA_DIRS=/nix/store/fw25cpvjkkx897r7d9bb9719pfyad4rg-python3.13-nautilus-open-any-terminal-0.8.1/share/gsettings-schemas/python3.13-nautilus-open-any-terminal-0.8.1:$XDG_DATA_DIRS dconf-editorloads the schema & allows me to make edits.
Nautilus doesn’t react to the custom keybinding or default keybinding (even when called with the updated $XDG_DATA_DIRS).
- The relevant schema is located in
Context
- I’m on nixos-unstable commit
c6245e83d836d0433170a16eb185cefe0572f8b8 - I always run
nautilus -qto make sure nautilus is shut down before running tests services.displayManager.gnome.enableis set totrue, nautilus is installed system-wide- When I say “No additional context menu entry appears”, I’m referring to the Nautilus context menu, which should have a “Scripts” submenu (using nautilus scripts) or “Open Alacritty Here” (with nautilus-open-any-terminal extension):
See also:
