Bug 276436 - sysutils/xfce4-settings: xfce4-keyboard-settings: after standby the keyboard layout setting gets lost
Summary: sysutils/xfce4-settings: xfce4-keyboard-settings: after standby the keyboard ...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-xfce (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-18 19:41 UTC by p5B2EA84B3
Modified: 2024-01-31 13:06 UTC (History)
2 users (show)

See Also:
madpilot: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description p5B2EA84B3 2024-01-18 19:41:05 UTC
When awaking the system from standby the keyboard layout setting is lost.

The setting had to be done in the xfce4-keyboard-settings, as the keyboard layout of the system was not respected.

Is there a better way setting the keyboard layout so that it persists a standby/awake cycle?
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2024-01-19 08:17:37 UTC
Hi,

I'm not sure I am able to reply to this because this setting depends on really a lot of factors.

I don't use stdby much and almost always keep USA layout although it looks to me other keyboard settings do persist as expected.

My first guess is that when getting out of stdby some race happens that causes settings to not respect the XFCE ones.

How are you launching XFCE? using a disp0lay manager? lightdm? Or via startxfce4 from console?

If starting it from console could you try using "startxfce4 --with-ck-launch" and see if it makes any difference?


Another test you should do is, creating a brand new user in your system and check if this happens to him too with the default xfce config.


BTW the XFCE keyboard layout also has a switch "Use system defaults", have you tested both with that enabled and disabled?


I will try doing some test on my laptop and see if I can reproduce this later.


Apart from this I am not really expert on localization issues, and I'd suggest you file a bug report upstream, with XFCE directly, linking it here so it can be tracked. Maybe upstream someone has better insight on this. I really have no idea how the keyboard settings are managed in XFCE.
Comment 2 p5B2EA84B3 2024-01-19 12:30:22 UTC
(In reply to Guido Falsi from comment #1)
I do use "startxfce4 --with-ck-launch"

The XFCE keyboard layout switch "Use system defaults" had to be deactivated because it does not respect the system settings. Otherwise I could not set the keyboard layout I need.

When enabling "Use system defaults" the US-layout is enabled.
Comment 3 p5B2EA84B3 2024-01-19 12:35:46 UTC
(In reply to Guido Falsi from comment #1)
When starting from console only using "startxfce4" without "--with-ck-launch" the startup of XFCE takes up to 50 seconds and more important there is no way logging out of the user session, which is very bad. In that case the user has to kill a process the hard way. Also worth mentioning as IMO this should never be the case.
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2024-01-19 14:43:52 UTC
(In reply to p5B2EA84B3 from comment #3)

startxfce4 from console should always be launched with "--with-ck-launch". The switch is there for that purpose. It is expected to misbehave without that.


(In reply to p5B2EA84B3 from comment #2)

I see, I just wanted to understand if the switch made any difference.

What about the other tests I suggested?

Please be aware you're the first one to report this issue, I don't suspend my laptop usually, and also always have a US layout, so I have little experience with this. As stated int he other bug, I'm trying to help you but I can only guess aft present.

I also have never started xfce via console, I've always used a display manager, which is the most common way at present. Have you enabled dbus in rc.conf? That could be required.

The XFCE port is a port, if there is a bug upstream it will need to be reported there.

You should really file a bug report at https://gitlab.xfce.org/ about this, upstream developers who know the internals better than me could give some insight.
Comment 5 Guido Falsi freebsd_committer freebsd_triage 2024-01-19 19:18:14 UTC
I performed a test on my laptop right now.

I set the layout to Italian using xfce4-keyboard-settings and set my laptop to standby (by closing the lid), then woke it up and I cannot reproduce the issue. My keyboard was back to Italian.


I guess the issue is due to some local setup of your machine. Maybe some daemon not started or something wrong with the Xorg setup. Various things compete for locale setup and could be conflicting, and I'm not an expert about such things to be able to name them and how they interact.

You should really test in a clean setup, or try using a display manager, maybe, since these do a lot of setuo for the session.

BTW the startxfce4 script is provided by x11-wm/xfce4-session and written by upstream. Any change to it should be discussed with upstream too.
Comment 6 Tom Hukins 2024-01-22 20:32:04 UTC
A question for the bug reporter: do you use a USB keyboard and what does usbconfig(8) output on the problematic machine?

When I run xfce on a FreeBSD laptop, I see no problems with suspend/resume and the keyboard.  When I run xfce on a desktop with a USB keyboard, the keyboard resets to a US keymap on resume.

I don't fully understand the problem, but the default /etc/devd.conf contains a line that runs `service syscons setkeyboard /dev/ukbd0` and this seems to happen on resume.

/etc/rc.d/syscons has a syscons_setkeyboard() function that runs kbdcontrol(1), which in turn reads keymap configuration from /etc/rc.conf.

On my desktop computer with a USB keyboard, I have `keymap="uk.kbd"` in /etc/rc.conf and when I run zzz(1) from the command line without xfce or any other X window manager running, I see the USB keyboard recognised on resume, and everything works fine.  When I run zzz(1) from within xfce, on resume I have a US keyboard layout and have to reset the layout myself manually in order to use my chosen keymap.
Comment 7 p5B2EA84B3 2024-01-27 18:26:50 UTC
(In reply to Tom Hukins from comment #6)
Yes, I confirm using an USB-keyboard. 
Will you write a new PR on your findings?
Comment 8 Tom Hukins 2024-01-31 13:06:16 UTC
(In reply to p5B2EA84B3 from comment #7)
> Will you write a new PR on your findings?
No, we already have this PR.  We don't need another with duplicate information.