Skip to content

Commit

Permalink
chore: env update script add
Browse files Browse the repository at this point in the history
remove env update script from startdde, and add in here

Log:
  • Loading branch information
dengbo11 committed Nov 22, 2023
1 parent 0fe9679 commit 37399b6
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
13 changes: 13 additions & 0 deletions misc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
configure_file(xsessions/dde-x11.desktop.in xsessions/dde-x11.desktop)
configure_file(wayland-sessions/dde-wayland.desktop.in wayland-sessions/dde-wayland.desktop)

set(XSESSION
${CMAKE_CURRENT_SOURCE_DIR}/Xsession.d/00deepin-dde-env
${CMAKE_CURRENT_SOURCE_DIR}/Xsession.d/01deepin-profile
${CMAKE_CURRENT_SOURCE_DIR}/Xsession.d/94qt_env
)

set(PROFILE
${CMAKE_CURRENT_SOURCE_DIR}/profile.d/deepin-xdg-dir.sh
)

install(
DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/xsessions
Expand All @@ -10,3 +20,6 @@ install(
PATTERN
"*.in" EXCLUDE
)

install(FILES ${XSESSION} DESTINATION /etc/X11/Xsession.d/)
install(FILES ${PROFILE} DESTINATION /etc/profile.d)
30 changes: 30 additions & 0 deletions misc/Xsession.d/00deepin-dde-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
if [ "$1" = "/usr/bin/dde-session" ]; then
if [ -f "$HOME/.dde_env" ]; then
. "$HOME/.dde_env"
# Handling configuration migration issues
if [ -n "$QT_SCALE_FACTOR" ]; then
unset QT_SCALE_FACTOR
unset QT_SCREEN_SCALE_FACTORS
unset QT_AUTO_SCREEN_SCALE_FACTOR
unset QT_FONT_DPI
export STARTDDE_MIGRATE_SCALE_FACTOR=1
fi
elif [ -f "$HOME/.pam_environment" -a -n "$QT_SCALE_FACTOR" ]; then
# Handling configuration migration issues for earlier version
unset QT_SCALE_FACTOR
export STARTDDE_MIGRATE_SCALE_FACTOR=1
fi
# control qt program infos level, set it only on uos
if [ -f "/etc/os-version" ];then
if [ ! `grep Community /etc/os-version` ];then
export QT_LOGGING_RULES="*.debug=false"
fi
fi
# set qt qpa platform type
export QT_QPA_PLATFORM=xcb
# control qml softwarecontext in loongson-drm
lshw -c display | grep "driver=loongson-drm"
if [ $? -eq 0 ];then
export QMLSCENE_DEVICE=softwarecontext
fi
fi
1 change: 1 addition & 0 deletions misc/Xsession.d/01deepin-profile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ -f /etc/profile ] && . /etc/profile
9 changes: 9 additions & 0 deletions misc/Xsession.d/94qt_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
case $XDG_SESSION_TYPE in
x11)
export QT_QPA_PLATFORM=xcb
;;
wayland)
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_SHELL_INTEGRATION="kwayland-shell;xdg-shell;wl-shell;ivi-shell;qt-shell;"
;;
esac
12 changes: 12 additions & 0 deletions misc/profile.d/deepin-xdg-dir.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"

#export XDG_DESKTOP_DIR="$HOME/Desktop"
#export XDG_DOCUMENTS_DIR="$HOME/Documents"
#export XDG_DOWNLOAD_DIR="$HOME/Downloads"
#export XDG_MUSIC_DIR="$HOME/Music"
#export XDG_VIDEOS_DIR="$HOME/Videos"
#export XDG_PICTURES_DIR="$HOME/Pictures"
#export XDG_PUBLICSHARE_DIR="$HOME/Public"
#export XDG_TEMPLATES_DIR="$HOME/Templates"

0 comments on commit 37399b6

Please sign in to comment.