-
-
Notifications
You must be signed in to change notification settings - Fork 694
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
[Feature request] Allow actions on hover #1064
Comments
Having hover actions is probably something that can be implemented. However, the second part about showing certain mpd buttons on hover only, would likely require custom ipc commands for each module, as well as a bunch of new config options to tell polybar what to do on hover. I'll add this to the list of feature requests but I don't know when/if we're going to implement this. |
To add to this, I'd love if this would allow replacing the hovered module with another for the duration of the hover. For example, when hovering over the battery module, it would be replaced with the backlight module, etc. No idea how this could look in the config file, but I think it's worth considering. |
I think this is the only thing polybar sorely needs. How can I help? |
Hi @daraul thanks for offering to help! There hasn't been any work done on this yet. Currently we are focusing on fixing bugs and making polybar more maintainable. We could most use your help on the tracking down and fixing bugs part (there are enough out here). Comment on any issue you'd like to take up like you did here and we would be happy to give you directions. If you want to work on this feature here that is fine too. Just be aware that the process may be slower because we don't have that much capacity and new features are not top priority. I think here, before you start coding, you should do a write up of what what new formatting tags and config keys you would need to add and how they would behave (their semantics). Then we can decide if that approach is feasible (UX and complexity-wise), after that you should be able to actually start coding. Thank you very much for helping! 😃 |
@patrick96 I probably should have mentioned that I've done no work with C++ as yet 😆 I'll be happy to tackle a couple small bugs to get myself up to speed, though |
@daraul Oh, that changes things. I don't want to spam this issue with this, please write me an email (address should be in my profile) with what languages you have experience with, and I'll try to find some things you can work on. |
Just some pointers if anyone wants to work on this (and also a reminder to myself): is used to track motion events (i.e. the position of the cursor). I already used this to detect when to change the mouse cursor, so it shouldn't be too hard to insert the actual functionality. From there, the action handling should be similar to that in and we'll probably have to create a new |
Another thing that is nice to have is the ability to change the styling (like background and text color) of an element on mouseover. |
This is a really nice feature, and could make polybar a lot cleaner. Right now i'm only relying on notify-send to get the desired infos. |
Any progress on this? Hovering on modules would be a grade A+ feature. |
I don't see any assignees. Is this issue free for the taking? |
@Astrono2 Yeah, this can be worked on, I'll assign it to you. What was your previous bar? Let me know if you need any help and also feel free to just ask for feedback if you're not sure about certain design decisions. |
My previous (and current until I finish switching) bar is the one that comes with KDE Plasma. I'm looking at the codebase right now, starting from the links provided above (checking the same methods but in master) and recursively looking for the definitions of methods/classes involved. Also this could be the jumping point for #534, which is actually the feature I miss from Plasma. |
Hey quick question: Edit: nvm I found it here. |
I'm guessing that storing the currently hovered action as an How would you recommend I go about keeping track of an action/action block for an arbitrary amount of time? |
Exactly. An I think a good enough solution would be to store the action string and if they match the action string in a new render cycle, it can be considered the same action block. Maybe instead of storing the entire string, we could also just store a hash or something. |
I'm adding a hover action to custom/script for debugging, and the key strings (click-left, click-middle, etc.) are hardcoded per-module D: |
Okay, so I have another dilemma: |
Progress update! |
Nice progress!
I know 🙈
Hmm, this doesn't work if the user creates a hover action using an action tag. Either we de/re-register after each render cycle depending on whether there are hover regions currently on the bar or we just always listen for motion events. I'm not sure how expensive it is to constantly change the event mask on a window. Always listening for motion events is certainly easier to implement.
This depends on what you want your hover module to do. It seems to me on the module side there isn't much to do, we just have to add a new mouse button and a |
I mean, in that case it's just a case of making the modules set the bool and also the config or config parser set the bool, to cover both cases. Or maybe we could always listen for motion events and add a key to manually disable listening for motion events for performance? And mention in the wiki something like "This will prevent cursor-click, cursor-scroll and hover from working. Use it if you're not using those functionalities"
I'm thinking about the flicker when a module shrinks on hover. A hover module could add a middle step between the output set by the module and the actual output, padding with whitespace to ensure that the width of the module stays greater or equal to the width it had when it received the hover event. |
Or, with tooltips in mind, we could put the hover logic in the base module, and enable it/disable it based on whether there is a hover action (in the code or in the config) and whether a future 'tooltip' key is set. I figure if tooltips are implemented, they should be implemented for all modules. |
This doesn't cover everything. For example a script could generate a hover action, there is no way for polybar to know this beforehand.
Hmm, like if the hover action is the toggle action on the date module and the alternative label is much smaller? Also, there is currently no way to know which module a click action is coming from. |
Hmm that's what I feared. I guess the best option is to leave the flicker just to have the feature ready, and leave it to each module to deal with. Then someone who's more familiar with the codebase might come up with a fix. |
Progress on this feature is currently on hold, as I've noticed that this feature is dependent of #2469 |
Has this been implemented or any rough way to do this as of now (perhaps with any forks?), I want to make it so that when hovering over my time module, it can show a small popup including more detailed info like the date. |
@SystematicError #2466 is the current progress. |
Well, #2469 was closed, so I can keep working on this. Sadly I'm quite busy at the moment, but I'll try to get to it as soon as possible. |
No pressure, take your time :) |
@Astrono2 Since I see its been almost a year, just wanted to see what the current status of this is or have you just not had the time? |
Tbh I forgot about this 😅. I'll get back to it this week. Sorry for the delay. |
No worries, assumed as much or that you had just gotten busy. Thanks! |
It's working. It was pretty simple to implement. Now I have to test it and check that the API is usable and make the bar only listen to mouse motion events if needed. One question though: I'm testing using a script module and I noticed that the docs show an example like click-left = echo left %counter% But all the mouse related actions as far as I can tell don't affect the text of the module. The example does nothing because the echo just screams into the void. Is this intended behaviour? Also should I leave adding hover actions to existing modules for a different pull request or do it all in one? (I'm thinking that the date module could have a setting for using hover instead of click for showing date-alt and time-alt) |
I am not one of the developers or maintainers of polybar but I would split adding hover actions to existing modules into a different pull request just since it would considerably help code clarity and segment two different improvements. |
Hi! Sorry for the delay again 😅, I got my first job as a programmer!! Anyways, I think I have the code working in my fork. I'll work on the documentation and changelog now and make a PR soon! |
Like showing buttons for next/previous on the music module on hover
The text was updated successfully, but these errors were encountered: