Skip to content

Commit

Permalink
In Wayland force opengl to render plasmashell, in Xorg with Nvidia be…
Browse files Browse the repository at this point in the history
…fore driver 560 force Vulkan if supported, if not supported use Opengl with XLIB_SKIP_ARGB_VISUALS=1
  • Loading branch information
bigbruno committed Nov 4, 2024
1 parent 3d1258d commit 340fcd5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 32 deletions.
13 changes: 0 additions & 13 deletions usr/bin/big-theme-plasma
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,6 @@ if [ "$2" = "vanilla" ]; then
kwriteconfig6 --file ~/.config/kdeglobals --group Icons --key "Theme" "breeze"
fi

# Verify if using nvidia proprietary driver in Xorg
if [[ "$XDG_SESSION_TYPE" == "x11" ]] && lsmod | grep -q -m1 nvidia_drm && ! grep -q -m1 'showToolTips=false' ~/.config/plasma-org.kde.plasma.desktop-appletsrc; then
# Detect and clean version of driver
nvidiaVersion=$(modinfo nvidia_drm -F version)
nvidiaVersion=${nvidiaVersion%%.*}

# Only in versions before 560
if [[ $nvidiaVersion -lt 560 ]]; then
# Disable ToolTips in plasma taskbar because window preview crash plasma desktop
sed -i '/middleClickAction=None/a showToolTips=false' ~/.config/plasma-org.kde.plasma.desktop-appletsrc
fi
fi

# Run specific desktop tweaks
/usr/share/biglinux/multi-kde/$2

Expand Down
18 changes: 0 additions & 18 deletions usr/bin/startkde-biglinux
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ if [ ! -e "$HOME/.kdebiglinux/ksmserver_changed" ]; then
kwriteconfig6 --file ~/.config/ksmserverrc --group 'General' --key 'loginMode' 'emptySession'
fi

# Force opengl if not specified to use vulkan or opengl (Software mode now is broken)
if grep -qiE 'SceneGraphBackend=(vulkan|opengl)' ~/.config/kdeglobals; then
kwriteconfig6 --file ~/.config/kdeglobals --group QtQuickRendererSettings --key SceneGraphBackend opengl
fi

nowlogin="$(cat "$HOME/.kdebiglinux/lastused")"
#ultimo login
lastlogin=$(cat "$HOME/.kdebiglinux/lastlogin")
Expand Down Expand Up @@ -166,17 +161,4 @@ export XDG_SESSION_DESKTOP=KDE
# In some laptops backlight not restore correctly, try fix this
sudo biglinux-backlight-restore 2> /dev/null &

# Verify if using nvidia proprietary driver in Xorg
if [[ "$XDG_SESSION_TYPE" == "x11" ]] && lsmod | grep -q -m1 nvidia_drm && ! grep -q -m1 'showToolTips=false' ~/.config/plasma-org.kde.plasma.desktop-appletsrc; then
# Detect and clean version of driver
nvidiaVersion=$(modinfo nvidia_drm -F version)
nvidiaVersion=${nvidiaVersion%%.*}

# Only in versions before 560
if [[ $nvidiaVersion -lt 560 ]]; then
# Disable ToolTips in plasma taskbar because window preview crash plasma desktop
sed -i '/middleClickAction=None/a showToolTips=false' ~/.config/plasma-org.kde.plasma.desktop-appletsrc
fi
fi

exec startplasma-$XDG_SESSION_TYPE
27 changes: 27 additions & 0 deletions usr/local/bin/plasmashell
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Verify if using nvidia proprietary driver in Xorg
if [[ "$XDG_SESSION_TYPE" == "x11" ]] && lsmod | grep -q -m1 nvidia_drm; then
# Detect and clean version of driver
nvidiaVersion=$(modinfo nvidia_drm -F version)
nvidiaVersion=${nvidiaVersion%%.*}

# Only in versions before 560
if [[ $nvidiaVersion -lt 560 ]]; then
if [[ $Vulkan_Supported == 1 ]]; then
# In Xorg and old driver with vulkan support, force to use vulkan
kwriteconfig6 --file ~/.config/kdeglobals --group QtQuickRendererSettings --key SceneGraphBackend vulkan
else
# In Xorg and old driver but without vulkan support, force opengl and disable transparency in XLIB
kwriteconfig6 --file ~/.config/kdeglobals --group QtQuickRendererSettings --key SceneGraphBackend opengl
export XLIB_SKIP_ARGB_VISUALS=1
fi
fi
fi

# In wayland force to use opengl
if [[ "$XDG_SESSION_TYPE" == "wayland" ]] && ! grep -q 'SceneGraphBackend=opengl' ~/.config/kdeglobals; then
kwriteconfig6 --file ~/.config/kdeglobals --group QtQuickRendererSettings --key SceneGraphBackend opengl
fi

exec /usr/bin/plasmashell ${1+"$@"}
5 changes: 4 additions & 1 deletion usr/share/libalpm/scripts/biglinux-multi-kde
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ sed -i 's|TryExec=.*|TryExec=/usr/bin/startkde-biglinux|g' /usr/share/xsessions/
# sed -i '/Restart=on-failure/a RestartForceExitStatus=SIGTERM' /usr/lib/systemd/user/plasma-plasmashell.service 2> /dev/null
# fi
# # systemd more relaxed to stop apps like plasmashell
sed -i 's|#DefaultRestartSec=100ms|DefaultRestartSec=1000ms|g;s|#DefaultStartLimitBurst=5|DefaultStartLimitBurst=10|g' /etc/systemd/user.conf 2> /dev/null
sed -i 's|#DefaultRestartSec=100ms|DefaultRestartSec=1000ms|g;s|#DefaultStartLimitBurst=5|DefaultStartLimitBurst=10|g' /etc/systemd/user.conf 2> /dev/null

# Remove /usr/bin for privilege goes to /usr/local/bin
sed -i 's|ExecStart=/usr/bin/plasmashell|ExecStart=plasmashell|g' /usr/lib/systemd/user/plasma-plasmashell.service 2> /dev/null
2 changes: 2 additions & 0 deletions usr/share/libalpm/scripts/biglinux-multi-kde-remove
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ sed -i 's|Exec=.*|Exec=/usr/bin/startplasma-wayland|g' /usr/share/wayland-sessio
sed -i 's|TryExec=.*|TryExec=/usr/bin/startplasma-wayland|g' /usr/share/wayland-sessions/plasmawayland.desktop 2> /dev/null
sed -i 's|Exec=.*|Exec=/usr/bin/startplasma-x11|g' /usr/share/xsessions/plasma.desktop 2> /dev/null
sed -i 's|TryExec=.*|TryExec=/usr/bin/startplasma-x11|g' /usr/share/xsessions/plasma.desktop 2> /dev/null

sed -i 's|ExecStart=plasmashell|ExecStart=/usr/bin/plasmashell|g' /usr/lib/systemd/user/plasma-plasmashell.service 2> /dev/null

0 comments on commit 340fcd5

Please sign in to comment.