Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard shortcuts working intermittently #76

Open
bjohas opened this issue Jan 27, 2018 · 18 comments
Open

Keyboard shortcuts working intermittently #76

bjohas opened this issue Jan 27, 2018 · 18 comments

Comments

@bjohas
Copy link
Contributor

bjohas commented Jan 27, 2018

This is a strange issue, where keyboard shortcuts set with Zutilo stop working (unsure why). However, if I then use a Zotero keyboard shortcut, the Zutilo keyboard shortcuts work again. Any ideas why? (Latest version Zotero/Zutllo, Mac OS 10.11)

@wshanks
Copy link
Owner

wshanks commented Jan 27, 2018

No...that is a tough one. I didn't look closely but it didn't look like the Zotero shortcut code changed significantly recently. If you can give more information, that would be good. The best would be if you could reliably reproduce the issue. Otherwise, if you could give some idea of when it happens -- like if you hit certain keys or do certain actions just before the shortcuts stop working. Are there Zotero shortcuts you use often? Maybe something about switching back and forth is problematic, like Zotero gets put in a state where it is expecting another shortcut and consumes keyboard input rather than let it propagate to Zutilo.

@wshanks
Copy link
Owner

wshanks commented Jan 27, 2018

Also, has your usage of Zotero changed recently, or is this something that you would have noticed before and so is probably the result of a recent code change?

@bjohas
Copy link
Contributor Author

bjohas commented Jan 27, 2018

I haven't used zotero very intensely for adding and managing new refs recently (where I use Zutilo most), but mainly worked with existing refs, rather than adding many new ones, so it's tricky. I'll look out for it.

@bjohas
Copy link
Contributor Author

bjohas commented Feb 9, 2018

I haven't seen this issue again, but have also (un-/re-)installed various plugins for testing. So I guess this could be closed?

@mbarton98
Copy link

I just had this issue. I had configured Copy Attachment Paths with Cmd-Opt-C and when I tried to assign Cmd-Opt-V to Paste tags, the copy no longer worked. I finally looked in Zotero's advance config settings and found these shortcuts had a strange string value, I used the reset value option to get back to default and then attempted to use Cmd-T and Cmd-U for them and that worked. I just needed some keystroke to configure a Keyboard Maestro to macro to copy the attachment path of the highlighted pdf in Zotero and create a URL in the note field of a repeating OmniFocus task to read that PDF. The macro then sets the clipboard to OFtask to paste as a tag in Zotero, so I know which ones already have tasks,

@bjohas
Copy link
Contributor Author

bjohas commented Jul 21, 2020

Hello @willsALMANJ . On Ubuntu 20.04, and Zotero 5.0.88, latest version of Zutilo, I've got a similar issue: After a while, the Zutilo keyboard shortcuts stop working. I'm at this moment not sure whether it's Zotero + Zutilo shortcuts that stop working, or just Zutilo. Just thought I'd post this, in case others have seen the same. I'll keep looking at the issue, trying to work out when it happens.

@bjohas
Copy link
Contributor Author

bjohas commented Jul 23, 2020

Hello @willsALMANJ - it's definitely the Zutlio shortcuts only. They do work after a restart, but generally stop working pretty soon. Is there anything I could do to diagnose this?

@wshanks
Copy link
Owner

wshanks commented Jul 24, 2020

If you disable and re-enable Zutilo do they come back? When you try to use them, does anything show up in the error console? Do the context menu items still appear and still function correctly? I wonder if something is getting reloaded that clears out the bindings that Zutilo has set (and if Zutilo could listen for that and reload them if so).

@bjohas
Copy link
Contributor Author

bjohas commented Jul 25, 2020

Thank you for the message!

If you disable and re-enable Zutilo do they come back?

No.

(When I restart Zotero, they do.)

When you try to use them, does anything show up in the error console?

No.

Do the context menu items still appear and still function correctly?

Yes, they always do.

Here's a strange additional observation: It appears to be keyboard shortcuts with shift that stop working. I'd always used ctrl-shift-something in line with other Zotero shortcuts, but had recently assigned some to just ctrl (in Zutilo). Those keep working (e.g. ctrl-[ and ctrl-]) when Zutilo combinations with shift stop working (e.g., ctrl-shift-\ or ctrl-shift-p). (Zotero shortcuts, i.e. with shift, do appear to keep working, even then.)

@wshanks
Copy link
Owner

wshanks commented Jul 25, 2020

Do you think the behavior just started with Zotero 5.0.88? I have had Zotero 5.0.87 open for many days and shortcuts with shift still work for me (including ctrl-shift-p). I am using the Zotero flatpak from flathub.org on Fedora 32. I will restart it now (jumping to 5.0.89) and see if they stop working.

@bjohas
Copy link
Contributor Author

bjohas commented Jul 25, 2020

I installed Zotero from the Zotero website (now auto-updated to 5.0.89). It definitely happens after Zotero is open for a while... wished I knew when exactly this happens.

@wshanks
Copy link
Owner

wshanks commented Jul 25, 2020

Most of Zotero's keyboard shortcut code is in chrome/content/zotero/zoteroPane.js and chrome/content/zotero/xpcom/zotero.js. I don't see much changing recently in the logs of those files. Since only shortcuts with ctrl+shift are affected, I wonder if something funny is happening with Zotero's shortcut handling. In zoteroPane.js, there is a function that gets called for all key presses. It should return early if the key event does not have ctrl+shift or if the key event does not match one of Zotero's mapped keys. Immediately after those two checks it does Zotero.debug('Keyboard shortcut: ' + command); so you could see if anything is getting printed to Zotero's debug logs when you try the Zutilo shortcut.

@bjohas
Copy link
Contributor Author

bjohas commented Jul 26, 2020

Thanks - So I've restarted with debug output enabled. I see all the sync/check messages (in 'debug outout', not the javascript console). However, when I then try the keyboard shortcuts (for Zutilo) I don't see any messages.

(edited) I have noticed that (on startup of) Zotero, the the Zutilo shift-keyboard shortcuts are sometimes working, but sometimes tthey are not. So it seems something intermittent may be happening during startup as well? The Zutilo non-shift-keyboard shortcuts appear to always work.

@wshanks
Copy link
Owner

wshanks commented Jul 26, 2020

So far my ctrl+shift shortcuts are still working since I updated Zotero.

What if you try setting a second function in Zutilo's preferences to the same shortcut keys as one that is not currently working? Does Zutilo detect it as a duplicate properly?

Also, try running this in Tools->Developer->Run javascript to see if the key is still set:

ks = document.getElementById("zutilo-keyset")
keys = []
for (let c of ks.children) {
  if (c.getAttribute("key")) {
    keys.push([c.id, c.getAttribute("modifiers"), c.getAttribute("key")])
  }
}
keys

That will print out all of the current mappings.

@bjohas
Copy link
Contributor Author

bjohas commented Jul 27, 2020

Zutilo detects it as a duplicate (but if I press OK, assigns it anyway). Running the js gives me the right key bindings.

However, I have some more information - and I hope that's not a 'doh' moment. The ctrl-shift shortcuts do definitely work sometimes... but I've now also noticed that the key bindings don't always work after restart of Zotero. So - Iwhile insist that they do occasionally work / have worked :) - there does seem to be a wider problem.

Now - I used shortcuts like

ctrl-shift-[ 
ctrl-shift-? 
ctrl-shift-| 
ctrl-shift-!
ctrl-shift-"  

Now, I noticed that e.g. ctrl-shift-! (entered as '1') doesn't work in Zotero either. But when I use ctrl-shift-A...Z, they do work. Same with Zutilo. If I use ctrl-shift-A...Z, they do work.

So I suppose the mystery is not why ctrl-shift doesn't work (because it does), but the mystery is now:

  1. Why does ctrl-shift-non_alpha_char not work reliably?

Or, if that's not supposed to work at all:

  1. Why does it sometimes work?

Edit: Also, the above cannot be the whole story... I've used ctrl-shift-p and ctrl-shift-m for ages (create parent/get metadata) and they do work intermittently too. However, they seems to reliably work again after Zotero restart. But maybe there are two separate issues here?

@bjohas
Copy link
Contributor Author

bjohas commented Jul 27, 2020

I've just restarted and now ctrl-shift temporarily works. I've run the js, and get

    "12": [
        "0": "zutilo-key-toggleZoteroItemPane"
        "1": "control"
        "2": "\\"
    ]
...
    "14": [
        "0": "zutilo-key-toggleZoteroItemPaneStickySplitter"
        "1": "control shift"
        "2": "|"
    ]

Both of these (currently) work... though I do wonder whether it shouldn't be "2": "\" in both cases? For the alpha-based codes, only the upper-case letter is used, irrespective of shift or not.

@wshanks
Copy link
Owner

wshanks commented Jul 28, 2020

Odd, so does control+shift+| trigger both functions? Also, do you always work with the same keyboard? Perhaps different keyboards could generate different codes for the same key sequences.

The API Zutilo uses is deprecated in the Mozilla documentation (it uses keyCode and charCode instead of key). At some point, the way Zutilo registers keyboard shortcuts probably needs to be updated. It was adapted from another Firefox extension that is over twelve years old at this point. Zutilo uses XUL to register shortcuts with Firefox. It should probably switch to a keyboard event listener like Zotero uses, as I don't think Electron has keyboard registration system equivalent to the XUL one. My hesitation with that is just that I don't know how much time it will take to get working well.

@bjohas
Copy link
Contributor Author

bjohas commented Aug 1, 2020

Odd, so does control+shift+| trigger both functions? Also, do you always work with the same keyboard? Perhaps different keyboards could generate different codes for the same key sequences.

No - I don't think so. Yes, always using the same keyboard.

However, I've just had a case where the Zotero keyboard shortcuts (which are all shifted) have stopped working, while the unshifted Zutilo ones work. So it's a wider problem, not just Zutilo!

Edit: I take that back - it's only some keyboard shortcuts that aren't working in Zotero...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants