dotfiles/dot_zprofile

112 lines
4 KiB
Text

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
if ! cat /etc/locale.conf | grep LANG=${lang}.UTF-8 1>/dev/null 2>&1; then
echo "LANG=${lang}.UTF-8" > /etc/locale.conf
echo "LC_COLLATE=C" >> /etc/locale.conf
echo "LANGUAGE=${lang}" >> /etc/locale.conf
echo "${lang}.UTF-8 UTF-8" > /etc/locale.gen
echo "${lang} ISO-8859-1" >> /etc/locale.gen
#echo "${lang}@euro ISO-8859-15" >> /etc/locale.gen
if ! grep 'en_US.UTF-8 UTF-8' /etc/locale.gen 1>/dev/null 2>&1; then
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
fi
locale-gen
fi
keytable_short="${keytable:0:2}"
echo "KEYMAP=${keytable_short}" > /etc/vconsole.conf
echo "FONT=lat9w-16" >> /etc/vconsole.conf
if [ -f "/etc/conf.d/keymaps" ]; then
sed -i 's/keymap=.*$/keymap=\"'$keytable_short'\"/' /etc/conf.d/keymaps
fi
sed -e 's|Option "XkbLayout".*$|Option "XkbLayout" "'$keytable_short'"|' -i /etc/X11/xorg.conf.d/20-keyboard.conf
if [ "$keytable_short" != "de" ]; then
sed -e 's| xkb_layout.*$| xkb_layout '$keytable_short',de|' -i /home/${user}/.config/sway/config
fi
# https://stackoverflow.com/questions/5767062/how-to-check-if-a-symlink-exists
if [ -L /etc/localtime ]; then
rm /etc/localtime
fi
ln -s /usr/share/zoneinfo/"${tz}" /etc/localtime
# Set global environments
export QT_QPA_PLATFORMTHEME=qt6ct
# 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"
# 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
fi
export PATH="$PATH:/home/${USER}/.local/bin/"
export PATH="$PATH:/home/${USER}/go/bin/"
export PATH="$PATH:/home/${USER}/.local/share/flatpak/exports/bin/"
export XDG_DATA_DIRS="/usr/share/:/usr/local/share/:/var/lib/flatpak/exports/share/:/home/${USER}/.local/share/flatpak/exports/share/"
# Added by Toolbox App
export PATH="$PATH:/home/${USER}/.local/share/JetBrains/Toolbox/scripts"
# Enable SSH agent
eval $(keychain --noask --eval --quiet)
# Various exports
export SHELL="$(command -v zsh)"
export TERMINAL=wezterm
export EDITOR=vim
# Falls autostartdesktop auf i3 gesetzt wird, wird i3 statt sway gestartet
if [ "${autostartdesktop}" = "i3" ]; then
echo "exec i3" > ~/.xinitrc
startx
elif [ "${autostartdesktop}" = "gnome" ]; then
MOZ_ENABLE_WAYLAND=1 QT_QPA_PLATFORM=wayland XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session
else
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export GDK_BACKEND=wayland
export XDG_SESSION_TYPE=wayland
export XDG_CURRENT_DESKTOP=sway
export WLR_NO_HARDWARE_CURSORS=1
export CLUTTER_BACKEND=wayland
export SDL_VIDEODRIVER=wayland
export BEMENU_BACKEND=wayland
export _JAVA_AWT_WM_NONREPARENTING=1 #Make java programs work somewhat
export ECORE_EVAS_ENGINE=wayland_egl
export ELM_ENGINE=wayland_egl
export PAN_MESA_DEBUG=gl3 #Fix alacritty not starting
export MOZ_ENABLE_WAYLAND=1 # Fix firefox not starting
#export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:~/.local/lib/
#XDG_CURRENT_DESKTOP=sway dbus-run-session sway
exec sway
fi
fi