feat: add top panel widgets
This commit is contained in:
1 parent
352c1307fe
commit
b8085e0e2a
14 files changed
+1016
-47
No files matched your search
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "desktop_internal.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include <montauk/config.h>
|
||||
#include <montauk/user.h>
|
||||
#include <gui/clipboard.hpp>
|
||||
@@ -241,6 +242,9 @@ void gui::desktop_init(DesktopState* ds) {
|
||||
ds->settings.clock_24h = true;
|
||||
ds->settings.ui_scale = 1;
|
||||
ds->settings.tz_offset_minutes = 60; // default CET (UTC+1)
|
||||
ds->settings.panel_widget_count = 0; // nothing pinned until the user asks
|
||||
ds->settings.weather_fahrenheit = false;
|
||||
desktop_widgets_init(ds);
|
||||
|
||||
// Load per-user desktop settings
|
||||
{
|
||||
@@ -294,6 +298,11 @@ void gui::desktop_init(DesktopState* ds) {
|
||||
ds->settings.clock_24h = doc.get_bool("display.clock_24h", true);
|
||||
ds->settings.show_shadows = doc.get_bool("display.show_shadows", true);
|
||||
|
||||
// Top bar widgets
|
||||
desktop_widgets_load_list(ds, doc.get_string("panel.widgets", ""));
|
||||
ds->settings.weather_fahrenheit =
|
||||
montauk::streq(doc.get_string("widgets.weather_unit", "c"), "f");
|
||||
|
||||
doc.destroy();
|
||||
}
|
||||
|
||||
@@ -449,6 +458,7 @@ static bool desktop_refresh_panel_state(DesktopState* ds, uint64_t now) {
|
||||
if (desktop_wifi_poll(ds, now)) changed = true;
|
||||
if (desktop_battery_poll(ds, now)) changed = true;
|
||||
if (desktop_brightness_poll(ds, now)) changed = true;
|
||||
if (desktop_widgets_poll(ds, now)) changed = true;
|
||||
|
||||
// Event-driven sync: the kernel mixer bumps a serial on every state
|
||||
// change. Reading it is one cheap syscall; refresh only when the serial
|
||||
|
||||
Reference in new issue
Block a user