Subject: Re: [X2Go-Dev] Bug#402: Numlock issues

From: [email-masked]
Date: Thu, 30 Jan 2014 09:46:04 +0100

> Package: x2goserver
> Version: 4.0.1.12-0x2go2+git20140108.809+wheezy.main.1
>
> Hello, numlock does not behave correctly. It behaves like if it was
> randomly and continuously toggling it state.
>
> Happens when numlock key is pressed, and after some time, it seems to
> stabilize in some state (on or off), but it can take some time.
>
> Happens on Mate 1.6 desktop environment over Debian 6. No problem on same
> host with a KDE session.
>
> If numlock state is modified with numlockx binary, it works as expected,
> only the key triggers this.
>
> user@host:~$ while numlockx status; do sleep 0.1; done
> Numlock is off
> Numlock is off
> Numlock is on
> Numlock is on
> Numlock is off
> Numlock is on
> Numlock is off
> Numlock is on
> Numlock is off
> Numlock is on
> Numlock is off
> Numlock is off
> Numlock is on
> Numlock is on
> Numlock is off
> Numlock is on
> Numlock is on
> ...

Found that the Mate setting which makes numlock state change at a very
high rate can be disabled by:
  gsettings set org.mate.peripherals-keyboard remember-numlock-state false

Still, users notify me that numlock change randomly. I did monitor
numlock status with "numlockx status" command, and I can see it do
change but very intermitently.

I first monitored numlock status and actively changed it to on with a
script.

Lately, I added to the keyboard options, the equivalent to "setxkbmap -o
numpad:mac", which can be added to
/org/mate/desktop/peripherals/keyboard/kbd/options with
'compat\tnumpad:mac'

Here is a dirty script, which every user runs at session startup:

---------------%-----------------%------------------%------------------
#!/bin/bash
tab="$(printf "\t")"
cadena=( $(dconf read /org/mate/desktop/peripherals/keyboard/kbd/options |
sed -e 's/.*\[\|\]//g') )
for (( i=0;i<${#cadena[@]};i++ )); do
	# esborrar '[', ']' i ','
	cadena[$i]="$(printf "${cadena[$i]}" | sed -e 's/,//g')"
done
if ! echo ${cadena[@]} | grep -q 'compat\snumpad:mac'; then
	for (( i=0;i<${#cadena[@]};i++ )); do
		nova="$nova ${cadena[$i]},"
	done
	nova="$nova 'compat${tab}numpad:mac'"
	dconf write /org/mate/desktop/peripherals/keyboard/kbd/options "[ $nova ]"
fi
gsettings set org.mate.peripherals-keyboard numlock-state          'on'
---------------%-----------------%------------------%------------------