Commit Graph

102 Commits

Author SHA1 Message Date
Aleksei Bavshin 93e340a081
feat(clock): support chrono Time Zone extensions.
Use chrono Calendars and Time Zones (P0355R7, P1466R3) when available
instead of the `date` library.
Verified with a patched build of a recent GCC 13 snapshot.
2023-01-21 02:18:44 -08:00
Aleksei Bavshin ea17a66dfc
fix: compilation errors with cpp_std=c++20
There were two main issues with fmtlib and C++20 mode:

 - `fmt::format` defaults to compile-time argument checking and requires
   using `fmt::runtime(format_string)` to bypass that.
 - `std::format` implementation introduces conflicting declarations and
   we have to specify the namespace for all `format`/`format_to` calls.
2023-01-20 22:50:02 -08:00
Aleksei Bavshin 67efe1af89
refactor(clock): remove struct waybar_time
The structure was used to pass the locale instance to the date
formatter. All the supported versions of `fmt` are passing the locale
parameter via `FormatContext.locale()` so we can remove the struct and
simplify the code.

While we at it, drop `date::make_zoned` in favor of CTAD on a
`date::zoned_time` constructor.
2023-01-20 22:50:01 -08:00
Aleksei Bavshin ba498869c5
fix(clock): delete outdated warning 2023-01-20 22:50:00 -08:00
Maxim Andreev f795e7a308 modules/clock: improve ux when calendar_shift is used:
1. change only date, but not time
  2. use shifted values only in tooltip
  3. reset shift when mouse leaves (popup closes)
2022-12-28 10:13:10 +03:00
Viktar Lukashonak 995802e8ae
ISSUE#1874 - happy linter 2022-12-14 16:49:03 +03:00
Viktar Lukashonak 0079092699
ISSUE#1874
1. Calendar. Weeks. Fix right paddings when first days of the week is
Monday
2. Fix small perfomrance penalty(avoid of defining parameter in the
month loop)
3. Small name convention for format string variables
2022-12-14 16:43:23 +03:00
Viktar Lukashonak 4c4d09992e
Regular expression improved 2022-12-10 18:36:58 +03:00
Viktar Lukashonak 9218968d2f
Wrong assigning 2022-12-10 17:55:21 +03:00
Viktar Lukashonak 272c638f7e
Happy linter 2022-12-10 16:48:22 +03:00
Viktar Lukashonak 57ad7f9536
ISSUE#1877 Calendar week numbers
1. Let's do code simplier
2. Week format using regexp. Needs when user provide additional
characters in format string and need to align week days according
3. Week format has got default formats: ":%U",":%V"
4. Week number is based on the first day of the week now. The output is
the same as of date library now.
5. Avoiding of unnecessary operations
2022-12-10 14:02:15 +03:00
Prokhor40 328575a721 fix: calendar week numbers
fix their format to correct

fix last number hide if the last day of the month is the last day of the week

some refactoring(mostly renaming abbreviations to the full phrases)
2022-12-06 03:47:28 +03:00
encbar5 8db1996ccc Allow calendar_shift_init_ to be negative 2022-11-27 21:24:56 -06:00
Simon Plakolb 5e9bbe5c76 modules: Revert button to label 2022-11-24 13:08:16 +01:00
Simon Plakolb 2b735f44bc modules: Set tooltip on button
Mouse-over tooltips set on the label only appear once the mouse hovers
over exactly the label. Other apps (e.g. firefox) show the tooltip once
the pointer hovers the button. Not solely its label. With this commit we
get the same behaviour.
2022-10-12 10:25:30 +02:00
Simon Plakolb b8322c4b4b button: Add AButton class
The AButton class is designed as full a substitute to ALabel. The
GtkButton attribute 'button_' is initialized with a label. This
label can the be referenced by the subsequent inheritors of AButton
instead of the GtkLabel attribute 'label_' of ALabel.
For convenience a GtkLabel* 'label_' attribute is added to AButton.

If the button cannot be clicked it is disabled, effectively acting
like its label predecessor.

GtkButton seems to catch one-click mouse events regardless of the
flags set on it. Therefore, 'signal_pressed' is connected to a
function creating a fake GdkEventButton* and calling 'handleToggle'
(for details on this possible bug in GTK see:
https://stackoverflow.com/questions/45334911 )

In accordance with other GtkButtons (i.e. the sway/workspace ones)
set_relief(Gtk::RELIEF_NONE) is called on the 'button_' instance.
2022-10-12 10:25:29 +02:00
Viktar Lukashonak e9e5780aae
Calendar scrolling opportunity 2022-08-06 13:55:20 +03:00
Aleksei Bavshin 3117aefdf3
fix: drop conditionals for ancient fmt versions 2022-07-13 22:36:33 -07:00
Viktar Lukashonak 36aa22189b
Last weekday applies Unix fmt 2022-06-24 16:44:06 +03:00
Viktar Lukashonak 315ea991bc
Calendar module: localization issue #1552 Linter #60 2022-05-13 23:56:08 +03:00
Viktar Lukashonak bd0f6128d3
Revert "Waybar. Issue#1552. Calendar module, LC_TIME variable"
This reverts commit 7b7ee41e13.
2022-05-13 22:58:38 +03:00
Viktar Lukashonak 5a014305ec
Revert "Issue#1552. Calendar module, LC_TIME variable"
This reverts commit 448b413eca.
2022-05-13 22:58:00 +03:00
Viktar Lukashonak e615612bf4
Calendar module: localization issue #1552 2022-05-13 18:51:32 +03:00
Viktar Lukashonak 448b413eca
Issue#1552. Calendar module, LC_TIME variable 2022-05-13 12:54:18 +03:00
Viktar Lukashonak 7b7ee41e13
Waybar. Issue#1552. Calendar module, LC_TIME variable 2022-05-12 19:04:45 +03:00
Rene D. Obermueller 4e3f91d237 Issue 1226/1497: align updates with times divisible by interval 2022-04-16 14:21:28 +02:00
Rene D. Obermueller e5d05baba3 Issue 1226/1497: Replace sleep_until with sleep_for to prevent clock from getting stuck with system time adjustment 2022-04-16 14:21:28 +02:00
Alex 54b1df69a9 fix: lint clock 2022-04-15 14:39:13 +02:00
LukashonakV 6ad1f6b853
Merge branch 'master' into master 2022-04-10 09:54:50 +00:00
Alex f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Viktar Lukashonak 4a457648f9
Waybar. Clock module. Calendar - custom output formats 2022-03-27 11:15:56 +03:00
Viktar Lukashonak 1d2a381b5f
Waybar. Clock module - weeknum fix for the left side 2022-03-25 18:51:59 +03:00
Viktar Lukashonak 2d87bcb1ab
https://github.com/Alexays/Waybar/issues/1315. Option to display week number on calendar 2022-03-24 15:41:50 +03:00
Louis des Landes 8b6bc215cc
Fix freebsd action 2022-03-10 14:48:40 +01:00
Alex b6655e475b
Merge branch 'master' into list_of_times 2022-03-08 09:59:22 +01:00
gemmelos 6be741afc9
Fix disabled tooltip on clock module
Seems like the tooltip text should only be set if both `if (tooltipEnabled())` and `if (config_["tooltip-format"].isString())` passes.
2022-02-02 12:41:06 +01:00
nullobsi 3a6e5be59d
Use locale when formatting clock 2022-01-14 10:36:24 -08:00
Aleksei Bavshin 7f6bef2049
fix(util): make waybar_time formatter compatible with fmt 8.1.0
Stop using private implementation details of the `formatter<std::tm>`.
We never needed anything from the class besides the format specifier,
which is easily obtainable with public API.
2022-01-07 22:34:00 -08:00
Aleksei Bavshin c0d84853ea
refactor(clock): extract waybar_time to util/waybar_time.hpp 2022-01-07 18:09:44 -08:00
Sergey Mishin ece86c96d7
Feature Clock: show list of time in other timezones in a tooltip
Introducing new tooltip placeholder: {timezoned_time_list}. It will be replaced with the list of times in different time zones.
I've found it useful to hover the mouse pointer on time and see time in all my timezones at once.
Current timezone excluding from the list, so if you will scroll over the time module and change the active timezone, this timezone will be excluded from the list and the previous active zone will be added.
2021-12-01 17:08:05 +00:00
Sergey Mishin c5e4d26320
Fix working without timezone 2021-10-05 10:20:06 +00:00
Sergey Mishin d8bc6c92bb
Fix style and spelling 2021-10-05 09:55:30 +00:00
Sergey Mishin 110c66dd32
Refactor Clock: generalize multi timezones and single timezone cases
After this refactoring:
1. Timezones parses only once on start and the we refer to saved values. All time_zone.isString() checks gone to the constructor.
2. Single timezone case handling as case of multi timezoned logic.
3. Scroll event seems more clear now.
4. Tooltip template parses on start to check if there calendar placeholder or not. To do not calculate calendar_text() if not necessary.
2021-10-03 16:57:55 +00:00
Sergey Mishin 174db444d6
Fix Clock crash on empty string in timezones field
Also fixed timezones behavior: now waybar starting with the first timezone in timezones list and falling back to timezone field only if timezones omit or has no elements.
2021-10-03 03:27:54 +00:00
Elyes HAOUAS f18eb71ad7 Fix spelling errors
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-10-02 18:13:17 +02:00
John Helmert III 368e4813de
libfmt >=8.0.0 compatibility 2021-06-30 13:12:38 -05:00
nullobsi ecba117dc0
remove unnessecary logging 2021-01-31 11:56:25 -08:00
nullobsi d2a1f41750
Use g_unichar_iswide to properly align calendar on CJK locales 2021-01-31 11:53:53 -08:00
Thomas Hebb 29f78e0426 Fix a few compiler warnings
There was one uninitialized value warning and two mismatched-sign
compare warnings. They both appear valid, the first occurring when MPD's
"format-stopped" contains {songPosition} or {queueLength} and the second
occurring when the clock's "timezones" array is more than 2 billion
items long (not likely, I admit). Fix both issues.
2020-11-30 18:07:22 -08:00
Daniel De Graaf 62082bdb01 clock: scroll through multiple timezones 2020-08-13 18:53:18 -04:00