Aylur/dotfiles

Implement third party JS modules

Tenyun opened this issue · 4 comments

Hi

I have been using your ags dotfiles for some time now and would like to add a button for an on screen keyboard in the taskbar. Unfortunately your configuration is very advanced and I have no idea where to start. The ags wiki didn't help me either. I would like to continue using your ags dotfiles in the future, which is why I am looking for a solution that I can quickly add again after an update. The best solution for me at the moment would be the module from https://github.com/end-4/dots-hyprland/tree/main/.config/ags/modules/onscreenkeyboard as this has already implemented a layout for German. I have tried to implement the module myself, but the difference between TS and JS is too big for my understanding, so I have not been able to do it yet.

I would appreciate some support.

I'm not Aylur, but -- I did implement having a button in my bar for toggling an OSK. In my case, I use https://github.com/jjsullivan5196/wvkbd OSK, along with a small C program for the toggling part. https://github.com/nine7nine/n7n-AGS-Shell/blob/main/sources/wvctl.c ...

I suspect you will find it challenging to maintain a JS or TS module, if you aren't super confident in your TS/JS skills, and may be better off finding an OSK that is maintained by someone else and won't require additional hassles to use... Implementing a button/toggle in AGS is fairly simple, you can get an idea from my commit over here: nine7nine/n7n-AGS-Shell@0df92e1 ... Specifically, look at the wvctl parts:

  1. add an icon to icons.ts
  2. add the needed bits in options.ts
  3. add import and position in bar.ts
  4. add any css bits needed
  5. create the button in ags/widget/bar/buttons

It's tricky finding a decent OSK for Wayland, so I can understand why you might want to grab up someone else's module. It's still definitely an option -- and integrating it may or may not be that difficult -- but the above still may give you some ideas on how to do so... I suppose if you find a good TS based OSK, you would need to modify the above steps a bit: create a folder like ags/widgets/OSK and import it correctly, then instead of using an sh() command, do similar to the launcher to call it or close it.

Personally, also not being a JS or TS guy I opted to find an external OSK, with only needing to setup a button or gestures to manage it. it just simplified everything for me -- other than having to write my own OSK layout for Wvkbd, as it didn't have a full-sized keyboard layout.

food for thought. I hope it gives you some ideas

Hi nine7nine, thanks for the suggestions.

I have already experimented with wvkbd and it was also my first idea for a solution.
Even if wvkbd already works very well, it is unfortunately only provided with an English layout.
There are submenus with all the special keys but it would still be nice to have a local (in my case German) layout.
The configuration of wvkbd is at least as complicated/comprehensive as JS/TS for me.
Since I have already added various things in dwm, I know what I am talking about.

Yes, finding an OSK for wayland is really a challenge, especially if you want it to work independently of the DE (see GNOME OSK).

I'll have a look at your configuration and then decide which way to go.
Since my tablet will only arrive in a few weeks, I still have some time to look for a solution.

Thank you very much

I doubt it would be all that difficult to add German to wvkbd. probably less complicated than you think. Take a look at: https://github.com/nine7nine/wvkbd-n7n/blob/e5a999cb61ad7c7a4842f9b3660540ee924484d5/layout.mobintl.h

you can see how Arabic, Georgian, Hebrew, etc layouts work (english is not the only layout!). I suspect If I was german-speaking - I could add support for that in a night, with a bit of tinkering about. wvkbd isn't hard to change or extend. maybe you need to get into some additionnal tinkering/learning key codes -- but again, not that difficult to figure out... I'm actually surprised wvkbd doesn't have German, and say Spanish layouts already!

and yeah, Wayland is a huge pain for OSK. I looked at a bunch of options last year. For me: wvkbd was pretty much the only option that actually worked out. not perfect, but good enough for me.

btw, if your are going to be using AGS/Hyprland on a tablet: you may be interested in some of the code / widgets in my fork of Aylur's dotfiles -- I use AGS on my Microsoft Surface 7 pro, so some of the stuff i use is very much tablet-centric. You may find a useful bit or two in there.

for a module system, we would have to all agree on a standard, which is out of scope for ags
if you want end4's osk, you need to dig into the code and make it happen yourself