Sæt NumLock-tilstand

Source: Download script

Last Updated: 4. December 2024 by Agnete Moos (agms@sonderborg.dk)

Parameters:

Navn Type Standardværdi Påkrævet
Click to see the source code
#!/bin/sh

# DESCRIPTION
# Requires "lightdm_greeter_setup_scripts" to be run and enabled to take effect.
#
# This script will install numlockx and enable it when the pc reaches the login screen.
# Any changes made requires a reboot to take effect.
#
# PARAMETERS
# 1. Checkbox. Enables or disables numlock

set -ex

if get_os2borgerpc_config os2_product | grep --quiet kiosk; then
  echo "Dette script er ikke designet til at blive anvendt på en kiosk-maskine."
  exit 1
fi

NUMLOCK_ON=$1

SCRIPT_DIR="/etc/lightdm/greeter-setup-scripts"
SCRIPT="$SCRIPT_DIR/enable_numlock.sh"
POLICY="/etc/xdg/autostart/os2borgerpc-numlock.desktop"
# Stop Debconf from doing anything
export DEBIAN_FRONTEND=noninteractive

if [ "$NUMLOCK_ON" = "True" ]; then
    if [ ! -f "/usr/bin/numlockx" ]; then
        apt-get update -qq > /dev/null
        apt-get -yqq install numlockx
    fi

    mkdir -p "$SCRIPT_DIR"

    cat << EOF > "$SCRIPT"
#!/bin/sh

numlockx on
EOF
    # Set the correct permissions on the file, so it can be executed by lightdm
    chmod 700 "$SCRIPT"
    echo "Added the script: $SCRIPT"


    cat > "$POLICY" <

Beskrivelse

Dette script installerer numlockx og slår numlock til når computeren når til loginsiden.

Dette script er blevet testet og virker på Ubuntu 22.04.

Parametre

  1. Sæt hak for at slå numlock til, eller lad stå tomt for at fjerne denne funktion igen.