keyboard-layout-converter icon indicating copy to clipboard operation
keyboard-layout-converter copied to clipboard

Difficulties for a Linux newbie (Ubuntu)

Open CodeGrepicious opened this issue 3 years ago • 18 comments

image I am having issues running the script, I am also not sure if I got the naming correct or if you also somehow have to include the directory in it (see the attached screenshot) I also have no idea what it means that you have to merge the files

CodeGrepicious avatar Nov 29 '21 11:11 CodeGrepicious

I realized I probably need to name the subfolders (or directories I guess they are called) correctly, so I did that, but when I try to run the script it does not work with "python" image image

CodeGrepicious avatar Nov 29 '21 13:11 CodeGrepicious

and when I try without the directories above (and with python3) I get the error "name "klcfile) is not defined" image

CodeGrepicious avatar Nov 29 '21 13:11 CodeGrepicious

running it with python3 seems to be fine on your system. the filename should be in quotes, i.e. input.close("...klc"). (Replace the "...klc" with your filename, but keep the quotes)

alexriss avatar Nov 29 '21 21:11 alexriss

Edit: new error textiowrapper takes no arguments

Am I not naming the .xkb file correctly? i just want to get the xkb file now I don't care where it goes or what it is called image image

CodeGrepicious avatar Nov 30 '21 16:11 CodeGrepicious

I also tried with a slash before, the apostrophes also don't make a difference image

CodeGrepicious avatar Nov 30 '21 18:11 CodeGrepicious

oh sorry, I didn't look properly. this line should not be changed. just these two (you see the quotes?):

output = open(r"US - international - custom - nodeadkeys - greek.xkb","w")
input = open(r"US - international - custom - nodeadkeys - greek.klc", encoding="utf-16")

alexriss avatar Nov 30 '21 18:11 alexriss

So you should not have close, but open? And what does the r mean? That is what I meant! It would be really helpful to have an example of what to input like let's say a file in the Downloads directory input.close(Home/daniel/Downloads/NorUltiNov2021.klc) output.close(Home/daniel/Downloads/NorUltiLinuxNov2021.xkb)

CodeGrepicious avatar Nov 30 '21 19:11 CodeGrepicious

edit: I see what you mean, it is the one where output is over input. image I'm still getting an error maybe the r should not be there? output = open(r"Home/daniel/Downloads/NorUlti10LinuxNov2021.xkb","w") input = open(r"Home/daniel/Downloads/NorUlti10Nov2021.klc", encoding="utf-16")

CodeGrepicious avatar Nov 30 '21 19:11 CodeGrepicious

r is raw string. I dont think there will be much difference in most cases.

You see it says "no such file or directory", which means that your file path is wrong, you need to figure this out. If I were to guess it would be /home/daniel... (with the first slash, also upper/lowercase matters)

alexriss avatar Nov 30 '21 19:11 alexriss

well first off, do I leave the international - custom text in the front ? output = open(r"US - international - custom - nodeadkeys - NorUlti10Nov2021ctl.xkb","w") input = open(r"US - international - custom - nodeadkeys - NorUlti10Nov2021.klc", encoding="utf-16")

and do I need to state the directories if I have the .klc file in the same directory as the convert_to_xkb.py script?

CodeGrepicious avatar Nov 30 '21 19:11 CodeGrepicious

Now I am getting this error image edit: this is with the correct directories :

CodeGrepicious avatar Nov 30 '21 19:11 CodeGrepicious

remove it - just the filename. Same directory is good.

alexriss avatar Nov 30 '21 19:11 alexriss

that's what I am confused about, remove what exactly? do I not need this? /home/daniel ``

r is raw string. I dont think there will be much difference in most cases.

You see it says "no such file or directory", which means that your file path is wrong, you need to figure this out. If I were to guess it would be /home/daniel... (with the first slash, also upper/lowercase matters)

CodeGrepicious avatar Nov 30 '21 19:11 CodeGrepicious

put the path of your file inside the quotes (nothing else), leave everything outside the quotes.

alexriss avatar Nov 30 '21 19:11 alexriss

This worked, turned out the problem was that home was home with small letters and not capital letters. to whoever's reading this, remember to check the properties of your .klc file to get the proper file path! image

CodeGrepicious avatar Nov 30 '21 19:11 CodeGrepicious

Now I have the .xkb file (finally! :)) I tried looking at the sites you linked to in the README document, but I couldn't find any specific instructions as to what "merging" you were talking about. I can't seem to just add the lines of codes to the bottom as I don't have the permissions to do so image Two of the links referred to in the readme doc seem to not be working. I found this page https://rlog.rgtti.com/2014/05/01/how-to-modify-a-keyboard-layout-in-linux/ But here I also don't understand if this merging is something you do in the terminal. I don't understand these two last steps I tried reading through Karol's blog too https://karols.github.io/blog/2013/11/18/creating-custom-keyboard-layouts-for-linux/ Though I have the same issue there, I don't get where I am supposed to paste the generated xkb code, or how to merge it image

CodeGrepicious avatar Nov 30 '21 21:11 CodeGrepicious

I've been trying to figure it out and I've watched some videos and read some posts, but it's still unclear to me how you actually edit the

layout definitions are in the /usr/share/X11/xkb/symbols directory,

layout metadata are in the /usr/share/X11/xkb/rules/evdev.xml file.

and how you actually add the converted .xkb data into an existing layout. No matter what directory I go into I don't have the permission to change the keyboard layout code it seems.

CodeGrepicious avatar Dec 05 '21 18:12 CodeGrepicious

To whoever's reading this; the answer is to edit the file as root. The easiest way is using the terminal: navigate to /usr/share/X11/xkb/symbols and edit the file from command line.

If you don't know any conmand line editors, your best bet is nano: use sudo nano us (if you want to edit the us file)

CodeGrepicious avatar Dec 06 '21 08:12 CodeGrepicious