Skip to content

fix: close terminal after -e/-x/--execute command finishes #69

Description

@ALLANOSAN

Describe the bug

When Zash terminal is invoked with -e <command> (e.g. via a Terminal=true .desktop file or the x-terminal-emulator -e update-command pattern), it runs the command but keeps the shell open after the command finishes. Standard terminal emulators (xterm, konsole, gnome-terminal, etc.) close automatically in this scenario.

Impact

This breaks applications that rely on the terminal process exiting after the command completes. For example:

  • Cachy-Update / arch-update: uses Terminal=true .desktop files that invoke the terminal with -e <update-script>. The launcher waits for the terminal process to exit before refreshing the update statefile. Since Zash never exits, the update count badge never resets.
  • Any other tool that follows the same -e / -x pattern.

Expected behaviour

When invoked with -e, -x, or --execute, the terminal should default close_after_execute=True, matching the behaviour of xterm, konsole, gnome-terminal, etc. Users who want to keep the shell open can use an explicit --no-close-after-execute (not yet implemented).

Fix (attached PR will follow)

The fix is minimal — two close_after_execute = True assignments:

  1. Inside the --execute= argument handler (line ~593)
  2. Inside the -e/-x block where remaining args are captured as the command (line ~614)

The internal update flow (_trigger_update_install) calls create_execute_tab(close_after=False) directly, so it is unaffected.

Environment

  • Zash version: 0.8.7 (tested)
  • Distribution: CachyOS (Arch Linux)
  • Desktop: KDE Plasma (Dolphin TerminalLauncher)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions