diff options
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/Bar.qml | 2 | ||||
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/Clock.qml | 137 | ||||
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml | 4 | ||||
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/SystemTray.qml | 48 |
4 files changed, 117 insertions, 74 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Bar.qml b/accounts/gkleen@sif/shell/quickshell/Bar.qml index 2f323858..accad2a9 100644 --- a/accounts/gkleen@sif/shell/quickshell/Bar.qml +++ b/accounts/gkleen@sif/shell/quickshell/Bar.qml | |||
@@ -22,7 +22,7 @@ PanelWindow { | |||
22 | color: "transparent" | 22 | color: "transparent" |
23 | 23 | ||
24 | Rectangle { | 24 | Rectangle { |
25 | color: Qt.rgba(0, 0, 0, 0.66) | 25 | color: Qt.rgba(0, 0, 0, 0.75) |
26 | anchors.fill: parent | 26 | anchors.fill: parent |
27 | // bottomLeftRadius: 8 | 27 | // bottomLeftRadius: 8 |
28 | // bottomRightRadius: 8 | 28 | // bottomRightRadius: 8 |
diff --git a/accounts/gkleen@sif/shell/quickshell/Clock.qml b/accounts/gkleen@sif/shell/quickshell/Clock.qml index 56f8d41f..3e0f8200 100644 --- a/accounts/gkleen@sif/shell/quickshell/Clock.qml +++ b/accounts/gkleen@sif/shell/quickshell/Clock.qml | |||
@@ -61,18 +61,20 @@ Item { | |||
61 | Repeater { | 61 | Repeater { |
62 | model: 12 | 62 | model: 12 |
63 | 63 | ||
64 | Column { | 64 | GridLayout { |
65 | columns: 2 | ||
66 | |||
65 | required property int index | 67 | required property int index |
66 | property int month: index | 68 | property int month: index |
67 | 69 | ||
68 | id: monthCalendar | 70 | id: monthCalendar |
69 | 71 | ||
70 | width: parent.width | ||
71 | |||
72 | Layout.alignment: Qt.AlignTop | Qt.AlignRight | 72 | Layout.alignment: Qt.AlignTop | Qt.AlignRight |
73 | Layout.fillWidth: false | ||
73 | 74 | ||
74 | Text { | 75 | Text { |
75 | width: parent.width | 76 | Layout.column: 1 |
77 | Layout.fillWidth: true | ||
76 | 78 | ||
77 | horizontalAlignment: Text.AlignHCenter | 79 | horizontalAlignment: Text.AlignHCenter |
78 | 80 | ||
@@ -87,96 +89,93 @@ Item { | |||
87 | color: "#ffead3" | 89 | color: "#ffead3" |
88 | } | 90 | } |
89 | 91 | ||
90 | GridLayout { | 92 | DayOfWeekRow { |
91 | columns: 2 | 93 | locale: grid.locale |
92 | 94 | ||
93 | DayOfWeekRow { | 95 | Layout.row: 1 |
94 | locale: grid.locale | 96 | Layout.column: 1 |
97 | Layout.fillWidth: true | ||
95 | 98 | ||
96 | Layout.column: 1 | 99 | delegate: Text { |
97 | Layout.fillWidth: true | 100 | required property string shortName |
98 | 101 | ||
99 | delegate: Text { | 102 | font.pointSize: 10 |
100 | required property string shortName | 103 | font.family: "Fira Mono" |
101 | |||
102 | font.pointSize: 10 | ||
103 | font.family: "Fira Mono" | ||
104 | 104 | ||
105 | text: shortName | 105 | text: shortName |
106 | color: "#ffcc66" | 106 | color: "#ffcc66" |
107 | 107 | ||
108 | horizontalAlignment: Text.AlignRight | 108 | horizontalAlignment: Text.AlignRight |
109 | verticalAlignment: Text.AlignVCenter | 109 | verticalAlignment: Text.AlignVCenter |
110 | } | ||
111 | } | 110 | } |
111 | } | ||
112 | 112 | ||
113 | WeekNumberColumn { | 113 | WeekNumberColumn { |
114 | month: grid.month | 114 | month: grid.month |
115 | year: grid.year | 115 | year: grid.year |
116 | locale: grid.locale | 116 | locale: grid.locale |
117 | |||
118 | Layout.fillHeight: true | ||
119 | 117 | ||
120 | delegate: Text { | 118 | Layout.fillHeight: true |
121 | required property int weekNumber | ||
122 | 119 | ||
123 | opacity: { | 120 | delegate: Text { |
124 | const simple = new Date(weekNumber == 1 && monthCalendar.month == 12 ? yearCalendar.year + 1 : yearCalendar.year, 0, 1 + (weekNumber - 1) * 7); | 121 | required property int weekNumber |
125 | const dayOfWeek = simple.getDay(); | ||
126 | const isoWeekStart = simple; | ||
127 | 122 | ||
128 | isoWeekStart.setDate(simple.getDate() - dayOfWeek + 1); | 123 | opacity: { |
129 | if (dayOfWeek > 4) { | 124 | const simple = new Date(weekNumber == 1 && monthCalendar.month == 12 ? yearCalendar.year + 1 : yearCalendar.year, 0, 1 + (weekNumber - 1) * 7); |
130 | isoWeekStart.setDate(isoWeekStart.getDate() + 7); | 125 | const dayOfWeek = simple.getDay(); |
131 | } | 126 | const isoWeekStart = simple; |
132 | 127 | ||
133 | for (let i = 0; i < 7; i++) { | 128 | isoWeekStart.setDate(simple.getDate() - dayOfWeek + 1); |
134 | const dayInWeek = isoWeekStart; | 129 | if (dayOfWeek > 4) { |
135 | dayInWeek.setDate(dayInWeek.getDate() + i); | 130 | isoWeekStart.setDate(isoWeekStart.getDate() + 7); |
136 | if (dayInWeek.getMonth() == monthCalendar.month) | 131 | } |
137 | return 1; | ||
138 | } | ||
139 | 132 | ||
140 | return 0; | 133 | for (let i = 0; i < 7; i++) { |
134 | const dayInWeek = isoWeekStart; | ||
135 | dayInWeek.setDate(dayInWeek.getDate() + i); | ||
136 | if (dayInWeek.getMonth() == monthCalendar.month) | ||
137 | return 1; | ||
141 | } | 138 | } |
142 | 139 | ||
143 | font.pointSize: 10 | 140 | return 0; |
144 | font.family: "Fira Sans" | 141 | } |
145 | font.features: { "tnum": 1 } | ||
146 | 142 | ||
147 | text: weekNumber | 143 | font.pointSize: 10 |
148 | color: "#99ffdd" | 144 | font.family: "Fira Sans" |
145 | font.features: { "tnum": 1 } | ||
149 | 146 | ||
150 | horizontalAlignment: Text.AlignRight | 147 | text: weekNumber |
151 | verticalAlignment: Text.AlignVCenter | 148 | color: "#99ffdd" |
152 | } | 149 | |
150 | horizontalAlignment: Text.AlignRight | ||
151 | verticalAlignment: Text.AlignVCenter | ||
153 | } | 152 | } |
153 | } | ||
154 | 154 | ||
155 | MonthGrid { | 155 | MonthGrid { |
156 | id: grid | 156 | id: grid |
157 | 157 | ||
158 | year: yearCalendar.year | 158 | year: yearCalendar.year |
159 | month: monthCalendar.month | 159 | month: monthCalendar.month |
160 | locale: Qt.locale("en_DK") | 160 | locale: Qt.locale("en_DK") |
161 | 161 | ||
162 | Layout.fillWidth: true | 162 | Layout.fillWidth: true |
163 | Layout.fillHeight: true | 163 | Layout.fillHeight: true |
164 | 164 | ||
165 | delegate: Text { | 165 | delegate: Text { |
166 | required property var model | 166 | required property var model |
167 | 167 | ||
168 | opacity: model.month === monthCalendar.month ? 1 : 0 | 168 | opacity: model.month === monthCalendar.month ? 1 : 0 |
169 | 169 | ||
170 | font.pointSize: 10 | 170 | font.pointSize: 10 |
171 | font.family: "Fira Sans" | 171 | font.family: "Fira Sans" |
172 | font.features: { "tnum": 1 } | 172 | font.features: { "tnum": 1 } |
173 | 173 | ||
174 | text: model.day | 174 | text: model.day |
175 | color: model.today ? "#ff6699" : "white" | 175 | color: model.today ? "#ff6699" : "white" |
176 | 176 | ||
177 | horizontalAlignment: Text.AlignRight | 177 | horizontalAlignment: Text.AlignRight |
178 | verticalAlignment: Text.AlignVCenter | 178 | verticalAlignment: Text.AlignVCenter |
179 | } | ||
180 | } | 179 | } |
181 | } | 180 | } |
182 | } | 181 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml index 4d3bd180..710ea10c 100644 --- a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml +++ b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml | |||
@@ -56,8 +56,8 @@ Rectangle { | |||
56 | } | 56 | } |
57 | visible: kbdMouseArea.containsMouse | 57 | visible: kbdMouseArea.containsMouse |
58 | 58 | ||
59 | implicitWidth: kbdTooltipText.contentWidth + 4 | 59 | implicitWidth: kbdTooltipText.contentWidth + 16 |
60 | implicitHeight: kbdTooltipText.contentHeight + 4 | 60 | implicitHeight: kbdTooltipText.contentHeight + 16 |
61 | color: "black" | 61 | color: "black" |
62 | 62 | ||
63 | Text { | 63 | Text { |
diff --git a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml index a02a81fd..afed4bf0 100644 --- a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml +++ b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml | |||
@@ -17,7 +17,11 @@ Item { | |||
17 | spacing: 0 | 17 | spacing: 0 |
18 | 18 | ||
19 | Repeater { | 19 | Repeater { |
20 | model: SystemTray.items.values | 20 | model: { |
21 | var trayItems = Array.from(SystemTray.items.values).filter(item => item.status !== Status.Passive); | ||
22 | trayItems.sort((a, b) => a.category !== b.category ? b.category - a.category : a.id.localeCompare(b.id)) | ||
23 | return trayItems; | ||
24 | } | ||
21 | 25 | ||
22 | delegate: Item { | 26 | delegate: Item { |
23 | property var trayItem: modelData | 27 | property var trayItem: modelData |
@@ -59,7 +63,7 @@ Item { | |||
59 | anchors.fill: parent | 63 | anchors.fill: parent |
60 | acceptedButtons: Qt.LeftButton | Qt.RightButton | 64 | acceptedButtons: Qt.LeftButton | Qt.RightButton |
61 | hoverEnabled: true | 65 | hoverEnabled: true |
62 | cursorShape: Qt.PointingHandCursor | 66 | cursorShape: trayItem.onlyMenu ? Qt.ArrowCursor : Qt.PointingHandCursor |
63 | onClicked: mouse => { | 67 | onClicked: mouse => { |
64 | if (!trayItem) | 68 | if (!trayItem) |
65 | return | 69 | return |
@@ -85,6 +89,46 @@ Item { | |||
85 | } | 89 | } |
86 | } | 90 | } |
87 | } | 91 | } |
92 | |||
93 | PopupWindow { | ||
94 | anchor { | ||
95 | item: trayItemArea | ||
96 | edges: Edges.Bottom | ||
97 | } | ||
98 | visible: (trayItem.tooltipTitle || trayItem.tooltipDescription) && trayItemArea.containsMouse && !menuAnchor.visible | ||
99 | |||
100 | color: "black" | ||
101 | |||
102 | implicitWidth: Math.max(tooltipTitle.contentWidth, tooltipDescription.contentWidth) + 16 | ||
103 | implicitHeight: tooltipTitle.contentHeight + tooltipDescription.contentHeight + 16 | ||
104 | |||
105 | WrapperItem { | ||
106 | margin: 8 | ||
107 | |||
108 | Column { | ||
109 | Text { | ||
110 | id: tooltipTitle | ||
111 | |||
112 | font.pointSize: 10 | ||
113 | font.family: "Fira Sans" | ||
114 | font.bold: true | ||
115 | color: "white" | ||
116 | |||
117 | text: trayItem.tooltipTitle | ||
118 | } | ||
119 | |||
120 | Text { | ||
121 | id: tooltipDescription | ||
122 | |||
123 | font.pointSize: 10 | ||
124 | font.family: "Fira Sans" | ||
125 | color: "white" | ||
126 | |||
127 | text: trayItem.tooltipDescription | ||
128 | } | ||
129 | } | ||
130 | } | ||
131 | } | ||
88 | } | 132 | } |
89 | } | 133 | } |
90 | } | 134 | } |