
dex: DesktopEntry Execution CLI
dex is a lightweight command-line tool to generate and execute DesktopEntry files (the .desktop files used by Linux desktops).
Why use it
- Quickly execute autostart or specific DesktopEntry entries without writing wrapper scripts.
- Preview what would run in GNOME autostart or in a dry-run mode.
- Inspect a DesktopEntry’s Name property without opening the file.
Getting started: quick examples
- Execute all programs in the autostart folders:
dex -a
- Execute all programs in user-specified folders (colon-separated):
dex -a -s /path/to/dir1:/path/to/dir2
- Preview what would run in a GNOME autostart workspace:
dex -a -e GNOME
- Preview the programs in a regular autostart setup (dry-run):
dex -a -d
- Show the value of a specific DesktopEntry property (e.g., Name):
dex -p Name /path/to/file.desktop
- Create a DesktopEntry in the current directory from a file you already have:
dex -c path/to/file.desktop
- Run a single DesktopEntry program in the terminal (Terminal=true in the .desktop file):
dex --term my-terminal-terminal /path/to/file.desktop
Common workflows and tips
- Use the autostart flag when you want to consider all programs that would normally start automatically when the session begins.
- Use -s to narrow the search to folders you control. If you omit -s, dex will search default autostart locations.
- The -e / -d or —environment options help you visualize different environments or dry-run behaviors. This is useful when a .desktop file is environment-specific.
- The -p option is handy for quick inspection. It’s a read-only operation but saves you from opening a file to confirm its display name.
Common pitfalls to avoid
- Path correctness: dex will only find .desktop files in the specified directories; misspelled paths mean nothing will run.
- Execution permissions: ensure the target desktop files are executable if you intend to run them directly via dex.
- Environment differences: GNOME autostart semantics may differ from other environments; use -e to preview in GNOME before relying on -a in a non-GNOME session.
- Terminal=true: if a .desktop file specifies Terminal=true but dex is invoked without a terminal, the program may not present a terminal window as expected. Use the —term option when appropriate.
Troubleshooting quick checks
- If nothing happens when you run dex, verify the target DesktopEntry files exist and have valid Exec lines.
- Check permissions on the DesktopEntry files themselves; read access is typically required, and execute permission may be needed for direct execution.
- When using -s with multiple paths, separate directories with colons and avoid spaces unless you quote the entire argument.
Further reading
- Official project page for dex: https://github.com/jceb/dex
- DesktopEntry specification for fields like Name, Exec, and Terminal
Next steps
- Try a dry-run first to understand what dex would execute in your environment.
- Then run with -a to validate autostart behavior across all configured folders.