Skip to content

Add clickable menu #1436

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

Qingwu-Li
Copy link

Hello fellow geeks,
I tring to implemented a built-in clickable menu feature,
Tested with wayland,

@Qingwu-Li Qingwu-Li marked this pull request as ready for review January 22, 2025 07:35
@Qingwu-Li Qingwu-Li force-pushed the add-clickable-menu branch 2 times, most recently from fbc180d to bbf6888 Compare January 23, 2025 02:37
@bynect
Copy link
Member

bynect commented Jan 23, 2025

hello. I like your idea and I also wanted to implement the buttons.

I tried your branch and noticed some problems with the text alignment

img-1737672610

I think the best way would be to either specify a maximum amount of buttons allowed (then dmenu is used for extra action) or to wrap the buttons to a newline. squeezing all actions in a single line is impossible when there are a lot after all

@Qingwu-Li Qingwu-Li force-pushed the add-clickable-menu branch 5 times, most recently from 3f14999 to ce35eed Compare February 8, 2025 08:52
Implement menu structure and related functions,
preparing for clickable menu feature.
Add new menus array to preserve current actions.

Signed-off-by: LI Qingwu <[email protected]>
Introduce built-in menu settings in dunstrc.
Add corresponding settings in settings.h.
Update settings_data.h with new menu-related options.
Preparing for built-in clickable menu.

Signed-off-by: LI Qingwu <[email protected]>
Add menu button drawing function.
Update layout calculations for menu height.
Integrate menu rendering into notification display.

Signed-off-by: LI Qingwu <[email protected]>
Add function to handle built-in menu clicks.
Trigger action invocation on menu button click.

Signed-off-by: LI Qingwu <[email protected]>
Add menu_free_array call in notification_invalidate_actions,
ensure proper cleanup of menu resources when invalidating actions

Signed-off-by: LI Qingwu <[email protected]>
- Revise fixed value with settings.width.max in built-in menu.
- Revise 'h_padding' parameter to align with the offical definition
ub built-in menu.

Signed-off-by: gujie <[email protected]>
Add menu related function to prepare key navigation feature.

Signed-off-by: gujie <[email protected]>
@gujie-leica
Copy link

We revised the settings parameter in the built-in menu and added support for a rounded corner menu in the built-in menu two commits ago.

@bynect
Copy link
Member

bynect commented Mar 31, 2025

I will try the new changes 👍

Introduce built-in menu keybaord settings in dunstrc.

Signed-off-by: gujie <[email protected]>
Add function to handle built-in menu key navigation.

Signed-off-by: gujie <[email protected]>
The design now utilizes an inverted display when the key is in
focus, with the first key being in focus when the menu appears.

Signed-off-by: gujie <[email protected]>
@gujie-leica
Copy link

gujie-leica commented Apr 1, 2025

Now we add key navigation inside of notification:

  • left, right, up and down arrow keys select the button (action)
  • enter key executes action
  • add “focus“ when selected, the first key is the default focus key

Tested it in Wayland, hope this makes the built-in menu more user-friendly.

@bynect
Copy link
Member

bynect commented May 5, 2025

sorry for the late reply. I found two compilation errors (one in input.c and one in wl_seat.c). They could be easily solved but you should fix them.

As for the code it mostly works but somehow the text did not line up with the button. I think the scale is not taken into account. On the other hand the input and shape draws correctly

@bynect
Copy link
Member

bynect commented May 5, 2025

Now we add key navigation inside of notification:

* left, right, up and down arrow keys select the button (action)

* enter key executes action

* add “focus“ when selected, the first key is the default focus key

Tested it in Wayland, hope this makes the built-in menu more user-friendly.

I think splitting the keyword part in a separate pr is better since this one already quite big.

@bynect
Copy link
Member

bynect commented May 5, 2025

After this change

                        cairo_move_to(c, round(text_x * scale), round(text_y * scale));

It almost works correctly, with a minor offset to the text.

img-1746477429

@gujie-leica
Copy link

I think splitting the keyword part in a separate pr is better since this one already quite big.

Thank you for your reply. Basically, the drawing and navigation parts are separate, but they share some common changes in input.c. I will update it in the coming days.

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

Successfully merging this pull request may close these issues.

3 participants