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 8 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
@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 👍

@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.

@gujie-leica gujie-leica force-pushed the add-clickable-menu branch 2 times, most recently from ff8f89c to 1dfa5ab Compare May 20, 2025 09:30
Qingwu-Li and others added 8 commits May 20, 2025 17:45
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]>
@gujie-leica gujie-leica force-pushed the add-clickable-menu branch from 1dfa5ab to 22d7661 Compare May 20, 2025 09:46
@codecov-commenter
Copy link

codecov-commenter commented May 20, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 10.97561% with 146 lines in your changes missing coverage. Please review.

Project coverage is 63.96%. Comparing base (896f788) to head (22d7661).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
src/draw.c 13.86% 87 Missing ⚠️
src/menu.c 6.25% 45 Missing ⚠️
src/input.c 0.00% 14 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1436      +/-   ##
==========================================
- Coverage   64.91%   63.96%   -0.96%     
==========================================
  Files          51       51              
  Lines        9022     9179     +157     
  Branches     1048     1078      +30     
==========================================
+ Hits         5857     5871      +14     
- Misses       3165     3308     +143     
Flag Coverage Δ
unittests 63.96% <10.97%> (-0.96%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bynect
Copy link
Member

bynect commented Jun 24, 2025

is this ready for review?

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.

4 participants