mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-04-19 19:34:24 +02:00
feat: enable use of markup in clock module format and format_popup, and update documentation to reflect supporting Pango markup in both
This commit is contained in:
parent
d981265dac
commit
f4384b6252
2 changed files with 11 additions and 6 deletions
|
@ -10,8 +10,8 @@ Clicking on the widget opens a popup with the time and a calendar.
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
|----------------|----------|------------------------------------|-------------------------------------------------------------------------------------|
|
|----------------|----------|------------------------------------|-------------------------------------------------------------------------------------|
|
||||||
| `format` | `string` | `%d/%m/%Y %H:%M` | Date/time format string. |
|
| `format` | `string` | `%d/%m/%Y %H:%M` | Date/time format string. Pango markup is supported. |
|
||||||
| `format_popup` | `string` | `%H:%M:%S` | Date/time format string to display in the popup header. |
|
| `format_popup` | `string` | `%H:%M:%S` | Date/time format string to display in the popup header. Pango markup is supported. |
|
||||||
| `locale` | `string` | `$LC_TIME` or `$LANG` or `'POSIX'` | Locale to use (eg `en_GB`). Defaults to the system language (reading from env var). |
|
| `locale` | `string` | `$LC_TIME` or `$LANG` or `'POSIX'` | Locale to use (eg `en_GB`). Defaults to the system language (reading from env var). |
|
||||||
|
|
||||||
> Detail on available tokens can be found here: <https://docs.rs/chrono/latest/chrono/format/strftime/index.html>
|
> Detail on available tokens can be found here: <https://docs.rs/chrono/latest/chrono/format/strftime/index.html>
|
||||||
|
@ -80,4 +80,4 @@ end:
|
||||||
| `.popup-clock .calendar-clock` | Clock inside the popup |
|
| `.popup-clock .calendar-clock` | Clock inside the popup |
|
||||||
| `.popup-clock .calendar` | Calendar widget inside the popup. GTK provides some OOTB styling options for this. |
|
| `.popup-clock .calendar` | Calendar widget inside the popup. GTK provides some OOTB styling options for this. |
|
||||||
|
|
||||||
For more information on styling, please see the [styling guide](styling-guide).
|
For more information on styling, please see the [styling guide](styling-guide).
|
||||||
|
|
|
@ -99,8 +99,10 @@ impl Module<Button> for ClockModule {
|
||||||
info: &ModuleInfo,
|
info: &ModuleInfo,
|
||||||
) -> Result<ModuleParts<Button>> {
|
) -> Result<ModuleParts<Button>> {
|
||||||
let button = Button::new();
|
let button = Button::new();
|
||||||
let label = Label::new(None);
|
let label = Label::builder()
|
||||||
label.set_angle(info.bar_position.get_angle());
|
.angle(info.bar_position.get_angle())
|
||||||
|
.use_markup(true)
|
||||||
|
.build();
|
||||||
button.add(&label);
|
button.add(&label);
|
||||||
|
|
||||||
let tx = context.tx.clone();
|
let tx = context.tx.clone();
|
||||||
|
@ -132,7 +134,10 @@ impl Module<Button> for ClockModule {
|
||||||
) -> Option<gtk::Box> {
|
) -> Option<gtk::Box> {
|
||||||
let container = gtk::Box::new(Orientation::Vertical, 0);
|
let container = gtk::Box::new(Orientation::Vertical, 0);
|
||||||
|
|
||||||
let clock = Label::builder().halign(Align::Center).build();
|
let clock = Label::builder()
|
||||||
|
.halign(Align::Center)
|
||||||
|
.use_markup(true)
|
||||||
|
.build();
|
||||||
clock.add_class("calendar-clock");
|
clock.add_class("calendar-clock");
|
||||||
|
|
||||||
container.add(&clock);
|
container.add(&clock);
|
||||||
|
|
Loading…
Add table
Reference in a new issue