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

Scroll calendar to prev/next month #581

Closed
skligys opened this issue Feb 7, 2020 · 9 comments
Closed

Scroll calendar to prev/next month #581

skligys opened this issue Feb 7, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@skligys
Copy link
Contributor

skligys commented Feb 7, 2020

I was thinking how I could see the previous/next months in the new calendar tooltip, and could not see a good way.

  • One option is to always display 3 months (as in cal -3) but then the tooltip is huge.
  • Awesome WM scrolls to previous month on left click and to next month on right click but that doesn't match left/right click actions in other modules.
  • Mouse scroll up/down could scroll months but right now scrolling seems to be reserved to executing external executables.

Please advise!

@Alexays Alexays added the enhancement New feature or request label Feb 11, 2020
@Alexays
Copy link
Owner

Alexays commented Apr 11, 2020

@maximbaz I'll go if possible by using https://developer.gnome.org/gtkmm/stable/classGtk_1_1Calendar.html
and replace the tooltip widget with the calendar one that can give an output like this:
image
Using gtkmm you can IMO do something like this.
Get the tooltip window using:

auto window = label_. get_tooltip_window();
auto widget = window.get_child()
window.remove(widget); // In order to replace current widget
window.add(GtkCalendar);

I don't know if it's gonna work, but it's worth a try. 😄

@maximbaz
Copy link
Contributor

Thanks for the input, this is an interesting idea!

(keeping a mind that I have very little C++ experience 😛) here's what I managed to investigate so far:

  • most importantly, in update() method label_.get_tooltip_window() always returns null for me, I speculate that the window is only being created when the tooltip is actually being rendered on screen and update() is called before that
  • trying to create a completely new window for the tooltip doesn't crash waybar, but then the tooltip simply doesn't show up at all:
    auto gtkCalendar = Gtk::Calendar();
    auto gtkCalendarWindow = Gtk::Window();
    gtkCalendarWindow.add(gtkCalendar);
    gtkCalendar.show();
    label_.set_tooltip_window(gtkCalendarWindow);
  • trying to find some examples of drawing this calendar I only found this reference: https://gitlab.gnome.org/GNOME/gnome-panel/-/blob/master/modules/clock/calendar-window.c#L1598

Any hints are very appreciated 🙂

@skligys or anyone else, if you have some ideas, do feel free to jump in 😉

@Alexays
Copy link
Owner

Alexays commented Apr 13, 2020

@maximbaz You may need to use set_has_tooltip(true), can you try?

@Alexays
Copy link
Owner

Alexays commented Apr 13, 2020

And try to set the tooltip on the event_box parent

@maximbaz
Copy link
Contributor

Thanks! As far as I could see setting set_has_tooltip(true) on label_, event_box_ or event_box_.get_parent() had no effect; get_tooltip_window() still returns null and set_tooltip_window() as in the snippet above still does nothing, nothing appears on hover.

@LukashonakV
Copy link
Contributor

Hi @skligys , @maximbaz calendar scrolling is supported by the clock module. See Clock WIKI + there's open #2019 which implements of module action redefinition

@LukashonakV
Copy link
Contributor

Hi @skligys , @maximbaz #2019 is merge into the master.
So now your are able to redefine Clock actions on your wish.
Please see:

  1. Module actions config
  2. Wiki clock

If it's Ok for you , please close an issue.
Thank you

@skligys
Copy link
Contributor Author

skligys commented Mar 1, 2023

Yes, thank you very much for code changes. I rebuilt waybar, and am using calendar with your changes. Works very well for me.

Closing the bug.

@LukashonakV
Copy link
Contributor

Hi @skligys please close the issue then as an author. Thanks )

@skligys skligys closed this as completed Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants