ds-voix / xswitcher

X switcher: fully customizable low-level keyboard helper for X.Org-based linux desktop
GNU Affero General Public License v3.0
70 stars 6 forks source link

Does it work? #2

Closed horseinthesky closed 2 years ago

horseinthesky commented 2 years ago

Lenovo X1 Carbon 9gen Ubuntu 20.04.3 LTS GNOME Shell 3.36.9

+xs permission are given.

xswitcher is running with an example config from this repo

sudo /usr/local/bin/xswitcher
keyboard: Sleep Button
keyboard: sof-hda-dsp Headset Jack
keyboard: Power Button
keyboard: AT Translated Set 2 keyboard
keyboard: ThinkPad Extra Buttons
mouse: SYNA8008:00 06CB:CE58 Mouse
mouse: TPPS/2 Elan TrackPoint
keyboard: Intel HID events
mouse: SYNA8008:00 06CB:CE58 Touchpad
= telegram-desktop
= yandex-browser-beta
= telegram-desktop
= kitty
= yandex-browser-beta
= telegram-desktop
= yandex-browser-beta
= telegram-desktop
= yandex-browser-beta
= kitty
= telegram-desktop
= kitty
= telegram-desktop
= yandex-browser-beta
= kitty

but pressing Fn+B (break on Lenovo laptops) or F12 (I don;t know if this should work but config mentions F12 since you have Lenovo laptop also) just do nothing.

ds-voix commented 2 years ago

You must use "gnome hack" from https://github.com/ds-voix/xswitcher/tree/main/gnome3 Put "switch.gnome" under "/usr/local/bin/" (and make it executable) and place "xswitcher.conf" to "/etc/xswitcher/xswitcher.conf". Then restart xswitcher.

horseinthesky commented 2 years ago

@ds-voix Ok, so I have

.rwxr-xr-x   733 root 31 Jan 14:26   /usr/local/bin/switch.gnome

Then I've built this guy

.rwxr-xr-x   27k root 31 Jan 14:31   /usr/local/bin/g3kb-switch

It doens't seem to change anything.

Btw these executables seem to have some issues by themselves

sudo /usr/local/bin/switch.gnome 
Failed to build keyboard layouts map: The connection is closed
Failed to build keyboard layouts map: The connection is closed

and

sudo /usr/local/bin/g3kb-switch 
Failed to build keyboard layouts map: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.Shell was not provided by any .service files
ds-voix commented 2 years ago

The error "The name org.gnome.Shell was not provided by any .service files" points to something wrong inside your gnome. Try https://askubuntu.com/questions/1357359/gnome-software-sorry-something-went-wrong-the-name-xxx-was-not-provided-by-an

It also could be something like "non-gnome over gnome" https://github.com/lyokha/vim-xkbswitch/issues/39 But, according to "GNOME Shell 3.36.9" it's not your case.

** Note that sudo is the bad idea to call "g3kb-switch". You switches the current user language, not "root", understand? Just run /usr/local/bin/g3kb-switch -p to test at this level.

Then, my script "switch.gnome" is only the wrapper around this "g3kb-switch". And it must be fixed in case the current user has id≠1000, or the language pair differs from "en-ru" and so on.

And the last one. I'd already forgot that "xswitcher.conf" must be slightly fixed before usage. Look for UID = "user_name" pairs. Of course, "user_name" must be replaced with Your real user name.

horseinthesky commented 2 years ago

** Note that sudo is the bad idea to call "g3kb-switch". You switches the current user language, not "root", understand?

Got it.

g3kb-switch works perfectly fine without sudo.

/usr/local/bin/g3kb-switch -l
us
ru

And finally changing user_name to my user name in xswticher.conf made it work. Thank you.

Want to clarify a new move moments: 1) If it is possible to select the whole sentance typed with wrong layout and retype it in the right layout with a single button? I really miss this feature of punto? 2) Are you still using this tool yourself? I am asking because it's quite complex just to set it up and configure without being you actually =) 3) Is it possible to simplify it? I mean we have to get xswticher itself, switch.gnome and g3kb-switch which in turn we need to build from souce. And I haven't tried to run it with systemd which is deffinitely should be run with. 4) Are there better tools doing the same? I just couldn't find any.

ds-voix commented 2 years ago
  1. Use extra scripts, such as https://forum.ubuntu.ru/index.php?topic=271377.0 together with xswitcher "Exec" actions (of course, You can use Your OS hotkeys). ** Note that there's no common way to "change selected" in linux (in windows, too). Most of time I work with terminals, this feature is not in demand for me. But I left the way to change the behaviour depending on "WindowClasses".

  2. Someone can now write user-friendly GUI and so on. I only did the key component. Any help is welcome.

  3. Yes, the project needs maintainers. I always try to help, but just have no time for promotion.

  4. Sorry, "metoo". https://habr.com/ru/post/495748/ My regular job is far from GUI tools. But I felt the need in such a tool and just did it. ** I use KDE in all my desk/lap-tops. KDE has no need in crutches.

horseinthesky commented 2 years ago

https://habr.com/ru/post/495748/ is exactly the place I found out about your tool =)

I mostly use Windows with WSL but had to move to plain Linux on my working laptop so missing things T_T I don't know much of a Go for now but I'll try to understand what is happening underneeth. Thank you for work and time.