You are not logged in.
so when i login into sway using sway in tty
XDG_SESSION_DESKTOP is not set to anything and i need it to be set to sway
i tried bash scripts like this
#!/bin/bash
export XDG_SESSION_DESKTOP=sway
exec sway
#!/bin/bash
export XDG_SESSION_DESKTOP=sway
XDG_SESSION_DESKTOP=sway sway
#!/bin/bash
export XDG_SESSION_DESKTOP=sway
env XDG_SESSION_DESKTOP=sway sway
after running one of this scripts and openning terminal and running echo $XDG_SESSION_DESKTOP
it seems to be empty / not set still
how can i set it?
Online
Last edited by omarhanykasban (2024-12-06 19:27:17)
Offline
Are you sure you're not confusing XDG_SESSION_DESKTOP with XDG_CURRENT_DESKTOP?
If you're positive, then perhaps add it to your /etc/sway/config.d/50-systemd-user.conf. Based on the comments in the file, it sounds like sway makes it difficult:
# sway does not set DISPLAY/WAYLAND_DISPLAY in the systemd user environment
# See FS#63021
# Adapted from xorg's 50-systemd-user.sh, which achieves a similar goal.
# Upstream refuses to set XDG_CURRENT_DESKTOP so we have to.
<snip>
Offline
i know that this file has
exec systemctl --user set-environment XDG_CURRENT_DESKTOP=sway
i also tried echo $XDG_CURRENT_DESKTOP
and it said nothing
i just want this from .profile to work
if [ "$XDG_SESSION_DESKTOP" = "i3" ] || [ "$XDG_SESSION_DESKTOP" = "sway" ] || [ "$XDG_SESSION_DESKTOP" = "Hyprland" ]; then
# Set the platform theme for QT applications
export QT_QPA_PLATFORMTHEME=qt5ct
# Override the default style for QT applications
export QT_STYLE_OVERRIDE=kvantum-dark
# Set Kvantum theme
export KVANTUM_THEME=Nordic
# Set the icon theme for the desktop environment
export ICON_THEME=Papirus-Dark
export QT_QPA_ICONTHEME=Papirus-Dark
# Set the GTK theme to use for applications
export GTK_THEME=Nordic
# Set the cursor theme across various environments
export CURSOR_THEME=WhiteSur-cursors
export QT_QT_CURSORTHEME=WhiteSur-cursors
export QT_QT5_CURSORTHEME=WhiteSur-cursors
export QT_QT6_CURSORTHEME=WhiteSur-cursors
export XCURSOR_THEME=WhiteSur-cursors
# Define the cursor size for different environments
export CURSOR_SIZE=24
export XCURSOR_SIZE=24
fi
Offline
i just tried to put
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway
in .profile and it doesnt even work
how do i set this 2 envs please i need them
Last edited by omarhanykasban (2024-12-06 01:47:13)
Offline
You don't at all.
First and foremost and as twelveeighty hinted, that's not a formal variable.
Second, setting it before starting the session will be simply too late for your ~/.profile which is parsed by the login shell - so if that's your "does nots works" metric, that's not surprising at all.
[Edit: third, those are to be set by the session/WM/compositor, so you can expect them to change whenever the session actually starts]
Instead set the other variables right before starting the WM, depending on which WM you start.
Last edited by seth (2024-12-06 08:44:16)
Offline
```sh
#!/bin/bash
# Set environment variables
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway
# Source the user's .profile
if [ -f "$HOME/.profile" ]; then
. "$HOME/.profile"
fi
# Start the Sway session
dbus-run-session /usr/bin/sway --unsupported-gpu "$@"
```
works i only had to use `dbus-run-session`
Offline
Please use [code][/code] tags, the bbs predates markdown by your age. Edit your post in this regard.
What is that file?
Why does it source ~/.profile?
Why do you insist of condition the environment in ~/.profile instead of fixing this file?
Again: do not export those variables, they're for the session to set - not you.
Generally don't use dbus-run-session, you probably need to "systemctl --user import-environment [VARIABLES]" and "dbus-update-activation-environment [VARIABLES]" (see /etc/X11/xinit/xinitrc.d/50-systemd-user.sh) but again: your entire approach to this is convoluted tbw.
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline