repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix nuguland calendar popup

72542113b311bacf5d1f4411e3cd1f5b667e9bbe

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (4)

quickshell/nuguland/Bar.qml

Modified
287 287 id: workspaceChip
289 289 readonly property bool active: !!pillWrap.modelData.is_focused
290 - readonly property string idxStr: String(pillWrap.modelData.idx || pillWrap.modelData.id || "?")
290 + readonly property string idxStr: String(pillWrap.modelData.shortcut || pillWrap.modelData.idx || pillWrap.modelData.id || "?")
291 291 readonly property string nameStr: pillWrap.modelData.name ? String(pillWrap.modelData.name).toLowerCase() : ""
292 292 readonly property string abbrName: root.formatService && workspaceChip.nameStr ? root.formatService.abbreviate(workspaceChip.nameStr) : ""
331 331 hoverEnabled: true
332 332 cursorShape: Qt.PointingHandCursor
333 333 onClicked: {
334 - // focus by unique name (works cross-output); idx/id
335 - // fallback only for the unnamed, which are filtered out.
336 334 if (root.niriService)
337 335 root.niriService.focusWorkspace(pillWrap.modelData.name || pillWrap.modelData.idx || pillWrap.modelData.id);

quickshell/nuguland/CalDav.qml

Modified
37 37 secretError: secretError,
38 38 host: host,
39 39 username: config ? config.username : "",
40 + setupDraftUrl: setupUrlDraft,
41 + setupDraftUsername: setupUsernameDraft,
42 + setupDraftHasPassword: setupPasswordDraft.length > 0,
40 43 calendarCount: config && config.calendars ? config.calendars.length : 0,
41 44 eventCount: events ? events.length : 0
73 76 const back = new Date(Date.UTC(+w.start.slice(0, 4), +w.start.slice(4, 6) - 1, +w.start.slice(6, 8), +w.start.slice(9, 11), +w.start.slice(11, 13), +w.start.slice(13, 15)));
74 77 const spanDays = (Date.UTC(+w.end.slice(0, 4), +w.end.slice(4, 6) - 1, +w.end.slice(6, 8), +w.end.slice(9, 11)) - Date.UTC(+w.start.slice(0, 4), +w.start.slice(4, 6) - 1, +w.start.slice(6, 8), +w.start.slice(9, 11))) / 86400000;
75 78 ok("window", shape.test(w.start) && shape.test(w.end) && back.getFullYear() === 2026 && back.getMonth() === 5 && back.getDate() === 8 && back.getHours() === 0 && spanDays === 42); // local-midnight round-trip + 42-day span, timezone-independent
79 + const oldUrlDraft = root.setupUrlDraft;
80 + const oldUserDraft = root.setupUsernameDraft;
81 + const oldPwDraft = root.setupPasswordDraft;
82 + try {
83 + root.setSetupDraft("https://dav.example", "alice", "pw");
84 + ok("setup-draft", root.setupUrlDraft === "https://dav.example" && root.setupUsernameDraft === "alice" && root.setupPasswordDraft === "pw");
85 + } finally {
86 + root.setSetupDraft(oldUrlDraft, oldUserDraft, oldPwDraft);
87 + }
76 88 } catch (e) {
77 89 ok("threw:" + e, false);
94 106 root.config.url = String(data.url || "");
95 107 root.config.username = String(data.username || "");
96 108 root.config.calendars = data.calendars || [];
109 + if (!root.setupUrlDraft)
110 + root.setupUrlDraft = root.config.url;
111 + if (!root.setupUsernameDraft)
112 + root.setupUsernameDraft = root.config.username;
99 115 function persistConfig() {
276 292 // non-empty when the last keyring write failed; shown in the setup form
277 293 property string secretError: ""
294 + property string setupUrlDraft: ""
295 + property string setupUsernameDraft: ""
296 + property string setupPasswordDraft: ""
298 + function setSetupDraft(url, username, password) {
299 + root.setupUrlDraft = String(url || "");
300 + root.setupUsernameDraft = String(username || "");
301 + root.setupPasswordDraft = String(password || "");
279 304 // Persist url+username, store the password in gnome-keyring, then discover.
280 305 // Password reaches secret-tool via stdin (printf is a shell builtin, so it
281 306 // never appears in argv/ps); it travels QML->sh only as a transient env var.
282 307 function saveSetup(url, username, password) {
283 308 root.secretError = "";
309 + root.setSetupDraft(url, username, password);
284 310 const u = String(url || "").trim().replace(/\/+$/, "");
285 311 const user = String(username || "").trim();
286 312 if (!u || !user || !password) {
293 319 root.secretError = "URL ungültig (https://… erwartet)";
294 320 return;
322 + root.setupUrlDraft = u;
323 + root.setupUsernameDraft = user;
296 324 root.config.url = u;
297 325 root.config.username = user;
298 326 root.config.calendars = [];
351 379 function onExited(code) {
352 380 if (code === 0) {
353 381 root.secretError = "";
382 + root.setupPasswordDraft = "";
354 383 root.discoverAndFetch();
355 384 } else {
356 385 root.status = "needs-setup";

quickshell/nuguland/Niri.qml

Modified
20 20 readonly property string focusedTitle: focusedWindowRecord ? (focusedWindowRecord.title || "") : ""
21 21 readonly property string focusedAppId: focusedWindowRecord ? (focusedWindowRecord.app_id || focusedWindowRecord.appId || "") : ""
22 22 readonly property string focusedOutputName: focusedOutputNameFromWorkspaces(workspaces)
23 + readonly property string keybindConfigPath: {
24 + const xdg = String(Quickshell.env("XDG_CONFIG_HOME") || "");
25 + const home = String(Quickshell.env("HOME") || "");
26 + return (xdg.length > 0 ? xdg : home + "/.config") + "/niri/cfg/keybinds.kdl";
27 + }
28 + property var workspaceShortcuts: ({})
24 30 function refresh() {
25 31 if (!available || query.running)
92 98 return "";
101 + function shortcutKey(sequence) {
102 + const parts = String(sequence || "").split("+");
103 + return parts.length > 0 ? parts[parts.length - 1] : "";
106 + function parseWorkspaceShortcuts(text) {
107 + const map = ({});
108 + const re = /(?:^|\n)\s*([^\s{]+)[^{]*\{([^{}]*)\}/g;
109 + let match;
110 + while ((match = re.exec(String(text || ""))) !== null) {
111 + const focus = /\bfocus-workspace\s+(?:"([^"]+)"|([^\s}]+))/.exec(match[2]);
112 + if (!focus)
113 + continue;
115 + const name = String(focus[1] || focus[2] || "");
116 + if (name.length > 0 && !map[name])
117 + map[name] = shortcutKey(match[1]);
119 + return map;
122 + function reloadWorkspaceShortcuts() {
123 + workspaceShortcuts = parseWorkspaceShortcuts(keybindFile.text());
126 + function workspaceShortcut(name) {
127 + return workspaceShortcuts[String(name || "")] || "";
95 130 // Group visible workspaces by output, each output's list idx-sorted, so the
96 131 // single primary bar renders every monitor's workspaces in its own tray.
97 132 // Pure: pass `items` for testing; defaults to the live workspace array.
105 140 byOutput[name] = [];
106 141 order.push(name);
108 - byOutput[name].push(vis[i]);
143 + byOutput[name].push(Object.assign({}, vis[i], {
144 + "shortcut": workspaceShortcut(vis[i].name)
145 + }));
110 147 return order.map(name => {
111 148 return {
219 256 failures.push(`focused output helper missing: ${error}`);
259 + try {
260 + const shortcuts = parseWorkspaceShortcuts('binds {\n Mod+1 { focus-workspace "code" }\n Mod+4 { focus-workspace "browser" }\n Mod+Shift+4 { move-column-to-workspace "browser" }\n}');
261 + if (shortcuts.code !== "1" || shortcuts.browser !== "4")
262 + failures.push(`workspace shortcuts ${JSON.stringify(shortcuts)} != code/browser 1/4`);
263 + } catch (error) {
264 + failures.push(`workspace shortcut parser missing: ${error}`);
222 267 return {
223 268 "pass": failures.length === 0,
224 269 "failures": failures
406 451 "outputCount": Array.isArray(outputs) ? outputs.length : Object.keys(outputs || {}).length,
407 452 "outputs": outputs,
408 453 "workspaces": workspaces,
454 + "workspaceShortcuts": workspaceShortcuts,
409 455 "overviewState": overviewState,
410 456 "focusedWindow": focusedWindow,
411 457 "focusedOutputName": focusedOutputName,
463 509 refresh();
512 + FileView {
513 + id: keybindFile
515 + path: root.keybindConfigPath
516 + preload: true
517 + printErrors: false
518 + onLoaded: root.reloadWorkspaceShortcuts()
519 + onLoadFailed: root.workspaceShortcuts = ({})
466 522 Process {
467 523 id: snapshot

quickshell/nuguland/PopoutHost.qml

Modified
462 - // multi-day band overlay: thin lane-stacked bars over the grid.
462 + // multi-day bands sit behind day numbers and dots.
463 463 // pitch derives from the live cell size; bands sit near the
464 464 // cell bottom, stacking upward per lane.
465 465 Item {
466 466 anchors.fill: monthGrid
467 - z: 2
467 + z: -1
469 469 Repeater {
470 470 model: clockCol.bandLayout.segments
491 491 // today's agenda: events + tasks, ○ for open tasks, ✓ for done; centered
492 492 Item {
493 + id: agendaFrame
493 495 visible: !clockCol.setupMode
494 496 width: parent ? parent.width : 0
495 - height: agendaCol.height
497 + height: Math.max(70, parent ? parent.height - y : agendaCol.height)
498 + clip: true
497 - Column {
498 - id: agendaCol
500 + Flickable {
501 + id: agendaFlick
500 - anchors.horizontalCenter: parent.horizontalCenter
501 - width: clockCol.gridW
502 - spacing: 4
503 + anchors.fill: parent
504 + contentWidth: clockCol.gridW
505 + contentHeight: agendaCol.height
506 + interactive: contentHeight > height
507 + boundsBehavior: Flickable.StopAtBounds
504 - Repeater {
505 - model: clockCol.todayItems
509 + Column {
510 + id: agendaCol
507 - Row {
508 - spacing: 6
512 + x: Math.round((agendaFrame.width - width) / 2)
513 + width: clockCol.gridW
514 + spacing: 4
510 - Rectangle {
511 - anchors.verticalCenter: parent.verticalCenter
512 - width: 6
513 - height: 6
514 - radius: 3
515 - color: modelData.color
516 + Repeater {
517 + model: clockCol.todayItems
518 - NuguText {
519 - theme: root.theme
520 - variant: "body"
521 - text: {
522 - const ev = modelData;
523 - const mark = ev.kind === "task" ? (ev.done ? "✓ " : "○ ") : "";
524 - let t = "";
525 - if (!ev.allDay && ev.startMs != null) {
526 - const d = new Date(ev.startMs);
527 - const p = function (n) {
528 - return (n < 10 ? "0" : "") + n;
529 - };
530 - t = p(d.getHours()) + ":" + p(d.getMinutes()) + " ";
519 + Row {
520 + spacing: 6
522 + Rectangle {
523 + anchors.verticalCenter: parent.verticalCenter
524 + width: 6
525 + height: 6
526 + radius: 3
527 + color: modelData.color
530 + NuguText {
531 + theme: root.theme
532 + variant: "body"
533 + text: {
534 + const ev = modelData;
535 + const mark = ev.kind === "task" ? (ev.done ? "✓ " : "○ ") : "";
536 + let t = "";
537 + if (!ev.allDay && ev.startMs != null) {
538 + const d = new Date(ev.startMs);
539 + const p = function (n) {
540 + return (n < 10 ? "0" : "") + n;
541 + };
542 + t = p(d.getHours()) + ":" + p(d.getMinutes()) + " ";
544 + return t + mark + (ev.summary || "(ohne Titel)");
532 - return t + mark + (ev.summary || "(ohne Titel)");
538 - NuguText {
539 - visible: clockCol.todayItems.length === 0
540 - theme: root.theme
541 - variant: "meta"
542 - text: "Keine Termine"
550 + NuguText {
551 + visible: clockCol.todayItems.length === 0
552 + theme: root.theme
553 + variant: "meta"
554 + text: "Keine Termine"
559 + Rectangle {
560 + visible: agendaFlick.interactive
561 + anchors.right: parent.right
562 + anchors.rightMargin: 2
563 + y: agendaFlick.contentY / Math.max(1, agendaFlick.contentHeight) * parent.height
564 + width: 3
565 + height: Math.max(18, parent.height * Math.min(1, parent.height / Math.max(parent.height, agendaFlick.contentHeight)))
566 + radius: 2
567 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.55) : "white"
547 571 // setup form: shown when the service has no usable config yet.
571 595 id: urlField
573 597 placeholder: "https://host/remote.php/dav"
598 + text: root.caldavService ? root.caldavService.setupUrlDraft : ""
599 + onEdited: text => {
600 + if (root.caldavService)
601 + root.caldavService.setupUrlDraft = text;
576 605 Field {
577 606 id: userField
579 608 placeholder: "Benutzername"
609 + text: root.caldavService ? root.caldavService.setupUsernameDraft : ""
610 + onEdited: text => {
611 + if (root.caldavService)
612 + root.caldavService.setupUsernameDraft = text;
582 616 Field {
585 619 placeholder: "App-Passwort"
586 620 secret: true
621 + text: root.caldavService ? root.caldavService.setupPasswordDraft : ""
622 + onEdited: text => {
623 + if (root.caldavService)
624 + root.caldavService.setupPasswordDraft = text;
589 628 Rectangle {
603 642 anchors.fill: parent
604 643 cursorShape: Qt.PointingHandCursor
605 644 onClicked: if (root.caldavService)
606 - root.caldavService.saveSetup(urlField.field.text, userField.field.text, pwField.field.text)
645 + root.caldavService.saveSetup(urlField.text, userField.text, pwField.text)
622 661 property alias field: ti
623 662 property string placeholder: ""
624 663 property bool secret: false
664 + property string text: ""
665 + signal edited(string text)
626 667 width: setupForm.width
627 668 height: 30
641 682 font.family: "IBM Plex Sans"
642 683 font.pixelSize: 13
643 684 echoMode: parent.secret ? TextInput.Password : TextInput.Normal
685 + text: parent.text
644 686 clip: true
687 + onTextEdited: parent.edited(text)
647 690 NuguText {