Fix the launcher to do inline replacement so it can be used as $EDITOR properly

This commit is contained in:
David Heinemeier Hansson
2026-05-22 14:24:04 +02:00
parent e16b0f5201
commit d13aeacabe
2 changed files with 19 additions and 8 deletions
+18 -7
View File
@@ -1,21 +1,32 @@
#!/bin/bash
# omarchy:summary=Launch the default editor selected via Omarchy defaults.
# omarchy:args=<path>
# omarchy:args=[--inline] <path>
editor_file="$HOME/.local/state/omarchy/defaults/editor"
editor="nvim"
default_editor="$HOME/.local/state/omarchy/defaults/editor"
if [[ -f $editor_file ]]; then
read -r editor <"$editor_file"
if [[ ${1:-} == "--inline" ]]; then
inline=true
shift
else
inline=false
fi
if [[ -f $default_editor ]]; then
read -r editor <"$default_editor"
else
editor="nvim"
fi
[[ -n $editor ]] || editor="nvim"
omarchy-cmd-present "$editor" || editor="nvim"
case "${editor##*/}" in
nvim | vim | nano | micro | hx | helix | fresh)
exec omarchy-launch-tui "$editor" "$@"
if [[ $inline == "true" ]]; then
exec "$editor" "$@"
else
exec omarchy-launch-tui "$editor" "$@"
fi
;;
*)
exec setsid uwsm-app -- "$editor" "$@"
+1 -1
View File
@@ -7,7 +7,7 @@ export TERMINAL=xdg-terminal-exec
export BROWSER=omarchy-launch-browser
# Used by terminal programs to open files with the selected Omarchy default editor
export EDITOR=omarchy-launch-editor
export EDITOR="omarchy-launch-editor --inline"
# Use a custom directory for screenshots (remember to make the directory!)
# export OMARCHY_SCREENSHOT_DIR="$HOME/Pictures/Screenshots"