aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/Prefs.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-13 09:55:00 +0100
committerDanilo M. <danix@danix.xyz>2026-11-13 09:55:00 +0100
commit7829a18d8049087eaa963fb922a8701cc9851979 (patch)
tree0ce6c851a96ff4f337a47ac40d6253a9f8f7f079 /desktop/Prefs.qml
parent70d2b0c0e2e83dd2f17bd49dc2f06d39a7f7f4cf (diff)
downloadquickshell-7829a18d8049087eaa963fb922a8701cc9851979.tar.gz
quickshell-7829a18d8049087eaa963fb922a8701cc9851979.zip
feat(island): date and time format settingsHEADmaster
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 <noreply@anthropic.com>
Diffstat (limited to 'desktop/Prefs.qml')
-rw-r--r--desktop/Prefs.qml9
1 files changed, 7 insertions, 2 deletions
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),
};
}