Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bin/omarchy-launch-editor
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

case "$EDITOR" in
nvim | vim | nano | micro | hx)
exec setsid uwsm app -- "$TERMINAL" -e "$EDITOR" "$@"
;;
code | codium | subl | gedit | kate | zeditor)
exec setsid uwsm app -- "$EDITOR" "$@"
;;
*)
exec setsid uwsm app -- "$TERMINAL" -e nvim "$@"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have my EDITOR set to emacsclient -c, so will be forced into this branch. I wonder if this might be a bit too clever, with trying to differentiate GUI from TUI editors? Or maybe the fallback should just be the second branch in the above; e.g.

case "$EDITOR" in
nvim | vim | nano | micro | hx)
  exec setsid uwsm app -- "$TERMINAL" -e "$EDITOR" "$@"
  ;;
*)
  exec setsid uwsm app -- "$EDITOR" "$@"
  ;;
esac

So anything we don't definitively know to be TUI is assumed to be a GUI editor.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that idea. But we also have to deal with the case where no $EDITOR is set and make sure it then opens neovim. Can you open a PR for that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will do 👀

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #1702

;;
esac
46 changes: 27 additions & 19 deletions bin/omarchy-menu
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ present_terminal() {
omarchy-launch-floating-terminal-with-presentation $1
}

edit_in_nvim() {
open_in_editor() {
notify-send "Editing config file" "$1"
$TERMINAL -e nvim "$1"
omarchy-launch-editor "$1"
}

install() {
Expand Down Expand Up @@ -142,9 +142,9 @@ show_style_menu() {
*Theme*) show_theme_menu ;;
*Font*) show_font_menu ;;
*Background*) omarchy-theme-bg-next ;;
*Hyprland*) edit_in_nvim ~/.config/hypr/looknfeel.conf ;;
*Screensaver*) edit_in_nvim ~/.config/omarchy/branding/screensaver.txt ;;
*About*) edit_in_nvim ~/.config/omarchy/branding/about.txt ;;
*Hyprland*) open_in_editor ~/.config/hypr/looknfeel.conf ;;
*Screensaver*) open_in_editor ~/.config/omarchy/branding/screensaver.txt ;;
*About*) open_in_editor ~/.config/omarchy/branding/about.txt ;;
*) show_main_menu ;;
esac
}
Expand All @@ -171,7 +171,7 @@ show_setup_menu() {
local options=" Audio\n Wifi\n󰂯 Bluetooth\n󱐋 Power Profile\n󰍹 Monitors"
[ -f ~/.config/hypr/bindings.conf ] && options="$options\n Keybindings"
[ -f ~/.config/hypr/input.conf ] && options="$options\n Input"
options="$options\n󰱔 DNS\n Config\n󰈷 Fingerprint\n Fido2"
options="$options\n Defaults\n󰱔 DNS\n Security\n Config"

case $(menu "Setup" "$options") in
*Audio*) $TERMINAL --class=Wiremix -e wiremix ;;
Expand All @@ -184,13 +184,13 @@ show_setup_menu() {
blueberry
;;
*Power*) show_setup_power_menu ;;
*Monitors*) edit_in_nvim ~/.config/hypr/monitors.conf ;;
*Keybindings*) edit_in_nvim ~/.config/hypr/bindings.conf ;;
*Input*) edit_in_nvim ~/.config/hypr/input.conf ;;
*Monitors*) open_in_editor ~/.config/hypr/monitors.conf ;;
*Keybindings*) open_in_editor ~/.config/hypr/bindings.conf ;;
*Input*) open_in_editor ~/.config/hypr/input.conf ;;
*Defaults*) open_in_editor ~/.config/uwsm/default ;;
*DNS*) present_terminal omarchy-setup-dns ;;
*Security*) show_setup_security_menu ;;
*Config*) show_setup_config_menu ;;
*Fingerprint*) present_terminal omarchy-setup-fingerprint ;;
*Fido2*) present_terminal omarchy-setup-fido2 ;;
*) show_main_menu ;;
esac
}
Expand All @@ -207,18 +207,26 @@ show_setup_power_menu() {

show_setup_config_menu() {
case $(menu "Setup" " Hyprland\n Hypridle\n Hyprlock\n Hyprsunset\n Swayosd\n󰌧 Walker\n󰍜 Waybar\n󰞅 XCompose") in
*Hyprland*) edit_in_nvim ~/.config/hypr/hyprland.conf ;;
*Hypridle*) edit_in_nvim ~/.config/hypr/hypridle.conf && omarchy-restart-hypridle ;;
*Hyprlock*) edit_in_nvim ~/.config/hypr/hyprlock.conf ;;
*Hyprsunset*) edit_in_nvim ~/.config/hypr/hyprsunset.conf && omarchy-restart-hyprsunset ;;
*Swayosd*) edit_in_nvim ~/.config/swayosd/config.toml && omarchy-restart-swayosd ;;
*Walker*) edit_in_nvim ~/.config/walker/config.toml && omarchy-restart-walker ;;
*Waybar*) edit_in_nvim ~/.config/waybar/config.jsonc && omarchy-restart-waybar ;;
*XCompose*) edit_in_nvim ~/.XCompose && omarchy-restart-xcompose ;;
*Hyprland*) open_in_editor ~/.config/hypr/hyprland.conf ;;
*Hypridle*) open_in_editor ~/.config/hypr/hypridle.conf && omarchy-restart-hypridle ;;
*Hyprlock*) open_in_editor ~/.config/hypr/hyprlock.conf ;;
*Hyprsunset*) open_in_editor ~/.config/hypr/hyprsunset.conf && omarchy-restart-hyprsunset ;;
*Swayosd*) open_in_editor ~/.config/swayosd/config.toml && omarchy-restart-swayosd ;;
*Walker*) open_in_editor ~/.config/walker/config.toml && omarchy-restart-walker ;;
*Waybar*) open_in_editor ~/.config/waybar/config.jsonc && omarchy-restart-waybar ;;
*XCompose*) open_in_editor ~/.XCompose && omarchy-restart-xcompose ;;
*) show_main_menu ;;
esac
}

show_setup_security_menu() {
case $(menu "Setup" "󰈷 Fingerprint\n Fido2") in
*Fingerprint*) present_terminal omarchy-setup-fingerprint ;;
*Fido2*) present_terminal omarchy-setup-fido2 ;;
*) show_setup_menu ;;
esac
}

show_install_menu() {
case $(menu "Install" "󰣇 Package\n󰣇 AUR\n Web App\n TUI\n Service\n Style\n󰵮 Development\n Editor\n󱚤 AI\n Gaming") in
*Package*) terminal omarchy-pkg-install ;;
Expand Down
2 changes: 1 addition & 1 deletion config/hypr/bindings.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bindd = SUPER, F, File manager, exec, uwsm app -- nautilus --new-window
bindd = SUPER, B, Browser, exec, $browser
bindd = SUPER SHIFT, B, Browser (private), exec, $browser --private
bindd = SUPER, M, Music, exec, omarchy-launch-or-focus spotify
bindd = SUPER, N, Neovim, exec, $terminal -e nvim
bindd = SUPER, N, Editor, exec, omarchy-launch-editor
bindd = SUPER, T, Activity, exec, $terminal -e btop
bindd = SUPER, D, Docker, exec, $terminal -e lazydocker
bindd = SUPER, G, Signal, exec, omarchy-launch-or-focus signal "uwsm app -- signal-desktop"
Expand Down
4 changes: 4 additions & 0 deletions config/uwsm/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Changes require a relaunch of Hyprland to take effect.

export TERMINAL=alacritty
export EDITOR=nvim
4 changes: 2 additions & 2 deletions config/uwsm/env
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
export OMARCHY_PATH=$HOME/.local/share/omarchy
export PATH=$OMARCHY_PATH/bin/:$PATH

# Set terminal used by all default commands
export TERMINAL=alacritty
# Set default terminal and editor
source ~/.config/uwsm/default

# Activate mise if present on the system
omarchy-cmd-present mise && eval "$(mise activate bash)"
1 change: 0 additions & 1 deletion default/bash/envs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Editor used by CLI
export EDITOR="nvim"
export SUDO_EDITOR="$EDITOR"
export BAT_THEME=ansi
6 changes: 0 additions & 6 deletions default/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,3 @@ source ~/.local/share/omarchy/default/bash/rc
#
# Make an alias for invoking commands you use constantly
# alias p='python'
#
# Use VSCode instead of neovim as your default editor
# export EDITOR="code"
#
# Set a custom prompt with the directory revealed (alternatively use https://starship.rs)
# PS1="\W \[\e]0;\w\a\]$PS1"
16 changes: 11 additions & 5 deletions migrations/1758019332.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
echo "Ensure $TERMINAL is set in uwsm env so entire system can rely on it"
echo "Set \$TERMINAL and \$EDITOR in ~/.config/uwsm/default so entire system can rely on it"

if ! grep -q "export TERMINAL" ~/.config/uwsm/env; then
omarchy-refresh-config uwsm/env
omarchy-state set relaunch-required
fi
# Set terminal and editor default in uwsm
omarchy-refresh-config uwsm/default
omarchy-refresh-config uwsm/env
omarchy-state set relaunch-required

# Ensure scrolltouchpad setting applies to all terminals
if grep -q "scrolltouchpad 1.5, class:Alacritty" ~/.config/hypr/input.conf; then
sed -i 's/windowrule = scrolltouchpad 1\.5, class:Alacritty/windowrule = scrolltouchpad 1.5, tag:terminal/' ~/.config/hypr/input.conf
fi

# Use default editor for keybinding
if grep -q "bindd = SUPER, N, Neovim" ~/.config/hypr/bindings.conf; then
sed -i '/SUPER, N, Neovim, exec/ c\bindd = SUPER, N, Editor, exec, omarchy-launch-editor' ~/.config/hypr/bindings.conf
fi