From 7829a18d8049087eaa963fb922a8701cc9851979 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 13 Nov 2026 09:55:00 +0100 Subject: feat(island): date and time format settings The clock pill hard-coded "ddd dd/MM" and "HH:mm", and the calendar its day headings. A new Date and time page in the Island bar group picks a 24- or 12-hour clock and one of 22 date formats, grouped by order (day, month or year first) and each shown as today's date. The calendar's headings and editor dates keep spelling the month out and follow the chosen order; agenda times and the hour picker go compact on the 12-hour clock ("9:30p", "1p"), where width is short. A preview mocks the pill and panel with the unsaved choice. The formats live in Cal.js (DATE_GROUPS), which Prefs imports to validate island.dateFormat. Event times still store and show as 24-hour HH:MM, since that is what calctl speaks, but normTime now also accepts am and pm ("9.30pm", "12am"), rejecting an hour outside 1 to 12 with one. Co-Authored-By: Claude Opus 5.5 --- desktop/Prefs.qml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'desktop/Prefs.qml') diff --git a/desktop/Prefs.qml b/desktop/Prefs.qml index 09960c4..1d24796 100644 --- a/desktop/Prefs.qml +++ b/desktop/Prefs.qml @@ -14,6 +14,7 @@ pragma Singleton import Quickshell import Quickshell.Io import QtQuick +import "island/calendar/Cal.js" as Cal // Preferences that must survive a reboot, in one JSON file under the state // home. Only the shell writes it, which is why it is not in ~/.config. @@ -86,8 +87,10 @@ Singleton { // The island bar's settings (modules/island): the length a new event gets, // and that its end keeps from the start, in minutes; the pills left to - // right, the first two left of the screen's centre, the last two right. - readonly property var islandDefaults: ({ eventMinutes: 60, pills: ["media", "clock", "status", "obs"] }) + // right, the first two left of the screen's centre, the last two right; the + // clock, 12-hour or not, and the date's format (island/calendar/Cal.js). + readonly property var islandDefaults: ({ eventMinutes: 60, pills: ["media", "clock", "status", "obs"], + h12: false, dateFormat: Cal.DATE_FORMATS[0] }) property var island: islandDefaults function setIsland(changes) { root.island = Object.assign({}, root.island, changes); @@ -171,6 +174,8 @@ Singleton { pills: Array.isArray(isl.pills) && isl.pills.length === 4 && root.islandDefaults.pills.every(p => isl.pills.includes(p)) ? isl.pills.slice() : root.islandDefaults.pills, + h12: isl.h12 === true, + dateFormat: Cal.shortDateFmt(isl.dateFormat), }; } -- cgit v1.2.3