Skip to content

Conversation

@postsolar
Copy link
Contributor

@postsolar postsolar commented Nov 21, 2025

… for all modules

  • Add double-click support for all modules via CommonConfig
  • Add TrayClickAction enum with built-in and custom command support
  • Support placeholders in custom commands: {name}, {title}, {icon}, {address}
  • Add reusable connect_pressed_with_double_click() to IronbarGtkExt
  • Update documentation for new click action configuration
  • Full backward compatibility

Closes #1242

🤖 Generated with Claude Code

@postsolar postsolar force-pushed the feat/double-clicks-and-tray-actions branch from 19a68e7 to f1a334f Compare November 21, 2025 19:47
@postsolar
Copy link
Contributor Author

For tray I think ideal would be per-item configuration like

[tray.items.nm-applet]
on_click_left = "do something"

[tray.items.telegram-desktop]
on_click_right = "do something else"

but too complicated + YAGNI.

@postsolar
Copy link
Contributor Author

There is one limitation currently, for tray there's some GTK spam about some CSS errors when opening certain items' menus now (e.g. nm-applet, but not copyq) - IDK what this is and what to do about it, but it's harmless, doesn't seem to be impacting anything.

Copy link
Owner

@JakeStanger JakeStanger left a comment

Choose a reason for hiding this comment

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

Thanks for this, this looks good. A few minor things on first pass.

Are you able to split into two commits please? One for the tray features, and one for the global double-click features.

@postsolar postsolar force-pushed the feat/double-clicks-and-tray-actions branch 3 times, most recently from 3ed7db1 to c5d6d4f Compare November 23, 2025 22:09
@postsolar
Copy link
Contributor Author

@JakeStanger all feedback addressed. For configuring gtk-double-click-time I wasn't able to do it with ~/.config/gtk-4.0/settings.ini (maybe it's issues with my setup, IDK), but I was able to confirm it works via GTK Inspector (I set it there and Ironbar behavior was reflecting this).

I chose to keep the default to be 250ms. I think 200ms is too aggressive, I personally struggle with this 😆

@JakeStanger
Copy link
Owner

I'm wondering if it might be better to run the single-click action always, which'd avoid the delay. It would potentially be more limited, but it would be more inline with standard double-click behaviour in other applications.

@postsolar
Copy link
Contributor Author

I think it only works for situations where single-click action is some sort of a light toggle, e.g. opening a menu or a popup, where the second click would just cancel it out and trigger the right action. For anything else I think it would basically render it unusable. My personal use cases are covered either way (I only do "toggles" for now), but it would feel quite weird to have it "broken" by the virtue of always performing single click.

As for other software, I could only think of file managers where double clicks exist at all (open vs select, rename vs select, and in Nemo go a directory up vs unselect). In these cases, the semantics of actions always allow for this, and they don't expose any sort of configuration to this. Could you remind me of other examples?

I also don't really notice any delay with 250ms click interval, feels instant to me.

I wouldn't mind making it optional though. OTOH this could be an unnecessary complexity dump onto people casually reading the config guide — might be moved into something like wiki/Advanced Configuration.md.

@postsolar
Copy link
Contributor Author

From kitty docs (which offers freely configurable double/triple clicks):

Note that the click and double click events have a delay of click_interval to disambiguate from double and triple presses

So they just accept the delay. You prolly already got it from the code, but just in case note that in our implementation, if user only configured single clicks, and no double clicks, then single clicks happen instantly, there's no delay if we're not even waiting for a successive click.

@JakeStanger
Copy link
Owner

Sorry for the delay - I think going based on Kitty behaviour makes the most sense, since it's the most applicable/similar scenario.

Copy link
Owner

@JakeStanger JakeStanger left a comment

Choose a reason for hiding this comment

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

Two minor bits then we're good to go

Comment on lines 527 to 513
Keyword(DoubleClickTimeKeyword),
}

#[derive(Debug, Clone, Deserialize)]
#[cfg_attr(feature = "extras", derive(schemars::JsonSchema))]
#[serde(rename_all = "lowercase")]
pub enum DoubleClickTimeKeyword {
Gtk,
}
Copy link
Owner

Choose a reason for hiding this comment

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

There is no need to introduce an additional enum here - we can just create a Gtk variant directly.

Suggested change
Keyword(DoubleClickTimeKeyword),
}
#[derive(Debug, Clone, Deserialize)]
#[cfg_attr(feature = "extras", derive(schemars::JsonSchema))]
#[serde(rename_all = "lowercase")]
pub enum DoubleClickTimeKeyword {
Gtk,
}
Gtk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it could work without a custom deserializer (which is a lot of new code). This specifically leads to config parsing failing when the value is set to "gtk", only works with null. Is there something I missed, or should I just keep it the current way?

Copy link
Owner

Choose a reason for hiding this comment

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

Try including untagged in the enum serde attr

@JakeStanger JakeStanger added the Z:Changes Requested Pull request awaiting changes from author label Dec 6, 2025
@postsolar
Copy link
Contributor Author

fe99eaf is unrelated in terms of scope of the PR, but needed to pass clippy. Let me know if I should revert it 👍

postsolar and others added 10 commits December 7, 2025 12:45
- Add double-click support via CommonConfig
- Add on_click_left_double, on_click_middle_double, on_click_right_double events
- Add reusable connect_pressed_with_double_click() to IronbarGtkExt
- Update documentation for double-click configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add TrayClickAction enum with built-in and custom command support
- Support placeholders in custom commands: {name}, {title}, {icon}, {address}
- Update tray documentation for new click action configuration

Closes JakeStanger#1242

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Remove verbose prefixes from tray click actions:
- open_menu -> menu
- trigger_default -> default
- trigger_secondary -> secondary

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Create TrayClickHandlers struct with flattened serde
- Simplify function signatures (removed clippy allow)
- Reduce parameter passing throughout codebase

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Replace manual Deserialize implementation with derived version using
nested enum pattern (similar to ScriptInput):
- Create ReservedTrayAction enum with snake_case variants
- Use #[serde(untagged)] on TrayClickAction
- Serde tries Reserved first, falls back to Custom(String)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add make_handler helper to eliminate repetitive closure setup
- Add is_actionable() method to replace verbose None checks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add on_click_right_double and on_click_middle_double to match
other modules and provide consistent double-click support across
all mouse buttons.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Adds a top-level `double_click_time` configuration option that allows
customizing the double-click detection timeout. This improves
accessibility for users who need more time between clicks.

Configuration accepts either:
- A number in milliseconds (e.g., `200`, `5000`)
- The string `"gtk"` to use GTK's gtk-double-click-time setting

Defaults to 250ms (faster than GTK's 400ms default).

When using a custom millisecond value, the implementation also updates
GTK's internal gtk-double-click-time setting to ensure GestureClick's
n_press detection matches the configured timeout. This synchronization
is done lazily on first use to avoid GTK initialization issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Replace standalone default_double_click_time() function with Default trait implementation. Also derive Default for Config struct to simplify the implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Create IconConfig struct to group icon_theme, icon_size, and prefer_theme parameters together. This reduces the on_update function parameter count from 8 to 6, fixing the clippy::too_many_arguments warning.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@JakeStanger JakeStanger force-pushed the feat/double-clicks-and-tray-actions branch from fe99eaf to 69e4473 Compare December 7, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Z:Changes Requested Pull request awaiting changes from author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: Optional pre-GTK4 port behavior on clicking tray icons

2 participants