Manjaro-Optimus Indicator v2.0 - An Optimus-Switch GUI for multiple Desktop-Environments

Allow me to introduce Manjaro-Optimus Indicator v2.0. It is a stand alone program in Python that provides a GUI for @dglt's Optimus-Switch program. I have tested it on and it will work with the following Desktop-Environments:

  • XFCE
  • KDE
  • Gnome
  • Budgie
  • Cinnamon
  • Mate
  • LXDE
  • LXQT (support is in beta)

It has been confirmed to work with the following tiling window manager: (thanks to @dglt for testing it!)

  • Awesome

Because I have never used a tiling window manager, I have not tested it on Bspwn or i3.

Thank you to @dglt for his Optimus-Switch solution. Thank you @bogdancovaciu , @papajoke , @xircon for their help in expanding my knowledge of Python.

Here is a screenshot of version 2.0.

New for version 2.0.

The user now has the option to switch graphics cards and have their laptop automatically reboot.

Existing users will need to re-install to be able to use the new options.

To re-install:

  1. Delete the folder ~/manjaroptimus-appindicator

  2. Follow the readme to install.

17 Likes

looks great! :+1:

i use awesome so i'll test this in a few minutes when the coffee kicks in :sleeping:

3 Likes

Great. I just do not know enough about awesome to try it out there. It took all afternoon to test the other DE's. Multiple installs of Manjaro in a VM. It was also a great way to test out the setup scripts. :wink:

1 Like

it works great, easy/fast setup. only with awesome, the autostart is handled differently. instead of a .desktop file you would add this line to ~/.config/awesome/autorun.sh and it will auto-start

run manjaroptimus-appindicator

from intel mode:

nvidia mode:

3 Likes

Thanks for the information. I will update the readme and the initial post.

2 Likes

this is much better than a desktop specific tool like a shell extension or plasmoid. nicely done :+1:

4 Likes

i've seen now that they've have the hybrid option too how do i do to switch to switch to nvidia card with the hybrid option

are you referring to the render offload "feature" that came with the 435.xx drivers?

if so then no, there is no 3rd optimus-switch option for that. i was going to add it but then after using the render-offload setup i decided against it because it's useless unless you have a Turing class gpu (gtx 1660 and newer) because the nvidia gpu is on all the time and cant be turned off since the xorg session is running on the nvidia gpu but everything is rendered on the intel gpu unless you launch with the given parameters which IMO is nonsense. external monitors are also a non-starter, the performance is less than ideal. and the 435.xx beta drivers themselves have issues.

even if i had an RTX with it's better power management, i still wouldn't use it in it's current state due to the limitations it has. even fumblebee works with external monitors (if you can get fumblebee to work)

i think the 3rd icon thats included is displayed if for whatever reason it cant detect if it's in intel or nvidia mode but @linesma would know better than myself

2 Likes

Thank you for answering @emmanuel's question. It was not something I was worried about since I do not have a card that supports it.

Yes, the third icon is the "default" icon. It is only used if the program can't determine what GPU is in use.

1 Like

Man, that's great work! :star_struck:

Immediate recommendation to all of my unfortunate optimus friends :laughing:

4 Likes

works on all desktop environments, and should work on most window managers as well. im using it on awesome-wm and works great

5 Likes

Thank you. I never worked with Python before. It was a learning experience for me. I spent some time "banging my head on my desk" while trying to figure out why something did not work, or how to do something in python that I knew how to do in bash.

Then installing 8 versions of Manjaro into separate VM's to test whether it would work or not.

Overall, I had fun doing this and gained a new respect for people who write code for a living.

Hopefully someone can test it on the other tiling wm's. If it works, I will update the post and readme accordingly.

6 Likes

Is also related to the xorg-server version

3 Likes

Hi all,
Unfortunately I could not make it work with gnome. This is what I did:

[philippe@Probook-450 ~]$ git clone https://github.com/linesma/manjaroptimus-appindicator.git
Clonage dans 'manjaroptimus-appindicator'...
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 124 (delta 12), reused 0 (delta 0), pack-reused 96
RĂ©ception d'objets: 100% (124/124), 372.59 Kio | 499.00 Kio/s, fait.
RĂ©solution des deltas: 100% (47/47), fait.

[philippe@Probook-450 ~]$ sudo pacman -S libappindicator-gtk3
résolution des dépendances…
recherche des conflits entre paquets…

Paquets (3) libdbusmenu-gtk3-16.04.0-3  libindicator-gtk3-12.10.1-8  libappindicator-gtk3-12.10.0-13

Taille totale du téléchargement :  0,09 MiB
Taille totale installée :        0,36 MiB

:: Procéder à l’installation ? [O/n] 
:: Récupération des paquets…
 libdbusmenu-gtk3-16.04.0-3-x86_64                                 35,4 KiB  1540K/s 00:00 [#####################################################] 100%
 libindicator-gtk3-12.10.1-8-x86_64                                26,4 KiB  2029K/s 00:00 [#####################################################] 100%
 libappindicator-gtk3-12.10.0-13-x86_64                            29,0 KiB  2,84M/s 00:00 [#####################################################] 100%
(3/3) vérification des clés dans le trousseau                                              [#####################################################] 100%
(3/3) vérification de l’intégrité des paquets                                              [#####################################################] 100%
(3/3) chargement des fichiers des paquets                                                  [#####################################################] 100%
(3/3) analyse des conflits entre fichiers                                                  [#####################################################] 100%
(3/3) vérification de l’espace disque disponible                                           [#####################################################] 100%
:: Traitement des changements du paquet…
(1/3) installation de libdbusmenu-gtk3                                                     [#####################################################] 100%
(2/3) installation de libindicator-gtk3                                                    [#####################################################] 100%
(3/3) installation de libappindicator-gtk3                                                 [#####################################################] 100%
:: Exécution des crochets de post-transaction…
(1/1) Arming ConditionNeedsUpdate...

[philippe@Probook-450 ~]$ cd manjaroptimus-appindicator/

[philippe@Probook-450 manjaroptimus-appindicator]$ chmod a+x setupgn.py

[philippe@Probook-450 manjaroptimus-appindicator]$ sudo ./setupgn.py install
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/manjaroptimusindicator
copying manjaroptimusindicator/indicator.py -> build/lib/manjaroptimusindicator
copying manjaroptimusindicator/__init__.py -> build/lib/manjaroptimusindicator
running build_scripts
creating build/scripts-3.7
copying and adjusting bin/manjaroptimus-appindicator -> build/scripts-3.7
changing mode of build/scripts-3.7/manjaroptimus-appindicator from 644 to 755
running install_lib
creating /usr/lib/python3.7/site-packages/manjaroptimusindicator
copying build/lib/manjaroptimusindicator/indicator.py -> /usr/lib/python3.7/site-packages/manjaroptimusindicator
copying build/lib/manjaroptimusindicator/__init__.py -> /usr/lib/python3.7/site-packages/manjaroptimusindicator
byte-compiling /usr/lib/python3.7/site-packages/manjaroptimusindicator/indicator.py to indicator.cpython-37.pyc
byte-compiling /usr/lib/python3.7/site-packages/manjaroptimusindicator/__init__.py to __init__.cpython-37.pyc
running install_scripts
copying build/scripts-3.7/manjaroptimus-appindicator -> /usr/bin
changing mode of /usr/bin/manjaroptimus-appindicator to 755
running install_data
copying icons/manjaroptimus-symbolic.svg -> /usr/share/icons/hicolor/symbolic/apps/
copying icons/manjaroptimus-intel-symbolic.svg -> /usr/share/icons/hicolor/symbolic/apps/
copying icons/manjaroptimus-nvidia-symbolic.svg -> /usr/share/icons/hicolor/symbolic/apps/
creating /usr/share/manjaroptimus-appindicator
creating /usr/share/manjaroptimus-appindicator/scripts
copying scripts/pkexec_nvidia -> /usr/share/manjaroptimus-appindicator/scripts/
copying scripts/pkexec_intel -> /usr/share/manjaroptimus-appindicator/scripts/
copying gnome-script/set-intel.sh -> /usr/local/bin/
copying gnome-script/set-nvidia.sh -> /usr/local/bin/
copying pkexec/org.freedesktop.policykit.set-intel.sh.policy -> /usr/share/polkit-1/actions/
copying pkexec/org.freedesktop.policykit.set-nvidia.sh.policy -> /usr/share/polkit-1/actions/
copying autostart/manjaroptimus-appindicator.desktop -> /etc/xdg/autostart/
running install_egg_info
Writing /usr/lib/python3.7/site-packages/manjaroptimusindicator-1.0.0-py3.7.egg-info
[philippe@Probook-450 manjaroptimus-appindicator]$ 

I installed it under 5.3 kernel, and tried also 4.19 and 5.2: no luck
Tried also to switch off gnome extensions with no luck either
optimus-switch is still working with terminal command, but no indicator at all.
Did I miss something ?
Thanks for your help

are you able to launch manjaroptimus-appindicator manually?

2 Likes

@Lopasilver

Everything looks like it installed properly. Let's check a some things.

  1. Please make sure that the libnotify package is installed.

sudo pacman -S libnotify

After the package is installed, you can test if that fixed your issue by doing the following:

    a. Hit "alt+F2"
    b. Type "r" in the dialog box and hit enter.

This will restart the Gnome shell.

If this package is not installed, then the notification will not be displayed.

  1. Let's make sure that the file permissions are correct.
sudo chmod a+x /etc/xdg/autostart/manjaroptimus-appindicator.desktop
sudo chmod a+x /usr/bin/manjaroptimus-appindicator
sudo chmod a+x /usr/share/manjaroptimus-appindicator/scripts/pkexec_nvidia
sudo chmod a+x /usr/share/manjaroptimus-appindicator/scripts/pkexec_intel

If the above steps do not fix the problem:

  1. You can run the indicator directly from the terminal. Doing this, will display any errors it encounters when it runs. to do this type the following.
cd /usr/bin
manjaroptimus-appindicator

If it runs correctly, it will show the results of the test it uses to determine which graphics card you are using. If it can't run, it will display an error. If it does display an error, please post it here.

Make sure to reboot once you have made the above changes, and let me know the results.

2 Likes

No way!

[philippe@Probook-450 ~]$ manjaroptimus-appindicator.desktop
bash: manjaroptimus-appindicator.desktop : commande introuvable
[philippe@Probook-450 ~]$ 

=> Command not found
EDIT: my mistake. I did it in the next post

That is not the command @dglt asked about. Try

$ manjaroptimus-appindicator
2 Likes

Thank you all for helping me

  1. [quote="linesma, post:16, topic:105870"]
    sudo pacman -S libnotify
    [/quote]
[philippe@Probook-450 ~]$ sudo pacman -S libnotify
avertissement : libnotify-0.7.8-1 est à jour -- réinstallation
résolution des dépendances…
recherche des conflits entre paquets…

Paquets (1) libnotify-0.7.8-1

Taille totale du téléchargement :  0,04 MiB
Taille totale installée :        0,27 MiB
Taille de mise Ă  jour nette :    0,00 MiB

:: Procéder à l’installation ? [O/n] n
[philippe@Probook-450 ~]$ 

Already installed, I did not reinstall it
I did restart gnome shell yesterday, and today also... no luck

  1. Check the 4 files for running permissions and was already OK, and reapply via your commands.

[philippe@Probook-450 bin]$ manjaroptimus-appindicator
['intel open source technology center']
find intel open source technology center in dict_keys(['nvidia corporation', 'intel open source technology center', 'other']) ...?
['intel open source technology center']
find intel open source technology center in dict_keys(['nvidia corporation', 'intel open source technology center', 'other']) ...?
['intel open source technology center']
find intel open source technology center in dict_keys(['nvidia corporation', 'intel open source technology center', 'other']) ...?
['intel open source technology center']
find intel open source technology center in dict_keys(['nvidia corporation', 'intel open source technology center', 'other']) ...?

Stuck here with a blinking cursor, had to do Ctrl C to stop it, same as yesterday.
No idea what is happening
Could not works without you :wink:

Edit: I forgot to do Ctrl C

^CTraceback (most recent call last):
  File "/usr/bin/manjaroptimus-appindicator", line 12, in <module>
    indicator.main()
  File "/usr/lib/python3.7/site-packages/manjaroptimusindicator/indicator.py", line 65, in main
    gtk.main()
  File "/usr/lib/python3.7/site-packages/gi/overrides/Gtk.py", line 1630, in main
    return _Gtk_main(*args, **kwargs)
  File "/usr/lib/python3.7/contextlib.py", line 119, in __exit__
    next(self.gen)
  File "/usr/lib/python3.7/site-packages/gi/_ossighelper.py", line 251, in register_sigint_fallback
    signal.default_int_handler(signal.SIGINT, None)
KeyboardInterrupt
[philippe@Probook-450 bin]$ ^C
[philippe@Probook-450 bin]$ 

Can you post the output from this command:

glxinfo -B | grep "OpenGL vendor string"

Forum kindly sponsored by