Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MacShell/CardWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,7 @@ Item {
scale: w.s; transformOrigin: Item.TopLeft
z: 3
sourceComponent: w.content
Binding { target: body.item; property: "width"; value: body.width; when: body.item !== null }
Binding { target: body.item; property: "height"; value: body.height; when: body.item !== null }
}
}
14 changes: 11 additions & 3 deletions MacShell/Desktop.qml
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,19 @@ Scope {
WlrLayershell.keyboardFocus: ((renameSheet.open || linkSheet.open || emojiSheet.open) && !root.picking) ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None

// The whole screen takes the pointer (empty desktop: selection rectangle, right-click menu) EXCEPT
// * a Player widget's buttons, which live in the widgets window and still have to be clickable, and
// * interactive widgets' buttons (Player, Reminders), which live in the widgets window and still have to be clickable, and
// * everything, while the widgets are being edited (the widgets window needs the pointer then).
mask: Region {
item: root.widgetsEditing ? null : iconLayer
regions: [
Region { item: pr0; intersection: Intersection.Subtract },
Region { item: pr1; intersection: Intersection.Subtract },
Region { item: pr2; intersection: Intersection.Subtract },
Region { item: pr3; intersection: Intersection.Subtract }
Region { item: pr3; intersection: Intersection.Subtract },
Region { item: pr4; intersection: Intersection.Subtract },
Region { item: pr5; intersection: Intersection.Subtract },
Region { item: pr6; intersection: Intersection.Subtract },
Region { item: pr7; intersection: Intersection.Subtract }
]
}

Expand Down Expand Up @@ -692,11 +696,15 @@ Scope {
id: iconLayer
anchors.fill: parent

// hit areas of the Player widgets' buttons, cut out of the mask above
// hit areas of the interactive widgets' buttons, cut out of the mask above
Item { id: pr0; x: root.playerRect(w.modelData.name, 0, 0); y: root.playerRect(w.modelData.name, 0, 1); width: root.playerRect(w.modelData.name, 0, 2); height: root.playerRect(w.modelData.name, 0, 3) }
Item { id: pr1; x: root.playerRect(w.modelData.name, 1, 0); y: root.playerRect(w.modelData.name, 1, 1); width: root.playerRect(w.modelData.name, 1, 2); height: root.playerRect(w.modelData.name, 1, 3) }
Item { id: pr2; x: root.playerRect(w.modelData.name, 2, 0); y: root.playerRect(w.modelData.name, 2, 1); width: root.playerRect(w.modelData.name, 2, 2); height: root.playerRect(w.modelData.name, 2, 3) }
Item { id: pr3; x: root.playerRect(w.modelData.name, 3, 0); y: root.playerRect(w.modelData.name, 3, 1); width: root.playerRect(w.modelData.name, 3, 2); height: root.playerRect(w.modelData.name, 3, 3) }
Item { id: pr4; x: root.playerRect(w.modelData.name, 4, 0); y: root.playerRect(w.modelData.name, 4, 1); width: root.playerRect(w.modelData.name, 4, 2); height: root.playerRect(w.modelData.name, 4, 3) }
Item { id: pr5; x: root.playerRect(w.modelData.name, 5, 0); y: root.playerRect(w.modelData.name, 5, 1); width: root.playerRect(w.modelData.name, 5, 2); height: root.playerRect(w.modelData.name, 5, 3) }
Item { id: pr6; x: root.playerRect(w.modelData.name, 6, 0); y: root.playerRect(w.modelData.name, 6, 1); width: root.playerRect(w.modelData.name, 6, 2); height: root.playerRect(w.modelData.name, 6, 3) }
Item { id: pr7; x: root.playerRect(w.modelData.name, 7, 0); y: root.playerRect(w.modelData.name, 7, 1); width: root.playerRect(w.modelData.name, 7, 2); height: root.playerRect(w.modelData.name, 7, 3) }

// A local monitor-sized wallpaper copy is the source for the right-click menu's glass.
// It is never visible on screen: opacity 0 (a ShaderEffectSource ignores its source's own opacity, the same idiom the
Expand Down
227 changes: 176 additions & 51 deletions MacShell/ExtraWidgets.qml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion MacShell/MacDock.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2900,7 +2900,8 @@ Scope {
{ type: "calendar", name: I18n.tr("Calendar"), hint: I18n.tr("Today's date and the month"), styles: [["liquid", I18n.tr("Liquid Glass")], ["normal", I18n.tr("Normal")]] },
{ type: "clock", name: I18n.tr("Clock"), hint: I18n.tr("Analog clock face"), styles: [["liquid", I18n.tr("Liquid Glass")], ["light", I18n.tr("Light")], ["dark", I18n.tr("Dark")]] },
{ type: "player", name: I18n.tr("Player"), hint: I18n.tr("Now Playing with controls and lyrics"), styles: [["liquid", I18n.tr("Liquid Glass")], ["light", I18n.tr("Light")], ["dark", I18n.tr("Dark")]] },
{ type: "image", name: I18n.tr("Image"), hint: I18n.tr("Your own picture (you choose the file)"), styles: [["normal", I18n.tr("Photo")]] }
{ type: "image", name: I18n.tr("Image"), hint: I18n.tr("Your own picture (you choose the file)"), styles: [["normal", I18n.tr("Photo")]] },
{ type: "reminders", name: I18n.tr("Reminders"), hint: I18n.tr("To-do list and checklist"), styles: [["liquid", I18n.tr("Liquid Glass")], ["normal", I18n.tr("Normal")]] }
]
delegate: Item {
id: addRow
Expand Down
35 changes: 26 additions & 9 deletions MacShell/MacWidgets.qml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ Scope {
property bool anyLiquid: false
property int rev: 0 // bumped on every change to the list, so Settings bindings can re-evaluate count()

ExtraWidgets {
id: extraWidgets
host: root
}
readonly property alias extra: extraWidgets

readonly property var styleNames: ({ liquid: "Liquid Glass", normal: "Normal", light: "Light", dark: "Dark" })
readonly property var typeNames: ({ weather: "Weather", calendar: "Calendar", clock: "Clock", player: "Player", image: "Image" })
readonly property var typeNames: ({ weather: "Weather", calendar: "Calendar", clock: "Clock", player: "Player", image: "Image", reminders: "Reminders" })
readonly property var sizeNames: ({ small: "Small", medium: "Medium", large: "Large" })
function dims(size) {
var b = size === "large" ? [375, 385] : (size === "medium" ? [395, 185] : [185, 185]);
Expand Down Expand Up @@ -326,9 +332,10 @@ Scope {
wmodel.clear();
for (var i = 0; i < o.widgets.length; i++) {
var w = o.widgets[i];
if (!w || (w.type !== "weather" && w.type !== "calendar" && w.type !== "clock" && w.type !== "player" && w.type !== "image")) continue;
wmodel.append({ wid: String(w.id || ("w" + i)), wtype: w.type,
wstyle: w.type === "image" ? "normal" : (w.type === "clock" || w.type === "player")
var t = w ? (w.type || w.wtype) : "";
if (!t || !root.typeNames[t]) continue;
wmodel.append({ wid: String(w.id || ("w" + i)), wtype: t,
wstyle: t === "image" ? "normal" : (t === "clock" || t === "player")
? ((w.style === "light" || w.style === "dark") ? w.style : "liquid")
: (w.style === "normal" ? "normal" : "liquid"),
wsize: (w.size === "medium" || w.size === "large") ? w.size : "small",
Expand Down Expand Up @@ -372,12 +379,15 @@ Scope {
running: root.player !== null && root.player.isPlaying && root.count("player") > 0
onTriggered: { try { root.player.positionChanged(); } catch (err) { } }
}
// screen rectangles of the Player widgets: they stay clickable while the rest of the layer is click-through
function isInteractive(type) {
return type === "player" || type === "reminders" || type === "notes";
}
// screen rectangles of interactive widgets (Player, Reminders): they stay clickable while the rest of the layer is click-through
readonly property var playerRects: {
var r = rev, out = [];
for (var i = 0; i < wmodel.count; i++) {
var m = wmodel.get(i);
if (m.wtype !== "player") continue;
if (!root.isInteractive(m.wtype)) continue;
var d = dims(m.wsize);
out.push([m.wx, m.wy, d[0], d[1]]);
}
Expand Down Expand Up @@ -712,12 +722,15 @@ Scope {

WlrLayershell.namespace: "macwidgets"
WlrLayershell.layer: WlrLayer.Bottom
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
WlrLayershell.keyboardFocus: (root.extra && root.extra.typing) ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None

// click-through unless editing; only the Player widgets (up to 4) take clicks, for their buttons
// click-through unless editing; interactive widgets (Player, Reminders) take clicks for their buttons
mask: Region {
item: root.editing ? ui : null
regions: [ Region { item: hit0 }, Region { item: hit1 }, Region { item: hit2 }, Region { item: hit3 } ]
regions: [
Region { item: hit0 }, Region { item: hit1 }, Region { item: hit2 }, Region { item: hit3 },
Region { item: hit4 }, Region { item: hit5 }, Region { item: hit6 }, Region { item: hit7 }
]
}

Item {
Expand All @@ -728,6 +741,10 @@ Scope {
Item { id: hit1; x: root.pr(1, 0); y: root.pr(1, 1); width: root.pr(1, 2); height: root.pr(1, 3) }
Item { id: hit2; x: root.pr(2, 0); y: root.pr(2, 1); width: root.pr(2, 2); height: root.pr(2, 3) }
Item { id: hit3; x: root.pr(3, 0); y: root.pr(3, 1); width: root.pr(3, 2); height: root.pr(3, 3) }
Item { id: hit4; x: root.pr(4, 0); y: root.pr(4, 1); width: root.pr(4, 2); height: root.pr(4, 3) }
Item { id: hit5; x: root.pr(5, 0); y: root.pr(5, 1); width: root.pr(5, 2); height: root.pr(5, 3) }
Item { id: hit6; x: root.pr(6, 0); y: root.pr(6, 1); width: root.pr(6, 2); height: root.pr(6, 3) }
Item { id: hit7; x: root.pr(7, 0); y: root.pr(7, 1); width: root.pr(7, 2); height: root.pr(7, 3) }

Rectangle { // slight dim while editing
anchors.fill: parent
Expand Down
31 changes: 30 additions & 1 deletion MacShell/WidgetVisual.qml
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,41 @@ Item {
editing: host.editing
}
}
Component {
id: cardVisual
CardWidget {
scaleF: host.widgetScale
style: wstyle
size: wsize
mode: wmode
fam: host.fontFamily
screenX: v.sx; screenY: v.sy
glassReady: host.glassState === "ready"
shaderUrl: "file://" + host.glassShaderOut
wallUrl: host.fileUrl(host.wallpaperFor(v.sname))
wallVideo: host.liveWallVideo
wallPaused: host.liveWallPaused
screenW: v.sw
screenH: v.sh
glassOpacity: host.glassOpacity
glassBlur: host.glassBlur
glassLiquid: host.glassLiquid
glassRim: host.glassRim
borderTint: host.borderTint
glassGrain: host.glassGrain
darkGlass: host.darkGlass
editing: host.editing
content: (host && host.extra) ? host.extra.comp(v.wtype) : null
onGlassFailed: host.glassState = "failed"
}
}
Loader {
id: visual
anchors.fill: parent
sourceComponent: wtype === "calendar" ? calendarVisual
: (wtype === "clock" ? clockVisual
: (wtype === "player" ? playerVisual
: (wtype === "image" ? imageVisual : weatherVisual)))
: (wtype === "image" ? imageVisual
: ((host && host.extra && host.extra.comp(wtype)) ? cardVisual : weatherVisual))))
}
}
1 change: 1 addition & 0 deletions MacShell/lang/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ var strings = {
"Your own picture (you choose the file)": "Tu propia imagen (elige el archivo)",
"Current conditions, hourly and daily forecast": "Condiciones actuales y pronóstico por horas y días",
"Today's date and the month": "Fecha de hoy y el mes",
"To-do list and checklist": "Lista de tareas y lista de verificación",
"Now Playing with controls and lyrics": "Reproduciendo con controles y letra",
"Unknown Title": "Título desconocido",
"Loading lyrics…": "Cargando letra…",
Expand Down
3 changes: 3 additions & 0 deletions MacShell/lang/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ var strings = {
"Your own picture (you choose the file)": "Своя картинка (вы выбираете файл)",
"Current conditions, hourly and daily forecast": "Сейчас, почасовой и дневной прогноз",
"Today's date and the month": "Сегодняшняя дата и месяц",
"To-do list and checklist": "Список задач и чек-лист",
"Reminders": "Напоминания",
"New Reminder": "Новое напоминание",
"Now Playing with controls and lyrics": "«Сейчас играет» с управлением и текстом песни",
"Unknown Title": "Без названия",
"Loading lyrics…": "Загрузка текста…",
Expand Down