From e7b14fd8ee49f75d6eb16dc84ae7b9f606fac95b Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Thu, 28 Aug 2025 11:06:45 +0200 Subject: [PATCH] Move Wayland specific env variables into Wayland startup script --- zsh/.profile.d/runwm.sh | 31 ++++++++++++++++++++++++++++++- zsh/.zprofile | 29 +---------------------------- zsh/.zshrc | 6 +++--- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/zsh/.profile.d/runwm.sh b/zsh/.profile.d/runwm.sh index 1954f21..004a6e7 100755 --- a/zsh/.profile.d/runwm.sh +++ b/zsh/.profile.d/runwm.sh @@ -2,8 +2,37 @@ if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then if [ -n "$DBUS_SESSION_BUS_ADDRESS" ]; then + # XDG Wayland support + export XDG_CURRENT_DESKTOP=sway # Required for tray icons on waybar + export XDG_SESSION_TYPE=wayland # Session Type for later screensharing + + # Force wayland on qt apps + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 + + # Explicitly set to '96' instead of 'physical' because some apps have problems + # Looking at you nextcloud client! + # https://github.com/nextcloud/desktop/issues/1079 + # https://github.com/swaywm/sway/issues/2424 + export QT_WAYLAND_FORCE_DPI=96 + + # Mozilla Wayland support + hardware video decoding + export MOZ_ENABLE_WAYLAND=1 + export MOZ_WAYLAND_USE_VAAPI=1 + + # Reduces crashs for some gdk apps, like evolution + # ! Do not set as global variable. Electron Apps will not start ! + # export GDK_BACKEND=wayland + + # SDL + export SDL_VIDEODRIVER=wayland + + # Java under Xwayland + export _JAVA_AWT_WM_NONREPARENTING=1 + + # Launch Sway through dbus exec dbus-run-session sway else - echo "Cannot found dbus session: Sway don't work" + echo "Cannot found DBus session, Wayland startup failed" fi fi diff --git a/zsh/.zprofile b/zsh/.zprofile index 436d64b..c912020 100644 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -15,8 +15,6 @@ export XDG_CONFIG_HOME=${HOME}/.config export XDG_DATA_HOME=${HOME}/.local/share export XDG_CACHE_HOME=${HOME}/.local/cache export XDG_STATE_HOME=${HOME}/.local/state -export XDG_CURRENT_DESKTOP=sway # Required for tray icons on waybar -export XDG_SESSION_TYPE=wayland # Session Type for later screensharing # Enable GTK themes export GTK2_RC_FILES=${XDG_CONFIG_HOME}/gtk-2.0/gtkrc-2.0 @@ -24,39 +22,14 @@ export GTK2_RC_FILES=${XDG_CONFIG_HOME}/gtk-2.0/gtkrc-2.0 # Enable QT apps to have gtk theme export QT_QPA_PLATFORMTHEME=qt5ct -# Force wayland on qt apps -export QT_QPA_PLATFORM=wayland - -export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 - -# Explicitly set to '96' instead of 'physical' because some apps have problems -# Looking at you nextcloud client! -# https://github.com/nextcloud/desktop/issues/1079 -# https://github.com/swaywm/sway/issues/2424 -export QT_WAYLAND_FORCE_DPI=96 - # Make Qt apps honour DPI settings. export QT_AUTO_SCREEN_SCALE_FACTOR=1 -# Mozilla Wayland support + hardware video decoding -export MOZ_ENABLE_WAYLAND=1 -export MOZ_WAYLAND_USE_VAAPI=1 - export ZSH_HOME="$HOME/.zsh" export DOTFILES="$HOME/.dotfiles" export EDITOR=nvim export HELPDIR=/usr/share/zsh/"${ZSH_VERSION}"/help -# Reduces crashs for some gdk apps, like evolution -# ! Do not set as global variable. Electron Apps will not start ! -# export GDK_BACKEND=wayland - -# SDL -export SDL_VIDEODRIVER=wayland - -# Java under Xwayland -export _JAVA_AWT_WM_NONREPARENTING=1 - # SSH socket export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh" @@ -79,4 +52,4 @@ source "$HOME/.profile.d/cargo.sh" source "$HOME/.profile.d/golang.sh" source "$HOME/.profile.d/java.sh" source "$HOME/.profile.d/zoxide.sh" -source "$HOME/.profile.d/runwm.sh" +# source "$HOME/.profile.d/runwm.sh" diff --git a/zsh/.zshrc b/zsh/.zshrc index 976de00..693b214 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -81,6 +81,6 @@ alias userlist="cut -d: -f1 /etc/passwd | sort" alias ip='ip -color' alias stow='stow -d $DOTFILES ' -if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then - tmux attach-session -t default || tmux new-session -s default -fi +# if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then +# tmux attach-session -t default || tmux new-session -s default +# fi