Skip to content

Instantly share code, notes, and snippets.

@anestv
Created January 1, 2016 21:07
Show Gist options
  • Save anestv/2e5b2306002a4d0b651b to your computer and use it in GitHub Desktop.
Save anestv/2e5b2306002a4d0b651b to your computer and use it in GitHub Desktop.
Automatically enable numlock on login screen
#!/bin/bash
# script to automatically enable numlock on login screen
# tested on Ubuntu 14.04
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
echo "Updating reps..."
sudo apt-get -qq update
echo "Installing numlockx..."
sudo apt-get install numlockx
if [ -w /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf ]; then
echo "# enable numlock" >> /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
echo "greeter-setup-script=/usr/bin/numlockx on" >> /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
echo "Success!"
else
echo "File /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf does not exist or is not writeable"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment