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
+17 -6
View File
@@ -1,21 +1,32 @@
#!/bin/bash #!/bin/bash
# omarchy:summary=Launch the default editor selected via Omarchy defaults. # 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" default_editor="$HOME/.local/state/omarchy/defaults/editor"
editor="nvim"
if [[ -f $editor_file ]]; then if [[ ${1:-} == "--inline" ]]; then
read -r editor <"$editor_file" inline=true
shift
else
inline=false
fi
if [[ -f $default_editor ]]; then
read -r editor <"$default_editor"
else
editor="nvim"
fi fi
[[ -n $editor ]] || editor="nvim"
omarchy-cmd-present "$editor" || editor="nvim" omarchy-cmd-present "$editor" || editor="nvim"
case "${editor##*/}" in case "${editor##*/}" in
nvim | vim | nano | micro | hx | helix | fresh) nvim | vim | nano | micro | hx | helix | fresh)
if [[ $inline == "true" ]]; then
exec "$editor" "$@"
else
exec omarchy-launch-tui "$editor" "$@" exec omarchy-launch-tui "$editor" "$@"
fi
;; ;;
*) *)
exec setsid uwsm-app -- "$editor" "$@" exec setsid uwsm-app -- "$editor" "$@"
+1 -1
View File
@@ -7,7 +7,7 @@ export TERMINAL=xdg-terminal-exec
export BROWSER=omarchy-launch-browser export BROWSER=omarchy-launch-browser
# Used by terminal programs to open files with the selected Omarchy default editor # 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!) # Use a custom directory for screenshots (remember to make the directory!)
# export OMARCHY_SCREENSHOT_DIR="$HOME/Pictures/Screenshots" # export OMARCHY_SCREENSHOT_DIR="$HOME/Pictures/Screenshots"