diff --git a/root/usr/local/bin/hypr.sh b/root/usr/local/bin/hypr.sh new file mode 100755 index 0000000..c96ac47 --- /dev/null +++ b/root/usr/local/bin/hypr.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh + +set -eu + +export XDG_CURRENT_DESKTOP=Hyprland # xdg-desktop-portal +export XDG_SESSION_DESKTOP=Hyprland # systemd +export XDG_SESSION_TYPE=wayland # xdg/systemd + +if command -v dbus-update-activation-environment >/dev/null; then + dbus-update-activation-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE +fi +# without this, systemd starts xdg-desktop-portal without these environment variables, +# and the xdg-desktop-portal does not start xdg-desktop-portal-wrl as expected +# https://github.com/emersion/xdg-desktop-portal-wlr/issues/39#issuecomment-638752975 +systemctl --user import-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE + +# use systemd-run here, because systemd units inherit variables from ~/.config/environment.d +# shellcheck disable=SC2068 +systemd-run --quiet --unit=hypr --user --wait Hyprland $@ +systemctl --user stop hypr-session.target + +# this teardown makes it easier to switch between compositors +unset DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE +systemctl --user unset-environment DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE +if command -v dbus-update-activation-environment >/dev/null; then + dbus-update-activation-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE +fi + diff --git a/root/usr/local/bin/sway.sh b/root/usr/local/bin/sway.sh new file mode 100755 index 0000000..53c6d15 --- /dev/null +++ b/root/usr/local/bin/sway.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh + +set -eu + +export XDG_CURRENT_DESKTOP=sway # xdg-desktop-portal +export XDG_SESSION_DESKTOP=sway # systemd +export XDG_SESSION_TYPE=wayland # xdg/systemd + +if command -v dbus-update-activation-environment >/dev/null; then + dbus-update-activation-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE +fi +# without this, systemd starts xdg-desktop-portal without these environment variables, +# and the xdg-desktop-portal does not start xdg-desktop-portal-wrl as expected +# https://github.com/emersion/xdg-desktop-portal-wlr/issues/39#issuecomment-638752975 +systemctl --user import-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE + +# use systemd-run here, because systemd units inherit variables from ~/.config/environment.d +# shellcheck disable=SC2068 +systemd-run --quiet --unit=sway --user --wait sway $@ +systemctl --user stop sway-session.target + +# this teardown makes it easier to switch between compositors +unset DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE +systemctl --user unset-environment DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE +if command -v dbus-update-activation-environment >/dev/null; then + dbus-update-activation-environment XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE +fi +