cleanup: remove XDG_SESSION_TYPE, XDG_VTNR from global environment
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
sane.programs.komikku = {
|
||||
# packageUnwrapped = pkgs.komikku.overrideAttrs (upstream: {
|
||||
# preFixup = ''
|
||||
# # 2024/02/21: render bug which affects only moby:
|
||||
# # large images render blank in several gtk applications.
|
||||
# # may resolve itself as gtk or mesa are updated.
|
||||
# gappsWrapperArgs+=(--set GSK_RENDERER cairo)
|
||||
# '' + (upstream.preFixup or "");
|
||||
# });
|
||||
packageUnwrapped = pkgs.komikku.overrideAttrs (upstream: {
|
||||
preFixup = ''
|
||||
# 2024/07/25: Komikku uses XDG_SESSION_TYPE in the webkitgtk useragent, and errors if it's empty.
|
||||
# XDG_SESSION_DESKTOP is used similarly in debug_info.py.
|
||||
# TODO: patch/upstream Komikku
|
||||
gappsWrapperArgs+=(--set-default XDG_SESSION_TYPE "unknown" --set-default XDG_SESSION_DESKTOP "unknown")
|
||||
'' + (upstream.preFixup or "");
|
||||
});
|
||||
|
||||
sandbox.method = "bwrap"; # TODO:sandbox untested
|
||||
sandbox.net = "clearnet";
|
||||
|
@@ -13,6 +13,19 @@ let
|
||||
echo "warning: required directory not found (create it?): $(dirname "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY")"
|
||||
test -e /tmp/.X11-unix || \
|
||||
echo "warning: required directory not found (create it?): /tmp/.X11-unix"
|
||||
|
||||
# sway needs to know which virtual TTY to render to
|
||||
setVtnr() {
|
||||
local ttyPath="$(tty)"
|
||||
case $ttyPath in
|
||||
(/dev/tty*)
|
||||
export XDG_VTNR=''${ttyPath#/dev/tty}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
if ! [ -v "$XDG_VTNR" ]; then
|
||||
setVtnr
|
||||
fi
|
||||
# delete DISPLAY-related vars from env before launch, else sway will try to connect to a remote display.
|
||||
# (consider: nested sway sessions, where sway actually has a reason to read these)
|
||||
exec env -u DISPLAY -u WAYLAND_DISPLAY "DESIRED_WAYLAND_DISPLAY=$WAYLAND_DISPLAY" ${configuredSway}/bin/sway 2>&1
|
||||
|
@@ -201,9 +201,12 @@ let
|
||||
# - doesn't have to be numeric, could be "colin"
|
||||
# - XDG_SESSION_CLASS
|
||||
# - e.g. "user"
|
||||
# - XDG_SESSION_DESKTOP
|
||||
# - e.g. "Phosh"
|
||||
# - XDG_SESSION_TYPE
|
||||
# - e.g. "tty", "wayland"
|
||||
# - XDG_VTNR
|
||||
# - e.g. `1`, or `2`. corresponds to some /dev/ttyN.
|
||||
# - SYSTEMD_EXEC_PID
|
||||
# some of my program-specific environment variables depend on some of these being set,
|
||||
# hence do that early:
|
||||
@@ -247,34 +250,17 @@ let
|
||||
done
|
||||
}
|
||||
|
||||
setVTNR() {
|
||||
# some desktops (e.g. sway) need to know which virtual TTY to render to
|
||||
if [ -v "$XDG_VTNR" ]; then
|
||||
return
|
||||
fi
|
||||
local ttyPath=$(tty)
|
||||
case $ttyPath in
|
||||
(/dev/tty*)
|
||||
export XDG_VTNR=''${ttyPath#/dev/tty}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
sessionCommands+=('setVTNR')
|
||||
setXdgSessionType() {
|
||||
# some apps (e.g. Komikku) require XDG_SESSION_TYPE to be set
|
||||
if [ -v "$XDG_SESSION_TYPE" ]; then
|
||||
return
|
||||
fi
|
||||
case $XDG_VTNR in
|
||||
(1)
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
;;
|
||||
(*)
|
||||
export XDG_SESSION_TYPE=tty
|
||||
;;
|
||||
esac
|
||||
}
|
||||
sessionCommands+=('setXdgSessionType')
|
||||
# this is *probably not necessary*.
|
||||
# historically, Komikku needed to know if it was running under X or Wayland, and used XDG_SESSION_TYPE for that.
|
||||
# but unless this is a super common idiom, managing it here is just ugly.
|
||||
# setXdgSessionType() {
|
||||
# case $(tty) in
|
||||
# (/dev/pts*)
|
||||
# export XDG_SESSION_TYPE=tty
|
||||
# ;;
|
||||
# esac
|
||||
# }
|
||||
# sessionCommands+=('setXdgSessionType')
|
||||
sourceEnv() {
|
||||
# source env vars and the like, as systemd would. `man environment.d`
|
||||
for env in ~/.config/environment.d/*.conf; do
|
||||
|
Reference in New Issue
Block a user