Dominic-DallOsto / zotero-reading-list

Keep track of whether you've read items in Zotero
GNU General Public License v3.0
239 stars 6 forks source link

Shortcuts on macOS? #9

Closed Derekmini closed 2 months ago

Derekmini commented 1 year ago

Hello, may I ask if shortcut keys can be used on macOS?

I tried using Command+Num, Option+Num, Ctrl+Num but there was no response.

Dominic-DallOsto commented 1 year ago

I had a quick look and the Option key should work. Does this code snippet work for you?

Derekmini commented 1 year ago

I press Option + N to obtain the desired result as:

I pressed Option + Num again in Zotero, but it only highlighted the collection of items instead of setting the reading status.

Dominic-DallOsto commented 1 year ago

That's interesting - it seems like an existing shortcut is taking precedence and stopping us from detecting the shortcut.

I checked here (https://www.zotero.org/support/kb/keyboard_shortcuts) but didn't see this combination - only that Option+Num should change the annotation tool in the PDF Reader. Is it possible another addon is implementing the shortcut to highlight a collection when you press Option+Num?

On 9/05/2023 11:17 am, Derek wrote:

I press |Option + N| to obtain the desired result as:

https://camo.githubusercontent.com/add6a6ea39dea7174206a478a22444eb33c3bda4c8c97a38d56aefa5e688b244/68747470733a2f2f6f73732d636e2d6265696a696e672d646572656b2e6f73732d636e2d6265696a696e672e616c6979756e63732e636f6d2f696d672f3230323330353039313431323636392e706e67

I pressed |Option + Num| again in Zotero, but it only highlighted the collection of items instead of setting the reading status.

— Reply to this email directly, view it on GitHub https://github.com/Dominic-DallOsto/zotero-reading-list/issues/9#issuecomment-1539494408, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM5S3FGCLYGT6FYYEVY323XFIDRXANCNFSM6AAAAAAXVRJWYA. You are receiving this because you commented.Message ID: @.***>

Derekmini commented 1 year ago

I have disabled all addons except for reading-list, and checked if other background software is using this keyboard shortcut combination. However, I still cannot add Read Status by pressing Option+Num.

I feel that my previous description was unclear. Actually, it is the Option key that triggers the highlight. Pressing the Num key interrupts the continuous highlight. Here is a recording demonstrating this situation:

itsmevictor commented 1 year ago

Same problem here. Thank you for the add-on though! It's great. It'd be even better once the shortcuts work :)

Dominic-DallOsto commented 7 months ago

Thanks for the patience!

Are you able to test the latest version for Zotero 7 (#17) - does the issue still occur?

itsmevictor commented 7 months ago

@Dominic-DallOsto I have not yet switched to Zotero 7 as I am waiting for all the add-ons I'm using to be working on the new version, but I will let you know as soon as I have made the switch!

jamy3531 commented 5 months ago

Thanks for the patience!

Are you able to test the latest version for Zotero 7 (#17) - does the issue still occur?

This problem still occurs. I'm now using the latest version Zotero 7 and the latest plugin.

Dominic-DallOsto commented 5 months ago

Can you open the Error Console in Zotero (Tools > Developer > Error Console), paste the following code and see if you can get the key presses when using Option+Num

window.addEventListener('keydown', function(e) {
  if (["0","1","2","3","4","5","6","7","8","9"].includes(e.key))
     console.log(`key: ${e.key}, alt: ${e.altKey}, ctrl: ${e.ctrlKey}, shift: ${e.shiftKey}`);
}); 
adamslc commented 2 months ago

Hi there, sorry for the duplicate issue. I wasn't able to get that code to work in Zotero, but I was able to use the Firefox dev console. I modified the code to not restrict to only number keys. I held Alt, and then pressed 1 through 0, and got the following results:

key: Alt, alt: true, ctrl: false, shift: false
key: ¡, alt: true, ctrl: false, shift: false
key: ™, alt: true, ctrl: false, shift: false
key: £, alt: true, ctrl: false, shift: false
key: ¢, alt: true, ctrl: false, shift: false
key: ∞, alt: true, ctrl: false, shift: false
key: §, alt: true, ctrl: false, shift: false
key: ¶, alt: true, ctrl: false, shift: false
key: •, alt: true, ctrl: false, shift: false
key: ª, alt: true, ctrl: false, shift: false 
key: º, alt: true, ctrl: false, shift: false

It looks like the issue is that MacOS is doing a transformation of the key before it is received by the application. Would it be possible to make the keyboard shortcuts configurable?

Dominic-DallOsto commented 2 months ago

I found a similar issue here which states that pressing Opt + key on Mac also modifies the keycode instead of returning the original keycode.

github-actions[bot] commented 2 months ago

:rocket: This ticket has been resolved in v1.3.2. See Release 1.3.2 for release notes.

Dominic-DallOsto commented 2 months ago

This has been fixed in v1.3.2 of this plugin, but the fix seems a bit "fragile" / like it might be keyboard / language dependent.

Please let me know if you have any issues in your configuration.

github-actions[bot] commented 2 days ago

:rocket: This ticket has been resolved in v1.5.1. See Release 1.5.1 for release notes.