Skip to content

Conversation

@devdinc
Copy link
Contributor

@devdinc devdinc commented Nov 18, 2025

Added the ability to hold your mouse click button to open glance.

Don't know whether this is finished or not, so will do a draft PR.
activation ms threshold can be a preference, etc.

Also since we detect movement, it should fix the issue related to Alt + Hold Click to select links.

devdinc and others added 5 commits November 18, 2025 15:42
* Update ZenGlanceChild.sys.mjs

* Update ZenActorsManager.sys.mjs

* Update zenLooksAndFeel.inc.xhtml

* Update zen-preferences.ftl
performance.now is lightweight so this method is fine, using XOR is kinda wrong I think considering odd numbers pass, and some default shortcuts use 3 modifier keys (god knows who uses them but they exist, even if they are weird e.g open linkedIn in default browser)

moveThreshold not being squared(not checking diagonals properly) should be fine since its not that much of an importance, the default value 8px is small anyways. 

Signed-off-by: devdinc <[email protected]>
@devdinc devdinc marked this pull request as ready for review November 19, 2025 07:54
@devdinc devdinc requested a review from mr-cheffy as a code owner November 19, 2025 07:54
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. Feature labels Nov 19, 2025
#ensureOnlyOneModifierKeyIsPressed(event) {
return (
[event.ctrlKey, event.altKey, event.shiftKey, event.metaKey].filter(Boolean).length === 1
);
Copy link
Contributor

@garrza garrza Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can make this ensureOnlyOneModifierKeyIsPressed faster and lighter by avoiding the array allocation and filter.

Since JavaScript coerces booleans to numbers during addition, we can just sum them up such as:

#ensureOnlyOneModifierKeyIsPressed(event) { return (event.ctrlKey + event.altKey + event.shiftKey + event.metaKey) === 1; }

This would be more lightweight for a high-frequency usage event handler. Nothing goes to the heap and nothing would need to be garbage collected.

@mr-cheffy
Copy link
Member

Could you please show me a video on how it should look?

@devdinc
Copy link
Contributor Author

devdinc commented Nov 19, 2025

Could you please show me a video on how it should look?

There is no visual changes or an indicator. When mouse up is done after 300ms it opens glance. If you are wondering whether the code works, I have not really tested the code except some POC version that I posted into web console that logs the duration and the element.

We can consider adding visual indicator, some circular slider like thing maybe? To cancel the visual indicator, we can create a message endpoint in parent. Adding an attribute on the top element is risky as before and after might be already used, so we need to create an element probably like a popup that has the same proportions and edit that using css.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants