dunst icon indicating copy to clipboard operation
dunst copied to clipboard

feat: add mouse scroll action scripting to notificaiton

Open leyuskckiran1510 opened this issue 5 months ago • 5 comments

Adds mouse scroll action scripting to the notification,

how to use it

  • add mouse action mouse_scroll_forward = forward_script as and mouse_scroll_backward = back_script [optional as it's by default]
  • now add your costume rule to trigger for notification in your dunstrc;
# a example 
[volume]
    sumamry = "changevolume"
    script_mouse_forward = change_vup
    script_mouse_back = change_vdown

[note:- script_mouse_forward/back takes single word script to run, you cannot put long script their, make a file of the script you want to execute, and give it a simple single word name and add that to path, do not forget to add executable flag chmod +x my_script ]

  • now you can do something like dunstify "changevolume" "volume=10%"
  • now if you hover to that notification and scroll with mouse wheel, your script should be triggred

why we need this

  • this allows us to control linear actions, through our mouse wheel, instead of just clicking on mouse.
  • this opens ups the possibility of triggering actions, when needed, for example if you have a setup which warns if volume it to high. You can just use mouse wheel to change the volume.

TODOS:

  • if this concept is liked my many, we can also add feature like script_mouse_click1/2/3
  • so that we can execute different set of scripts for different mouse action

Closes #1490

leyuskckiran1510 avatar Jun 21 '25 12:06 leyuskckiran1510

demo video

https://github.com/user-attachments/assets/ed40c696-0056-45da-8dca-0523741c5e04

leyuskckiran1510 avatar Jun 21 '25 13:06 leyuskckiran1510

hello. thank you for the contribution. I like the idea however there are some things we might improve. I am busy right now so I will just leave some initial review. also please fix the errors

bynect avatar Jun 22 '25 16:06 bynect

hello. thank you for the contribution. I like the idea however there are some things we might improve. I am busy right now so I will just leave some initial review. also please fix the errors

about the error, their seems to be memory leak issue in my code, will fix those issues to, thank you

leyuskckiran1510 avatar Jun 23 '25 07:06 leyuskckiran1510

hello. thank you for the contribution. I like the idea however there are some things we might improve. I am busy right now so I will just leave some initial review. also please fix the errors

about the error, their seems to be memory leak issue in my code, will fix those issues to, thank you

i am working on, it will update when I am done, rn now busy with other stuffs

leyuskckiran1510 avatar Jun 24 '25 07:06 leyuskckiran1510

dont worry. let me know when its ready for review

bynect avatar Jun 24 '25 19:06 bynect

@bynect could you rerun the workflow, I think the leak was due the mouse_script_scroll not being freed, I think the last commits solves the issue. Could you verify that and let me know if that fixes

leyuskckiran1510 avatar Jun 27 '25 12:06 leyuskckiran1510

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

Codecov Report

Attention: Patch coverage is 16.25000% with 67 lines in your changes missing coverage. Please review.

Project coverage is 64.49%. Comparing base (fb59a30) to head (15bef64).

Files with missing lines Patch % Lines
src/notification.c 17.50% 33 Missing :warning:
src/rules.c 18.18% 18 Missing :warning:
src/input.c 0.00% 12 Missing :warning:
src/x11/x.c 0.00% 4 Missing :warning:

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1489      +/-   ##
==========================================
- Coverage   64.90%   64.49%   -0.42%     
==========================================
  Files          51       51              
  Lines        9024     9100      +76     
  Branches     1048     1065      +17     
==========================================
+ Hits         5857     5869      +12     
- Misses       3167     3231      +64     
Flag Coverage Δ
unittests 64.49% <16.25%> (-0.42%) :arrow_down:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov-commenter avatar Jun 27 '25 16:06 codecov-commenter

@bynect Do i need to make 100% code coverage too ? or the task here is done for me. Please do let me know on changes required.

leyuskckiran1510 avatar Jul 07 '25 13:07 leyuskckiran1510

Sorry right now I can't review

bynect avatar Jul 07 '25 14:07 bynect

I left a review. mostly it is formatting. but there are some architecture changes I suggest. let me know what do you think

bynect avatar Jul 09 '25 10:07 bynect

I left a review. mostly it is formatting. but there are some architecture changes I suggest. let me know what do you think

okay I will make those changes and let you know, thank you for the time to review the code

leyuskckiran1510 avatar Jul 10 '25 06:07 leyuskckiran1510