Initial commit of the Quickshell desktop suite: bar, dock, launcher, settings, Control Center, dashboard, OSD, lock screen, desktop widgets, plugin host with the vendored Noctalia/Omarchy compatibility layer, helpers, packaging, tests and phase documentation. Includes the optimization work so far: usage widgets and dashboard gauges no longer animate continuously, desktop widgets pause while covered, system controls stop flickering on background polls, dock app matching uses an indexed catalog, and workspace ghosts are created only for occupied slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
113 lines
4.1 KiB
QML
113 lines
4.1 KiB
QML
pragma ComponentBehavior: Bound
|
||
import QtQuick
|
||
import QtQuick.Layouts
|
||
import Quickshell
|
||
import "../../theme"
|
||
|
||
// Month view starting on the locale's first weekday; arrows browse months.
|
||
Face {
|
||
id: root
|
||
SystemClock {
|
||
id: clock
|
||
precision: SystemClock.Minutes
|
||
}
|
||
property int offset: 0
|
||
readonly property date today: clock.date
|
||
readonly property date shown: new Date(today.getFullYear(), today.getMonth() + offset, 1)
|
||
readonly property int firstDay: Qt.locale().firstDayOfWeek % 7
|
||
readonly property var cells: {
|
||
const start = (shown.getDay() - firstDay + 7) % 7;
|
||
const result = [];
|
||
for (let i = 0; i < 42; i++)
|
||
result.push(new Date(shown.getFullYear(), shown.getMonth(), 1 - start + i));
|
||
return result;
|
||
}
|
||
ColumnLayout {
|
||
anchors.fill: parent
|
||
anchors.margins: 14
|
||
spacing: 6
|
||
RowLayout {
|
||
Layout.fillWidth: true
|
||
Text {
|
||
text: Qt.formatDate(root.shown, "MMMM yyyy")
|
||
color: Theme.text
|
||
font.pixelSize: 14
|
||
font.weight: Font.DemiBold
|
||
Layout.fillWidth: true
|
||
}
|
||
Repeater {
|
||
model: [-1, 1]
|
||
Rectangle {
|
||
id: arrow
|
||
required property int modelData
|
||
implicitWidth: 22
|
||
implicitHeight: 22
|
||
radius: 11
|
||
color: arrowArea.containsMouse ? Theme.hover : Theme.transparent
|
||
Text {
|
||
anchors.centerIn: parent
|
||
text: arrow.modelData < 0 ? "‹" : "›"
|
||
color: Theme.textSecondary
|
||
font.pixelSize: 16
|
||
}
|
||
MouseArea {
|
||
id: arrowArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
cursorShape: Qt.PointingHandCursor
|
||
onClicked: root.offset += arrow.modelData
|
||
}
|
||
}
|
||
}
|
||
}
|
||
GridLayout {
|
||
Layout.fillWidth: true
|
||
Layout.fillHeight: true
|
||
columns: 7
|
||
rowSpacing: 0
|
||
columnSpacing: 0
|
||
Repeater {
|
||
model: 7
|
||
Text {
|
||
required property int index
|
||
text: Qt.locale().dayName((root.firstDay + index) % 7, Locale.NarrowFormat)
|
||
color: Theme.textSecondary
|
||
font.pixelSize: 10
|
||
font.weight: Font.DemiBold
|
||
horizontalAlignment: Text.AlignHCenter
|
||
Layout.fillWidth: true
|
||
}
|
||
}
|
||
Repeater {
|
||
model: root.cells
|
||
Item {
|
||
id: cell
|
||
required property date modelData
|
||
readonly property bool isToday: modelData.toDateString() === root.today.toDateString()
|
||
readonly property bool inMonth: modelData.getMonth() === root.shown.getMonth()
|
||
Layout.fillWidth: true
|
||
Layout.fillHeight: true
|
||
Rectangle {
|
||
anchors.centerIn: parent
|
||
width: Math.min(parent.width, parent.height) - 2
|
||
height: width
|
||
radius: width / 2
|
||
color: Theme.accent
|
||
visible: cell.isToday
|
||
}
|
||
Text {
|
||
anchors.centerIn: parent
|
||
text: cell.modelData.getDate()
|
||
color: cell.isToday ? Theme.accentText : Theme.text
|
||
opacity: cell.inMonth ? 1 : 0.3
|
||
font.pixelSize: 11
|
||
font.weight: cell.isToday ? Font.DemiBold : Font.Normal
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
// Jump back to the current month when the day changes.
|
||
onTodayChanged: offset = 0
|
||
}
|