Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] localectl missing (Read 3341 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] localectl missing

Hello! I installed Artix linux (runit I think, has been a while, with what command can I check?)

I want to have a keyboard shortcut to be able to switch from english into greek, and back to english if I press that keyboard shortcut again

/etc/locale.conf contains:
Code: [Select]
LANG=en_US.UTF-8
LANG=el_GR.UTF-8 UTF-8

/etc/vconsole.conf is non-existent.

The computer displays greek characters, even outside the browser, so probably my configuration is good.
Typing locale displays:
Code: [Select]
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Anyway, I am not asking for how to put a shortcut to change language, I am confident I can achieve that.
I just can't seem to change language since https://wiki.archlinux.org/title/Locale needs localectl, and typing localectl in the terminal does nothing. I even tried typing locale then pressing tab in case it displays but nothing happened.

For more information, I am using https://github.com/LukeSmithxyz/LARBS/issues but I see other users can use localectl normally https://github.com/LukeSmithxyz/LARBS/issues/371  :o

If you need any more information, ask anything freely, I posted all I could think of above

Re: localectl missing

Reply #1
localectl is a part of systemd. The main idea of Artix is to be free of systemd. Therefore, Artix doesn't support the command localectl.

/etc/locale.conf contains:
Code: [Select]
LANG=en_US.UTF-8
LANG=el_GR.UTF-8 UTF-8
This will assign "en_US.UTF-8" to the variable $LANG, then give an error that the command "UTF-8" is non-existant. There can be only one default system language. If you want el_GR.UTF-8, then put only that:
Code: [Select]
#/etc/locale.conf
LANG=el_GR.UTF-8

Quote
/etc/vconsole.conf is non-existent.
You can create it. It is only a text file. It affects the text console only (ttys, not a virtual terminal like st).

Code: [Select]
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
You don't need quotes there, as there are no spaces.

Quote
Anyway, I am not asking for how to put a shortcut to change language, I am confident I can achieve that.
That depends on your DE. I'm using no DE, and have my custom build of dwm which includes the call to setxkbmap on startup, approximately this:
Code: [Select]
setxkbmap -layout us,rs -option grp:alt_shift_toggle
This allows me to switch input language in X.Org with left Alt+Shift.

GNOME and KDE (and their derivatives) should have control panels for language input.


Re: localectl missing

Reply #3
wow wtf. I expected a reply in like a week since its not the main/popular archlinux forum

Thank you for the info strajder, I didn't know localectl missing was because of artix, though I kinda suspected that so I'm happy I posted it here instead of archlinux forums (since they would assume i use arch, the end result of that thread would be "wrong forum bro, you wasted our time")

Didn't know about the LANG variable either, makes sense, though I certainly want my OS in english, especially a linux one lul

>You can create vconsole.conf It is only a text file. It affects the text console only (ttys, not a virtual terminal like st).
What does it do?

>That depends on your DE. I'm using no DE, and have my custom build of dwm which includes the call to setxkbmap on startup
I don't use a desktop enviroment either, I have some autistic setup without mouse but it is excellent

>setxkbmap -layout us,rs -option grp:alt_shift_toggle
Bless

I was like "walls of text, but no solution" and checked out the below reply's link, but it's bloat(installing fcitx5 + misc languages package + input module which works only with certain programs lul)

Anyway, thanks man, literally copy-pasted 1 line (changed `rs` ofc) and it works smoothly for everything. Να'σαι καλά!

P.S. I am happy to see much activity here, no discord bs to get an answer feelsgoodman

Re: localectl missing

Reply #4
>You can create vconsole.conf It is only a text file. It affects the text console only (ttys, not a virtual terminal like st).
What does it do?
https://man.archlinux.org/man/vconsole.conf.5

Relevant services in Artix are modified to also make use of the file, so it is not systemd-specific.


Re: localectl missing

Reply #5
Of course, localectl is missing, it's a part of systemd. But your problem can be solved without systemd, it's simple. There are two different parts: localization of tty (console) and localization of X11.

Localization of console in Artix is done by creating and editing /etc/vconsole.conf. You should add KEYMAP definition there. For example, here is my /etc/vconsole.conf:
Code: [Select]
LOCALE="en_US.UTF-8"
KEYMAP="ruwin_alt_sh-UTF-8"
FONT="ter-v16b"
CONSOLEMAP=""
This allows me to switch between English and Russian keymaps by pressing Alt+Shift. Keymaps are stored in the /usr/share/kbd/keymaps/i386/qwerty directory. There is a couple of Greek keymaps: gr and gr-pc. Those are compressed text files, just look inside and read the commentary to learn how to switch between languages in each keymap, and then choose whichever you like.

Then, localization of X11. As already mentioned before, this can be done by executing setxkbmap. But this can be done automatically by Xorg during the startup. Just add the file /etc/X11/xorg.conf.d/10-keyboard.conf with something like that:
Code: [Select]
Section "InputClass"
Identifier     "MyPreciousKeyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "us,ru"
Option "XkbVariant" ","
Option "XkbOptions" "grp:alt_shift_toggle,terminate:ctrl_alt_bksp,grp_led:scroll,numpad:microsoft"
EndSection
These are options transferred to setxkbmap. switching by Alt+Shift, Ctrl+Alt+Backspace terminates X11 session, scroll lock keyboard indicator shows the current layout, numpad keys work as in Windows (you can use Alt/Ctrl/Shift + arrows/home/end/etc).
Option XkbVariant sets the variant of keymaps: for the first keymap before the comma, and for the second one after the comma. In my case, there are no specific variants, thus the "basic" variant is used. You can learn what variants your preferred keymap has by inspecting the /usr/share/X11/xkb/symbols directory. Just look inside the desired file, in your case it's gr. Variants are defined by strings like xkb_symbols "blah-blah-blah". For the Greek, there is a particular variant polytonic, which allows you to type Ancient Greek diacritics. Ὑγιαίνῃ!

Re: localectl missing

Reply #6
(Sorry, pressed "Quote" instead of "Quick edit"; how can I delete a message btw?)

Re: localectl missing

Reply #7
Of course, localectl is missing, it's a part of systemd. But your problem can be solved without systemd, it's simple. There are two different parts: localization of tty (console) and localization of X11.

Localization of console in Artix is done by creating and editing /etc/vconsole.conf. You should add KEYMAP definition there. For example, here is my /etc/vconsole.conf:
Code: [Select]
LOCALE="en_US.UTF-8"
KEYMAP="ruwin_alt_sh-UTF-8"
FONT="ter-v16b"
CONSOLEMAP=""
This allows me to switch between English and Russian keymaps by pressing Alt+Shift. Keymaps are stored in the /usr/share/kbd/keymaps/i386/qwerty directory. There is a couple of Greek keymaps: gr and gr-pc.

Those are compressed text files, just look inside and read the commentary to learn how to switch between languages in each keymap, and then choose whichever you like.
Thanks for the mini-guide on how to find the keymaps, with it I created the vconsole.conf:
Code: [Select]
LOCALE="en_US.UTF-8"
KEYMAP="gr"
#KEYMAP="gr-pc"
CONSOLEMAP=""

It doesn't work by pressing shift+alt though

Then, localization of X11. As already mentioned before, this can be done by executing setxkbmap. But this can be done automatically by Xorg during the startup. Just add the file /etc/X11/xorg.conf.d/10-keyboard.conf with something like that:
Code: [Select]
Section "InputClass"
Identifier     "MyPreciousKeyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "us,ru"
Option "XkbVariant" ","
Option "XkbOptions" "grp:alt_shift_toggle,terminate:ctrl_alt_bksp,grp_led:scroll,numpad:microsoft"
EndSection
I am confused by xorg.conf.d
It is a directory of sorts, and the only thing under xorg.conf.d is "40-libinput.conf", I don't see 10-keyboard.conf
It had some laptop-settings (touchpad lul), but anyway, I copy-pasted yours on top of it pretty much, and changed rs to gr, and it works smoothly on startup <3
The ancient greek variant is interesting, I thought it would be very hard to set it up for linux

Slightly off-topic:
Quote
scroll lock keyboard indicator shows the current layout, numpad keys work as in Windows (you can use Alt/Ctrl/Shift + arrows/home/end/etc).
What do these do? Scroll lock doesn't show current layout, and idk what you mean by numpad functionality

Re: localectl missing

Reply #8
That depends on your DE. I'm using no DE, and have my custom build of dwm which includes the call to setxkbmap on startup, approximately this:
Code: [Select]
setxkbmap -layout us,rs -option grp:alt_shift_toggle
This allows me to switch input language in X.Org with left Alt+Shift.
@strajder that script worked, but I couldn't make an initscript (I am a newbie), so I ended up using the above X11 way and it works on startup
Out of curiosity, since I already have it working by the xorg.conf.d, how have you set up your initscript/openrcservice?

Edit: My script:
Code: [Select]
#!/sbin/openrc-run

command="/etc/init.d/greek-toggle"
name="Greek Toggle"
description="The script which enables toggling between languages"
pidfile="/var/run/greek-toggle.pid"
command_args="setxkbmap -layout us,gr -option grp:alt_shift_toggle"
And ofc I run it via
Code: [Select]
rc-update add greek-toggle default
But even if I run it instantly, it doesn't work, something with default display error

P.S. I have never written an initscript before, so I'm just curious on how yours is made

Re: [SOLVED] localectl missing

Reply #9
It doesn't work by pressing shift+alt though
In gr keymap, switching to Greek works by pressing left-shift-alt, as described in the comment. I've just tested, it works for me. Right alt and shift don't work.

I am confused by xorg.conf.d
It is a directory of sorts, and the only thing under xorg.conf.d is "40-libinput.conf", I don't see 10-keyboard.conf
Just create this file. It's a common way to manage configs in Linux. Say, you have some config file whatever.conf, and often there is a directory whatever.conf.d. You can put there your own config files, say whatever.conf.d/myown.conf. The format of these files is the same as of the original file. The reason for this is, the default config files can be replaced during upgrades, but these user-defined files aren't. Thus you can redefine default options and keep your changed config without reediting the default config file after it changes. Also, you can create several such files and keep various groups of options in different files, which makes your user configuration modular.

With option grp_led:scroll, the scroll lock led will show you the current layout. In my case, when the scroll lock led is off, it's English layout, when it's on, it's Russian layout. In some keymaps, caps lock is used to indicate layout (and also capslock button to switch between layouts), but I find this inconvenient.

I usually turn NumLock off and use the numpad for Ins/PgUp/Home/etc. But the default Linux keyboard behaviour is when you press say Ctrl+Ins on numpad or Shift+Ins on numpad or whatever, it doesn't work as Ctrl+Ins, but instead types some weird keycode. At least, it used to work in such a way a while ago. By setting the option numpad:microsoft, you can use Ctrl+Ins and other combinations with numpad as Ctrl+ generic Ins etc.

Those additional options for setxkbmap are not well documented, so I was very glad to find this config setting, I don't remember yet where I stumbled upon it. I just keep this setting in my config since then.

UPD. Which init system do you actually use? In the first post, you mentioned runit, but then you write about openrc init scripts. The thing is, console keyboard configuration works differently for runit and openrc. In openrc, /etc/vconsole.conf has no effect, you should edit /etc/conf.d/consolefont and /etc/conf.d/keymap instead. Also, you must add the consolefont service to runlevel boot in order to adjust your console font during startup.

Re: [SOLVED] localectl missing

Reply #10
@strajder that script worked, but I couldn't make an initscript (I am a newbie), so I ended up using the above X11 way and it works on startup
Out of curiosity, since I already have it working by the xorg.conf.d, how have you set up your initscript/openrcservice?
I'm using 66 process supervision suite.

What calls setxkbmap for me, however, is not a script but dwm itself, through the patch "cool autostart".

 

Re: [SOLVED] localectl missing

Reply #11
In gr keymap, switching to Greek works by pressing left-shift-alt, as described in the comment. I've just tested, it works for me. Right alt and shift don't work.
Just create this file. It's a common way to manage configs in Linux. Say, you have some config file whatever.conf, and often there is a directory whatever.conf.d. You can put there your own config files, say whatever.conf.d/myown.conf. The format of these files is the same as of the original file. The reason for this is, the default config files can be replaced during upgrades, but these user-defined files aren't. Thus you can redefine default options and keep your changed config without reediting the default config file after it changes. Also, you can create several such files and keep various groups of options in different files, which makes your user configuration modular.
With option grp_led:scroll, the scroll lock led will show you the current layout. In my case, when the scroll lock led is off, it's English layout, when it's on, it's Russian layout. In some keymaps, caps lock is used to indicate layout (and also capslock button to switch between layouts), but I find this inconvenient.
I usually turn NumLock off and use the numpad for Ins/PgUp/Home/etc. But the default Linux keyboard behaviour is when you press say Ctrl+Ins on numpad or Shift+Ins on numpad or whatever, it doesn't work as Ctrl+Ins, but instead types some weird keycode. At least, it used to work in such a way a while ago. By setting the option numpad:microsoft, you can use Ctrl+Ins and other combinations with numpad as Ctrl+ generic Ins etc.

Those additional options for setxkbmap are not well documented, so I was very glad to find this config setting, I don't remember yet where I stumbled upon it. I just keep this setting in my config since then.
Thanks for the info, stuff like this helps me understand linux better!

Quote
UPD. Which init system do you actually use? In the first post, you mentioned runit, but then you write about openrc init scripts. The thing is, console keyboard configuration works differently for runit and openrc. In openrc, /etc/vconsole.conf has no effect, you should edit /etc/conf.d/consolefont and /etc/conf.d/keymap instead. Also, you must add the consolefont service to runlevel boot in order to adjust your console font during startup.
It is open-rc.
It shows on the top left when I boot and open-rc commands work, so I am certain it is Openrc
It makes sense now that vconsole.conf didn't work lel
I apologize for not knowing it earlier, but anyway, your solution works perfectly :)