XFCE - The keyboard layout changes automatically
XFCE - The keyboard layout changes automatically
Hi all,
In porteus-v5.0-x86_64.cfg I have registered kmap=de
If I don't shut down but go into standby mode, then the setting changes to us
I then have to use the command setxkbmap de
That's annoying
Can the problem be solved?
In porteus-v5.0-x86_64.cfg I have registered kmap=de
If I don't shut down but go into standby mode, then the setting changes to us
I then have to use the command setxkbmap de
That's annoying
Can the problem be solved?
Last edited by Rava on 26 Jan 2023, 01:37, edited 1 time in total.
Reason: To clarify I added "XFCE" to the subject title.
Reason: To clarify I added "XFCE" to the subject title.
The keyboard layout changes automatically
Did you try to deinstall the German keyboard and then install it again?
- Rava
- Contributor
- Posts: 5401
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
The keyboard layout changes automatically
Which DE do you use?
(aka post your
Code: Select all
cat /etc/porteus/*
My setting is via kernel cheatcode in porteus.cfg, but that should make no difference to your porteus-v5.0-x86_64.cfg approach
Slightly off topic:
(though it would be interesting to know when there are conflicting infos in porteus-v5.0-x86_64.cfg and in the boot APPEND line of porteus.cfg - what would happen?
Would one override the other or would the kernel halt the boot and complain?
E.g. have kmap=de in APPEND line of porteus.cfg - and kmap=es in porteus-v5.0-x86_64.cfg.)
Back on topic:
I have
Code: Select all
kmap=de lang=de
And after suspend, the keyboard is still German (Germany) (no dead keys).
But when I unplug the external keyboard (it is a notebook with internal keyboard that I hardly ever use (the internal keyboard, that is)) and re-plug it, then sometimes the keyboard got reset to en-US, but other times it not gets reset.
Cheers!
Yours Rava
Yours Rava
The keyboard layout changes automatically
Hi Rava,
I use Porteus 5.0 Xfce
and in porteus-v5.0-x86_64.cfg file I have: kmap=de lang=de
I run now (for control) in always fresh mode.
But the same problem
After Suspend : Keyboard map changes from "de" to "us"
I use Porteus 5.0 Xfce
and in porteus-v5.0-x86_64.cfg file I have: kmap=de lang=de
I run now (for control) in always fresh mode.
But the same problem
After Suspend : Keyboard map changes from "de" to "us"
The keyboard layout changes automatically
copy this from /usr/share/X11/xorg.conf.d/90-keyboard-layout.conf in /etc/X11/xorg.conf.d/ with your language but you have also /etc/profile.d/lang.csh
/etc/profile.d/lang.sh
you have to change with your language and i think when you resume you have your language keyboard
/etc/profile.d/lang.sh
you have to change with your language and i think when you resume you have your language keyboard
The keyboard layout changes automatically
Hi Rava, I use 4.16
Code: Select all
guest@porteus:~$ xfce4-panel --version
xfce4-panel 4.16.3 (Xfce 4.16)
- Rava
- Contributor
- Posts: 5401
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
The keyboard layout changes automatically
I use bash and that should use /etc/profile.d/lang.sh
My lang.sh:
Code: Select all
guest@porteus:~$ grep =en_ /etc/profile.d/lang.sh
export LANG=en_US.UTF-8
#export LANG=en_US.ISO8859-1
Code: Select all
guest@porteus:~$ echo $LANG
en_US.UTF-8
Seems beny once more knows his stuff, and I need to use an updated /etc/profile.d/lang.sh
beny, would this be the correct way:
Code: Select all
#!/bin/sh
# Set the system locale. (no, we don't have a menu for this ;-)
# For a list of locales which are supported by this machine, type:
# locale -a
# 'C' is the old Slackware (and UNIX) default, which is 127-bit
# ASCII with a charmap setting of ANSI_X3.4-1968. These days,
# it's better to use en_US or another modern $LANG setting to
# support extended character sets.
#export LANG=C
# There is also support for UTF-8 locales, but be aware that
# some programs are not yet able to handle UTF-8 and will fail to
# run properly. In those cases, you can set LANG=C before
# starting them. Still, I'd avoid UTF unless you actually need it.
export LANG=de_DE.UTF-8
# Another option for en_US:
#export LANG=en_US.ISO8859-1
# One side effect of the newer locales is that the sort order
# is no longer according to ASCII values, so the sort order will
# change in many places. Since this isn't usually expected and
# can break scripts, we'll stick with traditional ASCII sorting.
# If you'd prefer the sort algorithm that goes with your $LANG
# setting, comment this out.
export LC_COLLATE=C
# End of /etc/profile.d/lang.sh
Same here:
Code: Select all
guest@porteus:/$ xfce4-panel --version
xfce4-panel 4.16.3 (Xfce 4.16)
Copyright (c) 2004-2011
The Xfce development team. All rights reserved.
Please report bugs to <http://bugzilla.xfce.org/>.
Code: Select all
guest@porteus:~/.config/xfce4/xfconf/xfce-perchannel-xml$ grep de keyboard-layout.xml
<property name="XkbLayout" type="string" value="de"/>
<property name="XkbVariant" type="string" value="nodeadkeys"/>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<channel name="keyboard-layout" version="1.0">
<property name="Default" type="empty">
<property name="XkbDisable" type="bool" value="false"/>
<property name="XkbLayout" type="string" value="de"/>
<property name="XkbVariant" type="string" value="nodeadkeys"/>
</property>
</channel><?xml version="1.0" encoding="UTF-8"?>
<channel name="keyboard-layout" version="1.0">
<property name="Default" type="empty">
<property name="XkbDisable" type="bool" value="false"/>
<property name="XkbLayout" type="string" value="de"/>
<property name="XkbVariant" type="string" value="nodeadkeys"/>
</property>
</channel>
Please be aware that I also removed the default keyboard setting of en_US so that there is only de_DE available and no other layout in the below listing, as you can see in the screenshot.
Cheers!
Yours Rava
Yours Rava
XFCE - The keyboard layout changes automatically
Hi Rava and beny,
After Suspend : Keyboard map changes from "de" to "us"
That means there are always small imperfections!
But I'll leave it at that.
I then use the command: setxkbmap de
After Suspend : Keyboard map changes from "de" to "us"
That means there are always small imperfections!
But I'll leave it at that.
I then use the command: setxkbmap de
- Rava
- Contributor
- Posts: 5401
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
XFCE - The keyboard layout changes automatically
Do you use the settings of XFCE -as in - only the DE keymap available as you can see in my screenshot and in the config file I posted?
I suggest the following:
Create a script to be run as root that handles your suspend. E.g. like so.
Code: Select all
#!/bin/sh
# aliases and functions
function seconds2time ()
{
local T=$1;
local D=$((T/60/60/24));
local H=$((T/60/60%24));
local M=$((T/60%60));
local S=$((T%60));
if [[ ${D} != 0 ]]; then
if [[ ${D} = 1 ]]; then
printf '%d day %02d:%02d:%02d' $D $H $M $S;
else
printf '%d days %02d:%02d:%02d' $D $H $M $S;
fi;
else
printf '%02d:%02d:%02d' $H $M $S;
fi
}
function mydate () {
echo $(date +%d.%m.%Y\ %H:%M:%S) ____________________________________________________________
}
# main
declare -i startepoch=$(date +%s)
mydate
echo loginctl suspend
loginctl suspend
echo $0: sleeping 10 seconds for suspend to finish…
sleep 10s
echo '●●●●● loginctl suspend took '$(seconds2time $(date +%s)-$startepoch)' …'
echo setxkbmap de
setxkbmap de
mydate
Calculates and prints the time you spend in suspend (function seconds2time)
Resets your keyboard
Prints date/time prior finishing
when you want none of these extra info and suspend time calculation, then just use this:
Code: Select all
#!/bin/sh
# no aliases nor functions
echo loginctl suspend
loginctl suspend
echo $0: sleeping 10 seconds for suspend to finish…
sleep 10s
echo setxkbmap de
setxkbmap de
Cave! Put the script into your $PATH, the recommended folder is /usr/local/bin
Make it executable via
Code: Select all
chmod a+x SCRIPT
My script that does the suspend for me and also writes even more info than above into /var/log/messages is named suspend-s0 and its file properties are like so:
Code: Select all
root@porteus:/usr/local/bin# ls -l suspend-s0
-rwxr--r-- 1 root root 1610 2022-10-06 05:06 suspend-s0
Code: Select all
root@porteus:/usr/local/bin# ls -l help.yt-dlp
-rwxr-xr-x 1 root root 2313 2023-01-24 05:39 help.yt-dlp
root@porteus:/usr/local/bin# stat help.yt-dlp |grep 'Access: ('
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Because of security reasons. The script is in $PATH of all users and in these $PATH I keep all programs and scripts owned by root and while executable by all, only read-only for all others than root gives my system a bit more of security.
Added in 2 minutes 9 seconds:
when guest tries executing the script (s)he gets this error:
Code: Select all
guest@porteus:/$ suspend-s0
bash: /usr/local/bin/suspend-s0: Permission denied
Last edited by Rava on 27 Jan 2023, 03:42, edited 1 time in total.
Reason: fixed syntax error in script code - removed info about it being run only by root (thanks to Ed_P for pointing out both these mistakes)
Reason: fixed syntax error in script code - removed info about it being run only by root (thanks to Ed_P for pointing out both these mistakes)
Cheers!
Yours Rava
Yours Rava
XFCE - The keyboard layout changes automatically
hi i have added glibc-i18n and the copy of the script and i have two keyboard layout that i can choose us and it and after suspend the it layout is ok porteus5
- Ed_P
- Contributor
- Posts: 8368
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
XFCE - The keyboard layout changes automatically
An impressive script but doesn't need to be run as root. loginctl suspend works for me as guest.
Code: Select all
guest@porteus:~$ date
Thu Jan 26 18:37:10 EST 2023
guest@porteus:~$ loginctl suspend
guest@porteus:~$ date
Thu Jan 26 18:37:40 EST 2023
guest@porteus:~$
Code: Select all
guest@porteus:~$ chmod +x suspend.sh
guest@porteus:~$ ./suspend.sh
26.01.2023 18:47:22 ____________________________________________________________
loginctl suspend
./suspend.sh: sleeping 10 seconds for suspend to finish…
./suspend.sh: line 33: unexpected EOF while looking for matching `''
./suspend.sh: line 37: syntax error: unexpected end of file
guest@porteus:~$
Ed
- Rava
- Contributor
- Posts: 5401
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
XFCE - The keyboard layout changes automatically
Silly me, it was not due to loginctl suspend needing root but the fact that my suspend-s0 script also writes more info into /var/log/messages being the reason why my script needs to be root.
Thanks for pointing that out.
also the typo why it exits with a syntax error is this:
Code: Select all
echo '●●●●● loginctl suspend took '$(seconds2time $(date +%s)-$startepoch)' …
Code: Select all
echo '●●●●● loginctl suspend took '$(seconds2time $(date +%s)-$startepoch)' …'
I now edit the above post to change the typo and remove the info about it needing to be run as root.
Cheers!
Yours Rava
Yours Rava
XFCE - The keyboard layout changes automatically
Hi Rava,
thank you very much for the script.
But the time is only displayed when I run the script in the terminal.
But I usually run scripts with a double click.
My system is set up that way, I find it more convenient.
I am considering how to receive the ad as a message
thank you very much for the script.
But the time is only displayed when I run the script in the terminal.
But I usually run scripts with a double click.
My system is set up that way, I find it more convenient.
I am considering how to receive the ad as a message
- Rava
- Contributor
- Posts: 5401
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
XFCE - The keyboard layout changes automatically
Using notify-send
Code: Select all
notify-send -i info -t 5000 "Keyboard set" "to DE"
Code: Select all
echo setxkbmap de
setxkbmap de
returnval=$?
if [ $returnval -eq 0 ]; then
notify-send -i info -t 5000 "Keyboard set" "to DE"
else
notify-send -i error -t 0 "Keyboard setting to" "DE failed"
fi
Code: Select all
echo setxkbmap de
setxkbmap de && notify-send -i info -t 5000 "Keyboard set" "to DE" || notify-send -i error -t 0 "Keyboard setting to" "DE failed"
In case of an error I would recommend the popup to be displayed indefinitely for you to manually acknowledge.
Cheers!
Yours Rava
Yours Rava
- Ed_P
- Contributor
- Posts: 8368
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
XFCE - The keyboard layout changes automatically
Add "read" to the end of the script. The message will be available until you click on the window and press Enter. Another option is to add "sleep 30" to the end of the script to have the message available for 30 seconds after the suspend ends then the window closes. Obviously the time duration is your choice.
Ed