aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gnome-set-config5
-rwxr-xr-xbin/rofi30
2 files changed, 33 insertions, 2 deletions
diff --git a/bin/gnome-set-config b/bin/gnome-set-config
index a3cc753..509d542 100755
--- a/bin/gnome-set-config
+++ b/bin/gnome-set-config
@@ -55,6 +55,7 @@ gsettings set org.gnome.desktop.wm.preferences num-workspaces $NUM_WORKSPACES
ensure_extension_enabled "$WORKSPACE_ROUTER_UUID"
ensure_extension_enabled "$ORG_AGENDA_INDICATOR_UUID"
+ROFI_CMD="$HOME/bin/rofi"
# Disable the default <Super>p. I don't use it, and it's disruptive when I accidentally trigger it.
gsettings set org.gnome.mutter.keybindings switch-monitor '[]'
@@ -90,9 +91,9 @@ gsettings set org.gnome.desktop.wm.keybindings switch-input-source "[]"
gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward '[]'
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi/binding "'<Super>space'"
-dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi/command "'rofi -x11 -show window'"
+dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi/command "'$ROFI_CMD -show window'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi/name "'rofi'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi-run/binding "'<Super>f2'"
-dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi-run/command "'rofi -x11 -show run'"
+dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi-run/command "'$ROFI_CMD -show run'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/rofi-run/name "'rofi-run'"
diff --git a/bin/rofi b/bin/rofi
new file mode 100755
index 0000000..cfa5a8f
--- /dev/null
+++ b/bin/rofi
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# GNOME on Wayland does not support the layer-shell protocol that rofi's
+# native Wayland backend requires, so fall back to Xwayland there.
+
+self_path=$(readlink -f "$0" 2>/dev/null || printf '%s\n' "$0")
+rofi_bin=""
+
+for candidate in /usr/bin/rofi /bin/rofi; do
+ candidate_path=$(readlink -f "$candidate" 2>/dev/null || printf '%s\n' "$candidate")
+ if [ -x "$candidate" ] && [ "$candidate_path" != "$self_path" ]; then
+ rofi_bin="$candidate"
+ break
+ fi
+done
+
+if [ -z "$rofi_bin" ]; then
+ printf '%s\n' "rofi: unable to find the system rofi binary" >&2
+ exit 127
+fi
+
+if [ "${XDG_SESSION_TYPE:-}" = "wayland" ] && [ -n "${WAYLAND_DISPLAY:-}" ]; then
+ case "${XDG_CURRENT_DESKTOP:-}:${DESKTOP_SESSION:-}" in
+ *GNOME*:*|*:gnome|GNOME:*|gnome:*)
+ set -- -x11 "$@"
+ ;;
+ esac
+fi
+
+exec "$rofi_bin" "$@"
nihil fit ex nihilo