optimus-manager icon indicating copy to clipboard operation
optimus-manager copied to clipboard

(using startx) How do I exactly run /usr/bin/prime-switch as root after the current user has logged out

Open ndavd opened this issue 3 years ago • 6 comments

Could this be a bit more specific https://github.com/Askannz/optimus-manager/wiki/FAQ,-common-issues,-troubleshooting#i-do-not-use-a-display-manager-i-use-startx-or-xinit ?

ndavd avatar Apr 24 '21 16:04 ndavd

First enable the prime-switch script to be executed from your account by appending this to /etc/sudoers

<username> ALL = NOPASSWD: /usr/bin/prime-switch

Then in your .xinitrc execute /usr/bin/prime-offload before your display manager. Also execute sudo /usr/bin/prime-switch after your display manager (executed when you log out). Mine looks like this

/usr/bin/prime-offload
ssh-agent dwm
sudo /usr/bin/prime-switch

karl-tye avatar May 09 '21 10:05 karl-tye

And by doing that are you sure it does what we want? Because it seems that it executes the script after the window manager starts

ndavd avatar May 09 '21 11:05 ndavd

@ndavidq0 it does exactly what described in the wiki, namely running a command just after xorg starts(but before dwm starts), and another one after it stops

BachoSeven avatar May 12 '21 14:05 BachoSeven

Thanks I'll try that

ndavd avatar May 12 '21 16:05 ndavd

This didn't work for me (i.e. after I do the switch command it logs off, I execute startx and get a black-screen)

/usr/bin/prime-offload
exec bspwm
sudo /usr/bin/prime-switch

What am I doing wrong here?

ndavd avatar May 12 '21 21:05 ndavd

Does removing the exec bit work? So like:

/usr/bin/prime-offload
bspwm
sudo /usr/bin/prime-switch

X-m7 avatar Jun 28 '21 06:06 X-m7

Reopen if that doesn't work.

es20490446e avatar Jul 15 '24 04:07 es20490446e