emdash icon indicating copy to clipboard operation
emdash copied to clipboard

[bug]: "Open in → Terminal" fails on Linux without x-terminal-emulator / gnome-terminal / konsole

Open staruxian opened this issue 1 month ago • 0 comments

Bug Description

On Linux, Open in → Terminal fails when none of the three hardcoded terminals is installed. It doesn't check $TERMINAL or xdg-terminal-exec (the XDG default-terminal launcher), so it fails on setups like Arch + Hyprland (Omarchy), where the default terminal is set through xdg-terminal-exec.

The Linux commands are hardcoded here: https://github.com/generalaction/emdash/blob/3a4406366a273880048ed7477b412a42a6a8254a/apps/emdash-desktop/src/core/primitives/open-in-apps/api/open-in-apps.ts#L218-L224

linux: {
  openCommands: [
    'x-terminal-emulator --working-directory={{path}}',
    'gnome-terminal --working-directory={{path}}',
    'konsole --workdir {{path}}',
  ],
},

x-terminal-emulator exists only on Debian/Ubuntu (via update-alternatives), so on Arch, Fedora and other non-GNOME/KDE desktops this usually leaves no working option.

Steps to Reproduce

  1. On a Linux system with no x-terminal-emulator, gnome-terminal or konsole (e.g. Arch Linux with Ghostty as the default terminal through xdg-terminal-exec)
  2. Open a project in Emdash
  3. Use Open in → Terminal

Actual vs Expected Behavior

Actual: an error, and no terminal opens:

Command failed: x-terminal-emulator --working-directory='/home/user/Work/school' || gnome-terminal --working-directory='/home/user/Work/school' || konsole --workdir '/home/user/Work/school'
/bin/sh: line 1: x-terminal-emulator: command not found
/bin/sh: line 1: gnome-terminal: command not found
/bin/sh: line 1: konsole: command not found

Expected: the user's default terminal opens in the project directory.

Suggested fix

Try the user's configured terminal before the hardcoded list, for example:

'xdg-terminal-exec --dir={{path}}',
// then $TERMINAL, then the existing fallbacks

xdg-terminal-exec is the reference launcher for the proposed XDG default-terminal spec, and desktops like Omarchy use it as their system default. I'd be happy to open a PR for this if the approach sounds good.

Workarounds: use Open in → Ghostty directly (that option works), or put an x-terminal-emulator shim on PATH that forwards to xdg-terminal-exec --dir=….

emdash Version

1.2.7 (AUR emdash-app)

Operating System

Arch Linux (Omarchy), kernel 7.2.5, Hyprland 0.56.2 (Wayland), default terminal Ghostty 1.3.1 via xdg-terminal-exec

Additional Context

Related: #287 (closed feature request to choose the terminal backend).

staruxian avatar Oct 07 '26 13:10 staruxian