From a494198dbbdb29c9806e8d0922c8a824cede9b94 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 2 Aug 2023 13:26:11 +0200 Subject: Trying to fix gnome/gdm3 login loop caused by if statements --- .config/zsh/.zshenv | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv index 2861b2a..4539de5 100644 --- a/.config/zsh/.zshenv +++ b/.config/zsh/.zshenv @@ -11,12 +11,21 @@ for wm in "${available_wms[@]}"; do fi done +# Set a flag to indicate if the display server type is found +display_server_found=0 + # Conditionally set Display server -if [ -n "$WAYLAND_DISPLAY" ]; then - export XDG_SESSION_TYPE=wayland -else - export XDG_SESSION_TYPE=x11 +available_displays=("wayland" "x11") +for display in "${available_displays[@]}"; do + if [ "$WAYLAND_DISPLAY" == "$display" ]; then + export XDG_SESSION_TYPE="$display" + display_server_found=1 + break + fi +done +# Check if XDG_SESSION_TYPE is "x11" and set X11-specific variables +if [ "$display_server_found" -eq 1 ] && [ "$XDG_SESSION_TYPE" == "x11" ]; then # X11-specific variables export XINITRC="$HOME/.config/X11/.xinitrc" export XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc" -- cgit v1.2.3