summaryrefslogtreecommitdiff
path: root/accounts
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-08-31 11:56:56 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2025-08-31 11:56:56 +0200
commit97423da1a1e58a2820d12bed5b36f0896fd3cccc (patch)
tree26e910659e498f03e80548c12ef00cea0a120401 /accounts
parent2f0e13af015d5bfdbac77d2340e8f4810929620a (diff)
downloadnixos-97423da1a1e58a2820d12bed5b36f0896fd3cccc.tar
nixos-97423da1a1e58a2820d12bed5b36f0896fd3cccc.tar.gz
nixos-97423da1a1e58a2820d12bed5b36f0896fd3cccc.tar.bz2
nixos-97423da1a1e58a2820d12bed5b36f0896fd3cccc.tar.xz
nixos-97423da1a1e58a2820d12bed5b36f0896fd3cccc.zip
...
Diffstat (limited to 'accounts')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/Bar.qml218
1 files changed, 203 insertions, 15 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Bar.qml b/accounts/gkleen@sif/shell/quickshell/Bar.qml
index 520ec2c6..9cb58b93 100644
--- a/accounts/gkleen@sif/shell/quickshell/Bar.qml
+++ b/accounts/gkleen@sif/shell/quickshell/Bar.qml
@@ -5,6 +5,9 @@ import Quickshell.Widgets
5import Custom as Custom 5import Custom as Custom
6import QtQuick 6import QtQuick
7import qs.Services 7import qs.Services
8import QtQuick.Controls
9import QtQuick.Layouts
10import QtQml
8 11
9 12
10PanelWindow { 13PanelWindow {
@@ -309,10 +312,9 @@ PanelWindow {
309 } 312 }
310 } 313 }
311 314
312 Rectangle { 315 Item {
313 height: parent.height 316 height: parent.height
314 width: 4 317 width: 4
315 color: "transparent"
316 } 318 }
317 319
318 Rectangle { 320 Rectangle {
@@ -361,30 +363,216 @@ PanelWindow {
361 return kbdWidget.keyboardAbbrev[currentLayout] ? kbdWidget.keyboardAbbrev[currentLayout] : currentLayout; 363 return kbdWidget.keyboardAbbrev[currentLayout] ? kbdWidget.keyboardAbbrev[currentLayout] : currentLayout;
362 } 364 }
363 } 365 }
366
367 PopupWindow {
368 anchor {
369 item: kbdMouseArea
370 edges: Edges.Bottom
371 }
372 visible: kbdMouseArea.containsMouse
373
374 implicitWidth: kbdTooltipText.contentWidth + 4
375 implicitHeight: kbdTooltipText.contentHeight + 4
376 color: "black"
377
378 Text {
379 id: kbdTooltipText
380
381 anchors.centerIn: parent
382
383 font.pointSize: 10
384 font.family: "Fira Sans"
385 color: "white"
386
387 text: {
388 const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx];
389 return currentLayout || "";
390 }
391 }
392 }
364 } 393 }
365 394
366 Rectangle { 395 Item {
367 height: parent.height 396 height: parent.height
368 width: 4 397 width: 4
369 color: "transparent"
370 } 398 }
371 399
372 Text { 400 Item {
373 id: clock 401 width: clock.contentWidth
374 color: "white" 402 height: parent.height
375
376 anchors.verticalCenter: parent.verticalCenter 403 anchors.verticalCenter: parent.verticalCenter
377 404
378 Custom.Chrono { 405 MouseArea {
379 id: chrono 406 id: clockMouseArea
380 format: "W{0:%V-%u} {0:%F} {0:%H:%M:%S%Ez}" 407
408 anchors.fill: parent
409 hoverEnabled: true
410 enabled: true
411 }
412
413 Text {
414 id: clock
415 color: "white"
416
417 anchors.verticalCenter: parent.verticalCenter
418
419 Custom.Chrono {
420 id: chrono
421 format: "W{0:%V-%u} {0:%F} {0:%H:%M:%S%Ez}"
422 }
423
424 text: chrono.date
425
426 font.pointSize: 10
427 font.family: "Fira Sans"
428 font.features: { "tnum": 1 }
381 } 429 }
382 430
383 text: chrono.date 431 PopupWindow {
432 anchor {
433 item: clockMouseArea
434 edges: Edges.Bottom
435 }
436 visible: clockMouseArea.containsMouse
437
438 implicitWidth: yearCalendar.implicitWidth + 16
439 implicitHeight: yearCalendar.implicitHeight + 16
440 color: "black"
441
442 GridLayout {
443 property int year: { const d = new Date(); return d.getFullYear(); }
444
445 id: yearCalendar
446
447 columns: 3
448 columnSpacing: 16
449 rowSpacing: 16
450
451 anchors.centerIn: parent
452
453 Repeater {
454 model: 12
455
456 Column {
457 required property int index
458 property int month: index
459
460 id: monthCalendar
384 461
385 font.pointSize: 10 462 width: parent.width
386 font.family: "Fira Sans" 463
387 font.features: { "tnum": 1 } 464 Text {
465 width: parent.width
466
467 horizontalAlignment: Text.AlignHCenter
468
469 font.pointSize: 10
470 font.family: "Fira Sans"
471
472 text: {
473 const date = Date.fromLocaleDateString(Qt.locale(), `${yearCalendar.year}-${monthCalendar.month + 1}-01`, "yyyy-M-dd");
474 return date.toLocaleString(Qt.locale("en_DK"), "MMMM")
475 }
476
477 color: "#ffead3"
478 }
479
480 GridLayout {
481 columns: 2
482
483 DayOfWeekRow {
484 locale: grid.locale
485
486 Layout.column: 1
487 Layout.fillWidth: true
488
489 delegate: Text {
490 required property string shortName
491
492 font.pointSize: 10
493 font.family: "Fira Mono"
494
495 text: shortName
496 color: "#ffcc66"
497
498 horizontalAlignment: Text.AlignRight
499 verticalAlignment: Text.AlignVCenter
500 }
501 }
502
503 WeekNumberColumn {
504 month: grid.month
505 year: grid.year
506 locale: grid.locale
507
508 Layout.fillHeight: true
509
510 delegate: Text {
511 required property int weekNumber
512
513 opacity: {
514 const simple = new Date(weekNumber == 1 && monthCalendar.month == 12 ? yearCalendar.year + 1 : yearCalendar.year, 0, 1 + (weekNumber - 1) * 7);
515 const dayOfWeek = simple.getDay();
516 const isoWeekStart = simple;
517
518 isoWeekStart.setDate(simple.getDate() - dayOfWeek + 1);
519 if (dayOfWeek > 4) {
520 isoWeekStart.setDate(isoWeekStart.getDate() + 7);
521 }
522
523 for (let i = 0; i < 7; i++) {
524 const dayInWeek = isoWeekStart;
525 dayInWeek.setDate(dayInWeek.getDate() + i);
526 if (dayInWeek.getMonth() == monthCalendar.month)
527 return 1;
528 }
529
530 return 0;
531 }
532
533 font.pointSize: 10
534 font.family: "Fira Sans"
535 font.features: { "tnum": 1 }
536
537 text: weekNumber
538 color: "#99ffdd"
539
540 horizontalAlignment: Text.AlignRight
541 verticalAlignment: Text.AlignVCenter
542 }
543 }
544
545 MonthGrid {
546 id: grid
547
548 year: yearCalendar.year
549 month: monthCalendar.month
550 locale: Qt.locale("en_DK")
551
552 Layout.fillWidth: true
553 Layout.fillHeight: true
554
555 delegate: Text {
556 required property var model
557
558 opacity: model.month === monthCalendar.month ? 1 : 0
559
560 font.pointSize: 10
561 font.family: "Fira Sans"
562 font.features: { "tnum": 1 }
563
564 text: model.day
565 color: model.today ? "#ff6699" : "white"
566
567 horizontalAlignment: Text.AlignRight
568 verticalAlignment: Text.AlignVCenter
569 }
570 }
571 }
572 }
573 }
574 }
575 }
388 } 576 }
389 } 577 }
390} \ No newline at end of file 578} \ No newline at end of file