- 
                Notifications
    
You must be signed in to change notification settings  - Fork 364
 
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
base: master
Are you sure you want to change the base?
Add clickable menu #1436
Conversation
fbc180d    to
    bbf6888      
    Compare
  
    | 
           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 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  | 
    
3f14999    to
    ce35eed      
    Compare
  
    ce35eed    to
    e5fa05e      
    Compare
  
    e5fa05e    to
    595eb48      
    Compare
  
    | 
           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.  | 
    
| 
           I will try the new changes 👍  | 
    
| 
           Now we add key navigation inside of notification: 
 Tested it in Wayland, hope this makes the built-in menu more user-friendly.  | 
    
| 
           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  | 
    
          
 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.  | 
    
1dfa5ab    to
    22d7661      
    Compare
  
    | 
           
 Codecov Report❌ Patch coverage is  
 Additional details and impacted files@@            Coverage Diff             @@
##           master    #1436      +/-   ##
==========================================
- Coverage   64.90%   63.94%   -0.96%     
==========================================
  Files          51       51              
  Lines        9024     9181     +157     
  Branches     1048     1086      +38     
==========================================
+ Hits         5857     5871      +14     
- Misses       3167     3310     +143     
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
| 
           is this ready for review?  | 
    
22d7661    to
    5419199      
    Compare
  
    
          
 Yes, I think so, I just rebase to resolve conflicts. Sorry we're busy recently, didn't reponse in time.  | 
    
5419199    to
    0b58722      
    Compare
  
    Implement menu structure and related functions, preparing for clickable menu feature. Add new menus array to preserve current actions. Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
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 <Qing-wu.Li@leica-geosystems.com.cn>
Add menu button drawing function. Update layout calculations for menu height. Integrate menu rendering into notification display. Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
Add function to handle built-in menu clicks. Trigger action invocation on menu button click. Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
Add menu_free_array call in notification_invalidate_actions, ensure proper cleanup of menu resources when invalidating actions Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
- 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 <jie.gu@leica-geosystems.com.cn>
Signed-off-by: gujie <jie.gu@leica-geosystems.com.cn>
Signed-off-by: gujie <jie.gu@leica-geosystems.com.cn>
0b58722    to
    d8af273      
    Compare
  
    | 
           hello I finally tested it properly. codewise it seems ready to merge. 
  | 
    
| 
           also I think that the way the background can be improved. instead of having menu_frame_fill  | 
    
| 
           let me know what do you think @Qingwu-Li  | 
    
          
 I will have a look on it!  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some suggestions that could improve the code, avoiding issues in the future. Other than that it looks good
| if (!label) { | ||
| continue; | ||
| } | ||
| int text_width = strlen(label) * fontsize; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This calculation assumes the font is monospace. Do we know this is the case for the button font? This assumption can be avoided by first rendering the font and asking pango about the width. That would also handle unicode characters better
| 
               | 
          ||
| return NULL; | ||
| } | ||
| 
               | 
          
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now the new code in menu.c is not integrated with the old code. This could lead to confusion with other similar functions in this file. I would suggest to either
- create a separate dmenu.c for all dmenu stuff and renaming those functions to reflect the fact that there are multiple kinds of menu's
or 2. Merge some of the new functions with old ones and rename the other existing functions to avoid confusion. 
| 
           Also, could you add some tests, for example for   | 
    




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