Skip to content
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] Moving/disabling taskbar buttons #59

Closed
seba4316 opened this issue Oct 18, 2023 · 9 comments
Closed

[Feature] Moving/disabling taskbar buttons #59

seba4316 opened this issue Oct 18, 2023 · 9 comments

Comments

@seba4316
Copy link
Contributor

The problem

The taskbar buttons are currently static, they cannot be hidden and their order is hardcoded and cannot be changed.

Possible solution

This feature could be implemented by saving all the taskbar buttons (super, search field, bluetooth, clock, etc.) in an ini file that would look something like this:

[TaskbarItem0]
name=super
enabled=true
command=null

[TaskbarItem1]
name=field_search
small=false
enabled=true
command=null

...

[TaskbarItem6]
name=wifi
enabled=true
systray=false
command=wpa_gui

[TaskbarItem7]
name=volume
enabled=true
systray=true
command=pavucontrol

In this implementation, custom commands are relocated from the configuration file, enabling the customization of each button. Ideally, the systray buttons (wifi, bluetooth, battery, volume) would be draggable, allowing users to easily move them in and out of the systray popup menu.

My current implementation

I've already worked on part of this for personal use but if a PR would be welcome for this feature I wouldn't mind working on the code a little more and making one.

These are the changes I've made to the Container header and class:

  • Added the function Container::child(int type, int wanted_width, int wanted_height, bool add), the "add" property defines whether this button should be added to the taskbar
  • Added the function Container::addContainer(Container* container), which adds the container to the children vector

These are the changes I've made to the Taskbar class:

  • Added a vector of containers
  • Renamed the fill_root function to prepare_buttons
  • Set a name to the containers that don't currently have one
  • Added them to the vector
  • Created another fill_root method which traverses a string and only adds the buttons within

Another wrapper class might be needed to specify whether the container can be hidden through a right-click context menu and/or dragged into the systray.

@seba4316
Copy link
Contributor Author

seba4316 commented Oct 19, 2023

I wrote a wrapper class and a function to load the order and required data from an ini file.

To finish the implementation the following should be done: a function to save the items into the ini file, drag and drop to re-arrange systray items and a context menu to hide them.

I haven't looked too much into the code yet but the Settings button doesn't seem to be functional.
If that is implemented there could be a page to turn the disabled systray icons back on without having to manually edit the ini file.

@jmanc3
Copy link
Owner

jmanc3 commented Oct 19, 2023

I'd been meaning to replace the current configuration file with a proper GUI settings page for a while now. If you don't mind waiting a bit, I can add this.

@seba4316
Copy link
Contributor Author

If you don't mind waiting a bit, I can add this.

Do you mean implement the feature of disabling/moving the tray icons?

@jmanc3
Copy link
Owner

jmanc3 commented Oct 19, 2023

Yeah

@seba4316
Copy link
Contributor Author

Okay, I'll leave this issue open for future reference
If you'd like some help on anything let me know and I'll try

@jmanc3
Copy link
Owner

jmanc3 commented Oct 22, 2023

Added this feature on latest commit. I didn't add 'spacers' yet which people probably want, and no option to choose the alignment of pinned icons but i'll get to it at some point.

@jmanc3
Copy link
Owner

jmanc3 commented Oct 22, 2023

Somethings not working with the saving and loading, I'll look at that later

@seba4316
Copy link
Contributor Author

I'm not sure it has to do with saving. I've restarted the app a couple of times and didn't lose my configuration, but I noticed that after looking away from the screen for a good 10 minutes my configuration was indeed reverted to default.
Could be somehow related to the previous date flickering issue, though that's just a random thought more than anything.

I'll see if I get this behaviour again but I'll have to read the changes to understand better what's happening

@jmanc3
Copy link
Owner

jmanc3 commented Oct 22, 2023

Should be fixed in latest commit. It was a problem with correctly merging the settings page state with the taskbar state, although that reset to the default seems like a different thing. We will see if it that is fixed as a byproduct.

@jmanc3 jmanc3 closed this as completed Oct 24, 2023
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

No branches or pull requests

2 participants