[GH-ISSUE #931] Calendar date not being updated #1687

Closed
opened 2026-05-22 22:54:00 +01:00 by JakeStanger · 8 comments
Owner

Originally created by @postsolar on GitHub (Apr 8, 2025).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/931

Describe the bug

Calendar popup reported April 6th today (on April 8th). Fixed with systemctl --user restart ironbar.service

To Reproduce

Looking for a way to reproduce. Would changing system time be appropriate?

Expected behavior

System information:

  • Distro: NixOS
  • Compositor: Hyprland
  • Ironbar version:
$  nix flake metadata ironbar
Resolved URL:  path:/nix/store/ddzp1szx7y9n3gmdbcwkyw4lpal60axr-source?lastModified=1743804081&narHash=sha256-TgvLw2SnV8wRGp%2BqE5Jws7QmLXMMjebkQci1NcCIT6A%3D&rev=f2bc33ec26698f2aeb28d0c8e0c5605d5ffbcce1
Locked URL:    path:/nix/store/ddzp1szx7y9n3gmdbcwkyw4lpal60axr-source?lastModified=1743804081&narHash=sha256-TgvLw2SnV8wRGp%2BqE5Jws7QmLXMMjebkQci1NcCIT6A%3D&rev=f2bc33ec26698f2aeb28d0c8e0c5605d5ffbcce1
Description:   Nix Flake for ironbar
Path:          /nix/store/ddzp1szx7y9n3gmdbcwkyw4lpal60axr-source
Revision:      f2bc33ec26698f2aeb28d0c8e0c5605d5ffbcce1
Last modified: 2025-04-05 01:01:21
Fingerprint:   06d5561d788c9737f066595138b5f62f43105ddd20da35efddf987281f68335a
Inputs:
├───crane: github:ipetkov/crane/70947c1908108c0c551ddfd73d4f750ff2ea67cd?narHash=sha256-vVOAp9ahvnU%2BfQoKd4SEXB2JG2wbENkpqcwlkIXgUC0%3D (2025-03-19 14:35:00)
├───naersk: github:nix-community/naersk/a75c0584b0d69de943babc899530e9c70c642b42?narHash=sha256-o9dXcpfXpBm6%2B/SRqcQW0GzRkJymwyEAu5UD5LMDd3s%3D (2025-03-25 11:15:44)
│   └───nixpkgs: github:NixOS/nixpkgs/63158b9cbb6ec93d26255871c447b0f01da81619?narHash=sha256-FurMxmjEEqEMld11eX2vgfAx0Rz0JhoFm8UgxbfCZa8%3D (2025-03-30 07:43:48)
├───nixpkgs: github:nixos/nixpkgs/52faf482a3889b7619003c0daec593a1912fddc1?narHash=sha256-6hl6L/tRnwubHcA4pfUUtk542wn2Om%2BD4UnDhlDW9BE%3D (2025-03-30 06:12:12)
└───rust-overlay: github:oxalica/rust-overlay/011de3c895927300651d9c2cb8e062adf17aa665?narHash=sha256-OBcNE%2B2/TD1AMgq8HKMotSQF8ZPJEFGZdRoBJ7t/HIc%3D (2025-03-31 02:35:31)
    └───nixpkgs follows input 'nixpkgs'

Configuration

Share your bar configuration and stylesheet as applicable:

Config
{
  "center": [
    {
      "format": "%R",
      "type": "clock"
    }
  ],
  "end": [
    {
      "type": "tray"
    },
    {
      "icons": {
        "layout_map": {
          "English (Colemak-DH ISO)": "🇺🇸",
          "Estonian": "🇪🇪",
          "Russian": "🇷🇺"
        }
      },
      "show_caps": false,
      "show_num": false,
      "show_scroll": false,
      "type": "keyboard"
    },
    {
      "type": "clipboard"
    },
    {
      "truncate": {
        "max_length": 60,
        "mode": "start"
      },
      "type": "music"
    },
    {
      "format": "{icon} {percentage}%",
      "icons": {
        "muted": "󰝟",
        "volume_high": "󰕾",
        "volume_low": "󰕿",
        "volume_medium": "󰖀"
      },
      "max_volume": 150,
      "type": "volume"
    }
  ],
  "height": 30,
  "name": "hyprbar",
  "position": "top",
  "start": [
    {
      "hidden": [
        "special:magic"
      ],
      "type": "workspaces"
    }
  ]
}
Styles

Additional context

Config is applied via IRONBAR_CONFIG in a systemd unit

[Install]
WantedBy=hyprland-session.target

[Service]
Environment=IRONBAR_CONFIG=/nix/store/c4ghfwmjrc05hpfj4nhdp0lyg4flshvc-ironbar-hypr.json
ExecStart=/nix/store/cd047pz6g4f18my7ayi69iyfscf1pl2i-ironbar-0.16.1+date=2025-04-04_f2bc33e/bin/ironbar
Restart=on-failure
Type=simple

[Unit]
Description=Systemd service for Ironbar
Requires=graphical-session.target

Screenshots

If applicable, add screenshots to help explain your problem.

Originally created by @postsolar on GitHub (Apr 8, 2025). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/931 **Describe the bug** Calendar popup reported April 6th today (on April 8th). Fixed with `systemctl --user restart ironbar.service` **To Reproduce** Looking for a way to reproduce. Would changing system time be appropriate? **Expected behavior** **System information:** - Distro: NixOS - Compositor: Hyprland - Ironbar version: ``` $ nix flake metadata ironbar Resolved URL: path:/nix/store/ddzp1szx7y9n3gmdbcwkyw4lpal60axr-source?lastModified=1743804081&narHash=sha256-TgvLw2SnV8wRGp%2BqE5Jws7QmLXMMjebkQci1NcCIT6A%3D&rev=f2bc33ec26698f2aeb28d0c8e0c5605d5ffbcce1 Locked URL: path:/nix/store/ddzp1szx7y9n3gmdbcwkyw4lpal60axr-source?lastModified=1743804081&narHash=sha256-TgvLw2SnV8wRGp%2BqE5Jws7QmLXMMjebkQci1NcCIT6A%3D&rev=f2bc33ec26698f2aeb28d0c8e0c5605d5ffbcce1 Description: Nix Flake for ironbar Path: /nix/store/ddzp1szx7y9n3gmdbcwkyw4lpal60axr-source Revision: f2bc33ec26698f2aeb28d0c8e0c5605d5ffbcce1 Last modified: 2025-04-05 01:01:21 Fingerprint: 06d5561d788c9737f066595138b5f62f43105ddd20da35efddf987281f68335a Inputs: ├───crane: github:ipetkov/crane/70947c1908108c0c551ddfd73d4f750ff2ea67cd?narHash=sha256-vVOAp9ahvnU%2BfQoKd4SEXB2JG2wbENkpqcwlkIXgUC0%3D (2025-03-19 14:35:00) ├───naersk: github:nix-community/naersk/a75c0584b0d69de943babc899530e9c70c642b42?narHash=sha256-o9dXcpfXpBm6%2B/SRqcQW0GzRkJymwyEAu5UD5LMDd3s%3D (2025-03-25 11:15:44) │ └───nixpkgs: github:NixOS/nixpkgs/63158b9cbb6ec93d26255871c447b0f01da81619?narHash=sha256-FurMxmjEEqEMld11eX2vgfAx0Rz0JhoFm8UgxbfCZa8%3D (2025-03-30 07:43:48) ├───nixpkgs: github:nixos/nixpkgs/52faf482a3889b7619003c0daec593a1912fddc1?narHash=sha256-6hl6L/tRnwubHcA4pfUUtk542wn2Om%2BD4UnDhlDW9BE%3D (2025-03-30 06:12:12) └───rust-overlay: github:oxalica/rust-overlay/011de3c895927300651d9c2cb8e062adf17aa665?narHash=sha256-OBcNE%2B2/TD1AMgq8HKMotSQF8ZPJEFGZdRoBJ7t/HIc%3D (2025-03-31 02:35:31) └───nixpkgs follows input 'nixpkgs' ``` **Configuration** > Share your bar configuration and stylesheet as applicable: <details><summary>Config</summary> ``` { "center": [ { "format": "%R", "type": "clock" } ], "end": [ { "type": "tray" }, { "icons": { "layout_map": { "English (Colemak-DH ISO)": "🇺🇸", "Estonian": "🇪🇪", "Russian": "🇷🇺" } }, "show_caps": false, "show_num": false, "show_scroll": false, "type": "keyboard" }, { "type": "clipboard" }, { "truncate": { "max_length": 60, "mode": "start" }, "type": "music" }, { "format": "{icon} {percentage}%", "icons": { "muted": "󰝟", "volume_high": "󰕾", "volume_low": "󰕿", "volume_medium": "󰖀" }, "max_volume": 150, "type": "volume" } ], "height": 30, "name": "hyprbar", "position": "top", "start": [ { "hidden": [ "special:magic" ], "type": "workspaces" } ] } ``` </details> <details><summary>Styles</summary> ```css ``` </details> **Additional context** Config is applied via IRONBAR_CONFIG in a systemd unit ``` [Install] WantedBy=hyprland-session.target [Service] Environment=IRONBAR_CONFIG=/nix/store/c4ghfwmjrc05hpfj4nhdp0lyg4flshvc-ironbar-hypr.json ExecStart=/nix/store/cd047pz6g4f18my7ayi69iyfscf1pl2i-ironbar-0.16.1+date=2025-04-04_f2bc33e/bin/ironbar Restart=on-failure Type=simple [Unit] Description=Systemd service for Ironbar Requires=graphical-session.target ``` **Screenshots** > If applicable, add screenshots to help explain your problem.
JakeStanger 2026-05-22 22:54:00 +01:00
Author
Owner

@postsolar commented on GitHub (Apr 9, 2025):

Ok I can reproduce this as in the date keeps not getting updated at midnight, so not a one-off occurence.

<!-- gh-comment-id:2790839816 --> @postsolar commented on GitHub (Apr 9, 2025): Ok I can reproduce this as in the date keeps not getting updated at midnight, so not a one-off occurence.
Author
Owner

@postsolar commented on GitHub (May 19, 2025):

From what I understand gtk3-rs just doesn't expose anything here to have it nicely?

<!-- gh-comment-id:2890849371 --> @postsolar commented on GitHub (May 19, 2025): From what I understand gtk3-rs just doesn't expose anything here to have it nicely?
Author
Owner

@JakeStanger commented on GitHub (May 19, 2025):

I think GTK4's calendar widget does offer a lot more functionality, but there are methods in GTK3 that looks like they do the right thing.

https://gtk-rs.org/gtk3-rs/git/docs/gtk/prelude/trait.CalendarExt.html#tymethod.mark_day
https://gtk-rs.org/gtk3-rs/git/docs/gtk/prelude/trait.CalendarExt.html#tymethod.select_day

I've never played with any of them though.

<!-- gh-comment-id:2890872858 --> @JakeStanger commented on GitHub (May 19, 2025): I think GTK4's calendar widget does offer a lot more functionality, but there are methods in GTK3 that looks like they do the right thing. https://gtk-rs.org/gtk3-rs/git/docs/gtk/prelude/trait.CalendarExt.html#tymethod.mark_day https://gtk-rs.org/gtk3-rs/git/docs/gtk/prelude/trait.CalendarExt.html#tymethod.select_day I've never played with any of them though.
Author
Owner

@postsolar commented on GitHub (May 19, 2025):

I think I now understand the issue to be more broad:

  • What I refer to in this issue is the "selected" day not updating at 00:00. This is what I initially intuitively expected to be the current day.
  • But gtk3 calendar doesn't really seem to have a notion of the current day, it's just that the selected day defaults to whatever is the current day at time of widget creation.
  • Therefore, in whichever way we choose to fix this, we will also break existing semantics of the selected date.

Whether it's sensible to have this tradeoff, I don't know. I personally don't use date selection and would be fine with it resetting to current date across popup open/close cycles.

<!-- gh-comment-id:2890970708 --> @postsolar commented on GitHub (May 19, 2025): I think I now understand the issue to be more broad: - What I refer to in this issue is the "selected" day not updating at 00:00. This is what I initially intuitively expected to be the current day. - But gtk3 calendar doesn't really seem to have a notion of the current day, it's just that the selected day defaults to whatever is the current day at time of widget creation. - Therefore, in whichever way we choose to fix this, we will also break existing semantics of the selected date. Whether it's sensible to have this tradeoff, I don't know. I personally don't use date selection and would be fine with it resetting to current date across popup open/close cycles.
Author
Owner

@JakeStanger commented on GitHub (May 19, 2025):

Date selection doesn't do anything so I think it's fine to reset that whenever the popup opens, or on a timer at midnight.

The alternative is to 'mark' and/or show details for the day and then show markings so that it's independent of the selection (assuming the markings system works as one would expect).

<!-- gh-comment-id:2890982294 --> @JakeStanger commented on GitHub (May 19, 2025): Date selection doesn't do anything so I think it's fine to reset that whenever the popup opens, or on a timer at midnight. The alternative is to 'mark' and/or show details for the day and then show markings so that it's independent of the selection (assuming the markings system works as one would expect).
Author
Owner

@JakeStanger commented on GitHub (May 20, 2025):

Related: #244

<!-- gh-comment-id:2894261386 --> @JakeStanger commented on GitHub (May 20, 2025): Related: #244
Author
Owner

@postsolar commented on GitHub (May 20, 2025):

Markings are just bold text apparently, less noticeable than selections. So if someone launched Ironbar on 19.05, then on 20.05 they decided to open the calendar, there would be very visible "selected" 19.05 day and hardly noticeable marked 20.05 current day. I think using selections would result in more intuitive UI. Though if there's a way to have markings be more (or as) visible than selections then it might work.

In case we're using selections, I'm not sure if updating the date just at midnight is enough. Say, it's 20.05 01:00, I click some buttons in the calendar thus selecting another day, then go to sleep. Next day (but same date) I wake up and the calendar shows me the wrong date. So I'm more in favor of resetting it on popup opens.

Speaking of which, what is the right way to hook into popup opens?

I tried a simple

    fn into_popup(
        ...
        container.connect_show(move |_| {
            let date = Local::now();
            calendar.select_day(date.day());
            calendar.select_month(date.month(), date.year() as u32);
        });
        ...

but it has no effect at all.

<!-- gh-comment-id:2894395554 --> @postsolar commented on GitHub (May 20, 2025): Markings are just bold text apparently, less noticeable than selections. So if someone launched Ironbar on 19.05, then on 20.05 they decided to open the calendar, there would be very visible "selected" 19.05 day and hardly noticeable marked 20.05 current day. I think using selections would result in more intuitive UI. Though if there's a way to have markings be more (or as) visible than selections then it might work. In case we're using selections, I'm not sure if updating the date *just* at midnight is enough. Say, it's 20.05 01:00, I click some buttons in the calendar thus selecting another day, then go to sleep. Next day (but same *date*) I wake up and the calendar shows me the wrong date. So I'm more in favor of resetting it on popup opens. Speaking of which, what is the right way to hook into popup opens? I tried a simple ```rust fn into_popup( ... container.connect_show(move |_| { let date = Local::now(); calendar.select_day(date.day()); calendar.select_month(date.month(), date.year() as u32); }); ... ``` but it has no effect at all.
Author
Owner

@JakeStanger commented on GitHub (May 20, 2025):

Though if there's a way to have markings be more (or as) visible than selections then it might work.

So there's this mysterious details feature (I think you need to also set_show_details(true)) that might work nicely in addition, but I haven't been able to find out what it does from Googling at least.

https://gtk-rs.org/gtk3-rs/git/docs/gtk/prelude/trait.CalendarExt.html#tymethod.set_detail_func

I'm thinking there surely has to be a way to target the calendar internals with CSS too. Would have to pull apart a GTK theme to find out though.

Speaking of which, what is the right way to hook into popup opens?

The container parent should be the actual popup window (changing to a native popup element with GTK4). That is what gets shown/hidden so you should be able to listen to that.

I think you can get the popup window through either context.popup.window or container.parent.

<!-- gh-comment-id:2894621872 --> @JakeStanger commented on GitHub (May 20, 2025): > Though if there's a way to have markings be more (or as) visible than selections then it might work. So there's this mysterious details feature (I think you need to also `set_show_details(true)`) that might work nicely in addition, but I haven't been able to find out what it does from Googling at least. https://gtk-rs.org/gtk3-rs/git/docs/gtk/prelude/trait.CalendarExt.html#tymethod.set_detail_func I'm thinking there *surely* has to be a way to target the calendar internals with CSS too. Would have to pull apart a GTK theme to find out though. > Speaking of which, what is the right way to hook into popup opens? The container parent should be the actual popup window (changing to a native popup element with GTK4). That is what gets shown/hidden so you should be able to listen to that. I think you can get the popup window through either `context.popup.window` or `container.parent`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#1687
No description provided.