How to print # in non-english keyboard layout

Hello to everyone.
I have two keyboard layouts: us and ru.
Is it possible to print # symbol in non-english layout?

I use Obsidian and for writing hash tags I switch to English layout. That's inconvenient.
In Windows I can use combination ALT-35
 
According to /usr/local/share/X11/xkb/symbols/ru the 'numbersign' (#) is on the second level of the '3' key (i.e. shift + 3) for the 'common' variant of the ru layout. For other variants it's sometimes on the third level (alt + 3).
 
According to /usr/local/share/X11/xkb/symbols/ru the 'numbersign' (#) is on the second level of the '3' key (i.e. shift + 3) for the 'common' variant of the ru layout. For other variants it's sometimes on the third level (alt + 3).
Very interesting file.
I have commented one line. Is it possible to apply changes without reboot and restarting Xorg?
 
Very interesting file.
I have commented one line. Is it possible to apply changes without reboot and restarting Xorg?

yes, via setxkbmap(1) and xkbcomp(1):
setxkbmap -I /path/to/your/.xkb -print | xkbcomp -I/path/to/your/.xkb - $DISPLAY

Its usually not a good idea to modify the symbol files provided by the system/package; just create your own file e.g. in ~/.xkb/ and make any modifications there. You can either copy the existing file for your layout or a mostly empty template (look at the original symbol files, they are pretty much self-explanatory and copy the needed boilerplate from there) and just add the changes you want to make. You can include any other layout at the beginning and then overwrite single keys with other settings.
I'm using a modified german 'programmer dvorak' layout exactly this way - the file in [folder]~/.xkb/symbols/[/folder] includes "us(dvorak)" and then just re-defines some keys.
You can put that setxkbmap | xkbcomp command in your .(x)profile to automatically load the layout upon login (I also add setxkbmap -layout <kxb_symbols name> to make sure it is selected)
 
Back
Top