23
août
0

Get HDMI Working With Nvidia Optimus On Ubuntu By Using Bumblebee And Synergy

HDMI doesn’t work with Optimus hybrid graphics chipsets under Linux for most laptops, even if you use Bumblebee, but there is a way to get HDMI to work: by using a separate session.

Using the instructions below, you’ll get an LXDE session (you can use XFCE or others, but the instructions below are for LXDE) to Ubuntu NotifyOSD Notifications To Show Up On Active Monitor In Multi-Screen Environments [Quick Tip] » href= »http://www.adminreseau.fr/get-ubuntu-notifyosd-notifications-to-show-up-on-active-monitor-in-multi-screen-environments-quick-tip/ »>show up on the external monitor (which is connected via HDMI), and in this session, all the applications you launch use your laptop’s Nvidia Better Performance And Less Power Consumption For Bumblebee With Bumblebee Configurator GUI [Nvidia Optimus] » href= »http://www.adminreseau.fr/set-up-bumblebee-with-bumblebee-configurator-gui-nvidia-optimus/ »>Bumblebee [Optimus Hybrid Graphics Chipsets] » href= »http://www.adminreseau.fr/primus-better-performance-and-less-power-consumption-for-bumblebee-optimus-hybrid-graphics-chipsets-2/ »>Primus: Better Performance And Less Power Consumption For Bumblebee [Optimus Hybrid Graphics Chipsets] » href= »http://www.adminreseau.fr/primus-better-performance-and-less-power-consumption-for-bumblebee-optimus-hybrid-graphics-chipsets/ »>graphics card and you can play games, watch movies, etc. The LXDE session runs in the same time as your regular session, so on your laptop’s screen you get your regular (main) session. Also, the mouse and keyboard are shared Between Nvidia And Intel Graphics [Ubuntu 14.04] » href= »http://www.adminreseau.fr/prime-indicator-lets-you-quickly-switch-between-nvidia-and-intel-graphics-ubuntu-14-04/ »>between the two sessions / monitors.

Here’s how this looks like:

The first image above is from my laptop’s screen (Dell XPS L702X which comes with Nvidia Released With Primus Support [Nvidia Optimus GPU Switching] » href= »http://www.adminreseau.fr/bumblebee-3-1-released-with-primus-support-nvidia-optimus-gpu-switching/ »>Optimus) while the second image is the separate LXDE session which is also Arch Linux on Raspberry Pi Running XFCE [Version 2] » href= »http://www.adminreseau.fr/arch-linux-on-raspberry-pi-running-xfce-version-2/ »>running on my laptop, but is displayed on a TV connected via HDMI. As you can see, the first one is using the Intel graphics chip while the second one uses Nvidia.

However, there are some things to consider when using this:

  • the sound won’t work (if you know a way to get it to work, please let us know in the comments!) through HDMI so you’ll only get sound through your laptop’s speakers
  • you can’t move a window from your current desktop to the monitor connected via HDMI. The only way to run applications on the device connected via HDMI is to either run it from its session menu, or by using « export DISPLAY=:8.0″ (see the end of the post for more info on this). The mouse is however, shared between the two desktops.
  • when loading the extra session, you may get double indicators / tray icons on your current (main) session. There is a way around this though (see the « tips » section at the end of the post)

Get HDMI to work with laptops using the Optimus technology under Ubuntu using Bumblebee and Synergy

1. Install Bumblebee if you haven’t already.

2. Unity doesn’t work with Bumblebee (and I’m not sure if you can run two sessions using the same window manager without them interfering anyway), so you’ll need to use a different desktop environment / session, like LXDE, XFCE and so on – use whatever you want. I’ve used LXDE so using the instructions below, you’ll get an LXDE session on the monitor connected via HDMI.

To get the mouse and keyboard Skype Not Working In Ubuntu 13.04 Raring Ringtail [For Users With Proprietary Nvidia Drivers] » href= »http://www.adminreseau.fr/fix-skype-not-working-in-ubuntu-13-04-raring-ringtail-for-users-with-proprietary-nvidia-drivers/ »>working on the external monitor connected via HDMI we’ll use Synergy, a tool that lets you share the mouse and keyboard between multiple computers.

Let’s install the required packages (LXDE and Synergy):

sudo apt-get install synergy lxde lxde-common

3. To be able to use Synergy, you’ll need to create a configuration file. You can Xubuntu 14.04 Released With ARM Translator, More [Android For Netbooks Or Laptops] » href= »http://www.adminreseau.fr/android-x86-4-0-4-ics-rc2-released-with-arm-translator-more-android-for-netbooks-or-laptops/ »>Released, Install It In Ubuntu [GNOME 2 Fork] » href= »http://www.adminreseau.fr/mate-1-6-released-install-it-in-ubuntu-gnome-2-fork/ »>Ubuntu 14.04 Trusty Tahr Final Beta Available For Download [Video, Screenshots] » href= »http://www.adminreseau.fr/ubuntu-14-04-trusty-tahr-final-beta-available-for-download-video-screenshots/ »>Available For Download [Video, Screenshots] » href= »http://www.adminreseau.fr/xubuntu-14-04-available-for-download-video-screenshots/ »>download mine from HERE – copy the file to your home folder and rename it to « .synergy.conf » (notice the dot in front of the filename – that makes the file become hidden).
The file I’ve provided above should be enough, but if you want to change it, you can read about the Synergy configuration file here.

4. To start LXDE on the external monitor connected via HDMI, you can use a script which you can download from HERE. Extract the archive, copy the « hdmi » script to your home folder and make it executable using the following command:
chmod +x ~/hdmi

Now, to run the script, use the following command:

~/hdmi

LXDE should now start on the external monitor connected via HDMI. Give it some time (around 10 seconds) and moving your mouse to the left of your screen should make it show up on the HDMI device.

Here’s what the script does (this is just an explaination, you don’t need to run these commands, just use the above script):

- exports the display to the one we’re going to use for the HDMI monitor (8):

export DISPLAY=:8.0

- runs LXDE with optirun (Bumblebee):

optirun startlxde &

- runs the Synergy server in the foreground on the main display (on your laptop’s main session) with 127.0.0.1 as the address:
synergys -f -a 127.0.0.1 --display :0 -n ubuntu &

- runs the Synergy client in the foreground on the HDMI display and it connects it to the 127.0.0.1 server address:
synergyc -f -n hdmi --display :8 127.0.0.1 &

And finally, it exports the display back to your laptop’s (main) display:
export DISPLAY=:0.0

The script also uses some « sleep » commands which add a delay to make sure the commands have enough time to get executed before running the next command.

Tips

Launching applications:

To launch an application on the monitor connected via HDMI, you can use the LXDE menu on the external monitor or use the following command on your main session:
export DISPLAY=:8.0 APPLICATION

where « APPLICATION » is the executable name for the app you want to launch.

Optionally, you can also run « export DISPLAY=:8.0″ in a terminal window on your main session, and then all the applications you launch from that terminal window should show up on the external monitor.

Configuring your Nvidia graphics card:

Using the above instructions to launch applications on the external monitor, you can launch « nvidia-settings » (if you’re using the proprietary Nvidia graphics drivers):
export DISPLAY=:8.0 nvidia-settings
Launching this on your laptop session displays an error message saying that you’re not using Nvidia drivers, but launching in on the HDMI-connected device (which uses Bumblebee with « optirun »), you can configure various Nvidia settings: the screen resolution, etc.

Fixing double autostart applications / tray icons:

To avoid getting double indicators (two network indicators, etc.) in your regular session when launching the extra LXDE session, you can make all autostart applications / applets to not load in our LXDE session, using the following commands:
for f in /etc/xdg/autostart/*; do if [[ ! `grep "NotShowIn=LXDE" $  f` ]]; then echo "NotShowIn=LXDE;" | sudo tee -a $  f; fi; donefor f in ~/.config/autostart/*; do if [[ ! `grep "NotShowIn=LXDE" $  f` ]]; then echo "NotShowIn=LXDE;" | tee -a $  f; fi; done

You can also do this manually, by going to /etc/xdg/autostart and ~/.config/autostart and adding « NotShowIn=LXDE; » (without the quotes) to each .desktop file corresponding to the application(s) you don’t want to start in LXDE. More about using NotShowIn and OnlyShowIn, HERE.

References:


Web Upd8 – Ubuntu / Linux blog

Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.
Post your comment




Celadon theme by the Themes Boutique