mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Switch to xdg-terminal-exec
Solves the issue from ae10133b5e the right
way using the actual xdg-terminal-exec package and provides resillient
fallbacks no matter what the user might do.
This also removes the need to restart after changing terminals at all.
fixes #2198
fixes #2329
fixes #2673
fixes #1754
This commit is contained in:
21
applications/Alacritty.desktop
Normal file
21
applications/Alacritty.desktop
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
TryExec=alacritty
|
||||||
|
Exec=alacritty
|
||||||
|
Icon=Alacritty
|
||||||
|
Terminal=false
|
||||||
|
Categories=System;TerminalEmulator;
|
||||||
|
Name=Alacritty
|
||||||
|
GenericName=Terminal
|
||||||
|
Comment=A fast, cross-platform, OpenGL terminal emulator
|
||||||
|
StartupNotify=true
|
||||||
|
StartupWMClass=Alacritty
|
||||||
|
Actions=New;
|
||||||
|
X-TerminalArgExec=-e
|
||||||
|
X-TerminalArgAppId=--class=
|
||||||
|
X-TerminalArgTitle=--title=
|
||||||
|
X-TerminalArgDir=--working-directory=
|
||||||
|
|
||||||
|
[Desktop Action New]
|
||||||
|
Name=New Terminal
|
||||||
|
Exec=alacritty
|
||||||
@@ -7,15 +7,41 @@ fi
|
|||||||
|
|
||||||
package="$1"
|
package="$1"
|
||||||
|
|
||||||
|
# Map package name to desktop entry ID
|
||||||
|
case "$package" in
|
||||||
|
alacritty)
|
||||||
|
desktop_id="Alacritty.desktop"
|
||||||
|
;;
|
||||||
|
ghostty)
|
||||||
|
desktop_id="com.mitchellh.ghostty.desktop"
|
||||||
|
;;
|
||||||
|
kitty)
|
||||||
|
desktop_id="kitty.desktop"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown terminal: $package"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Install package
|
# Install package
|
||||||
if omarchy-pkg-add $package; then
|
if omarchy-pkg-add $package; then
|
||||||
# Set as default terminal
|
# Set as default terminal
|
||||||
echo "Setting $package as new default terminal..."
|
echo "Setting $package as new default terminal..."
|
||||||
sed -i "/export TERMINAL=/ c\export TERMINAL=$package" ~/.config/uwsm/default
|
sed -i "/export TERMINAL=/ c\export TERMINAL=$package" ~/.config/uwsm/default
|
||||||
|
|
||||||
# Restart is needed for new default to take effect
|
# Copy custom desktop entry for alacritty with X-TerminalArg* keys
|
||||||
echo
|
if [ "$package" = "alacritty" ]; then
|
||||||
gum confirm "Restart to use new terminal?" && systemctl reboot --no-wall
|
mkdir -p ~/.local/share/applications
|
||||||
|
cp "$OMARCHY_PATH/applications/Alacritty.desktop" ~/.local/share/applications/
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update xdg-terminals.list to prioritize the proper terminal
|
||||||
|
cat > ~/.config/xdg-terminals.list << EOF
|
||||||
|
# Terminal emulator preference order for xdg-terminal-exec
|
||||||
|
# The first found and valid terminal will be used
|
||||||
|
$desktop_id
|
||||||
|
EOF
|
||||||
else
|
else
|
||||||
echo "Failed to install $package"
|
echo "Failed to install $package"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
exec setsid uwsm-app -- alacritty --class=Omarchy -o font.size=9 -e bash -c 'fastfetch; read -n 1 -s'
|
exec setsid uwsm-app -- xdg-terminal-exec --app-id=com.omarchy.Omarchy -e bash -c 'fastfetch; read -n 1 -s'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ omarchy-cmd-present "$EDITOR" || EDITOR=nvim
|
|||||||
|
|
||||||
case "$EDITOR" in
|
case "$EDITOR" in
|
||||||
nvim | vim | nano | micro | hx | helix)
|
nvim | vim | nano | micro | hx | helix)
|
||||||
exec setsid uwsm-app -- "$TERMINAL" -e "$EDITOR" "$@"
|
exec setsid uwsm-app -- xdg-terminal-exec "$EDITOR" "$@"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
exec setsid uwsm-app -- "$EDITOR" "$@"
|
exec setsid uwsm-app -- "$EDITOR" "$@"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cmd="$*"
|
cmd="$*"
|
||||||
exec setsid uwsm-app -- alacritty -o font.size=9 --class=Omarchy --title=Omarchy -e bash -c "omarchy-show-logo; $cmd; omarchy-show-done"
|
exec setsid uwsm-app -- xdg-terminal-exec --app-id=com.omarchy.Omarchy --title=Omarchy -e bash -c "omarchy-show-logo; $cmd; omarchy-show-done"
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
exec setsid uwsm-app -- "${TERMINAL:-alacritty}" -e "$@"
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
exec setsid uwsm-app -- "$TERMINAL" --class=Impala -e impala "$@"
|
exec setsid uwsm-app -- xdg-terminal-exec --app-id=com.omarchy.Impala -e impala "$@"
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
terminal() {
|
terminal() {
|
||||||
alacritty --class=Omarchy -e "$@"
|
xdg-terminal-exec --app-id=com.omarchy.Omarchy "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
present_terminal() {
|
present_terminal() {
|
||||||
@@ -178,7 +178,7 @@ show_setup_menu() {
|
|||||||
options="$options\n Defaults\n DNS\n Security\n Config"
|
options="$options\n Defaults\n DNS\n Security\n Config"
|
||||||
|
|
||||||
case $(menu "Setup" "$options") in
|
case $(menu "Setup" "$options") in
|
||||||
*Audio*) $TERMINAL --class=Wiremix -e wiremix ;;
|
*Audio*) xdg-terminal-exec --app-id=com.omarchy.Wiremix -e wiremix ;;
|
||||||
*Wifi*)
|
*Wifi*)
|
||||||
rfkill unblock wifi
|
rfkill unblock wifi
|
||||||
omarchy-launch-wifi
|
omarchy-launch-wifi
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Application bindings
|
# Application bindings
|
||||||
$terminal = uwsm-app -- $TERMINAL
|
$terminal = uwsm-app -- xdg-terminal-exec
|
||||||
$browser = omarchy-launch-browser
|
$browser = omarchy-launch-browser
|
||||||
|
|
||||||
bindd = SUPER, RETURN, Terminal, exec, $terminal --working-directory="$(omarchy-cmd-terminal-cwd)"
|
bindd = SUPER, RETURN, Terminal, exec, $terminal --working-directory="$(omarchy-cmd-terminal-cwd)"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Changes require a restart to take effect.
|
# Changes require a restart to take effect.
|
||||||
|
|
||||||
# Install other terminals via Install > Terminal
|
# Install other terminals via Install > Terminal
|
||||||
export TERMINAL=alacritty
|
export TERMINAL=xdg-terminal-exec
|
||||||
|
|
||||||
# Use code for VSCode
|
# Use code for VSCode
|
||||||
export EDITOR=nvim
|
export EDITOR=nvim
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
"custom/omarchy": {
|
"custom/omarchy": {
|
||||||
"format": "<span font='omarchy'>\ue900</span>",
|
"format": "<span font='omarchy'>\ue900</span>",
|
||||||
"on-click": "omarchy-menu",
|
"on-click": "omarchy-menu",
|
||||||
"on-click-right": "omarchy-launch-terminal",
|
"on-click-right": "xdg-terminal-exec",
|
||||||
"tooltip-format": "Omarchy Menu\n\nSuper + Alt + Space"
|
"tooltip-format": "Omarchy Menu\n\nSuper + Alt + Space"
|
||||||
},
|
},
|
||||||
"custom/update": {
|
"custom/update": {
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
"cpu": {
|
"cpu": {
|
||||||
"interval": 5,
|
"interval": 5,
|
||||||
"format": "",
|
"format": "",
|
||||||
"on-click": "$TERMINAL -e btop"
|
"on-click": "xdg-terminal-exec btop"
|
||||||
},
|
},
|
||||||
"clock": {
|
"clock": {
|
||||||
"format": "{:L%A %H:%M}",
|
"format": "{:L%A %H:%M}",
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
},
|
},
|
||||||
"pulseaudio": {
|
"pulseaudio": {
|
||||||
"format": "{icon}",
|
"format": "{icon}",
|
||||||
"on-click": "$TERMINAL --class=Wiremix -e wiremix",
|
"on-click": "xdg-terminal-exec --app-id=com.omarchy.Wiremix -e wiremix",
|
||||||
"on-click-right": "pamixer -t",
|
"on-click-right": "pamixer -t",
|
||||||
"tooltip-format": "Playing at {volume}%",
|
"tooltip-format": "Playing at {volume}%",
|
||||||
"scroll-step": 5,
|
"scroll-step": 5,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# Floating windows
|
# Floating windows
|
||||||
windowrule = float, tag:floating-window
|
windowrule = float, tag:floating-window
|
||||||
windowrule = center, tag:floating-window
|
windowrule = center, tag:floating-window
|
||||||
windowrule = size 800 600, tag:floating-window
|
windowrule = size 875 600, tag:floating-window
|
||||||
|
|
||||||
windowrule = tag +floating-window, class:(blueberry.py|Impala|Wiremix|org.gnome.NautilusPreviewer|com.gabm.satty|Omarchy|About|TUI.float)
|
windowrule = tag +floating-window, class:(blueberry.py|com.omarchy.Impala|com.omarchy.Wiremix|com.omarchy.Omarchy|org.gnome.NautilusPreviewer|com.gabm.satty|Omarchy|About|TUI.float)
|
||||||
windowrule = tag +floating-window, class:(xdg-desktop-portal-gtk|sublime_text|DesktopEditors|org.gnome.Nautilus), title:^(Open.*Files?|Open [F|f]older.*|Save.*Files?|Save.*As|Save|All Files|.*wants to [open|save].*|[C|c]hoose.*)
|
windowrule = tag +floating-window, class:(xdg-desktop-portal-gtk|sublime_text|DesktopEditors|org.gnome.Nautilus), title:^(Open.*Files?|Open [F|f]older.*|Save.*Files?|Save.*As|Save|All Files|.*wants to [open|save].*|[C|c]hoose.*)
|
||||||
windowrule = float, class:org.gnome.Calculator
|
windowrule = float, class:org.gnome.Calculator
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# Solve for hardcoded glib terminals
|
|
||||||
# https://github.com/basecamp/omarchy/issues/1852
|
|
||||||
sudo ln -s $OMARCHY_PATH/bin/omarchy-launch-terminal /usr/local/bin/xdg-terminal-exec
|
|
||||||
@@ -143,6 +143,7 @@ wl-clipboard
|
|||||||
woff2-font-awesome
|
woff2-font-awesome
|
||||||
xdg-desktop-portal-gtk
|
xdg-desktop-portal-gtk
|
||||||
xdg-desktop-portal-hyprland
|
xdg-desktop-portal-hyprland
|
||||||
|
xdg-terminal-exec
|
||||||
xmlstarlet
|
xmlstarlet
|
||||||
xournalpp
|
xournalpp
|
||||||
yaru-icon-theme
|
yaru-icon-theme
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
echo "Setting up xdg-terminal-exec for gtk-launch terminal support"
|
|
||||||
# Solve for hardcoded glib terminals
|
|
||||||
# https://github.com/basecamp/omarchy/issues/1852
|
|
||||||
sudo ln -s $OMARCHY_PATH/bin/omarchy-launch-terminal /usr/local/bin/xdg-terminal-exec
|
|
||||||
64
migrations/1762121828.sh
Normal file
64
migrations/1762121828.sh
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
echo "Setting up xdg-terminal-exec for gtk-launch terminal support"
|
||||||
|
# Solve for hardcoded glib terminals
|
||||||
|
# https://github.com/basecamp/omarchy/issues/1852
|
||||||
|
|
||||||
|
# Remove old symlink if it exists -- if someone ran the previous migration early
|
||||||
|
if [ -L /usr/local/bin/xdg-terminal-exec ]; then
|
||||||
|
sudo rm /usr/local/bin/xdg-terminal-exec
|
||||||
|
fi
|
||||||
|
|
||||||
|
omarchy-pkg-add xdg-terminal-exec
|
||||||
|
|
||||||
|
# Set up xdg-terminals.list based on current $TERMINAL
|
||||||
|
if [ -n "$TERMINAL" ]; then
|
||||||
|
case "$TERMINAL" in
|
||||||
|
alacritty)
|
||||||
|
desktop_id="Alacritty.desktop"
|
||||||
|
;;
|
||||||
|
ghostty)
|
||||||
|
desktop_id="com.mitchellh.ghostty.desktop"
|
||||||
|
;;
|
||||||
|
kitty)
|
||||||
|
desktop_id="kitty.desktop"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -n "$desktop_id" ]; then
|
||||||
|
mkdir -p ~/.config
|
||||||
|
cat > ~/.config/xdg-terminals.list << EOF
|
||||||
|
# Terminal emulator preference order for xdg-terminal-exec
|
||||||
|
# The first found and valid terminal will be used
|
||||||
|
$desktop_id
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy custom desktop entries with proper X-TerminalArg* keys
|
||||||
|
if command -v alacritty > /dev/null 2>&1; then
|
||||||
|
cp "$OMARCHY_PATH/applications/Alacritty.desktop" ~/.local/share/applications/
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update hyprland bindings to use xdg-terminal-exec
|
||||||
|
sed -i 's/\$terminal = uwsm-app -- \$TERMINAL/$terminal = uwsm-app -- xdg-terminal-exec/' ~/.config/hypr/bindings.conf
|
||||||
|
# Update --working-directory to --dir for xdg-terminal-exec
|
||||||
|
sed -i 's/--working-directory=/--dir=/g' ~/.config/hypr/bindings.conf
|
||||||
|
|
||||||
|
# Update TERMINAL variable in uwsm config
|
||||||
|
sed -i 's/export TERMINAL=.*/export TERMINAL=xdg-terminal-exec/' ~/.config/uwsm/default
|
||||||
|
|
||||||
|
# Update waybar config to use xdg-terminal-exec
|
||||||
|
waybar_config=~/.config/waybar/config.jsonc
|
||||||
|
if [ -f "$waybar_config" ]; then
|
||||||
|
sed -i 's|"on-click-right": "omarchy-launch-terminal"|"on-click-right": "xdg-terminal-exec"|' "$waybar_config"
|
||||||
|
sed -i 's|"on-click": "\$TERMINAL -e btop"|"on-click": "xdg-terminal-exec btop"|' "$waybar_config"
|
||||||
|
sed -i 's|"on-click": "\$TERMINAL --class=Wiremix -e wiremix"|"on-click": "xdg-terminal-exec --app-id=com.omarchy.Wiremix -e wiremix"|' "$waybar_config"
|
||||||
|
omarchy-state set restart-waybar-required
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update hyprland window rules to use DNS-format class names
|
||||||
|
system_conf=~/.config/hypr/apps/system.conf
|
||||||
|
if [ -f "$system_conf" ]; then
|
||||||
|
if grep -q 'class:(.*|Impala|' "$system_conf" || grep -q 'class:(.*|Wiremix|' "$system_conf" || grep -q '|Omarchy|' "$system_conf"; then
|
||||||
|
sed -i 's/\bImpala\b/com.omarchy.Impala/g; s/\bWiremix\b/com.omarchy.Wiremix/g; s/|Omarchy|/|com.omarchy.Omarchy|/g' "$system_conf"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user