mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-06 12:39:35 +02:00
Fix the launcher to do inline replacement so it can be used as $EDITOR properly
This commit is contained in:
@@ -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
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user