Invert Fn Function Key Behaviour in Linux

Hey all,

Here’s a small tip that I thought should be documented.

If your fn key is behaving opposite to the way you want it to, there are likely 2 causes:

  1. Either your bios setting is the opposite of what you want
  2. Or your linux is interpreting differently.

Here are a few solutions :

  1. Try pressing fn + NumLock key
  2. Try pressing fn + ~ key (it’s the one before a 1 on most US keyboards)
  3. Press fn + Esc Key (Or look for a key with a lock sign on it)
  4. Go to the bios and look for the function key option to change it.

2 worked for me on linux!

Cheers

Advertisements

Keyboard Shortcut for Suspend/Sleep Laptop (Ubuntu)

To create a keyboard shortcut for putting your laptop to sleep/suspend mode with lockscreen on return: Copy the below script into a file

#!/bin/bash
gnome-screensaver-command --lock && dbus-send --system --print-reply \
--dest="org.freedesktop.UPower" \
/org/freedesktop/UPower \
org.freedesktop.UPower.Suspend

exit 0

Before naming the file, check if a command of that name doesn’t already exist. you can do this by the which command

Name the file to the command you wanna use. I use compsleep.

With the terminal, reach the file, and convert it into an executable:

chmod +x compsleep

now copy this file into the bin folder, as done at the end of this post.
Check the command in the terminal by writing the filename and pressing enter. If this works, proceed to next step.

Go to
system settings >> (Keyboard Shortcuts)/(Keyboard>>shortcuts)>>+ or add new shortcut.

Enter name of file we created above in the command text box. Set a shortcut for it.

Cheers.

[Update:] custom shortcuts with Alt don’t work from 12.04 onward. It’s a bug.

[Update:2 (August 2016)] The above mentioned command doesn’t work on the newer systems. A simple replacement┬áto that is this:

#!/bin/bash
systemctl suspend
exit 0