<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nicolas Barrios</title>
    <description>The latest articles on DEV Community by Nicolas Barrios (@nbarrios1337).</description>
    <link>https://dev.to/nbarrios1337</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F99054%2Fffd50538-042c-4443-b82d-3ce4bd623655.jpg</url>
      <title>DEV Community: Nicolas Barrios</title>
      <link>https://dev.to/nbarrios1337</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nbarrios1337"/>
    <language>en</language>
    <item>
      <title>Brightness Control with Nvidia Optimus on Ubuntu</title>
      <dc:creator>Nicolas Barrios</dc:creator>
      <pubDate>Tue, 09 Jul 2019 20:37:57 +0000</pubDate>
      <link>https://dev.to/nbarrios1337/brightness-control-with-nvidia-optimus-on-pop-os-2b6p</link>
      <guid>https://dev.to/nbarrios1337/brightness-control-with-nvidia-optimus-on-pop-os-2b6p</guid>
      <description>&lt;p&gt;Having recently installed &lt;a href="https://system76.com/pop"&gt;Pop!_OS&lt;/a&gt; (an Ubuntu derivative) in a dual boot setup for my laptop, I've found that it has been a nearly painless experience, especially since the proprietary NVIDIA drivers come pre-installed. &lt;/p&gt;

&lt;p&gt;However, one of the issues that I've found in my installation is the lack of brightness control via keyboard. Interestingly enough, hitting &lt;code&gt;Fn+F3&lt;/code&gt; or &lt;code&gt;Fn+F4&lt;/code&gt; (which normally would decrease/increase the screen brightness on Windows for me) does nothing on Linux, while the volume controls (&lt;code&gt;Fn+F9&lt;/code&gt; and &lt;code&gt;Fn+F10&lt;/code&gt; for me) did what they needed to without a hiccup.&lt;/p&gt;

&lt;p&gt;So what was happening? After writing this post, I still have no idea.&lt;/p&gt;

&lt;h1&gt;
  
  
  Fixing the Backlight Issue
&lt;/h1&gt;

&lt;p&gt;One of the "fixes" that I found was adding a configuration file for the X11 server to work with my integrated Intel graphics. I will outline below, perhaps it'll help someone else with better hardware support.&lt;/p&gt;

&lt;p&gt;I downloaded &lt;a href="https://linux.die.net/man/1/xbacklight"&gt;&lt;code&gt;xbacklight&lt;/code&gt;&lt;/a&gt; through &lt;code&gt;apt&lt;/code&gt;, and followed the short guide found on &lt;a href="https://itsfoss.com/fix-brightness-ubuntu-1310/"&gt;It's FOSS&lt;/a&gt;, which I'll outline below:&lt;/p&gt;

&lt;h4&gt;
  
  
  NOTE: this fix is for those with integrated graphics from Intel.
&lt;/h4&gt;

&lt;p&gt;Create the config file for the X server to use.&lt;br&gt;
&lt;code&gt;sudo touch /usr/share/X11/xorg.conf.d/20-intel.conf&lt;/code&gt;&lt;br&gt;
Open it in a text editor.&lt;br&gt;
&lt;code&gt;sudo gedit /usr/share/X11/xorg.conf.d/20-intel.conf&lt;/code&gt;&lt;br&gt;
And add the following in the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Section "Device"
        Identifier  "card0"
        Driver      "intel"
        Option      "Backlight"  "intel_backlight"
        BusID       "PCI:0:2:0"
EndSection
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Log out and back in (and possibly restart your system), and the &lt;code&gt;xbacklight&lt;/code&gt; commands should work as intended&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus
&lt;/h2&gt;

&lt;p&gt;Try adding keyboard shortcuts for &lt;code&gt;xbacklight -dec &amp;lt;percent&amp;gt;&lt;/code&gt; and &lt;code&gt;xbacklight -inc &amp;lt;percent&amp;gt;&lt;/code&gt;. I recreated my brightness controls to run &lt;code&gt;xbacklight -10&lt;/code&gt; and &lt;code&gt;xbacklight +10&lt;/code&gt; to decrease/increase the brightness by 10% each time.&lt;/p&gt;




&lt;h1&gt;
  
  
  But wait, why are my games running so poorly?
&lt;/h1&gt;

&lt;p&gt;As it turns out, I lost the ability to use my NVIDIA graphics card after this fix.&lt;/p&gt;

&lt;p&gt;After I did the above fix, I went to play some graphic-intensive games, that I knew worked prior when using the NVIDIA card, and found them running at a snail's pace, almost as if &lt;em&gt;they were using integrated graphics.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But &lt;code&gt;system76-power&lt;/code&gt; (Pop!_OS' graphics switcher) shows that I'm using my dedicated graphics card. What's going on?&lt;/p&gt;

&lt;p&gt;Opening up &lt;code&gt;nvidia-settings&lt;/code&gt; through the terminal shows an error (aside from the seemingly ubiquitous GTK errors) along with an empty GUI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ERROR: Unable to load info from any available system
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Well that can't be good right?&lt;/p&gt;

&lt;p&gt;Now, I didn't want to install other graphic switchers (i.e. &lt;code&gt;bumblebee&lt;/code&gt;, NVIDIA Prime) because attempting to replace the &lt;code&gt;system76-power&lt;/code&gt; package results in the entire desktop environment trying to uninstall itself, and I'm not quite ready to live in a terminal-only Linux world. What else could I do?&lt;/p&gt;




&lt;h1&gt;
  
  
  It's a Trade-Off
&lt;/h1&gt;

&lt;p&gt;Turns out, as you can probably already guess, that including that &lt;code&gt;20-intel.conf&lt;/code&gt; file for the X server stopped my NVIDIA card from functioning in a way that &lt;code&gt;system76-power&lt;/code&gt; didn't notice.&lt;/p&gt;

&lt;p&gt;To be sure, I reinstalled the distribution (Thankfully, I had set my home directory to live in a separate partition) and repeated my steps. I then deleted the &lt;code&gt;20-intel.conf&lt;/code&gt; file from where I created it, and rebooted.&lt;/p&gt;

&lt;p&gt;The results? My graphics card was back in action, and the games I tested worked flawlessly. But I no longer had the ability to tweak the brightness outside of using the slider in the system status menu.&lt;/p&gt;




&lt;h1&gt;
  
  
  Looking Forward
&lt;/h1&gt;

&lt;p&gt;There were plenty of other possible fixes, like &lt;a href="https://askubuntu.com/questions/428467/brightness-in-ubuntu-12-04"&gt;overwriting the kernel parameter for brightness&lt;/a&gt;, that isn't something I'm too keen to do; I still need a couple layers of abstraction to feel comfortable fiddling with my system. I will, however, be trying out some of the answers in this &lt;a href="https://askubuntu.com/questions/1034305/brightness-problem-ubuntu-18-04-lts"&gt;StackOverflow answer&lt;/a&gt;. Maybe the GRUB editing will end up working for me.&lt;/p&gt;

&lt;p&gt;Let me know what you think, and perhaps leave some possible fixes in the comments!&lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>linux</category>
      <category>productivity</category>
      <category>troubleshooting</category>
    </item>
  </channel>
</rss>
