1

I just got new Dell XPS 15 and install ubuntu 16.04 with XMonad. And all works just well except Fn keys. Keyboard backlight can be enabled by Fn+F10, but other buttons, like Fn+F11 or Fn+F12 (decrease and increase brightness) don't work.

Under Unity all Fn key works fine.

Which config can I use to enable Fn key under XMonad?

1

You have to add custom keybindings to your xmonad config file. The keycodes are XF86MonBrightnessUp and XF86MonBrightnessDown. Then you have to use something like lux.

Here is how i use it:

  import XMonad
  import XMonad.Hooks.DynamicLog
  import XMonad.Hooks.ManageDocks
  import XMonad.Util.EZConfig(additionalKeys, additionalKeysP)
  import XMonad.Util.Run(spawnPipe)
  import XMonad.Config.Desktop
  import XMonad.Config.Gnome
  import XMonad.Hooks.ManageHelpers
  import System.IO
  import Graphics.X11.ExtraTypes.XF86

  main = do
    xmproc <- spawnPipe "tint2"
    nm <- spawnPipe "nm-applet"
    xmonad $ desktopConfig
      { modMask = myModMask
      , terminal = "termite"
      , borderWidth = 1 
      , layoutHook = avoidStruts $ layoutHook defaultConfig
      , manageHook = manageHook defaultConfig <+> manageDocks
      } `additionalKeysP` myKeys

  myModMask = mod4Mask -- Use Super instead of Alt

  myKeys =  [ ("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ +1.5%")
            , ("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@  -1.5%")
            , ("<XF86AudioMute>", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle")    

            , ("<XF86AudioPlay>", spawn "playerctl play-pause")    
            , ("<XF86AudioPrev>", spawn "playerctl previous")    
            , ("<XF86AudioNext>", spawn "playerctl next")    

            , ("<XF86MonBrightnessUp>", spawn "lux -a 5%")    
            , ("<XF86MonBrightnessDown>", spawn "lux -s 5%")    
            ]

I hope this helps you.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.