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

Calendar Year mode #1956

Closed
wants to merge 6 commits into from
Closed

Conversation

LukashonakV
Copy link
Contributor

@LukashonakV LukashonakV commented Jan 17, 2023

Hi @Alexays ,
There's a huge code changing related to the new functionality. Calendar component in Clock module now supports Year view mode.

  1. Clock class supports now it's own button events
  2. Calendar configuration now is moved to separate group
"clock": {
        "format": "{:%H:%M}  ",
        "format-alt": "{:%A, %B %d, %Y (%R)}  ",
        "tooltip-format": "<tt><small>{calendar}</small></tt>",
        "calendar": {
                    "mode"          : "year",
                    "mode-mon-col"  : 3,
                    "weeks-pos"     : "right",
                    "on-scroll"     : 1,
                    "on-click-right": "mode",
                    "format": {
                              "months":     "<span color='#ffead3'><b>{}</b></span>",
                              "days":       "<span color='#ecc6d9'><b>{}</b></span>",
                              "weeks":      "<span color='#99ffdd'><b>W{}</b></span>",
                              "weekdays":   "<span color='#ffcc66'><b>{}</b></span>",
                              "today":      "<span color='#ff6699'><b><u>{}</u></b></span>"
                              }
                    }
    },
  1. mode configuration - possible values "year|month". Initial object class mode
  2. mode-mon-col - how many month should be printed in row in "year" mode
  3. on-scroll - shifting counter (month for month mode, year for year mode)
  4. on-click-right | on-click-left - possible value now is mode. Switches calendar mode
  5. Supports all previous functionality

Examples

ps_2023-01-18-00_25_51
ps_2023-01-18-00_25_55
ps_2023-01-18-00_25_58
ps_2023-01-18-00_27_03
ps_2023-01-18-00_27_08
ps_2023-01-18-00_27_12
ps_2023-01-18-00_27_37
ps_2023-01-18-00_27_40
ps_2023-01-18-00_27_43
ps_2023-01-18-00_27_53
ps_2023-01-18-00_28_18
ps_2023-01-18-00_28_36
ps_2023-01-18-00_29_03
ps_2023-01-18-00_29_08
ps_2023-01-18-00_29_13
ps_2023-01-18-00_29_16
ps_2023-01-18-00_29_37
ps_2023-01-18-00_29_41
ps_2023-01-18-00_29_43
ps_2023-01-18-00_29_47
ps_2023-01-18-00_30_07
ps_2023-01-18-00_30_11
ps_2023-01-18-00_30_13
ps_2023-01-18-00_30_15

Signed-off-by: Viktar Lukashonak <[email protected]>
Signed-off-by: Viktar Lukashonak <[email protected]>
Signed-off-by: Viktar Lukashonak <[email protected]>
Signed-off-by: Viktar Lukashonak <[email protected]>
@jlaunay
Copy link

jlaunay commented Jan 25, 2023

Changed my config accordingly but I cannot figure out how to display "format-alt"

@LukashonakV
Copy link
Contributor Author

LukashonakV commented Jan 25, 2023

Hi @jlaunay. As it was before

"format-alt": "{:%A, %B %d, %Y (%R)}  "

is supported under the clock configuration. Please see my config on the top of this PR. And thanks, I really don't see description on WIKI. Will complete it soon.

@jlaunay
Copy link

jlaunay commented Jan 25, 2023

Thank you for your answer. I have "format-alt" in my configuration. To be sure I copied and pasted the example in your PR but nothing to do, a left click does not change from "format" to "format-alt".
Waybar v0.9.17-37-gdd9e3d01 (branch 'master')

@LukashonakV
Copy link
Contributor Author

LukashonakV commented Jan 25, 2023

@jlaunay can you share config please? Or for testing purposes use my own temporarily does it suit for you DOT . Make sure to use all files in waybar directory

@jlaunay
Copy link

jlaunay commented Jan 25, 2023

Here is a small recording using a minimal configuration (only the clock module centered), I tried left, right and middle click.
https://user-images.githubusercontent.com/1137028/214574774-9a31ddba-bcf1-4e76-ae82-0f9d9a025066.mp4

@LukashonakV
Copy link
Contributor Author

LukashonakV commented Jan 25, 2023

@jlaunay can you reassign mode switching to left-button please and check then format alt ?
I mean,

"on-click-right": "mode", 

change to

 "on-click-left": "mode",

@jlaunay
Copy link

jlaunay commented Jan 25, 2023

using

"on-click-left": "mode",

Make left click change the mode (month/year view) but still no way to view alt format.

@LukashonakV
Copy link
Contributor Author

Thank you. Actually just checked and see the same issue.

@jlaunay
Copy link

jlaunay commented Jan 25, 2023

Glad to hear it, I was wondering what I could have done wrong again :)

@jlaunay
Copy link

jlaunay commented Jan 25, 2023

Also, if it's not too difficult to add, it would be nice to have on-click-middle support for calendar as I usually use right to launch a specific calendar app and left to change format.

@LukashonakV
Copy link
Contributor Author

@jlaunay, for now I'll fix the alt mode . I've already found the issue. For the improvements please create separate Issue. Thanks.

@LukashonakV
Copy link
Contributor Author

LukashonakV commented Jan 25, 2023

@jlaunay once PR#1976 is merged, the issue will be solved.

@LukashonakV
Copy link
Contributor Author

@jlaunay , fix was merged. Please take the freshet src and check again. Make sure - to return back switch mode

"on-click-right": "mode", 

format-alt should work as previous on left mouse button

@jlaunay
Copy link

jlaunay commented Jan 25, 2023

Thanks a lot for you for your responsiveness, I confirm it's now perfect.
I will take time to open a new issue for the middle click.

@apiraino
Copy link

I'm trying to use the timezone switch with the defined actions tz_up and tz_down, but I can't seem to make it work. Here a small repro:

{
    "layer": "top",
    "position": "bottom",
    "height": 33,
    "fixed-center": false,
    "modules-center": ["clock"],
    "clock": {
        "interval": 1,
        "format": "{:[W%W] (%a) (%Z) %Y-%m-%d - %H:%M:%S}",
        "timezones": ["", "Etc/UTC", "America/New_York", "America/Montevideo", "Asia/Tokyo"],
        "actions": {
            "on-click-right": "mode",
            "on-click-forward": "tz_up",
            "on-click-backward": "tz_down",
            "on-scroll-up": "shift_up",
            "on-scroll-down": "shift_down"
        }
    }
}

anything obvious I'm forgetting to configure?

thanks

@LukashonakV
Copy link
Contributor Author

Hi @apiraino , Is it still relevant?

@apiraino
Copy link

@LukashonakV yes, I think so. I could not yet figure out how the tz_{up,down} actions work. Using Waybar 0.9.20.

Let me know if you prefer me opening a separate issue.

thanks

@LukashonakV
Copy link
Contributor Author

LukashonakV commented Jul 27, 2023

Hi @apiraino can you start conversation in https://github.com/Alexays/Waybar/discussions in order to have tracked conversation.

  1. Can you redefine tz_up, tz_down on another mouse buttons .. just to check there is no issue with mouse forward - backward buttons. For example just to check - on-click-right
  2. Can you get pure example for clock module from the wiki Example#2. Does it work ?

@LukashonakV
Copy link
Contributor Author

HI @apiraino any news ?

@apiraino
Copy link

@LukashonakV opened a discussion

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

Successfully merging this pull request may close these issues.

3 participants