GSConnect / gnome-shell-extension-gsconnect

KDE Connect implementation for GNOME
GNU General Public License v2.0
3.2k stars 259 forks source link

Can't assign any keys to shortcuts #1215

Open MagnusLupus opened 2 years ago

MagnusLupus commented 2 years ago

Describe the bug

When I try to assign a shortcut key to any actions (i.e. Clipboard pull) the app says "key combination here is already being used." and selected keys don't get assigned.

Steps To Reproduce:

  1. Go to 'Keyboard Shortcuts'
  2. Click on 'any action'
  3. Pick a key combination
  4. See error

Expected behavior

I expected the application to assign a key combination for an action.

Screenshots

Screenshot from 2021-12-02 12-43-59

Support Log

Please generate a support log (Instructions) and paste any messages related to this issue between the two ``` lines below.


GSConnect: 48 (system)
GJS:       17000
Session:   x11
OS:        Manjaro Linux
--------------------------------------------------------------------------------
-- Journal begins at Wed 2021-12-01 19:59:07 EET, ends at Thu 2021-12-02 12:46:45 EET. --
dets  02 12:46:00 touchegg.desktop[107344]: Error connecting to Touchégg daemon: Could not connect: Connection refused
dets  02 12:46:00 touchegg.desktop[107344]: Reconnecting in 5 seconds...
dets  02 12:46:04 gnome-shell[107022]: Can't update stage views actor <unnamed>[<MetaWindowGroup>:0x55e6e5184350] is on because it needs an allocation.
dets  02 12:46:04 gnome-shell[107022]: Can't update stage views actor <unnamed>[<MetaWindowActorX11>:0x55e6e7092b50] is on because it needs an allocation.
dets  02 12:46:04 gnome-shell[107022]: Can't update stage views actor <unnamed>[<MetaSurfaceActorX11>:0x55e6e7094a20] is on because it needs an allocation.
dets  02 12:46:05 touchegg.desktop[107344]: Error connecting to Touchégg daemon: Could not connect: Connection refused
dets  02 12:46:05 touchegg.desktop[107344]: Reconnecting in 5 seconds...
dets  02 12:46:06 /usr/lib/gdm-x-session[106953]: (EE) client bug: timer event22 debounce short: scheduled expiry is in the past (-12ms), your system is too slow
dets  02 12:46:10 touchegg.desktop[107344]: Error connecting to Touchégg daemon: Could not connect: Connection refused
dets  02 12:46:10 touchegg.desktop[107344]: Reconnecting in 5 seconds...
dets  02 12:46:15 touchegg.desktop[107344]: Error connecting to Touchégg daemon: Could not connect: Connection refused
dets  02 12:46:15 touchegg.desktop[107344]: Reconnecting in 5 seconds...
dets  02 12:46:20 touchegg.desktop[107344]: Error connecting to Touchégg daemon: Could not connect: Connection refused
dets  02 12:46:20 touchegg.desktop[107344]: Reconnecting in 5 seconds...
dets  02 12:46:25 touchegg.desktop[107344]: Error connecting to Touchégg daemon: Could not connect: Connection refused
dets  02 12:46:25 touchegg.desktop[107344]: Reconnecting in 5 seconds...
dets  02 12:46:28 /usr/lib/gdm-x-session[106953]: (EE) client bug: timer event22 debounce short: scheduled expiry is in the past (-11ms), your system is too slow
dets  02 12:46:30 touchegg.desktop[107344]: Error connecting to Touchégg daemon: Could not connect: Connection refused
dets  02 12:46:30 touchegg.desktop[107344]: Reconnecting in 5 seconds...
dets  02 12:46:32 /usr/lib/gdm-x-session[106953]: (EE) client bug: timer event22 debounce: scheduled expiry is in the past (-11ms), your system is too slow
dets  02 12:46:32 /usr/lib/gdm-x-session[106953]: (EE) client bug: timer event22 debounce short: scheduled expiry is in the past (-24ms), your system is too slow
dets  02 12:46:35 touchegg.desktop[107344]: Error connecting to Touchégg daemon: Could not connect: Connection refused
dets  02 12:46:35 touchegg.desktop[107344]: Reconnecting in 5 seconds...
dets  02 12:46:39 gjs[108182]: JS ERROR: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: GrabAccelerator is not allowed
                               checkAccelerator/action</<@/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/keybindings.js:226:42
                               @/usr/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/gsconnect-preferences:114:21
dets  02 12:46:39 gjs[108182]: gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
dets  02 12:46:39 gjs[108182]: gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
dets  02 12:46:39 gjs[108182]: gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
dets  02 12:46:39 gjs[108182]: gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
dets  02 12:46:40 touchegg.desktop[107344]: Error connecting to Touchégg daemon: Could not connect: Connection refused
dets  02 12:46:40 touchegg.desktop[107344]: Reconnecting in 5 seconds...
dets  02 12:46:45 touchegg.desktop[107344]: Error connecting to Touchégg daemon: Could not connect: Connection refused
dets  02 12:46:45 touchegg.desktop[107344]: Reconnecting in 5 seconds...

System Details (please complete the following information):

GSConnect environment (if applicable):

Additional Notes:

I made sure that the key combination I tried wasn't used by anything else. In addition to that, I tried something bizzare like Ctrl+Shift+Super+Alt+C and it still complained about it being used. I saw similar issue reported back in 2019 and it was supposedly fixed here https://github.com/GSConnect/gnome-shell-extension-gsconnect/commit/de44f417ce78e4f77457ef8565f71df2afff87af

andyholmes commented 2 years ago

Thanks for reporting with thorough logs!

This is probably caused by GNOME Shell locking down external access to its DBus interface. There's probably not a good way to work around this, other than to export another DBus interface from the Shell extension and restrict access to the org.gnome.Shell.Extensions.GSconnect.Preferences name-owner, similar to what is done for the clipboard proxy we export.

MagnusLupus commented 2 years ago

Thanks for replying! Can I provide any other useful information? I am not a programmer though, so my knowledge here is limited.

andyholmes commented 2 years ago

Thanks for replying! Can I provide any other useful information?

Nope, your report describes the problem perfectly! This is just new change in GNOME Shell that will have to be worked around.

axelsimon commented 2 years ago

Sorry to be that person, but any progress on this? As far as i know, clipboard pull and push are impossible to use, right now, because there is no way to assign them a keyboard shortcut.

Also, for what it's worth, i'd set up the shortcuts on my previous laptop, probably around Fedora 32, and the shortcuts were working fine update after update, up to Fedora 35. On this new laptop's fresh install of F35, shortcuts can't be set up, as described in this issue. So it seems that if one could set up the right config, somewhere in GNOME, it could still work.

andyholmes commented 2 years ago

There's been no progress. GSConnect is effectively a community-driven project now, so this will probably rely on someone coming forward to contribute a fix.

PrajwalS1234 commented 2 years ago

I think if we know the command associated with these operations we can easily create our own shortcuts, is there a way to get the commands which are associated with these operations?

andyholmes commented 2 years ago

Not really without peeking through the source code. The available actions are just all the GActions that don't take parameters, if I remember right. If you want to just ignore the check, you can change this line:

https://github.com/GSConnect/gnome-shell-extension-gsconnect/blob/281a9c9c4cf156374bf651f0956ecfc04ba08771/src/preferences/keybindings.js#L146

to

const available = true;

I make no guarantees you won't shoot yourself in the foot, though.

axelsimon commented 2 years ago

Thanks a lot for the pointer, disabling that check in ~/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/preferences/keybindings.js works too.

But weirdly, disabling the check i was able to set clipboard push / paste and clipboard pull / copy shortcuts up, but only the paste one works. :thinking:

AdamPS commented 1 year ago

Great thanks, the workaround in keybindings.js works well for me. You only need it in place to set the keys - you can use existing keys without needing the workaround.

AdamPS commented 1 year ago

Gradually more and more users will be running on GNOME versions where this bug exists - so the keyboard shortcuts are confusingly not useable.

Please would you at least consider a workaround something like this? Check if the GNOME shell version is >= the one where this problem was introduced. If so, disable the check for keys already existing.

andyholmes commented 1 year ago

GSConnect is a community-driven project now, so if you want something changed or added you need open a pull request with those changes. The maintainers are really only here to act as custodians for the project.

AdamPS commented 1 year ago

Sure I understand. Do you think it's a good idea, would you accept such a pull request?

andyholmes commented 1 year ago

It's possible to overwrite other keyboard shortcuts if you skip the check. So I would say there should probably just be a label added to the keyboard editor warning about that.

Ideally the whole verification would be rewritten, but they're just keyboard shortcuts :man_shrugging:. So I'd accept a PR that disabled the check, as long as there's a little label somewhere letting the user know.

AdamPS commented 1 year ago

Great thanks. I don't have Gnome dev knowledge myself, however hopefully someone else might step in - it should be a much simpler fix than the "ideal" one.

ferdnyc commented 1 year ago

Pinning this, as it keeps getting re-reported.

Nakamerica commented 1 year ago

Hello,

for the time being, is there any way at all to push the computer clipboard to the phone?

andyholmes commented 1 year ago

You can either enable auto-push in settings, or use the clipboardPush GAction. There is no user documentation in GSConnect for using GActions though.

gerardbosch commented 1 year ago

You can either enable auto-push in settings, or use the clipboardPush GAction. There is no user documentation in GSConnect for using GActions though.

Hi @andyholmes, do you know if it is possible to run that GAction somehow, straight from command-line or script? We could use external other hotkey apps to push/pull from clipboard. I did a quick Google search and couldn't find anything obvious.

I personally don't like to enable full clipboard sync between laptop and phone, and would like to share it on demand using a shortcut, a button or any manual means.

Thanks!

gerardbosch commented 1 year ago

💡 Simple Workaround below: Just update the settings in dconf.

Sorry, forgot the above message, I realized that it's much simpler to change the line you pointed here to temporary disable it, assign the shortcut, and revert.

For anyone interested, it's also possible to do it without changing the code, if not wrong, the only you need to do is to use dconf-editor to save the preferences of the shortcut.

Something like this will work for the clipboard push and pull (dconf-editor screenshot):

image

You will find this registry under the following key (or can use the search to look for gsconnect):

/org/gnome/shell/extensions/gsconnect/device/<YOUR INSTANCE ID>/

Neither to say that this is a workaround. I suppose that adding a user warning tag on the window as @andyholmes suggested would be easy for someone that knows Gnome development. Just check the version, bypass the check if necessary and warn the user with a small text.

andyholmes commented 1 year ago

It doesn't look like clipboard push/pull were ever added to the CLI options, but I'd accept a PR for that if someone's interested.

gerardbosch commented 1 year ago

Hi @andyholmes, is it possible or easy to add the "Pull clipboard" and "Push clipboard" buttons/options in the menu?

It would be at least a neat way to deal with clipboard without relaying on shortcuts. I found strange that those buttons are not already present, maybe there's a reason. Thanks!

image

andyholmes commented 1 year ago

Sure, issue #1167 has been looking for a volunteer for a while :slightly_smiling_face: There are a few hints to get someone started on it, I'm sure that code hasn't changed much since then.

gerardbosch commented 1 year ago

I tried to add it for myself the other day before seeing the #1167 but I couldn't understand how it works (I have no experience in Gnome extensions development).

But I'm wondering if Gnome Shell 45 that will introduce/enforce ESM for extensions will break everything and what will be the cost to adapt it. I recently discovered this extension and I found it terrible useful - wouldn't like it became abandoned. I think Gnome 45 is gonna be rolled out soon for many distros, including Ubuntu.

Here is he issue for any one interested: https://github.com/GSConnect/gnome-shell-extension-gsconnect/issues/1665

andyholmes commented 1 year ago

GNOME Shell will indeed require all extensions to port to ESModules. Whether GSConnect is/will be abandoned is up to the community, as it has been a community-driven project for the last three years :shrug:

gerardbosch commented 1 year ago

GNOME Shell will indeed require all extensions to port to ESModules. Whether GSConnect is/will be abandoned is up to the community, as it has been a community-driven project for the last three years 🤷

How deep and complex is to port it to ESM? I'm not JS dev 😅.

I have the impression that Gnome plugin system is very fragile as it breaks frequently. Isn't it? Thanks anyway!!

andyholmes commented 1 year ago

There's a porting guide, if you want to give a shot: Port Extensions to GNOME Shell 45

nromn commented 1 year ago

💡 Simple Workaround below: Just update the settings in dconf.

Sorry, forgot the above message, I realized that it's much simpler to change the line you pointed here to temporary disable it, assign the shortcut, and revert.

For anyone interested, it's also possible to do it without changing the code, if not wrong, the only you need to do is to use dconf-editor to save the preferences of the shortcut.

Something like this will work for the clipboard push and pull (dconf-editor screenshot):

image

You will find this registry under the following key (or can use the search to look for gsconnect):

/org/gnome/shell/extensions/gsconnect/device/<YOUR INSTANCE ID>/

Neither to say that this is a workaround. I suppose that adding a user warning tag on the window as @andyholmes suggested would be easy for someone that knows Gnome development. Just check the version, bypass the check if necessary and warn the user with a small text.

Any idea on how to use this to set a shortcut for remote input? I tried to use this solution but it doesn't work for this.

ankit-at-quickreply commented 1 month ago

💡 Simple Workaround below: Just update the settings in dconf.

Sorry, forgot the above message, I realized that it's much simpler to change the line you pointed here to temporary disable it, assign the shortcut, and revert.

For anyone interested, it's also possible to do it without changing the code, if not wrong, the only you need to do is to use dconf-editor to save the preferences of the shortcut.

Something like this will work for the clipboard push and pull (dconf-editor screenshot):

image

You will find this registry under the following key (or can use the search to look for gsconnect):

/org/gnome/shell/extensions/gsconnect/device/<YOUR INSTANCE ID>/

Neither to say that this is a workaround. I suppose that adding a user warning tag on the window as @andyholmes suggested would be easy for someone that knows Gnome development. Just check the version, bypass the check if necessary and warn the user with a small text.

This works for now (I think this is the best workaround), but can't seem to pull the clipboard

gerardbosch commented 1 month ago

This works for now (I think this is the best workaround), but can't seem to pull the clipboard

I've just checked, and it still works for me. Do you mean that clipboard pull fails, but push works? For me, it works on both directions.