dotfiles/.chezmoitemplates/zprofile_linux.tmpl

114 lines
4.2 KiB
Cheetah
Raw Normal View History

2023-10-10 10:31:43 +02:00
__dotfiles_wayland_teardown() {
# true: as long as we try it's okay
#systemctl --user stop sway-session.target || true
# 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
}
2023-06-21 08:28:46 +02:00
if [[ -z $DISPLAY && $(tty) == /dev/tty1 && $XDG_SESSION_TYPE == tty ]]; then
# Lade die Bootparameter in den Variablen
for wort in $(cat /proc/cmdline)
do
echo "Parameter ${wort%=*} = ${wort#*=}"
if ! export ${wort%=*}=${wort#*=}; then echo "cannot export ${wort}!!!"; fi
done
# set systemconfiguration
2023-07-19 14:42:43 +02:00
echo "set systemconfiguration"
sudo scripts/set-systemsettings.sh
2023-06-07 15:48:35 +02:00
# First make sure dbus is started
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
export DBUS_SESSION_BUS_ADDRESS="$(dbus-daemon --session --fork --print-address)"
fi
echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
2023-01-30 14:28:59 +01:00
2023-06-07 15:48:35 +02:00
# Set XDG_RUNTIME_DIR
# Paragraph modified from https://wiki.gentoo.org/wiki/Sway
if test -z "${XDG_RUNTIME_DIR}"; then
UID="$(id -u)"
export XDG_RUNTIME_DIR=/tmp/"${UID}"-runtime-dir
if ! test -d "${XDG_RUNTIME_DIR}"; then
mkdir "${XDG_RUNTIME_DIR}"
chmod 0700 "${XDG_RUNTIME_DIR}"
fi
2023-06-07 15:48:35 +02:00
fi
2023-06-12 18:15:25 +02:00
export PATH="$PATH:/home/${USER}/.local/bin/"
export PATH="$PATH:/home/${USER}/go/bin/"
2023-10-10 10:31:43 +02:00
export XDG_DATA_DIRS="/usr/share/:/usr/local/share/"
2023-06-12 18:15:25 +02:00
# Added by Toolbox App
export PATH="$PATH:/home/${USER}/.local/share/JetBrains/Toolbox/scripts"
2023-06-07 15:48:35 +02:00
# Enable SSH agent
eval $(keychain --noask --eval --quiet)
2023-01-30 14:28:59 +01:00
2023-06-07 15:48:35 +02:00
# Various exports
export SHELL="$(command -v zsh)"
2023-01-30 14:28:59 +01:00
2023-06-08 11:10:35 +02:00
export TERMINAL=wezterm
export EDITOR=vim
2023-06-07 15:48:35 +02:00
# Falls autostartdesktop auf i3 gesetzt wird, wird i3 statt sway gestartet
if [ "${autostartdesktop}" = "i3" ]; then
echo "exec i3" > ~/.xinitrc
startx
2023-06-21 08:28:46 +02:00
elif [ "${autostartdesktop}" = "gnome" ]; then
MOZ_ENABLE_WAYLAND=1 QT_QPA_PLATFORM=wayland XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session
2023-06-07 15:48:35 +02:00
else
2023-10-10 10:31:43 +02:00
__dotfiles_wayland_teardown
2023-10-10 14:07:26 +02:00
# Set global environments
echo "set global environments"
export QT_QPA_PLATFORMTHEME=qt6ct
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export GDK_BACKEND=wayland
2023-10-10 10:13:27 +02:00
export XDG_CURRENT_DESKTOP=sway # xdg-desktop-portal
export XDG_SESSION_DESKTOP=sway # systemd
export XDG_SESSION_TYPE=wayland # xdg/systemd
export WLR_NO_HARDWARE_CURSORS=1
export CLUTTER_BACKEND=wayland
export SDL_VIDEODRIVER=wayland
2023-06-06 09:23:57 +02:00
export BEMENU_BACKEND=wayland
2023-01-30 14:28:59 +01:00
export _JAVA_AWT_WM_NONREPARENTING=1 #Make java programs work somewhat
export ECORE_EVAS_ENGINE=wayland_egl
export ELM_ENGINE=wayland_egl
2023-01-30 14:28:59 +01:00
export PAN_MESA_DEBUG=gl3 #Fix alacritty not starting
export MOZ_ENABLE_WAYLAND=1 # Fix firefox not starting
2023-01-30 14:28:59 +01:00
2023-10-10 10:31:43 +02:00
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
# true: ignore errors here so we always do the teardown afterwards
# shellcheck disable=SC2068
systemd-run --quiet --unit=sway --user --wait sway $@ || true
__dotfiles_wayland_teardown
#export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:~/.local/lib/
2023-01-30 14:28:59 +01:00
#XDG_CURRENT_DESKTOP=sway dbus-run-session sway
exec sway
fi
2023-01-30 14:28:59 +01:00
fi