Hi, is it possible to set up this keyboard to show different layouts for different types of input fields? I need to show a full keyboard when a text input is selected, and a numpad when a numeric input field is selected.
Edit:
Going through this thread, I found out that this is something that should work automatically. Problem is it doesn’t work for me at all. I’ve tried <input type="number">, as well as <input inputmode="numeric">. Nothing. I always get the standard keyboard.
About my setup:
Kiosk PC (touchscreen only) running Ubuntu Frame on Ubuntu Server, with Mir kioks, pointed to a webapp that runs locally. The web app is ASP.NET Core with Blazor UI.
Please advise.
EDIT 2:
Upon further experimentation, when I use <input type="number"> the numpad will show up. But, it will show up IF, and ONLY IF, I have another input on the page wchich is of type text (or default, I presume that is text), and I select that one first, and then select the numeric input. If the numeric in put is the only input on the page, or is selected first, I get the full keyboard.
This is a bug, right?
I have created an issue on GitHub regarding the issue with numpad not showing up.
In the meantime the following workaround was selected:
add a row of numbers to the top of the default layout
remove the “show_letters” (“123”) button, and the “preferences” button.
I followed the instructions from this guide exactly:
(except I modified keyboards/us.yaml, not keyboards/number/us.yaml)
…
views:
base: - “1 2 3 4 5 6 7 8 9 0”
- “q w e r t y u i o p”
- “a s d f g h j k l”
- “Shift_L z x c v b n m BackSpace” - “period space Return”
upper: - “1 2 3 4 5 6 7 8 9 0”
- “Q W E R T Y U I O P”
- “A S D F G H J K L”
- “Shift_L Z X C V B N M BackSpace” - “period space Return”
…
I left the rest of the file untouched. I verified that this modified file is located in
/root/snap/ubuntu-frame-osk/current/.local/share/squeekboard/keyboards/us.yaml
I restarted the ubuntu-frame-osk snap, and there was no change to the keyboard layout. Even restarting the machine didn’t help. Any idea why?
Also, I’ve read that the location $SNAP_USER_DATA is not persisted during snap updates? Will I have to repeat this process every time, just to make sure my keyboard layout doesn’t revert back to default at some point?
It definitely is persisted. On refresh, SnapD copies the data for the current version to the new version, so in case of problems you can revert and get the old data.
$SNAP_USER_COMMON is shared, and untouched between different snap revisions.
Sorry! We missed to update this documentation after this landed:
Replace $SNAP_USER_DATA/.local/share/ with $SNAP_COMMON in those instructions and things will work again. I’ll update the docs as soon as possible.
Thanks. I was able to figure out the path on my own in the mean time. I viewed the logs for the ubuntu-frame-osk snap, I saw it was trying to find a file:
Tried file “/var/snap/ubuntu-frame-osk/common/squeekboard/keyboards/us_wide.yaml”, but it’s missing: No such file or directory (os error 2)
I placed the file in that location and it worked. It looks like $SNAP_COMMON has a value of /var/snap/ubuntu-frame-osk/common.
I am experiencing some issues with keyboard width though.
First of all, adding a file called us.yaml does nothing. I have to rename it to us_wide.yaml.
When I do that, my layout is used, but it’s really narrow. It takes up maybe 40% of the width of the screen.
I downloaded the us_wide.yaml file from github, and modified that one. When I applied it, the keyboard got wider, but it still wasn’t full-width. That’s strange, because the default layout that shows up when I don’t use any custom files, fits the width of the screen perfectly. I suppose I could play with the button width until I get what I want, but the default behavior suggests to me there should be a cleaner solution.
Do you have any advice on this issue?
Also, I don’t mean to pile up questions on you, but as long as I’m here I have 2 more:
Is it possible to change the font of the keyboard? (the default font is too different from our application font, especially the numbers)
Is it possible to set up the keyboard so it overlays the screen, instead of resizing it vertically?
Thank you.
EDIT: Regarding the font, I’ve looked at the docs for both ubuntu-frame-osk and squeekboard. I didn’t find anything about setting a custom font. So I’ve looked at the source code. There’s nothing in the squeekboard codebase, in ubuntu-frame-osk there’s some settings in snapcraft.yaml. I can see it loads a whole bundle of fonts, plus some special font for emojis. I don’t need anything like that. Under no circumstances will my app ever have and emoji button. I just need the letters and numbers on the buttons to be displayed in Roboto font. How can I do this?
Yes, the us.yaml is just an example - and us_wide.yaml is the correct one in your case - as you can see from the logs. I’ll extend the documentation to spell that out.
The OSK is selecting and sizing the layout with some rules - in this case it’s keeping the OSK narrower to not cover a lot of screen vertically.
The fonts are determined by the theme, and we currently only have the light and dark Yaru theme, you can expect them to look like this:
From your screenshots, you probably use the 24/stable channel, the above are from 22/stable - and we’ll fix the font on the 24 track. Sorry, we don’t currently have facilities to impact this more, you’d have to modify the snap to make this possible.