Skip to content

Commit

Permalink
#28
Browse files Browse the repository at this point in the history
Added xsession runners for openbox and plasma
  • Loading branch information
Witko committed Dec 8, 2017
1 parent e2c12c3 commit 0152ea5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ Currently sudo is required as the script needs to wake up GPU, modprobe the nvid
* **/etc/X11/xinit/nvidia-xinitrc** - xinitrc config file. Contains the setting of provider output source
* **/etc/X11/xinit/nvidia-xinitrc.d** - custom xinitrc scripts directory
* **/etc/X11/nvidia-xorg.conf.d** - custom X config directory
* **/usr/share/xsessions/nvidia-xrun-openbox.desktop** - xsession file for openbox
* **/usr/share/xsessions/nvidia-xrun-plasma.desktop** - xsession file for plasma
* **[OPTIONAL] ~/.nvidia-xinitrc** - user-level custom xinit script file. You can put here your favourite window manager for example


## Setting the right bus id
Usually the 1:0:0 bus is correct. If this is not your case(you can find out through lspci or bbswitch output mesages) you can create
Expand All @@ -29,6 +31,10 @@ a conf script for example `nano /etc/X11/nvidia-xorg.conf.d/30-nvidia.conf` to s
Driver "nvidia"
BusID "PCI:2:0:0"
EndSection

You can use this command to get the bus id:

lspci | grep -i nvidia | awk '{print $1}`

Also this way you can adjust some nvidia settings if you encounter issues:

Expand All @@ -42,7 +48,13 @@ Also this way you can adjust some nvidia settings if you encounter issues:
## Automatically run window manager
For convenience you can create `nano ~/.nvidia-xinitrc` and put there your favourite window manager:

openbox-session
if [ $# -gt 0 ]; then
$*
else
openbox-session
# startkde
fi


With this you do not need to specify the app and you can simply run:

Expand Down
8 changes: 8 additions & 0 deletions launchers/nvidia-xrun-openbox.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Encoding=UTF-8
Name=Openbox(Nvidia Xrun)
Comment=Log in using the Openbox window manager (running with nvidia-xrun)
Type=Application
Exec=/usr/bin/nvidia-xrun /usr/bin/openbox-session
TryExec=/usr/bin/nvidia-xrun /usr/bin/openbox-session
Icon=openbox
8 changes: 8 additions & 0 deletions launchers/nvidia-xrun-plasma.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Encoding=UTF-8
Name=Plasma(Nvidia Xrun)
Comment=Plasma by KDE running with nvidia-xrun
Type=XSession
Exec=/usr/bin/nvidia-xrun /usr/bin/startkde
TryExec=/usr/bin/nvidia-xrun /usr/bin/startkde
DesktopNames=KDE
11 changes: 5 additions & 6 deletions nvidia-xinitrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

if [ -f "$userxinitrc" ]; then
sh ${userxinitrc}
fi

if [ $# -gt 0 ]
then
$*
sh ${userxinitrc} $#
else
if [ $# -gt 0 ]; then
$*
fi
fi
6 changes: 2 additions & 4 deletions nvidia-xrun
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function printHelp {
}

function execute {
if [ $DRY_RUN -eq 1 ]
if [ ${DRY_RUN} -eq 1 ]
then
echo ">>Dry run. Command: $*"
else
Expand Down Expand Up @@ -55,10 +55,8 @@ then
EXECL="$(which $1)"
shift 1
EXECL="$EXECL $*"
EXECPH=""
else # prepare to start new X sessions if no arguments passed
EXECL=""
EXECPH="New X session"
fi

EXECL="/etc/X11/xinit/nvidia-xinitrc $EXECL"
Expand All @@ -84,7 +82,7 @@ echo 'Loading nvidia_drm module'
execute "sudo modprobe nvidia_drm"

# ---------- EXECUTING COMMAND --------
execute $COMMAND
execute ${COMMAND}

# ---------- UNLOADING MODULES --------
echo 'Unloading nvidia_drm module'
Expand Down

0 comments on commit 0152ea5

Please sign in to comment.