Wednesday, 26 November 2014

Acer C720 Linux Ubuntu Brightness Keys (ElementaryOS)

This is written for the Acer C720-3445 ("NX.SHEAA.019") running elementary OS Freya beta-1, but it should work for other Acer C720 models and/or other ubuntu-derived flavours.

After installing your favourite flavour of linux on your Acer C720 chromebook, you may notice that the special function keys above the numbers row do not work as anticipated.  These are actually just normal function keys (i.e. "F keys") that you see on a normal keyboard, but instead of being labelled F1, F2, F3... they are labelled with pictures.


You'll notice that you can use them just like normal Function keys.  For example, ALT + F4 (the fullscreen image key) will close a program and F1 (the "back" key) will pull up a Help Menu on most applications.  Getting the volume keys working is pretty straight forward.  The keys that normally control this function are XF86AudioMute XF86AudioLowerVolume and XF86AudioRaiseVolume, but we're going to change them to F8, F9, and F10, respectively.  In elementary OS and other ubuntu 14.04 derivations, this keybindings can be manually set quite easily from the System Settings > Keyboard > Media menu:


Settings the brightness keys is more difficult, since the option for brightness keybindings is not build into the elementary OS or ubuntu settings.  However, this can be accomplished through the custom keybindings settings in org.gnome.settings-daemon.plugins.media-keys custom-keybindings.  The goal is to use a package called xdotool to call the brighness keys behind the scenes.  We'll then bind this process to the F6 and F7 keys on the Acer keyboard.  Here's how it is accomplished:

First, grab the xdotool application.  It should already be accessible from the repositories:
sudo apt-get install xdotool

The keys we want are XF86MonBrightnessDown and XF86MonBrightnessUp.  You can test these commands by opening an terminal and running:
xdotool key XF86MonBrightnessDown
xdotool key XF86MonBrightnessUp

You should see your screen brightness decrease, then increase.  It should also tie in with elementary OS's info window.  Next is to check if you already have any custom keybindings.  Run:
dconf read /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings

It should come back empty.... if not, you've probably already modified it and will need to make sure your current custom keybindings are not deleted.  Next, we will create two keybindings: one for brightness down and another for brightness up.  Let's call them custom1 and custom2, respectively:
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/','/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/']"

You can check these settings visually with dconf (dconf-tools):


All that's left is to set the name, binding, and command parameters.  Start with brightness down/ F6:
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ name 'BrightnessDown'

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ binding 'F6'

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ command 'xdotool key XF86MonBrightnessDown'


And here's brightness up for F7:
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ name 'BrightnessUp'

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ binding 'F7'

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/ command 'xdotool key XF86MonBrightnessUp'


The keys should work as per the keypad now.  Note that this will likely screw up your native F6 and F7 functions, which was not a problem for me since those keys were never used for anything else.  I also had to restart my computer before the keybindings took affect.




3 comments:

Anonymous said...

This helped a lot! Since, in the official version of Freya Elementary Tweaks no longer has a section for shortcuts. You have my thanks, I googled for hours before getting to your blog.

MDsmestad said...

This worked the first time..but when i rebooted it didn't work..I tried to do it again, and the xdotool key XF86MonBrightnessDown(Up) command doesn't work. Any trouble shooting advice?

Albert Jhon said...

Acer introduced F7 Series large venue projector. These new projectors are aimed at the professional market, with particular emphasis on large venues and installations. Acer has announced three projectors: the F7200, F7500 and F7600, that designed for professional installations. Acer F7 Series

  © Blogger template 'Isolation' by Ourblogtemplates.com 2008

Back to TOP