1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-30 08:22:51 -05:00

qmlfmt with 4 space

This commit is contained in:
bbedward
2025-08-20 00:05:14 -04:00
parent 6e0977c719
commit b688bbfe83
154 changed files with 28809 additions and 27639 deletions

View File

@@ -56,7 +56,8 @@ Singleton {
currentRanking[appId].lastUsed = Date.now() currentRanking[appId].lastUsed = Date.now()
currentRanking[appId].icon = app.icon || currentRanking[appId].icon currentRanking[appId].icon = app.icon || currentRanking[appId].icon
|| "application-x-executable" || "application-x-executable"
currentRanking[appId].name = app.name || currentRanking[appId].name || "" currentRanking[appId].name = app.name
|| currentRanking[appId].name || ""
} else { } else {
currentRanking[appId] = { currentRanking[appId] = {
"name": app.name || "", "name": app.name || "",

View File

@@ -6,7 +6,8 @@ Singleton {
// Clear all image cache // Clear all image cache
function clearImageCache() { function clearImageCache() {
Quickshell.execDetached(["rm", "-rf", Paths.stringify(Paths.imagecache)]) Quickshell.execDetached(["rm", "-rf", Paths.stringify(
Paths.imagecache)])
Paths.mkdir(Paths.imagecache) Paths.mkdir(Paths.imagecache)
} }

View File

@@ -22,7 +22,8 @@ Singleton {
"file://") ? _configUrl.substring( "file://") ? _configUrl.substring(
7) : _configUrl 7) : _configUrl
readonly property string shellDir: Qt.resolvedUrl(".").toString().replace( readonly property string shellDir: Qt.resolvedUrl(".").toString().replace(
"file://", "").replace("/Common/", "") "file://",
"").replace("/Common/", "")
readonly property string wallpaperPath: SessionData.wallpaperPath readonly property string wallpaperPath: SessionData.wallpaperPath
property bool matugenAvailable: false property bool matugenAvailable: false
property bool gtkThemingEnabled: false property bool gtkThemingEnabled: false
@@ -44,7 +45,8 @@ Singleton {
property color surfaceContainer: getMatugenColor("surface_container", property color surfaceContainer: getMatugenColor("surface_container",
"#1e2023") "#1e2023")
property color surfaceContainerHigh: getMatugenColor( property color surfaceContainerHigh: getMatugenColor(
"surface_container_high", "#292b2f") "surface_container_high",
"#292b2f")
property color surfaceVariant: getMatugenColor("surface_variant", "#44464f") property color surfaceVariant: getMatugenColor("surface_variant", "#44464f")
property color surfaceText: getMatugenColor("on_background", "#e3e8ef") property color surfaceText: getMatugenColor("on_background", "#e3e8ef")
property color primaryText: getMatugenColor("on_primary", "#ffffff") property color primaryText: getMatugenColor("on_primary", "#ffffff")
@@ -113,7 +115,8 @@ Singleton {
matugenAvailable = (code === 0) matugenAvailable = (code === 0)
if (!matugenAvailable) { if (!matugenAvailable) {
ToastService.wallpaperErrorStatus = "matugen_missing" ToastService.wallpaperErrorStatus = "matugen_missing"
ToastService.showWarning("matugen not found - dynamic theming disabled") ToastService.showWarning(
"matugen not found - dynamic theming disabled")
return return
} }
if (extractionRequested) { if (extractionRequested) {
@@ -147,13 +150,15 @@ Singleton {
onStreamFinished: { onStreamFinished: {
if (!matugenCollector.text) { if (!matugenCollector.text) {
ToastService.wallpaperErrorStatus = "error" ToastService.wallpaperErrorStatus = "error"
ToastService.showError("Wallpaper Processing Failed: Empty JSON extracted from matugen output.") ToastService.showError(
"Wallpaper Processing Failed: Empty JSON extracted from matugen output.")
return return
} }
const extractedJson = extractJsonFromText(matugenCollector.text) const extractedJson = extractJsonFromText(matugenCollector.text)
if (!extractedJson) { if (!extractedJson) {
ToastService.wallpaperErrorStatus = "error" ToastService.wallpaperErrorStatus = "error"
ToastService.showError("Wallpaper Processing Failed: Invalid JSON extracted from matugen output.") ToastService.showError(
"Wallpaper Processing Failed: Invalid JSON extracted from matugen output.")
console.log("Raw matugen output:", matugenCollector.text) console.log("Raw matugen output:", matugenCollector.text)
return return
} }
@@ -164,7 +169,8 @@ Singleton {
ToastService.clearWallpaperError() ToastService.clearWallpaperError()
} catch (e) { } catch (e) {
ToastService.wallpaperErrorStatus = "error" ToastService.wallpaperErrorStatus = "error"
ToastService.showError("Wallpaper processing failed (JSON parse error after extraction)") ToastService.showError(
"Wallpaper processing failed (JSON parse error after extraction)")
} }
} }
} }
@@ -172,7 +178,8 @@ Singleton {
onExited: code => { onExited: code => {
if (code !== 0) { if (code !== 0) {
ToastService.wallpaperErrorStatus = "error" ToastService.wallpaperErrorStatus = "error"
ToastService.showError("Matugen command failed with exit code " + code) ToastService.showError(
"Matugen command failed with exit code " + code)
} }
} }
} }
@@ -328,54 +335,60 @@ Singleton {
// Returns the first complete JSON substring (object or array) or null. // Returns the first complete JSON substring (object or array) or null.
function extractJsonFromText(text) { function extractJsonFromText(text) {
if (!text) return null; if (!text)
return null
const start = text.search(/[{\[]/); const start = text.search(/[{\[]/)
if (start === -1) return null; if (start === -1)
return null
const open = text[start]; const open = text[start]
const pairs = { '{': '}', '[': ']' }; const pairs = {
const close = pairs[open]; "{": '}',
if (!close) return null; "[": ']'
}
const close = pairs[open]
if (!close)
return null
let inString = false; let inString = false
let escape = false; let escape = false
const stack = [open]; const stack = [open]
for (let i = start + 1; i < text.length; i++) { for (var i = start + 1; i < text.length; i++) {
const ch = text[i]; const ch = text[i]
if (inString) { if (inString) {
if (escape) { if (escape) {
escape = false; escape = false
} else if (ch === '\\') { } else if (ch === '\\') {
escape = true; escape = true
} else if (ch === '"') { } else if (ch === '"') {
inString = false; inString = false
} }
continue; continue
} }
if (ch === '"') { if (ch === '"') {
inString = true; inString = true
continue; continue
} }
if (ch === '{' || ch === '[') { if (ch === '{' || ch === '[') {
stack.push(ch); stack.push(ch)
continue; continue
} }
if (ch === '}' || ch === ']') { if (ch === '}' || ch === ']') {
const last = stack.pop(); const last = stack.pop()
if (!last || pairs[last] !== ch) { if (!last || pairs[last] !== ch) {
return null; return null
} }
if (stack.length === 0) { if (stack.length === 0) {
return text.slice(start, i + 1); return text.slice(start, i + 1)
} }
} }
} }
return null; return null
} }
Process { Process {

View File

@@ -46,20 +46,32 @@ Singleton {
wallpaperPath = settings.wallpaperPath !== undefined ? settings.wallpaperPath : "" wallpaperPath = settings.wallpaperPath !== undefined ? settings.wallpaperPath : ""
wallpaperLastPath = settings.wallpaperLastPath wallpaperLastPath = settings.wallpaperLastPath
!== undefined ? settings.wallpaperLastPath : "" !== undefined ? settings.wallpaperLastPath : ""
profileLastPath = settings.profileLastPath !== undefined ? settings.profileLastPath : "" profileLastPath = settings.profileLastPath
!== undefined ? settings.profileLastPath : ""
doNotDisturb = settings.doNotDisturb !== undefined ? settings.doNotDisturb : false doNotDisturb = settings.doNotDisturb !== undefined ? settings.doNotDisturb : false
nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false nightModeEnabled = settings.nightModeEnabled
nightModeTemperature = settings.nightModeTemperature !== undefined ? settings.nightModeTemperature : 4500 !== undefined ? settings.nightModeEnabled : false
nightModeTemperature = settings.nightModeTemperature
!== undefined ? settings.nightModeTemperature : 4500
pinnedApps = settings.pinnedApps !== undefined ? settings.pinnedApps : [] pinnedApps = settings.pinnedApps !== undefined ? settings.pinnedApps : []
selectedGpuIndex = settings.selectedGpuIndex !== undefined ? settings.selectedGpuIndex : 0 selectedGpuIndex = settings.selectedGpuIndex
nvidiaGpuTempEnabled = settings.nvidiaGpuTempEnabled !== undefined ? settings.nvidiaGpuTempEnabled : false !== undefined ? settings.selectedGpuIndex : 0
nonNvidiaGpuTempEnabled = settings.nonNvidiaGpuTempEnabled !== undefined ? settings.nonNvidiaGpuTempEnabled : false nvidiaGpuTempEnabled = settings.nvidiaGpuTempEnabled
enabledGpuPciIds = settings.enabledGpuPciIds !== undefined ? settings.enabledGpuPciIds : [] !== undefined ? settings.nvidiaGpuTempEnabled : false
wallpaperCyclingEnabled = settings.wallpaperCyclingEnabled !== undefined ? settings.wallpaperCyclingEnabled : false nonNvidiaGpuTempEnabled = settings.nonNvidiaGpuTempEnabled
wallpaperCyclingMode = settings.wallpaperCyclingMode !== undefined ? settings.wallpaperCyclingMode : "interval" !== undefined ? settings.nonNvidiaGpuTempEnabled : false
wallpaperCyclingInterval = settings.wallpaperCyclingInterval !== undefined ? settings.wallpaperCyclingInterval : 300 enabledGpuPciIds = settings.enabledGpuPciIds
wallpaperCyclingTime = settings.wallpaperCyclingTime !== undefined ? settings.wallpaperCyclingTime : "06:00" !== undefined ? settings.enabledGpuPciIds : []
lastBrightnessDevice = settings.lastBrightnessDevice !== undefined ? settings.lastBrightnessDevice : "" wallpaperCyclingEnabled = settings.wallpaperCyclingEnabled
!== undefined ? settings.wallpaperCyclingEnabled : false
wallpaperCyclingMode = settings.wallpaperCyclingMode
!== undefined ? settings.wallpaperCyclingMode : "interval"
wallpaperCyclingInterval = settings.wallpaperCyclingInterval
!== undefined ? settings.wallpaperCyclingInterval : 300
wallpaperCyclingTime = settings.wallpaperCyclingTime
!== undefined ? settings.wallpaperCyclingTime : "06:00"
lastBrightnessDevice = settings.lastBrightnessDevice
!== undefined ? settings.lastBrightnessDevice : ""
} }
} catch (e) { } catch (e) {

File diff suppressed because it is too large Load Diff

View File

@@ -376,8 +376,10 @@ Singleton {
property color primaryHover: Qt.rgba(primary.r, primary.g, primary.b, 0.12) property color primaryHover: Qt.rgba(primary.r, primary.g, primary.b, 0.12)
property color primaryHoverLight: Qt.rgba(primary.r, primary.g, property color primaryHoverLight: Qt.rgba(primary.r, primary.g,
primary.b, 0.08) primary.b, 0.08)
property color primaryPressed: Qt.rgba(primary.r, primary.g, primary.b, 0.16) property color primaryPressed: Qt.rgba(primary.r, primary.g,
property color primarySelected: Qt.rgba(primary.r, primary.g, primary.b, 0.3) primary.b, 0.16)
property color primarySelected: Qt.rgba(primary.r, primary.g,
primary.b, 0.3)
property color primaryBackground: Qt.rgba(primary.r, primary.g, property color primaryBackground: Qt.rgba(primary.r, primary.g,
primary.b, 0.04) primary.b, 0.04)
@@ -409,7 +411,8 @@ Singleton {
property color outlineLight: Qt.rgba(outline.r, outline.g, outline.b, 0.05) property color outlineLight: Qt.rgba(outline.r, outline.g, outline.b, 0.05)
property color outlineMedium: Qt.rgba(outline.r, outline.g, outline.b, 0.08) property color outlineMedium: Qt.rgba(outline.r, outline.g, outline.b, 0.08)
property color outlineStrong: Qt.rgba(outline.r, outline.g, outline.b, 0.12) property color outlineStrong: Qt.rgba(outline.r, outline.g, outline.b, 0.12)
property color outlineSelected: Qt.rgba(outline.r, outline.g, outline.b, 0.2) property color outlineSelected: Qt.rgba(outline.r, outline.g,
outline.b, 0.2)
property color outlineHeavy: Qt.rgba(outline.r, outline.g, outline.b, 0.3) property color outlineHeavy: Qt.rgba(outline.r, outline.g, outline.b, 0.3)
property color outlineButton: Qt.rgba(outline.r, outline.g, outline.b, 0.5) property color outlineButton: Qt.rgba(outline.r, outline.g, outline.b, 0.5)
@@ -500,23 +503,23 @@ Singleton {
} }
function popupBackground() { function popupBackground() {
return Qt.rgba(surfaceContainer.r, surfaceContainer.g, surfaceContainer.b, return Qt.rgba(surfaceContainer.r, surfaceContainer.g,
popupTransparency) surfaceContainer.b, popupTransparency)
} }
function contentBackground() { function contentBackground() {
return Qt.rgba(surfaceContainer.r, surfaceContainer.g, surfaceContainer.b, return Qt.rgba(surfaceContainer.r, surfaceContainer.g,
popupTransparency) surfaceContainer.b, popupTransparency)
} }
function panelBackground() { function panelBackground() {
return Qt.rgba(surfaceContainer.r, surfaceContainer.g, surfaceContainer.b, return Qt.rgba(surfaceContainer.r, surfaceContainer.g,
panelTransparency) surfaceContainer.b, panelTransparency)
} }
function widgetBackground() { function widgetBackground() {
return Qt.rgba(surfaceContainer.r, surfaceContainer.g, surfaceContainer.b, return Qt.rgba(surfaceContainer.r, surfaceContainer.g,
widgetTransparency) surfaceContainer.b, widgetTransparency)
} }
function getBatteryIcon(level, isCharging, batteryAvailable) { function getBatteryIcon(level, isCharging, batteryAvailable) {

View File

@@ -21,123 +21,124 @@ DankModal {
property Component clipboardContent property Component clipboardContent
function updateFilteredModel() { function updateFilteredModel() {
filteredClipboardModel.clear(); filteredClipboardModel.clear()
for (var i = 0; i < clipboardModel.count; i++) { for (var i = 0; i < clipboardModel.count; i++) {
const entry = clipboardModel.get(i).entry; const entry = clipboardModel.get(i).entry
if (searchText.trim().length === 0) { if (searchText.trim().length === 0) {
filteredClipboardModel.append({ filteredClipboardModel.append({
"entry": entry "entry": entry
}); })
} else { } else {
const content = getEntryPreview(entry).toLowerCase(); const content = getEntryPreview(entry).toLowerCase()
if (content.includes(searchText.toLowerCase())) if (content.includes(searchText.toLowerCase()))
filteredClipboardModel.append({ filteredClipboardModel.append({
"entry": entry "entry": entry
}); })
} }
} }
clipboardHistoryModal.totalCount = filteredClipboardModel.count; clipboardHistoryModal.totalCount = filteredClipboardModel.count
// Clamp selectedIndex to valid range // Clamp selectedIndex to valid range
if (filteredClipboardModel.count === 0) { if (filteredClipboardModel.count === 0) {
keyboardNavigationActive = false; keyboardNavigationActive = false
selectedIndex = 0; selectedIndex = 0
} else if (selectedIndex >= filteredClipboardModel.count) { } else if (selectedIndex >= filteredClipboardModel.count) {
selectedIndex = filteredClipboardModel.count - 1; selectedIndex = filteredClipboardModel.count - 1
} }
} }
function toggle() { function toggle() {
if (shouldBeVisible) if (shouldBeVisible)
hide(); hide()
else else
show(); show()
} }
function show() { function show() {
open(); open()
clipboardHistoryModal.searchText = ""; clipboardHistoryModal.searchText = ""
initializeThumbnailSystem(); initializeThumbnailSystem()
refreshClipboard(); refreshClipboard()
keyboardController.reset(); keyboardController.reset()
Qt.callLater(function() { Qt.callLater(function () {
if (contentLoader.item && contentLoader.item.searchField) { if (contentLoader.item && contentLoader.item.searchField) {
contentLoader.item.searchField.text = ""; contentLoader.item.searchField.text = ""
contentLoader.item.searchField.forceActiveFocus(); contentLoader.item.searchField.forceActiveFocus()
} }
}); })
} }
function hide() { function hide() {
close(); close()
clipboardHistoryModal.searchText = ""; clipboardHistoryModal.searchText = ""
updateFilteredModel(); updateFilteredModel()
keyboardController.reset(); keyboardController.reset()
cleanupTempFiles(); cleanupTempFiles()
} }
function initializeThumbnailSystem() { function initializeThumbnailSystem() {}
}
function cleanupTempFiles() { function cleanupTempFiles() {
Quickshell.execDetached(["sh", "-c", "rm -f /tmp/clipboard_*.png"]); Quickshell.execDetached(["sh", "-c", "rm -f /tmp/clipboard_*.png"])
} }
function generateThumbnails() { function generateThumbnails() {}
}
function refreshClipboard() { function refreshClipboard() {
clipboardProcess.running = true; clipboardProcess.running = true
} }
function copyEntry(entry) { function copyEntry(entry) {
const entryId = entry.split('\t')[0]; const entryId = entry.split('\t')[0]
Quickshell.execDetached(["sh", "-c", `cliphist decode ${entryId} | wl-copy`]); Quickshell.execDetached(
ToastService.showInfo("Copied to clipboard"); ["sh", "-c", `cliphist decode ${entryId} | wl-copy`])
hide(); ToastService.showInfo("Copied to clipboard")
hide()
} }
function deleteEntry(entry) { function deleteEntry(entry) {
deleteProcess.deletedEntry = entry; deleteProcess.deletedEntry = entry
deleteProcess.command = ["sh", "-c", `echo '${entry.replace( deleteProcess.command = ["sh", "-c", `echo '${entry.replace(
/'/g, "'\\''")}' | cliphist delete`]; /'/g, "'\\''")}' | cliphist delete`]
deleteProcess.running = true; deleteProcess.running = true
} }
function clearAll() { function clearAll() {
clearProcess.running = true; clearProcess.running = true
} }
function getEntryPreview(entry) { function getEntryPreview(entry) {
let content = entry.replace(/^\s*\d+\s+/, ""); let content = entry.replace(/^\s*\d+\s+/, "")
if (content.includes("image/") || content.includes("binary data") || /\.(png|jpg|jpeg|gif|bmp|webp)/i.test(content)) { if (content.includes("image/") || content.includes("binary data")
const dimensionMatch = content.match(/(\d+)x(\d+)/); || /\.(png|jpg|jpeg|gif|bmp|webp)/i.test(content)) {
const dimensionMatch = content.match(/(\d+)x(\d+)/)
if (dimensionMatch) if (dimensionMatch)
return `Image ${dimensionMatch[1]}×${dimensionMatch[2]}`; return `Image ${dimensionMatch[1]}×${dimensionMatch[2]}`
const typeMatch = content.match(/\b(png|jpg|jpeg|gif|bmp|webp)\b/i); const typeMatch = content.match(/\b(png|jpg|jpeg|gif|bmp|webp)\b/i)
if (typeMatch) if (typeMatch)
return `Image (${typeMatch[1].toUpperCase()})`; return `Image (${typeMatch[1].toUpperCase()})`
return "Image"; return "Image"
} }
if (content.length > 100) if (content.length > 100)
return content.substring(0, 100) + "..."; return content.substring(0, 100) + "..."
return content; return content
} }
function getEntryType(entry) { function getEntryType(entry) {
if (entry.includes("image/") || entry.includes("binary data") || /\.(png|jpg|jpeg|gif|bmp|webp)/i.test(entry) || /\b(png|jpg|jpeg|gif|bmp|webp)\b/i.test(entry)) if (entry.includes("image/") || entry.includes("binary data")
return "image"; || /\.(png|jpg|jpeg|gif|bmp|webp)/i.test(entry)
|| /\b(png|jpg|jpeg|gif|bmp|webp)\b/i.test(entry))
return "image"
if (entry.length > 200) if (entry.length > 200)
return "long_text"; return "long_text"
return "text"; return "text"
} }
visible: false visible: false
@@ -149,10 +150,10 @@ DankModal {
borderWidth: 1 borderWidth: 1
enableShadow: true enableShadow: true
onBackgroundClicked: { onBackgroundClicked: {
hide(); hide()
} }
modalFocusScope.Keys.onPressed: function(event) { modalFocusScope.Keys.onPressed: function (event) {
keyboardController.handleKey(event); keyboardController.handleKey(event)
} }
content: clipboardContent content: clipboardContent
@@ -160,107 +161,116 @@ DankModal {
id: keyboardController id: keyboardController
function reset() { function reset() {
selectedIndex = 0; selectedIndex = 0
keyboardNavigationActive = false; keyboardNavigationActive = false
showKeyboardHints = false; showKeyboardHints = false
if (typeof clipboardListView !== 'undefined' && clipboardListView) if (typeof clipboardListView !== 'undefined' && clipboardListView)
clipboardListView.keyboardActive = false; clipboardListView.keyboardActive = false
} }
function selectNext() { function selectNext() {
if (filteredClipboardModel.count === 0) if (filteredClipboardModel.count === 0)
return ; return
keyboardNavigationActive = true; keyboardNavigationActive = true
selectedIndex = Math.min(selectedIndex + 1, filteredClipboardModel.count - 1); selectedIndex = Math.min(selectedIndex + 1,
filteredClipboardModel.count - 1)
} }
function selectPrevious() { function selectPrevious() {
if (filteredClipboardModel.count === 0) if (filteredClipboardModel.count === 0)
return ; return
keyboardNavigationActive = true; keyboardNavigationActive = true
selectedIndex = Math.max(selectedIndex - 1, 0); selectedIndex = Math.max(selectedIndex - 1, 0)
} }
function copySelected() { function copySelected() {
if (filteredClipboardModel.count === 0 || selectedIndex < 0 || selectedIndex >= filteredClipboardModel.count) if (filteredClipboardModel.count === 0 || selectedIndex < 0
return ; || selectedIndex >= filteredClipboardModel.count)
return
var selectedEntry = filteredClipboardModel.get(selectedIndex).entry; var selectedEntry = filteredClipboardModel.get(selectedIndex).entry
copyEntry(selectedEntry); copyEntry(selectedEntry)
} }
function deleteSelected() { function deleteSelected() {
if (filteredClipboardModel.count === 0 || selectedIndex < 0 || selectedIndex >= filteredClipboardModel.count) if (filteredClipboardModel.count === 0 || selectedIndex < 0
return ; || selectedIndex >= filteredClipboardModel.count)
return
var selectedEntry = filteredClipboardModel.get(selectedIndex).entry; var selectedEntry = filteredClipboardModel.get(selectedIndex).entry
deleteEntry(selectedEntry); deleteEntry(selectedEntry)
} }
function handleKey(event) { function handleKey(event) {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
if (keyboardNavigationActive) { if (keyboardNavigationActive) {
keyboardNavigationActive = false; keyboardNavigationActive = false
if (typeof clipboardListView !== 'undefined' && clipboardListView) if (typeof clipboardListView !== 'undefined'
clipboardListView.keyboardActive = false; && clipboardListView)
clipboardListView.keyboardActive = false
event.accepted = true; event.accepted = true
} else { } else {
hide(); hide()
event.accepted = true; event.accepted = true
} }
} else if (event.key === Qt.Key_Down) { } else if (event.key === Qt.Key_Down) {
if (!keyboardNavigationActive) { if (!keyboardNavigationActive) {
keyboardNavigationActive = true; keyboardNavigationActive = true
selectedIndex = 0; selectedIndex = 0
if (typeof clipboardListView !== 'undefined' && clipboardListView) if (typeof clipboardListView !== 'undefined'
clipboardListView.keyboardActive = true; && clipboardListView)
clipboardListView.keyboardActive = true
event.accepted = true; event.accepted = true
} else { } else {
selectNext(); selectNext()
event.accepted = true; event.accepted = true
} }
} else if (event.key === Qt.Key_Up) { } else if (event.key === Qt.Key_Up) {
if (!keyboardNavigationActive) { if (!keyboardNavigationActive) {
keyboardNavigationActive = true; keyboardNavigationActive = true
selectedIndex = 0; selectedIndex = 0
if (typeof clipboardListView !== 'undefined' && clipboardListView) if (typeof clipboardListView !== 'undefined'
clipboardListView.keyboardActive = true; && clipboardListView)
clipboardListView.keyboardActive = true
event.accepted = true; event.accepted = true
} else if (selectedIndex === 0) { } else if (selectedIndex === 0) {
keyboardNavigationActive = false; keyboardNavigationActive = false
if (typeof clipboardListView !== 'undefined' && clipboardListView) if (typeof clipboardListView !== 'undefined'
clipboardListView.keyboardActive = false; && clipboardListView)
clipboardListView.keyboardActive = false
event.accepted = true; event.accepted = true
} else { } else {
selectPrevious(); selectPrevious()
event.accepted = true; event.accepted = true
} }
} else if (event.key === Qt.Key_Delete && (event.modifiers & Qt.ShiftModifier)) { } else if (event.key === Qt.Key_Delete
clearAll(); && (event.modifiers & Qt.ShiftModifier)) {
hide(); clearAll()
event.accepted = true; hide()
event.accepted = true
} else if (keyboardNavigationActive) { } else if (keyboardNavigationActive) {
if ((event.key === Qt.Key_C && (event.modifiers & Qt.ControlModifier)) || event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { if ((event.key === Qt.Key_C
copySelected(); && (event.modifiers & Qt.ControlModifier))
event.accepted = true; || event.key === Qt.Key_Return
|| event.key === Qt.Key_Enter) {
copySelected()
event.accepted = true
} else if (event.key === Qt.Key_Delete) { } else if (event.key === Qt.Key_Delete) {
deleteSelected(); deleteSelected()
event.accepted = true; event.accepted = true
} }
} }
if (event.key === Qt.Key_F10) { if (event.key === Qt.Key_F10) {
showKeyboardHints = !showKeyboardHints; showKeyboardHints = !showKeyboardHints
event.accepted = true; event.accepted = true
} }
} }
} }
DankModal { DankModal {
@@ -270,7 +280,7 @@ DankModal {
width: 350 width: 350
height: 150 height: 150
onBackgroundClicked: { onBackgroundClicked: {
showClearConfirmation = false; showClearConfirmation = false
} }
content: Component { content: Component {
@@ -326,7 +336,6 @@ DankModal {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: showClearConfirmation = false onClicked: showClearConfirmation = false
} }
} }
Rectangle { Rectangle {
@@ -350,22 +359,16 @@ DankModal {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
clearAll(); clearAll()
showClearConfirmation = false; showClearConfirmation = false
hide(); hide()
} }
} }
} }
} }
} }
} }
} }
} }
ListModel { ListModel {
@@ -384,19 +387,17 @@ DankModal {
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
clipboardModel.clear(); clipboardModel.clear()
const lines = text.trim().split('\n'); const lines = text.trim().split('\n')
for (const line of lines) { for (const line of lines) {
if (line.trim().length > 0) if (line.trim().length > 0)
clipboardModel.append({ clipboardModel.append({
"entry": line "entry": line
}); })
} }
updateFilteredModel(); updateFilteredModel()
} }
} }
} }
Process { Process {
@@ -405,31 +406,33 @@ DankModal {
property string deletedEntry: "" property string deletedEntry: ""
running: false running: false
onExited: (exitCode) => { onExited: exitCode => {
if (exitCode === 0) { if (exitCode === 0) {
// Just remove the item from models instead of re-fetching everything // Just remove the item from models instead of re-fetching everything
for (var i = 0; i < clipboardModel.count; i++) { for (var i = 0; i < clipboardModel.count; i++) {
if (clipboardModel.get(i).entry === deleteProcess.deletedEntry) { if (clipboardModel.get(
clipboardModel.remove(i); i).entry === deleteProcess.deletedEntry) {
break; clipboardModel.remove(i)
break
} }
} }
for (var j = 0; j < filteredClipboardModel.count; j++) { for (var j = 0; j < filteredClipboardModel.count; j++) {
if (filteredClipboardModel.get(j).entry === deleteProcess.deletedEntry) { if (filteredClipboardModel.get(
filteredClipboardModel.remove(j); j).entry === deleteProcess.deletedEntry) {
break; filteredClipboardModel.remove(j)
break
} }
} }
clipboardHistoryModal.totalCount = filteredClipboardModel.count; clipboardHistoryModal.totalCount = filteredClipboardModel.count
// Clamp selectedIndex to valid range // Clamp selectedIndex to valid range
if (filteredClipboardModel.count === 0) { if (filteredClipboardModel.count === 0) {
keyboardNavigationActive = false; keyboardNavigationActive = false
selectedIndex = 0; selectedIndex = 0
} else if (selectedIndex >= filteredClipboardModel.count) { } else if (selectedIndex >= filteredClipboardModel.count) {
selectedIndex = filteredClipboardModel.count - 1; selectedIndex = filteredClipboardModel.count - 1
} }
} else { } else {
console.warn("Failed to delete clipboard entry"); console.warn("Failed to delete clipboard entry")
} }
} }
} }
@@ -439,30 +442,31 @@ DankModal {
command: ["cliphist", "wipe"] command: ["cliphist", "wipe"]
running: false running: false
onExited: (exitCode) => { onExited: exitCode => {
if (exitCode === 0) { if (exitCode === 0) {
clipboardModel.clear(); clipboardModel.clear()
filteredClipboardModel.clear(); filteredClipboardModel.clear()
totalCount = 0; totalCount = 0
} else { } else {
} }
} }
} }
IpcHandler { IpcHandler {
function open() { function open() {
clipboardHistoryModal.show(); clipboardHistoryModal.show()
return "CLIPBOARD_OPEN_SUCCESS"; return "CLIPBOARD_OPEN_SUCCESS"
} }
function close() { function close() {
hide(); hide()
return "CLIPBOARD_CLOSE_SUCCESS"; return "CLIPBOARD_CLOSE_SUCCESS"
} }
function toggle() { function toggle() {
clipboardHistoryModal.toggle(); clipboardHistoryModal.toggle()
return "CLIPBOARD_TOGGLE_SUCCESS"; return "CLIPBOARD_TOGGLE_SUCCESS"
} }
target: "clipboard" target: "clipboard"
@@ -504,7 +508,6 @@ DankModal {
font.weight: Font.Medium font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Row { Row {
@@ -518,7 +521,7 @@ DankModal {
iconColor: showKeyboardHints ? Theme.primary : Theme.surfaceText iconColor: showKeyboardHints ? Theme.primary : Theme.surfaceText
hoverColor: Theme.primaryHover hoverColor: Theme.primaryHover
onClicked: { onClicked: {
showKeyboardHints = !showKeyboardHints; showKeyboardHints = !showKeyboardHints
} }
} }
@@ -528,7 +531,7 @@ DankModal {
iconColor: Theme.error iconColor: Theme.error
hoverColor: Theme.errorHover hoverColor: Theme.errorHover
onClicked: { onClicked: {
showClearConfirmation = true; showClearConfirmation = true
} }
} }
@@ -539,9 +542,7 @@ DankModal {
hoverColor: Theme.errorHover hoverColor: Theme.errorHover
onClicked: hide() onClicked: hide()
} }
} }
} }
DankTextField { DankTextField {
@@ -555,25 +556,25 @@ DankModal {
ignoreLeftRightKeys: true ignoreLeftRightKeys: true
keyForwardTargets: [modalFocusScope] keyForwardTargets: [modalFocusScope]
onTextChanged: { onTextChanged: {
clipboardHistoryModal.searchText = text; clipboardHistoryModal.searchText = text
updateFilteredModel(); updateFilteredModel()
} }
Keys.onEscapePressed: function(event) { Keys.onEscapePressed: function (event) {
hide(); hide()
event.accepted = true; event.accepted = true
} }
Component.onCompleted: { Component.onCompleted: {
Qt.callLater(function() { Qt.callLater(function () {
forceActiveFocus(); forceActiveFocus()
}); })
} }
Connections { Connections {
target: clipboardHistoryModal target: clipboardHistoryModal
function onOpened() { function onOpened() {
Qt.callLater(function() { Qt.callLater(function () {
searchField.forceActiveFocus(); searchField.forceActiveFocus()
}); })
} }
} }
} }
@@ -592,15 +593,15 @@ DankModal {
function ensureVisible(index) { function ensureVisible(index) {
if (index < 0 || index >= count) if (index < 0 || index >= count)
return ; return
var itemHeight = 72 + spacing; var itemHeight = 72 + spacing
var itemY = index * itemHeight; var itemY = index * itemHeight
var itemBottom = itemY + itemHeight; var itemBottom = itemY + itemHeight
if (itemY < contentY) if (itemY < contentY)
contentY = itemY; contentY = itemY
else if (itemBottom > contentY + height) else if (itemBottom > contentY + height)
contentY = itemBottom - height; contentY = itemBottom - height
} }
anchors.fill: parent anchors.fill: parent
@@ -618,8 +619,7 @@ DankModal {
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (keyboardNavigationActive && currentIndex >= 0) if (keyboardNavigationActive && currentIndex >= 0)
ensureVisible(currentIndex); ensureVisible(currentIndex)
} }
StyledText { StyledText {
@@ -640,7 +640,8 @@ DankModal {
delegate: Rectangle { delegate: Rectangle {
property string entryType: getEntryType(model.entry) property string entryType: getEntryType(model.entry)
property string entryPreview: getEntryPreview(model.entry) property string entryPreview: getEntryPreview(
model.entry)
property int entryIndex: index + 1 property int entryIndex: index + 1
property string entryData: model.entry property string entryData: model.entry
property alias thumbnailImageSource: thumbnailImageSource property alias thumbnailImageSource: thumbnailImageSource
@@ -649,18 +650,25 @@ DankModal {
height: 72 height: 72
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
if (keyboardNavigationActive && index === selectedIndex) if (keyboardNavigationActive
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.2); && index === selectedIndex)
return Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.2)
return mouseArea.containsMouse ? Theme.primaryHover : Theme.primaryBackground; return mouseArea.containsMouse ? Theme.primaryHover : Theme.primaryBackground
} }
border.color: { border.color: {
if (keyboardNavigationActive && index === selectedIndex) if (keyboardNavigationActive
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.5); && index === selectedIndex)
return Qt.rgba(Theme.primary.r,
Theme.primary.g,
Theme.primary.b, 0.5)
return Theme.outlineStrong; return Theme.outlineStrong
} }
border.width: keyboardNavigationActive && index === selectedIndex ? 1.5 : 1 border.width: keyboardNavigationActive
&& index === selectedIndex ? 1.5 : 1
Row { Row {
anchors.fill: parent anchors.fill: parent
@@ -682,7 +690,6 @@ DankModal {
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.primary color: Theme.primary
} }
} }
Row { Row {
@@ -698,10 +705,12 @@ DankModal {
CachingImage { CachingImage {
id: thumbnailImageSource id: thumbnailImageSource
property string entryId: model.entry.split('\t')[0] property string entryId: model.entry.split(
'\t')[0]
anchors.fill: parent anchors.fill: parent
source: entryType === "image" && imageLoader.imageData ? `data:image/png;base64,${imageLoader.imageData}` : "" source: entryType === "image"
&& imageLoader.imageData ? `data:image/png;base64,${imageLoader.imageData}` : ""
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
smooth: true smooth: true
cache: true cache: true
@@ -718,12 +727,10 @@ DankModal {
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
imageLoader.imageData = text.trim(); imageLoader.imageData = text.trim()
} }
} }
} }
} }
MultiEffect { MultiEffect {
@@ -732,7 +739,8 @@ DankModal {
source: thumbnailImageSource source: thumbnailImageSource
maskEnabled: true maskEnabled: true
maskSource: clipboardCircularMask maskSource: clipboardCircularMask
visible: entryType === "image" && thumbnailImageSource.status === Image.Ready visible: entryType === "image"
&& thumbnailImageSource.status === Image.Ready
maskThresholdMin: 0.5 maskThresholdMin: 0.5
maskSpreadAtMin: 1 maskSpreadAtMin: 1
} }
@@ -752,25 +760,25 @@ DankModal {
color: "black" color: "black"
antialiasing: true antialiasing: true
} }
} }
DankIcon { DankIcon {
visible: !(entryType === "image" && thumbnailImageSource.status === Image.Ready) visible: !(entryType === "image"
&& thumbnailImageSource.status
=== Image.Ready)
name: { name: {
if (entryType === "image") if (entryType === "image")
return "image"; return "image"
if (entryType === "long_text") if (entryType === "long_text")
return "subject"; return "subject"
return "content_copy"; return "content_copy"
} }
size: Theme.iconSize size: Theme.iconSize
color: Theme.primary color: Theme.primary
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
Column { Column {
@@ -782,11 +790,11 @@ DankModal {
text: { text: {
switch (entryType) { switch (entryType) {
case "image": case "image":
return "Image • " + entryPreview; return "Image • " + entryPreview
case "long_text": case "long_text":
return "Long Text"; return "Long Text"
default: default:
return "Text"; return "Text"
} }
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
@@ -807,11 +815,8 @@ DankModal {
maximumLineCount: entryType === "long_text" ? 3 : 1 maximumLineCount: entryType === "long_text" ? 3 : 1
elide: Text.ElideRight elide: Text.ElideRight
} }
} }
} }
} }
DankActionButton { DankActionButton {
@@ -823,7 +828,7 @@ DankModal {
iconColor: Theme.error iconColor: Theme.error
hoverColor: Theme.errorHover hoverColor: Theme.errorHover
onClicked: { onClicked: {
deleteEntry(model.entry); deleteEntry(model.entry)
} }
} }
@@ -836,11 +841,8 @@ DankModal {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: copyEntry(model.entry) onClicked: copyEntry(model.entry)
} }
} }
} }
} }
Item { Item {
@@ -852,11 +854,8 @@ DankModal {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
} }
} }
Rectangle { Rectangle {
@@ -866,7 +865,9 @@ DankModal {
anchors.margins: Theme.spacingL anchors.margins: Theme.spacingL
height: 80 height: 80
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) color: Qt.rgba(Theme.surfaceContainer.r,
Theme.surfaceContainer.g,
Theme.surfaceContainer.b, 0.95)
border.color: Theme.primary border.color: Theme.primary
border.width: 2 border.width: 2
opacity: showKeyboardHints ? 1 : 0 opacity: showKeyboardHints ? 1 : 0
@@ -889,7 +890,6 @@ DankModal {
color: Theme.surfaceText color: Theme.surfaceText
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
} }
Behavior on opacity { Behavior on opacity {
@@ -897,13 +897,8 @@ DankModal {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
} }
} }
} }
} }

View File

@@ -34,9 +34,9 @@ PanelWindow {
property bool allowFocusOverride: false property bool allowFocusOverride: false
property bool allowStacking: false property bool allowStacking: false
signal opened() signal opened
signal dialogClosed() signal dialogClosed
signal backgroundClicked() signal backgroundClicked
Connections { Connections {
target: ModalManager target: ModalManager
@@ -49,25 +49,24 @@ PanelWindow {
function open() { function open() {
ModalManager.openModal(root) ModalManager.openModal(root)
closeTimer.stop(); closeTimer.stop()
shouldBeVisible = true; shouldBeVisible = true
visible = true; visible = true
focusScope.forceActiveFocus(); focusScope.forceActiveFocus()
} }
function close() { function close() {
shouldBeVisible = false; shouldBeVisible = false
closeTimer.restart(); closeTimer.restart()
} }
function toggle() { function toggle() {
if (shouldBeVisible) if (shouldBeVisible)
close(); close()
else else
open(); open()
} }
visible: shouldBeVisible visible: shouldBeVisible
color: "transparent" color: "transparent"
WlrLayershell.layer: WlrLayershell.Overlay WlrLayershell.layer: WlrLayershell.Overlay
@@ -75,13 +74,13 @@ PanelWindow {
WlrLayershell.keyboardFocus: shouldHaveFocus ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None WlrLayershell.keyboardFocus: shouldHaveFocus ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
onVisibleChanged: { onVisibleChanged: {
if (root.visible) { if (root.visible) {
opened(); opened()
} else { } else {
if (Qt.inputMethod) { if (Qt.inputMethod) {
Qt.inputMethod.hide(); Qt.inputMethod.hide()
Qt.inputMethod.reset(); Qt.inputMethod.reset()
} }
dialogClosed(); dialogClosed()
} }
} }
@@ -90,12 +89,10 @@ PanelWindow {
interval: animationDuration + 50 interval: animationDuration + 50
onTriggered: { onTriggered: {
visible = false; visible = false
} }
} }
anchors { anchors {
top: true top: true
left: true left: true
@@ -114,11 +111,14 @@ PanelWindow {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: root.closeOnBackgroundClick enabled: root.closeOnBackgroundClick
onClicked: (mouse) => { onClicked: mouse => {
var localPos = mapToItem(contentContainer, mouse.x, mouse.y); var localPos = mapToItem(contentContainer,
if (localPos.x < 0 || localPos.x > contentContainer.width || localPos.y < 0 || localPos.y > contentContainer.height) mouse.x, mouse.y)
root.backgroundClicked(); if (localPos.x < 0
|| localPos.x > contentContainer.width
|| localPos.y < 0
|| localPos.y > contentContainer.height)
root.backgroundClicked()
} }
} }
@@ -127,9 +127,7 @@ PanelWindow {
duration: root.animationDuration duration: root.animationDuration
easing.type: root.animationEasing easing.type: root.animationEasing
} }
} }
} }
Rectangle { Rectangle {
@@ -140,17 +138,18 @@ PanelWindow {
anchors.centerIn: positioning === "center" ? parent : undefined anchors.centerIn: positioning === "center" ? parent : undefined
x: { x: {
if (positioning === "top-right") if (positioning === "top-right")
return Math.max(Theme.spacingL, root.screenWidth - width - Theme.spacingL); return Math.max(Theme.spacingL,
root.screenWidth - width - Theme.spacingL)
else if (positioning === "custom") else if (positioning === "custom")
return root.customPosition.x; return root.customPosition.x
return 0; // Will be overridden by anchors.centerIn when positioning === "center" return 0 // Will be overridden by anchors.centerIn when positioning === "center"
} }
y: { y: {
if (positioning === "top-right") if (positioning === "top-right")
return Theme.barHeight + Theme.spacingXS; return Theme.barHeight + Theme.spacingXS
else if (positioning === "custom") else if (positioning === "custom")
return root.customPosition.y; return root.customPosition.y
return 0; // Will be overridden by anchors.centerIn when positioning === "center" return 0 // Will be overridden by anchors.centerIn when positioning === "center"
} }
color: root.backgroundColor color: root.backgroundColor
radius: root.cornerRadius radius: root.cornerRadius
@@ -160,9 +159,9 @@ PanelWindow {
opacity: root.shouldBeVisible ? 1 : 0 opacity: root.shouldBeVisible ? 1 : 0
scale: { scale: {
if (root.animationType === "scale") if (root.animationType === "scale")
return root.shouldBeVisible ? 1 : 0.9; return root.shouldBeVisible ? 1 : 0.9
return 1; return 1
} }
transform: root.animationType === "slide" ? slideTransform : null transform: root.animationType === "slide" ? slideTransform : null
@@ -186,7 +185,6 @@ PanelWindow {
duration: root.animationDuration duration: root.animationDuration
easing.type: root.animationEasing easing.type: root.animationEasing
} }
} }
Behavior on scale { Behavior on scale {
@@ -196,7 +194,6 @@ PanelWindow {
duration: root.animationDuration duration: root.animationDuration
easing.type: root.animationEasing easing.type: root.animationEasing
} }
} }
layer.effect: MultiEffect { layer.effect: MultiEffect {
@@ -207,7 +204,6 @@ PanelWindow {
shadowColor: Theme.shadowStrong shadowColor: Theme.shadowStrong
shadowOpacity: 0.3 shadowOpacity: 0.3
} }
} }
FocusScope { FocusScope {
@@ -217,31 +213,35 @@ PanelWindow {
anchors.fill: parent anchors.fill: parent
visible: root.visible // Only active when the modal is visible visible: root.visible // Only active when the modal is visible
focus: root.visible focus: root.visible
Keys.onEscapePressed: (event) => { Keys.onEscapePressed: event => {
console.log("DankModal escape pressed - shouldHaveFocus:", shouldHaveFocus, "closeOnEscapeKey:", root.closeOnEscapeKey, "objectName:", root.objectName || "unnamed"); console.log(
if (root.closeOnEscapeKey && shouldHaveFocus) { "DankModal escape pressed - shouldHaveFocus:",
console.log("DankModal handling escape"); shouldHaveFocus, "closeOnEscapeKey:",
root.close(); root.closeOnEscapeKey, "objectName:",
event.accepted = true; root.objectName || "unnamed")
if (root.closeOnEscapeKey
&& shouldHaveFocus) {
console.log("DankModal handling escape")
root.close()
event.accepted = true
} }
} }
onVisibleChanged: { onVisibleChanged: {
if (visible && shouldHaveFocus) if (visible && shouldHaveFocus)
Qt.callLater(function() { Qt.callLater(function () {
focusScope.forceActiveFocus(); focusScope.forceActiveFocus()
}); })
} }
Connections { Connections {
target: root target: root
function onShouldHaveFocusChanged() { function onShouldHaveFocusChanged() {
if (shouldHaveFocus && visible) { if (shouldHaveFocus && visible) {
Qt.callLater(function() { Qt.callLater(function () {
focusScope.forceActiveFocus(); focusScope.forceActiveFocus()
}); })
} }
} }
} }
} }
} }

View File

@@ -175,7 +175,8 @@ DankModal {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: currentPath !== homeDir hoverEnabled: currentPath !== homeDir
cursorShape: currentPath !== homeDir ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: currentPath
!== homeDir ? Qt.PointingHandCursor : Qt.ArrowCursor
enabled: currentPath !== homeDir enabled: currentPath !== homeDir
onClicked: navigateUp() onClicked: navigateUp()
} }
@@ -251,8 +252,8 @@ DankModal {
name: "description" name: "description"
size: Theme.iconSizeLarge size: Theme.iconSizeLarge
color: Theme.primary color: Theme.primary
visible: !delegateRoot.fileIsDir && !isImageFile( visible: !delegateRoot.fileIsDir
delegateRoot.fileName) && !isImageFile(delegateRoot.fileName)
} }
DankIcon { DankIcon {

View File

@@ -110,9 +110,11 @@ DankModal {
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
onWheel: event => { onWheel: event => {
let delta = event.pixelDelta.y let delta = event.pixelDelta.y
!== 0 ? event.pixelDelta.y * 1.8 : event.angleDelta.y / 120 * 60 !== 0 ? event.pixelDelta.y
* 1.8 : event.angleDelta.y / 120 * 60
let newY = parent.contentY - delta let newY = parent.contentY - delta
newY = Math.max(0, Math.min( newY = Math.max(
0, Math.min(
parent.contentHeight - parent.height, parent.contentHeight - parent.height,
newY)) newY))
parent.contentY = newY parent.contentY = newY
@@ -124,7 +126,8 @@ DankModal {
id: detailsRect id: detailsRect
width: parent.width width: parent.width
height: Math.max(parent.parent.height, height: Math.max(
parent.parent.height,
detailsText.contentHeight + Theme.spacingM * 2) detailsText.contentHeight + Theme.spacingM * 2)
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Theme.surfaceHover color: Theme.surfaceHover
@@ -136,8 +139,9 @@ DankModal {
anchors.fill: parent anchors.fill: parent
anchors.margins: Theme.spacingM anchors.margins: Theme.spacingM
text: NetworkService.networkInfoDetails.replace(/\\n/g, '\n') text: NetworkService.networkInfoDetails.replace(
|| "No information available" /\\n/g,
'\n') || "No information available"
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText color: Theme.surfaceText
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
@@ -161,10 +165,13 @@ DankModal {
Rectangle { Rectangle {
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: Math.max(70, closeText.contentWidth + Theme.spacingM * 2) width: Math.max(
70,
closeText.contentWidth + Theme.spacingM * 2)
height: 36 height: 36
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: closeArea.containsMouse ? Qt.darker(Theme.primary, color: closeArea.containsMouse ? Qt.darker(
Theme.primary,
1.1) : Theme.primary 1.1) : Theme.primary
StyledText { StyledText {

View File

@@ -21,7 +21,7 @@ DankModal {
modalKeyboardController.reset() modalKeyboardController.reset()
} }
modalFocusScope.Keys.onPressed: function(event) { modalFocusScope.Keys.onPressed: function (event) {
modalKeyboardController.handleKey(event) modalKeyboardController.handleKey(event)
} }
@@ -29,14 +29,14 @@ DankModal {
id: modalKeyboardController id: modalKeyboardController
listView: null listView: null
isOpen: notificationModal.notificationModalOpen isOpen: notificationModal.notificationModalOpen
onClose: function() { notificationModal.hide() } onClose: function () {
notificationModal.hide()
}
} }
property bool notificationModalOpen: false property bool notificationModalOpen: false
property var notificationListRef: null property var notificationListRef: null
function show() { function show() {
notificationModalOpen = true notificationModalOpen = true
open() open()
@@ -61,7 +61,6 @@ DankModal {
show() show()
} }
IpcHandler { IpcHandler {
function open() { function open() {
notificationModal.show() notificationModal.show()
@@ -117,7 +116,6 @@ DankModal {
} }
} }
} }
} }
NotificationKeyboardHints { NotificationKeyboardHints {
@@ -128,7 +126,6 @@ DankModal {
anchors.margins: Theme.spacingL anchors.margins: Theme.spacingL
showHints: modalKeyboardController.showKeyboardHints showHints: modalKeyboardController.showKeyboardHints
} }
} }
} }

View File

@@ -132,7 +132,8 @@ DankModal {
baseColor = Theme.primary baseColor = Theme.primary
break break
} }
return confirmButton.containsMouse ? Qt.rgba(baseColor.r, return confirmButton.containsMouse ? Qt.rgba(
baseColor.r,
baseColor.g, baseColor.g,
baseColor.b, baseColor.b,
0.9) : baseColor 0.9) : baseColor

View File

@@ -19,29 +19,28 @@ DankModal {
function show() { function show() {
if (!DgopService.dgopAvailable) { if (!DgopService.dgopAvailable) {
console.warn("ProcessListModal: dgop is not available"); console.warn("ProcessListModal: dgop is not available")
return ; return
} }
open(); open()
UserInfoService.getUptime(); UserInfoService.getUptime()
} }
function hide() { function hide() {
close(); close()
if (processContextMenu.visible) if (processContextMenu.visible)
processContextMenu.close(); processContextMenu.close()
} }
function toggle() { function toggle() {
if (!DgopService.dgopAvailable) { if (!DgopService.dgopAvailable) {
console.warn("ProcessListModal: dgop is not available"); console.warn("ProcessListModal: dgop is not available")
return ; return
} }
if (shouldBeVisible) if (shouldBeVisible)
hide(); hide()
else else
show(); show()
} }
width: 900 width: 900
@@ -58,23 +57,18 @@ DankModal {
ProcessesTab { ProcessesTab {
contextMenu: processContextMenu contextMenu: processContextMenu
} }
} }
Component { Component {
id: performanceTabComponent id: performanceTabComponent
PerformanceTab { PerformanceTab {}
}
} }
Component { Component {
id: systemTabComponent id: systemTabComponent
SystemTab { SystemTab {}
}
} }
ProcessContextMenu { ProcessContextMenu {
@@ -85,19 +79,19 @@ DankModal {
Item { Item {
anchors.fill: parent anchors.fill: parent
focus: true focus: true
Keys.onPressed: function(event) { Keys.onPressed: function (event) {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
processListModal.hide(); processListModal.hide()
event.accepted = true; event.accepted = true
} else if (event.key === Qt.Key_1) { } else if (event.key === Qt.Key_1) {
currentTab = 0; currentTab = 0
event.accepted = true; event.accepted = true
} else if (event.key === Qt.Key_2) { } else if (event.key === Qt.Key_2) {
currentTab = 1; currentTab = 1
event.accepted = true; event.accepted = true
} else if (event.key === Qt.Key_3) { } else if (event.key === Qt.Key_3) {
currentTab = 2; currentTab = 2
event.accepted = true; event.accepted = true
} }
} }
@@ -139,9 +133,7 @@ DankModal {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }
} }
} }
ColumnLayout { ColumnLayout {
@@ -175,7 +167,6 @@ DankModal {
onClicked: processListModal.hide() onClicked: processListModal.hide()
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
} }
} }
Rectangle { Rectangle {
@@ -210,17 +201,18 @@ DankModal {
name: { name: {
switch (index) { switch (index) {
case 0: case 0:
return "list_alt"; return "list_alt"
case 1: case 1:
return "analytics"; return "analytics"
case 2: case 2:
return "settings"; return "settings"
default: default:
return "tab"; return "tab"
} }
} }
size: Theme.iconSize - 2 size: Theme.iconSize - 2
color: currentTab === index ? Theme.primary : Theme.surfaceText color: currentTab
=== index ? Theme.primary : Theme.surfaceText
opacity: currentTab === index ? 1 : 0.7 opacity: currentTab === index ? 1 : 0.7
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -228,16 +220,15 @@ DankModal {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration
} }
} }
} }
StyledText { StyledText {
text: modelData text: modelData
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium font.weight: Font.Medium
color: currentTab === index ? Theme.primary : Theme.surfaceText color: currentTab
=== index ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -1 anchors.verticalCenterOffset: -1
@@ -245,11 +236,8 @@ DankModal {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration
} }
} }
} }
} }
MouseArea { MouseArea {
@@ -259,7 +247,7 @@ DankModal {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
currentTab = index; currentTab = index
} }
} }
@@ -267,22 +255,16 @@ DankModal {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration
} }
} }
Behavior on border.color { Behavior on border.color {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration
} }
} }
} }
} }
} }
} }
Rectangle { Rectangle {
@@ -308,9 +290,7 @@ DankModal {
duration: Theme.mediumDuration duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
} }
Loader { Loader {
@@ -328,9 +308,7 @@ DankModal {
duration: Theme.mediumDuration duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
} }
Loader { Loader {
@@ -348,17 +326,10 @@ DankModal {
duration: Theme.mediumDuration duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
} }
} }
} }
} }
} }
} }

View File

@@ -14,21 +14,21 @@ DankModal {
property Component settingsContent property Component settingsContent
signal closingModal() signal closingModal
function show() { function show() {
open(); open()
} }
function hide() { function hide() {
close(); close()
} }
function toggle() { function toggle() {
if (shouldBeVisible) if (shouldBeVisible)
hide(); hide()
else else
show(); show()
} }
objectName: "settingsModal" objectName: "settingsModal"
@@ -40,18 +40,18 @@ DankModal {
IpcHandler { IpcHandler {
function open() { function open() {
settingsModal.show(); settingsModal.show()
return "SETTINGS_OPEN_SUCCESS"; return "SETTINGS_OPEN_SUCCESS"
} }
function close() { function close() {
settingsModal.hide(); settingsModal.hide()
return "SETTINGS_CLOSE_SUCCESS"; return "SETTINGS_CLOSE_SUCCESS"
} }
function toggle() { function toggle() {
settingsModal.toggle(); settingsModal.toggle()
return "SETTINGS_TOGGLE_SUCCESS"; return "SETTINGS_TOGGLE_SUCCESS"
} }
target: "settings" target: "settings"
@@ -103,7 +103,6 @@ DankModal {
hoverColor: Theme.errorHover hoverColor: Theme.errorHover
onClicked: settingsModal.hide() onClicked: settingsModal.hide()
} }
} }
// Main content with side navigation // Main content with side navigation
@@ -153,7 +152,8 @@ DankModal {
height: 80 height: 80
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
property bool hasImage: profileImageSource.status === Image.Ready property bool hasImage: profileImageSource.status
=== Image.Ready
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
@@ -168,10 +168,11 @@ DankModal {
id: profileImageSource id: profileImageSource
source: { source: {
if (PortalService.profileImage === "") if (PortalService.profileImage === "")
return ""; return ""
if (PortalService.profileImage.startsWith("/")) if (PortalService.profileImage.startsWith(
return "file://" + PortalService.profileImage; "/"))
return PortalService.profileImage; return "file://" + PortalService.profileImage
return PortalService.profileImage
} }
smooth: true smooth: true
asynchronous: true asynchronous: true
@@ -226,7 +227,8 @@ DankModal {
name: "warning" name: "warning"
size: Theme.iconSizeLarge size: Theme.iconSizeLarge
color: Theme.error color: Theme.error
visible: PortalService.profileImage !== "" && profileImageSource.status === Image.Error visible: PortalService.profileImage !== ""
&& profileImageSource.status === Image.Error
} }
// Hover overlay with edit and clear buttons // Hover overlay with edit and clear buttons
@@ -244,7 +246,8 @@ DankModal {
width: 28 width: 28
height: 28 height: 28
radius: 14 radius: 14
color: Qt.rgba(255, 255, 255, 0.9) color: Qt.rgba(255, 255,
255, 0.9)
DankIcon { DankIcon {
anchors.centerIn: parent anchors.centerIn: parent
@@ -257,9 +260,10 @@ DankModal {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
settingsModal.allowFocusOverride = true; settingsModal.allowFocusOverride = true
settingsModal.shouldHaveFocus = false; settingsModal.shouldHaveFocus = false
profileBrowser.open(); profileBrowser.open(
)
} }
} }
} }
@@ -268,7 +272,8 @@ DankModal {
width: 28 width: 28
height: 28 height: 28
radius: 14 radius: 14
color: Qt.rgba(255, 255, 255, 0.9) color: Qt.rgba(255, 255,
255, 0.9)
visible: profileImageContainer.hasImage visible: profileImageContainer.hasImage
DankIcon { DankIcon {
@@ -282,7 +287,8 @@ DankModal {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
PortalService.setProfileImage(""); PortalService.setProfileImage(
"")
} }
} }
} }
@@ -306,7 +312,8 @@ DankModal {
spacing: Theme.spacingXS spacing: Theme.spacingXS
StyledText { StyledText {
text: UserInfoService.fullName || "User" text: UserInfoService.fullName
|| "User"
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium font.weight: Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
@@ -315,7 +322,8 @@ DankModal {
} }
StyledText { StyledText {
text: DgopService.distribution || "Linux" text: DgopService.distribution
|| "Linux"
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
elide: Text.ElideRight elide: Text.ElideRight
@@ -397,7 +405,6 @@ DankModal {
font.weight: parent.parent.isActive ? Font.Medium : Font.Normal font.weight: parent.parent.isActive ? Font.Medium : Font.Normal
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
@@ -407,7 +414,7 @@ DankModal {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
sidebarContainer.currentIndex = index; sidebarContainer.currentIndex = index
} }
} }
@@ -416,15 +423,10 @@ DankModal {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
} }
} }
} }
} }
// Main content area // Main content area
@@ -452,9 +454,7 @@ DankModal {
PersonalizationTab { PersonalizationTab {
parentModal: settingsModal parentModal: settingsModal
} }
} }
} }
Loader { Loader {
@@ -509,11 +509,8 @@ DankModal {
asynchronous: true asynchronous: true
sourceComponent: Component { sourceComponent: Component {
DockTab { DockTab {}
} }
}
} }
Loader { Loader {
@@ -545,11 +542,8 @@ DankModal {
asynchronous: true asynchronous: true
sourceComponent: AboutTab {} sourceComponent: AboutTab {}
} }
} }
} }
} }
// Footer // Footer
@@ -565,7 +559,10 @@ DankModal {
Image { Image {
anchors.fill: parent anchors.fill: parent
source: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Modals/", "") + "/assets/dank.svg" source: Qt.resolvedUrl(".").toString().replace(
"file://",
"").replace("/Modals/",
"") + "/assets/dank.svg"
sourceSize: Qt.size(68, 16) sourceSize: Qt.size(68, 16)
smooth: true smooth: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
@@ -580,7 +577,8 @@ DankModal {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: Qt.openUrlExternally("https://github.com/AvengeMedia/DankMaterialShell") onClicked: Qt.openUrlExternally(
"https://github.com/AvengeMedia/DankMaterialShell")
} }
} }
@@ -605,7 +603,10 @@ DankModal {
Image { Image {
anchors.fill: parent anchors.fill: parent
source: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Modals/", "") + "/assets/niri.svg" source: Qt.resolvedUrl(".").toString().replace(
"file://",
"").replace("/Modals/",
"") + "/assets/niri.svg"
sourceSize: Qt.size(24, 24) sourceSize: Qt.size(24, 24)
smooth: true smooth: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
@@ -614,7 +615,8 @@ DankModal {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: Qt.openUrlExternally("https://github.com/YaLTeR/niri") onClicked: Qt.openUrlExternally(
"https://github.com/YaLTeR/niri")
} }
} }
@@ -645,7 +647,10 @@ DankModal {
Image { Image {
anchors.fill: parent anchors.fill: parent
source: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Modals/", "") + "/assets/matrix-logo-white.svg" source: Qt.resolvedUrl(".").toString().replace(
"file://", "").replace(
"/Modals/",
"") + "/assets/matrix-logo-white.svg"
sourceSize: Qt.size(32, 20) sourceSize: Qt.size(32, 20)
smooth: true smooth: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
@@ -660,7 +665,8 @@ DankModal {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: Qt.openUrlExternally("https://matrix.to/#/#niri:matrix.org") onClicked: Qt.openUrlExternally(
"https://matrix.to/#/#niri:matrix.org")
} }
} }
@@ -691,7 +697,10 @@ DankModal {
Image { Image {
anchors.fill: parent anchors.fill: parent
source: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Modals/", "") + "/assets/discord.svg" source: Qt.resolvedUrl(".").toString().replace(
"file://",
"").replace("/Modals/",
"") + "/assets/discord.svg"
sourceSize: Qt.size(16, 16) sourceSize: Qt.size(16, 16)
smooth: true smooth: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
@@ -700,7 +709,8 @@ DankModal {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: Qt.openUrlExternally("https://discord.gg/vT8Sfjy7sx") onClicked: Qt.openUrlExternally(
"https://discord.gg/vT8Sfjy7sx")
} }
} }
@@ -731,7 +741,10 @@ DankModal {
Image { Image {
anchors.fill: parent anchors.fill: parent
source: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Modals/", "") + "/assets/reddit.svg" source: Qt.resolvedUrl(".").toString().replace(
"file://",
"").replace("/Modals/",
"") + "/assets/reddit.svg"
sourceSize: Qt.size(18, 18) sourceSize: Qt.size(18, 18)
smooth: true smooth: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
@@ -740,15 +753,13 @@ DankModal {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: Qt.openUrlExternally("https://reddit.com/r/niri") onClicked: Qt.openUrlExternally(
"https://reddit.com/r/niri")
} }
} }
} }
} }
} }
} }
FileBrowserModal { FileBrowserModal {
@@ -758,18 +769,17 @@ DankModal {
browserIcon: "person" browserIcon: "person"
browserType: "profile" browserType: "profile"
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"] fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
onFileSelected: (path) => { onFileSelected: path => {
PortalService.setProfileImage(path); PortalService.setProfileImage(path)
close(); close()
} }
onDialogClosed: { onDialogClosed: {
if (settingsModal) { if (settingsModal) {
settingsModal.allowFocusOverride = false; settingsModal.allowFocusOverride = false
settingsModal.shouldHaveFocus = Qt.binding(() => { settingsModal.shouldHaveFocus = Qt.binding(() => {
return settingsModal.shouldBeVisible; return settingsModal.shouldBeVisible
}); })
} }
} }
} }
} }

View File

@@ -16,33 +16,32 @@ DankModal {
property Component spotlightContent property Component spotlightContent
function show() { function show() {
spotlightOpen = true; spotlightOpen = true
open(); open()
if (contentLoader.item && contentLoader.item.appLauncher) if (contentLoader.item && contentLoader.item.appLauncher)
contentLoader.item.appLauncher.searchQuery = ""; contentLoader.item.appLauncher.searchQuery = ""
Qt.callLater(function() { Qt.callLater(function () {
if (contentLoader.item && contentLoader.item.searchField) if (contentLoader.item && contentLoader.item.searchField)
contentLoader.item.searchField.forceActiveFocus(); contentLoader.item.searchField.forceActiveFocus()
})
});
} }
function hide() { function hide() {
spotlightOpen = false; spotlightOpen = false
close(); close()
if (contentLoader.item && contentLoader.item.appLauncher) { if (contentLoader.item && contentLoader.item.appLauncher) {
contentLoader.item.appLauncher.searchQuery = ""; contentLoader.item.appLauncher.searchQuery = ""
contentLoader.item.appLauncher.selectedIndex = 0; contentLoader.item.appLauncher.selectedIndex = 0
contentLoader.item.appLauncher.setCategory("All"); contentLoader.item.appLauncher.setCategory("All")
} }
} }
function toggle() { function toggle() {
if (spotlightOpen) if (spotlightOpen)
hide(); hide()
else else
show(); show()
} }
shouldBeVisible: spotlightOpen shouldBeVisible: spotlightOpen
@@ -50,7 +49,8 @@ DankModal {
Connections { Connections {
target: ModalManager target: ModalManager
function onCloseAllModalsExcept(excludedModal) { function onCloseAllModalsExcept(excludedModal) {
if (excludedModal !== spotlightModal && !allowStacking && spotlightOpen) { if (excludedModal !== spotlightModal && !allowStacking
&& spotlightOpen) {
spotlightOpen = false spotlightOpen = false
} }
} }
@@ -64,43 +64,41 @@ DankModal {
enableShadow: true enableShadow: true
onVisibleChanged: { onVisibleChanged: {
if (visible && !spotlightOpen) if (visible && !spotlightOpen)
show(); show()
if (visible && contentLoader.item) if (visible && contentLoader.item)
Qt.callLater(function() { Qt.callLater(function () {
if (contentLoader.item.searchField) if (contentLoader.item.searchField)
contentLoader.item.searchField.forceActiveFocus(); contentLoader.item.searchField.forceActiveFocus()
})
});
} }
onBackgroundClicked: { onBackgroundClicked: {
hide(); hide()
} }
Component.onCompleted: { Component.onCompleted: {
} }
content: spotlightContent content: spotlightContent
IpcHandler { IpcHandler {
function open() { function open() {
spotlightModal.show(); spotlightModal.show()
return "SPOTLIGHT_OPEN_SUCCESS"; return "SPOTLIGHT_OPEN_SUCCESS"
} }
function close() { function close() {
spotlightModal.hide(); spotlightModal.hide()
return "SPOTLIGHT_CLOSE_SUCCESS"; return "SPOTLIGHT_CLOSE_SUCCESS"
} }
function toggle() { function toggle() {
spotlightModal.toggle(); spotlightModal.toggle()
return "SPOTLIGHT_TOGGLE_SUCCESS"; return "SPOTLIGHT_TOGGLE_SUCCESS"
} }
target: "spotlight" target: "spotlight"
} }
spotlightContent: Component { spotlightContent: Component {
Item { Item {
id: spotlightKeyHandler id: spotlightKeyHandler
@@ -110,29 +108,34 @@ DankModal {
anchors.fill: parent anchors.fill: parent
focus: true focus: true
Keys.onPressed: function(event) { Keys.onPressed: function (event) {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
hide(); hide()
event.accepted = true; event.accepted = true
} else if (event.key === Qt.Key_Down) { } else if (event.key === Qt.Key_Down) {
appLauncher.selectNext(); appLauncher.selectNext()
event.accepted = true; event.accepted = true
} else if (event.key === Qt.Key_Up) { } else if (event.key === Qt.Key_Up) {
appLauncher.selectPrevious(); appLauncher.selectPrevious()
event.accepted = true; event.accepted = true
} else if (event.key === Qt.Key_Right && appLauncher.viewMode === "grid") { } else if (event.key === Qt.Key_Right
appLauncher.selectNextInRow(); && appLauncher.viewMode === "grid") {
event.accepted = true; appLauncher.selectNextInRow()
} else if (event.key === Qt.Key_Left && appLauncher.viewMode === "grid") { event.accepted = true
appLauncher.selectPreviousInRow(); } else if (event.key === Qt.Key_Left
event.accepted = true; && appLauncher.viewMode === "grid") {
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { appLauncher.selectPreviousInRow()
appLauncher.launchSelected(); event.accepted = true
event.accepted = true; } else if (event.key === Qt.Key_Return
} else if (!searchField.activeFocus && event.text && event.text.length > 0 && event.text.match(/[a-zA-Z0-9\\s]/)) { || event.key === Qt.Key_Enter) {
searchField.forceActiveFocus(); appLauncher.launchSelected()
searchField.insertText(event.text); event.accepted = true
event.accepted = true; } else if (!searchField.activeFocus && event.text
&& event.text.length > 0 && event.text.match(
/[a-zA-Z0-9\\s]/)) {
searchField.forceActiveFocus()
searchField.insertText(event.text)
event.accepted = true
} }
} }
@@ -142,8 +145,8 @@ DankModal {
viewMode: SettingsData.spotlightModalViewMode viewMode: SettingsData.spotlightModalViewMode
gridColumns: 4 gridColumns: 4
onAppLaunched: hide() onAppLaunched: hide()
onViewModeSelected: function(mode) { onViewModeSelected: function (mode) {
SettingsData.setSpotlightModalViewMode(mode); SettingsData.setSpotlightModalViewMode(mode)
} }
} }
@@ -159,7 +162,8 @@ DankModal {
color: Theme.surfaceVariantAlpha color: Theme.surfaceVariantAlpha
border.color: Theme.outlineMedium border.color: Theme.outlineMedium
border.width: 1 border.width: 1
visible: appLauncher.categories.length > 1 || appLauncher.model.count > 0 visible: appLauncher.categories.length > 1
|| appLauncher.model.count > 0
CategorySelector { CategorySelector {
id: categorySelector id: categorySelector
@@ -169,11 +173,11 @@ DankModal {
categories: appLauncher.categories categories: appLauncher.categories
selectedCategory: appLauncher.selectedCategory selectedCategory: appLauncher.selectedCategory
compact: false compact: false
onCategorySelected: (category) => { onCategorySelected: category => {
return appLauncher.setCategory(category); return appLauncher.setCategory(
category)
} }
} }
} }
Row { Row {
@@ -183,10 +187,16 @@ DankModal {
DankTextField { DankTextField {
id: searchField id: searchField
width: parent.width - 80 - Theme.spacingM // Leave space for view toggle buttons width: parent.width - 80
- Theme.spacingM // Leave space for view toggle buttons
height: 56 height: 56
cornerRadius: Theme.cornerRadius cornerRadius: Theme.cornerRadius
backgroundColor: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, Theme.getContentBackgroundAlpha() * 0.7) backgroundColor: Qt.rgba(
Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b,
Theme.getContentBackgroundAlpha(
) * 0.7)
normalBorderColor: Theme.outlineMedium normalBorderColor: Theme.outlineMedium
focusedBorderColor: Theme.primary focusedBorderColor: Theme.primary
leftIconName: "search" leftIconName: "search"
@@ -202,20 +212,24 @@ DankModal {
keyForwardTargets: [spotlightKeyHandler] keyForwardTargets: [spotlightKeyHandler]
text: appLauncher.searchQuery text: appLauncher.searchQuery
onTextEdited: { onTextEdited: {
appLauncher.searchQuery = text; appLauncher.searchQuery = text
} }
Keys.onPressed: (event) => { Keys.onPressed: event => {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
hide(); hide()
event.accepted = true; event.accepted = true
} else if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length > 0) { } else if ((event.key === Qt.Key_Return
if (appLauncher.keyboardNavigationActive && appLauncher.model.count > 0) || event.key === Qt.Key_Enter)
appLauncher.launchSelected(); && text.length > 0) {
if (appLauncher.keyboardNavigationActive
&& appLauncher.model.count > 0)
appLauncher.launchSelected()
else if (appLauncher.model.count > 0) else if (appLauncher.model.count > 0)
appLauncher.launchApp(appLauncher.model.get(0)); appLauncher.launchApp(
event.accepted = true; appLauncher.model.get(0))
event.accepted = true
} else if (event.key === Qt.Key_Down || event.key === Qt.Key_Up || event.key === Qt.Key_Left || event.key === Qt.Key_Right || ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length === 0)) { } else if (event.key === Qt.Key_Down || event.key === Qt.Key_Up || event.key === Qt.Key_Left || event.key === Qt.Key_Right || ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length === 0)) {
event.accepted = false; event.accepted = false
} }
} }
} }
@@ -230,14 +244,16 @@ DankModal {
height: 36 height: 36
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: appLauncher.viewMode === "list" ? Theme.primaryHover : listViewArea.containsMouse ? Theme.surfaceHover : "transparent" color: appLauncher.viewMode === "list" ? Theme.primaryHover : listViewArea.containsMouse ? Theme.surfaceHover : "transparent"
border.color: appLauncher.viewMode === "list" ? Theme.primarySelected : "transparent" border.color: appLauncher.viewMode
=== "list" ? Theme.primarySelected : "transparent"
border.width: 1 border.width: 1
DankIcon { DankIcon {
anchors.centerIn: parent anchors.centerIn: parent
name: "view_list" name: "view_list"
size: 18 size: 18
color: appLauncher.viewMode === "list" ? Theme.primary : Theme.surfaceText color: appLauncher.viewMode
=== "list" ? Theme.primary : Theme.surfaceText
} }
MouseArea { MouseArea {
@@ -247,10 +263,9 @@ DankModal {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
appLauncher.setViewMode("list"); appLauncher.setViewMode("list")
} }
} }
} }
Rectangle { Rectangle {
@@ -258,14 +273,16 @@ DankModal {
height: 36 height: 36
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: appLauncher.viewMode === "grid" ? Theme.primaryHover : gridViewArea.containsMouse ? Theme.surfaceHover : "transparent" color: appLauncher.viewMode === "grid" ? Theme.primaryHover : gridViewArea.containsMouse ? Theme.surfaceHover : "transparent"
border.color: appLauncher.viewMode === "grid" ? Theme.primarySelected : "transparent" border.color: appLauncher.viewMode
=== "grid" ? Theme.primarySelected : "transparent"
border.width: 1 border.width: 1
DankIcon { DankIcon {
anchors.centerIn: parent anchors.centerIn: parent
name: "grid_view" name: "grid_view"
size: 18 size: 18
color: appLauncher.viewMode === "grid" ? Theme.primary : Theme.surfaceText color: appLauncher.viewMode
=== "grid" ? Theme.primary : Theme.surfaceText
} }
MouseArea { MouseArea {
@@ -275,14 +292,11 @@ DankModal {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
appLauncher.setViewMode("grid"); appLauncher.setViewMode("grid")
} }
} }
} }
} }
} }
Rectangle { Rectangle {
@@ -305,20 +319,20 @@ DankModal {
property bool hoverUpdatesSelection: false property bool hoverUpdatesSelection: false
property bool keyboardNavigationActive: appLauncher.keyboardNavigationActive property bool keyboardNavigationActive: appLauncher.keyboardNavigationActive
signal keyboardNavigationReset() signal keyboardNavigationReset
signal itemClicked(int index, var modelData) signal itemClicked(int index, var modelData)
signal itemRightClicked(int index, var modelData, real mouseX, real mouseY) signal itemRightClicked(int index, var modelData, real mouseX, real mouseY)
function ensureVisible(index) { function ensureVisible(index) {
if (index < 0 || index >= count) if (index < 0 || index >= count)
return ; return
var itemY = index * (itemHeight + itemSpacing); var itemY = index * (itemHeight + itemSpacing)
var itemBottom = itemY + itemHeight; var itemBottom = itemY + itemHeight
if (itemY < contentY) if (itemY < contentY)
contentY = itemY; contentY = itemY
else if (itemBottom > contentY + height) else if (itemBottom > contentY + height)
contentY = itemBottom - height; contentY = itemBottom - height
} }
anchors.fill: parent anchors.fill: parent
@@ -334,17 +348,16 @@ DankModal {
reuseItems: true reuseItems: true
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (keyboardNavigationActive) if (keyboardNavigationActive)
ensureVisible(currentIndex); ensureVisible(currentIndex)
} }
onItemClicked: function(index, modelData) { onItemClicked: function (index, modelData) {
appLauncher.launchApp(modelData); appLauncher.launchApp(modelData)
} }
onItemRightClicked: function(index, modelData, mouseX, mouseY) { onItemRightClicked: function (index, modelData, mouseX, mouseY) {
contextMenu.show(mouseX, mouseY, modelData); contextMenu.show(mouseX, mouseY, modelData)
} }
onKeyboardNavigationReset: { onKeyboardNavigationReset: {
appLauncher.keyboardNavigationActive = false; appLauncher.keyboardNavigationActive = false
} }
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
@@ -377,7 +390,9 @@ DankModal {
id: listIconImg id: listIconImg
anchors.fill: parent anchors.fill: parent
source: (model.icon) ? Quickshell.iconPath(model.icon, SettingsData.iconTheme === "System Default" ? "" : SettingsData.iconTheme) : "" source: (model.icon) ? Quickshell.iconPath(
model.icon,
SettingsData.iconTheme === "System Default" ? "" : SettingsData.iconTheme) : ""
smooth: true smooth: true
asynchronous: true asynchronous: true
visible: status === Image.Ready visible: status === Image.Ready
@@ -393,14 +408,16 @@ DankModal {
StyledText { StyledText {
anchors.centerIn: parent anchors.centerIn: parent
text: (model.name && model.name.length > 0) ? model.name.charAt(0).toUpperCase() : "A" text: (model.name
&& model.name.length
> 0) ? model.name.charAt(
0).toUpperCase(
) : "A"
font.pixelSize: resultsList.iconSize * 0.4 font.pixelSize: resultsList.iconSize * 0.4
color: Theme.primary color: Theme.primary
font.weight: Font.Bold font.weight: Font.Bold
} }
} }
} }
Column { Column {
@@ -423,11 +440,11 @@ DankModal {
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
elide: Text.ElideRight elide: Text.ElideRight
visible: resultsList.showDescription && model.comment && model.comment.length > 0 visible: resultsList.showDescription
&& model.comment
&& model.comment.length > 0
} }
} }
} }
MouseArea { MouseArea {
@@ -439,25 +456,28 @@ DankModal {
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
z: 10 z: 10
onEntered: { onEntered: {
if (resultsList.hoverUpdatesSelection && !resultsList.keyboardNavigationActive) if (resultsList.hoverUpdatesSelection
resultsList.currentIndex = index; && !resultsList.keyboardNavigationActive)
resultsList.currentIndex = index
} }
onPositionChanged: { onPositionChanged: {
resultsList.keyboardNavigationReset(); resultsList.keyboardNavigationReset()
} }
onClicked: (mouse) => { onClicked: mouse => {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
resultsList.itemClicked(index, model); resultsList.itemClicked(
index, model)
} else if (mouse.button === Qt.RightButton) { } else if (mouse.button === Qt.RightButton) {
var modalPos = mapToItem(spotlightKeyHandler, mouse.x, mouse.y); var modalPos = mapToItem(
resultsList.itemRightClicked(index, model, modalPos.x, modalPos.y); spotlightKeyHandler,
mouse.x, mouse.y)
resultsList.itemRightClicked(
index, model,
modalPos.x, modalPos.y)
} }
} }
} }
} }
} }
DankGridView { DankGridView {
@@ -474,25 +494,30 @@ DankModal {
property int minIconSize: 32 property int minIconSize: 32
property bool hoverUpdatesSelection: false property bool hoverUpdatesSelection: false
property bool keyboardNavigationActive: appLauncher.keyboardNavigationActive property bool keyboardNavigationActive: appLauncher.keyboardNavigationActive
property int baseCellWidth: adaptiveColumns ? Math.max(minCellWidth, Math.min(maxCellWidth, width / columns)) : (width - Theme.spacingS * 2) / columns property int baseCellWidth: adaptiveColumns ? Math.max(
minCellWidth,
Math.min(maxCellWidth, width / columns)) : (width - Theme.spacingS * 2) / columns
property int baseCellHeight: baseCellWidth + 20 property int baseCellHeight: baseCellWidth + 20
property int actualColumns: adaptiveColumns ? Math.floor(width / cellWidth) : columns property int actualColumns: adaptiveColumns ? Math.floor(
width
/ cellWidth) : columns
property int remainingSpace: width - (actualColumns * cellWidth) property int remainingSpace: width - (actualColumns * cellWidth)
signal keyboardNavigationReset() signal keyboardNavigationReset
signal itemClicked(int index, var modelData) signal itemClicked(int index, var modelData)
signal itemRightClicked(int index, var modelData, real mouseX, real mouseY) signal itemRightClicked(int index, var modelData, real mouseX, real mouseY)
function ensureVisible(index) { function ensureVisible(index) {
if (index < 0 || index >= count) if (index < 0 || index >= count)
return ; return
var itemY = Math.floor(index / actualColumns) * cellHeight; var itemY = Math.floor(
var itemBottom = itemY + cellHeight; index / actualColumns) * cellHeight
var itemBottom = itemY + cellHeight
if (itemY < contentY) if (itemY < contentY)
contentY = itemY; contentY = itemY
else if (itemBottom > contentY + height) else if (itemBottom > contentY + height)
contentY = itemBottom - height; contentY = itemBottom - height
} }
anchors.fill: parent anchors.fill: parent
@@ -510,17 +535,16 @@ DankModal {
reuseItems: true reuseItems: true
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (keyboardNavigationActive) if (keyboardNavigationActive)
ensureVisible(currentIndex); ensureVisible(currentIndex)
} }
onItemClicked: function(index, modelData) { onItemClicked: function (index, modelData) {
appLauncher.launchApp(modelData); appLauncher.launchApp(modelData)
} }
onItemRightClicked: function(index, modelData, mouseX, mouseY) { onItemRightClicked: function (index, modelData, mouseX, mouseY) {
contextMenu.show(mouseX, mouseY, modelData); contextMenu.show(mouseX, mouseY, modelData)
} }
onKeyboardNavigationReset: { onKeyboardNavigationReset: {
appLauncher.keyboardNavigationActive = false; appLauncher.keyboardNavigationActive = false
} }
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
@@ -536,7 +560,8 @@ DankModal {
height: resultsGrid.cellHeight - resultsGrid.cellPadding height: resultsGrid.cellHeight - resultsGrid.cellPadding
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: resultsGrid.currentIndex === index ? Theme.primaryPressed : gridMouseArea.containsMouse ? Theme.primaryHoverLight : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.03) color: resultsGrid.currentIndex === index ? Theme.primaryPressed : gridMouseArea.containsMouse ? Theme.primaryHoverLight : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.03)
border.color: resultsGrid.currentIndex === index ? Theme.primarySelected : Theme.outlineMedium border.color: resultsGrid.currentIndex
=== index ? Theme.primarySelected : Theme.outlineMedium
border.width: resultsGrid.currentIndex === index ? 2 : 1 border.width: resultsGrid.currentIndex === index ? 2 : 1
Column { Column {
@@ -544,7 +569,12 @@ DankModal {
spacing: Theme.spacingS spacing: Theme.spacingS
Item { Item {
property int iconSize: Math.min(resultsGrid.maxIconSize, Math.max(resultsGrid.minIconSize, resultsGrid.cellWidth * resultsGrid.iconSizeRatio)) property int iconSize: Math.min(
resultsGrid.maxIconSize,
Math.max(
resultsGrid.minIconSize,
resultsGrid.cellWidth
* resultsGrid.iconSizeRatio))
width: iconSize width: iconSize
height: iconSize height: iconSize
@@ -554,7 +584,9 @@ DankModal {
id: gridIconImg id: gridIconImg
anchors.fill: parent anchors.fill: parent
source: (model.icon) ? Quickshell.iconPath(model.icon, SettingsData.iconTheme === "System Default" ? "" : SettingsData.iconTheme) : "" source: (model.icon) ? Quickshell.iconPath(
model.icon,
SettingsData.iconTheme === "System Default" ? "" : SettingsData.iconTheme) : ""
smooth: true smooth: true
asynchronous: true asynchronous: true
visible: status === Image.Ready visible: status === Image.Ready
@@ -570,14 +602,18 @@ DankModal {
StyledText { StyledText {
anchors.centerIn: parent anchors.centerIn: parent
text: (model.name && model.name.length > 0) ? model.name.charAt(0).toUpperCase() : "A" text: (model.name
font.pixelSize: Math.min(28, parent.width * 0.5) && model.name.length
> 0) ? model.name.charAt(
0).toUpperCase(
) : "A"
font.pixelSize: Math.min(
28,
parent.width * 0.5)
color: Theme.primary color: Theme.primary
font.weight: Font.Bold font.weight: Font.Bold
} }
} }
} }
StyledText { StyledText {
@@ -592,7 +628,6 @@ DankModal {
maximumLineCount: 2 maximumLineCount: 2
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }
} }
MouseArea { MouseArea {
@@ -604,29 +639,30 @@ DankModal {
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
z: 10 z: 10
onEntered: { onEntered: {
if (resultsGrid.hoverUpdatesSelection && !resultsGrid.keyboardNavigationActive) if (resultsGrid.hoverUpdatesSelection
resultsGrid.currentIndex = index; && !resultsGrid.keyboardNavigationActive)
resultsGrid.currentIndex = index
} }
onPositionChanged: { onPositionChanged: {
resultsGrid.keyboardNavigationReset(); resultsGrid.keyboardNavigationReset()
} }
onClicked: (mouse) => { onClicked: mouse => {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
resultsGrid.itemClicked(index, model); resultsGrid.itemClicked(
index, model)
} else if (mouse.button === Qt.RightButton) { } else if (mouse.button === Qt.RightButton) {
var modalPos = mapToItem(spotlightKeyHandler, mouse.x, mouse.y); var modalPos = mapToItem(
resultsGrid.itemRightClicked(index, model, modalPos.x, modalPos.y); spotlightKeyHandler,
mouse.x, mouse.y)
resultsGrid.itemRightClicked(
index, model,
modalPos.x, modalPos.y)
} }
} }
} }
} }
} }
} }
} }
Rectangle { Rectangle {
@@ -651,8 +687,14 @@ DankModal {
finalY = y - menuHeight - 8 finalY = y - menuHeight - 8
} }
finalX = Math.max(8, Math.min(finalX, spotlightKeyHandler.width - menuWidth - 8)) finalX = Math.max(
finalY = Math.max(8, Math.min(finalY, spotlightKeyHandler.height - menuHeight - 8)) 8, Math.min(
finalX,
spotlightKeyHandler.width - menuWidth - 8))
finalY = Math.max(
8, Math.min(
finalY,
spotlightKeyHandler.height - menuHeight - 8))
contextMenu.x = finalX contextMenu.x = finalX
contextMenu.y = finalY contextMenu.y = finalY
@@ -672,7 +714,8 @@ DankModal {
height: menuColumn.implicitHeight + Theme.spacingS * 2 height: menuColumn.implicitHeight + Theme.spacingS * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Theme.popupBackground() color: Theme.popupBackground()
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.08)
border.width: 1 border.width: 1
z: 1000 z: 1000
opacity: menuVisible ? 1 : 0 opacity: menuVisible ? 1 : 0
@@ -700,7 +743,11 @@ DankModal {
width: parent.width width: parent.width
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: pinMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent" color: pinMouseArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.12) : "transparent"
Row { Row {
anchors.left: parent.left anchors.left: parent.left
@@ -710,11 +757,15 @@ DankModal {
DankIcon { DankIcon {
name: { name: {
if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) if (!contextMenu.currentApp
|| !contextMenu.currentApp.desktopEntry)
return "push_pin" return "push_pin"
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || "" var appId = contextMenu.currentApp.desktopEntry.id
return SessionData.isPinnedApp(appId) ? "keep_off" : "push_pin" || contextMenu.currentApp.desktopEntry.execString
|| ""
return SessionData.isPinnedApp(
appId) ? "keep_off" : "push_pin"
} }
size: Theme.iconSize - 2 size: Theme.iconSize - 2
color: Theme.surfaceText color: Theme.surfaceText
@@ -724,11 +775,15 @@ DankModal {
StyledText { StyledText {
text: { text: {
if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) if (!contextMenu.currentApp
|| !contextMenu.currentApp.desktopEntry)
return "Pin to Dock" return "Pin to Dock"
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || "" var appId = contextMenu.currentApp.desktopEntry.id
return SessionData.isPinnedApp(appId) ? "Unpin from Dock" : "Pin to Dock" || contextMenu.currentApp.desktopEntry.execString
|| ""
return SessionData.isPinnedApp(
appId) ? "Unpin from Dock" : "Pin to Dock"
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText color: Theme.surfaceText
@@ -744,10 +799,13 @@ DankModal {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) if (!contextMenu.currentApp
|| !contextMenu.currentApp.desktopEntry)
return return
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || "" var appId = contextMenu.currentApp.desktopEntry.id
|| contextMenu.currentApp.desktopEntry.execString
|| ""
if (SessionData.isPinnedApp(appId)) if (SessionData.isPinnedApp(appId))
SessionData.removePinnedApp(appId) SessionData.removePinnedApp(appId)
else else
@@ -767,7 +825,8 @@ DankModal {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
} }
} }
@@ -775,7 +834,11 @@ DankModal {
width: parent.width width: parent.width
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: launchMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent" color: launchMouseArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.12) : "transparent"
Row { Row {
anchors.left: parent.left anchors.left: parent.left
@@ -808,7 +871,8 @@ DankModal {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (contextMenu.currentApp) if (contextMenu.currentApp)
appLauncher.launchApp(contextMenu.currentApp) appLauncher.launchApp(
contextMenu.currentApp)
contextMenu.close() contextMenu.close()
} }
@@ -845,13 +909,11 @@ DankModal {
width: contextMenu.width width: contextMenu.width
height: contextMenu.height height: contextMenu.height
onClicked: { onClicked: {
// Prevent closing when clicking on the menu itself // Prevent closing when clicking on the menu itself
} }
} }
} }
} }
} }
} }

View File

@@ -14,7 +14,7 @@ DankModal {
wifiPasswordSSID = ssid wifiPasswordSSID = ssid
wifiPasswordInput = "" wifiPasswordInput = ""
open() open()
Qt.callLater(function() { Qt.callLater(function () {
if (contentLoader.item && contentLoader.item.passwordInput) { if (contentLoader.item && contentLoader.item.passwordInput) {
contentLoader.item.passwordInput.forceActiveFocus() contentLoader.item.passwordInput.forceActiveFocus()
} }
@@ -29,7 +29,7 @@ DankModal {
wifiPasswordInput = "" wifiPasswordInput = ""
} }
onOpened: { onOpened: {
Qt.callLater(function() { Qt.callLater(function () {
if (contentLoader.item && contentLoader.item.passwordInput) { if (contentLoader.item && contentLoader.item.passwordInput) {
contentLoader.item.passwordInput.forceActiveFocus() contentLoader.item.passwordInput.forceActiveFocus()
} }
@@ -61,7 +61,7 @@ DankModal {
anchors.fill: parent anchors.fill: parent
focus: true focus: true
Keys.onEscapePressed: function(event) { Keys.onEscapePressed: function (event) {
close() close()
wifiPasswordInput = "" wifiPasswordInput = ""
event.accepted = true event.accepted = true
@@ -138,8 +138,8 @@ DankModal {
wifiPasswordInput = text wifiPasswordInput = text
} }
onAccepted: { onAccepted: {
NetworkService.connectToWifiWithPassword(wifiPasswordSSID, NetworkService.connectToWifiWithPassword(
passwordInput.text) wifiPasswordSSID, passwordInput.text)
close() close()
wifiPasswordInput = "" wifiPasswordInput = ""
passwordInput.text = "" passwordInput.text = ""
@@ -224,7 +224,9 @@ DankModal {
spacing: Theme.spacingM spacing: Theme.spacingM
Rectangle { Rectangle {
width: Math.max(70, cancelText.contentWidth + Theme.spacingM * 2) width: Math.max(
70,
cancelText.contentWidth + Theme.spacingM * 2)
height: 36 height: 36
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: cancelArea.containsMouse ? Theme.surfaceTextHover : "transparent" color: cancelArea.containsMouse ? Theme.surfaceTextHover : "transparent"
@@ -255,10 +257,13 @@ DankModal {
} }
Rectangle { Rectangle {
width: Math.max(80, connectText.contentWidth + Theme.spacingM * 2) width: Math.max(
80,
connectText.contentWidth + Theme.spacingM * 2)
height: 36 height: 36
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: connectArea.containsMouse ? Qt.darker(Theme.primary, color: connectArea.containsMouse ? Qt.darker(
Theme.primary,
1.1) : Theme.primary 1.1) : Theme.primary
enabled: passwordInput.text.length > 0 enabled: passwordInput.text.length > 0
opacity: enabled ? 1 : 0.5 opacity: enabled ? 1 : 0.5
@@ -281,7 +286,8 @@ DankModal {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
enabled: parent.enabled enabled: parent.enabled
onClicked: { onClicked: {
NetworkService.connectToWifiWithPassword(wifiPasswordSSID, NetworkService.connectToWifiWithPassword(
wifiPasswordSSID,
passwordInput.text) passwordInput.text)
close() close()
wifiPasswordInput = "" wifiPasswordInput = ""

View File

@@ -173,11 +173,14 @@ DankPopout {
width: parent.width width: parent.width
height: 52 height: 52
cornerRadius: Theme.cornerRadius cornerRadius: Theme.cornerRadius
backgroundColor: Qt.rgba(Theme.surfaceVariant.r, backgroundColor: Qt.rgba(
Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, Theme.surfaceVariant.b,
Theme.getContentBackgroundAlpha() * 0.7) Theme.getContentBackgroundAlpha(
normalBorderColor: Qt.rgba(Theme.outline.r, Theme.outline.g, ) * 0.7)
normalBorderColor: Qt.rgba(Theme.outline.r,
Theme.outline.g,
Theme.outline.b, 0.3) Theme.outline.b, 0.3)
focusedBorderColor: Theme.primary focusedBorderColor: Theme.primary
leftIconName: "search" leftIconName: "search"
@@ -196,7 +199,8 @@ DankPopout {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
appDrawerPopout.close() appDrawerPopout.close()
event.accepted = true event.accepted = true
} else if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) } else if ((event.key === Qt.Key_Return
|| event.key === Qt.Key_Enter)
&& text.length > 0) { && text.length > 0) {
if (appLauncher.keyboardNavigationActive if (appLauncher.keyboardNavigationActive
&& appLauncher.model.count > 0) { && appLauncher.model.count > 0) {
@@ -208,8 +212,7 @@ DankPopout {
event.accepted = true event.accepted = true
} else if (event.key === Qt.Key_Down || event.key } else if (event.key === Qt.Key_Down || event.key
=== Qt.Key_Up || event.key === Qt.Key_Left || event.key === Qt.Key_Up || event.key === Qt.Key_Left || event.key
=== Qt.Key_Right || ((event.key === Qt.Key_Return || event.key === Qt.Key_Right || ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length === 0)) {
=== Qt.Key_Enter) && text.length === 0)) {
event.accepted = false event.accepted = false
} }
} }
@@ -268,17 +271,21 @@ DankPopout {
circular: false circular: false
iconName: "view_list" iconName: "view_list"
iconSize: 20 iconSize: 20
iconColor: appLauncher.viewMode === "list" ? Theme.primary : Theme.surfaceText iconColor: appLauncher.viewMode
=== "list" ? Theme.primary : Theme.surfaceText
hoverColor: appLauncher.viewMode hoverColor: appLauncher.viewMode
=== "list" ? Qt.rgba(Theme.primary.r, === "list" ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : Qt.rgba( 0.12) : Qt.rgba(
Theme.surfaceVariant.r, Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.08) Theme.surfaceVariant.b,
0.08)
backgroundColor: appLauncher.viewMode backgroundColor: appLauncher.viewMode
=== "list" ? Qt.rgba(Theme.primary.r, === "list" ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : "transparent" 0.12) : "transparent"
@@ -292,17 +299,21 @@ DankPopout {
circular: false circular: false
iconName: "grid_view" iconName: "grid_view"
iconSize: 20 iconSize: 20
iconColor: appLauncher.viewMode === "grid" ? Theme.primary : Theme.surfaceText iconColor: appLauncher.viewMode
=== "grid" ? Theme.primary : Theme.surfaceText
hoverColor: appLauncher.viewMode hoverColor: appLauncher.viewMode
=== "grid" ? Qt.rgba(Theme.primary.r, === "grid" ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : Qt.rgba( 0.12) : Qt.rgba(
Theme.surfaceVariant.r, Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.08) Theme.surfaceVariant.b,
0.08)
backgroundColor: appLauncher.viewMode backgroundColor: appLauncher.viewMode
=== "grid" ? Qt.rgba(Theme.primary.r, === "grid" ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : "transparent" 0.12) : "transparent"
@@ -322,7 +333,8 @@ DankPopout {
return parent.height - usedHeight return parent.height - usedHeight
} }
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.1) Theme.surfaceVariant.b, 0.1)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.05) Theme.outline.b, 0.05)
@@ -430,7 +442,8 @@ DankPopout {
StyledText { StyledText {
anchors.centerIn: parent anchors.centerIn: parent
text: (model.name text: (model.name
&& model.name.length > 0) ? model.name.charAt( && model.name.length
> 0) ? model.name.charAt(
0).toUpperCase( 0).toUpperCase(
) : "A" ) : "A"
font.pixelSize: appList.iconSize * 0.4 font.pixelSize: appList.iconSize * 0.4
@@ -460,7 +473,8 @@ DankPopout {
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
elide: Text.ElideRight elide: Text.ElideRight
visible: appList.showDescription && model.comment visible: appList.showDescription
&& model.comment
&& model.comment.length > 0 && model.comment.length > 0
} }
} }
@@ -484,10 +498,14 @@ DankPopout {
} }
onClicked: mouse => { onClicked: mouse => {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
appList.itemClicked(index, model) appList.itemClicked(
index, model)
} else if (mouse.button === Qt.RightButton) { } else if (mouse.button === Qt.RightButton) {
var panelPos = mapToItem(contextMenu.parent, mouse.x, mouse.y) var panelPos = mapToItem(
appList.itemRightClicked(index, model, contextMenu.parent,
mouse.x, mouse.y)
appList.itemRightClicked(
index, model,
panelPos.x, panelPos.x,
panelPos.y) panelPos.y)
} }
@@ -510,14 +528,9 @@ DankPopout {
property int minIconSize: 32 property int minIconSize: 32
property bool hoverUpdatesSelection: false property bool hoverUpdatesSelection: false
property bool keyboardNavigationActive: appLauncher.keyboardNavigationActive property bool keyboardNavigationActive: appLauncher.keyboardNavigationActive
property int baseCellWidth: adaptiveColumns ? Math.max( property int baseCellWidth: adaptiveColumns ? Math.max(minCellWidth, Math.min(maxCellWidth, width / columns)) : (width - Theme.spacingS * 2) / columns
minCellWidth,
Math.min(
maxCellWidth,
width / columns)) : (width - Theme.spacingS * 2) / columns
property int baseCellHeight: baseCellWidth + 20 property int baseCellHeight: baseCellWidth + 20
property int actualColumns: adaptiveColumns ? Math.floor( property int actualColumns: adaptiveColumns ? Math.floor(width / cellWidth) : columns
width / cellWidth) : columns
property int remainingSpace: width - (actualColumns * cellWidth) property int remainingSpace: width - (actualColumns * cellWidth)
signal keyboardNavigationReset signal keyboardNavigationReset
@@ -528,7 +541,8 @@ DankPopout {
if (index < 0 || index >= count) if (index < 0 || index >= count)
return return
var itemY = Math.floor(index / actualColumns) * cellHeight var itemY = Math.floor(
index / actualColumns) * cellHeight
var itemBottom = itemY + cellHeight var itemBottom = itemY + cellHeight
if (itemY < contentY) if (itemY < contentY)
contentY = itemY contentY = itemY
@@ -543,7 +557,8 @@ DankPopout {
clip: true clip: true
cellWidth: baseCellWidth cellWidth: baseCellWidth
cellHeight: baseCellHeight cellHeight: baseCellHeight
leftMargin: Math.max(Theme.spacingS, remainingSpace / 2) leftMargin: Math.max(Theme.spacingS,
remainingSpace / 2)
rightMargin: leftMargin rightMargin: leftMargin
focus: true focus: true
interactive: true interactive: true
@@ -578,8 +593,7 @@ DankPopout {
height: appGrid.cellHeight - appGrid.cellPadding height: appGrid.cellHeight - appGrid.cellPadding
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: appGrid.currentIndex === index ? Theme.primaryPressed : gridMouseArea.containsMouse ? Theme.primaryHoverLight : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.03) color: appGrid.currentIndex === index ? Theme.primaryPressed : gridMouseArea.containsMouse ? Theme.primaryHoverLight : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.03)
border.color: appGrid.currentIndex border.color: appGrid.currentIndex === index ? Theme.primarySelected : Theme.outlineMedium
=== index ? Theme.primarySelected : Theme.outlineMedium
border.width: appGrid.currentIndex === index ? 2 : 1 border.width: appGrid.currentIndex === index ? 2 : 1
Column { Column {
@@ -588,9 +602,11 @@ DankPopout {
Item { Item {
property int iconSize: Math.min( property int iconSize: Math.min(
appGrid.maxIconSize, Math.max( appGrid.maxIconSize,
Math.max(
appGrid.minIconSize, appGrid.minIconSize,
appGrid.cellWidth * appGrid.iconSizeRatio)) appGrid.cellWidth
* appGrid.iconSizeRatio))
width: iconSize width: iconSize
height: iconSize height: iconSize
@@ -619,10 +635,13 @@ DankPopout {
StyledText { StyledText {
anchors.centerIn: parent anchors.centerIn: parent
text: (model.name text: (model.name
&& model.name.length > 0) ? model.name.charAt( && model.name.length
> 0) ? model.name.charAt(
0).toUpperCase( 0).toUpperCase(
) : "A" ) : "A"
font.pixelSize: Math.min(28, parent.width * 0.5) font.pixelSize: Math.min(
28,
parent.width * 0.5)
color: Theme.primary color: Theme.primary
font.weight: Font.Bold font.weight: Font.Bold
} }
@@ -661,10 +680,14 @@ DankPopout {
} }
onClicked: mouse => { onClicked: mouse => {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
appGrid.itemClicked(index, model) appGrid.itemClicked(
index, model)
} else if (mouse.button === Qt.RightButton) { } else if (mouse.button === Qt.RightButton) {
var panelPos = mapToItem(contextMenu.parent, mouse.x, mouse.y) var panelPos = mapToItem(
appGrid.itemRightClicked(index, model, contextMenu.parent,
mouse.x, mouse.y)
appGrid.itemRightClicked(
index, model,
panelPos.x, panelPos.x,
panelPos.y) panelPos.y)
} }
@@ -701,8 +724,12 @@ DankPopout {
finalY = y - menuHeight - 8 finalY = y - menuHeight - 8
} }
finalX = Math.max(8, Math.min(finalX, appDrawerPopout.popupWidth - menuWidth - 8)) finalX = Math.max(
finalY = Math.max(8, Math.min(finalY, appDrawerPopout.popupHeight - menuHeight - 8)) 8, Math.min(finalX,
appDrawerPopout.popupWidth - menuWidth - 8))
finalY = Math.max(8, Math.min(
finalY,
appDrawerPopout.popupHeight - menuHeight - 8))
contextMenu.x = finalX contextMenu.x = finalX
contextMenu.y = finalY contextMenu.y = finalY
@@ -722,7 +749,8 @@ DankPopout {
height: menuColumn.implicitHeight + Theme.spacingS * 2 height: menuColumn.implicitHeight + Theme.spacingS * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Theme.popupBackground() color: Theme.popupBackground()
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.08)
border.width: 1 border.width: 1
z: 1000 z: 1000
opacity: menuVisible ? 1 : 0 opacity: menuVisible ? 1 : 0
@@ -750,7 +778,8 @@ DankPopout {
width: parent.width width: parent.width
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: pinMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, color: pinMouseArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : "transparent" 0.12) : "transparent"
@@ -768,8 +797,10 @@ DankPopout {
return "push_pin" return "push_pin"
var appId = contextMenu.currentApp.desktopEntry.id var appId = contextMenu.currentApp.desktopEntry.id
|| contextMenu.currentApp.desktopEntry.execString || "" || contextMenu.currentApp.desktopEntry.execString
return SessionData.isPinnedApp(appId) ? "keep_off" : "push_pin" || ""
return SessionData.isPinnedApp(
appId) ? "keep_off" : "push_pin"
} }
size: Theme.iconSize - 2 size: Theme.iconSize - 2
color: Theme.surfaceText color: Theme.surfaceText
@@ -784,7 +815,8 @@ DankPopout {
return "Pin to Dock" return "Pin to Dock"
var appId = contextMenu.currentApp.desktopEntry.id var appId = contextMenu.currentApp.desktopEntry.id
|| contextMenu.currentApp.desktopEntry.execString || "" || contextMenu.currentApp.desktopEntry.execString
|| ""
return SessionData.isPinnedApp( return SessionData.isPinnedApp(
appId) ? "Unpin from Dock" : "Pin to Dock" appId) ? "Unpin from Dock" : "Pin to Dock"
} }
@@ -807,7 +839,8 @@ DankPopout {
return return
var appId = contextMenu.currentApp.desktopEntry.id var appId = contextMenu.currentApp.desktopEntry.id
|| contextMenu.currentApp.desktopEntry.execString || "" || contextMenu.currentApp.desktopEntry.execString
|| ""
if (SessionData.isPinnedApp(appId)) if (SessionData.isPinnedApp(appId))
SessionData.removePinnedApp(appId) SessionData.removePinnedApp(appId)
else else
@@ -827,7 +860,8 @@ DankPopout {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
} }
} }
@@ -835,7 +869,8 @@ DankPopout {
width: parent.width width: parent.width
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: launchMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, color: launchMouseArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : "transparent" 0.12) : "transparent"
@@ -908,6 +943,7 @@ DankPopout {
width: contextMenu.width width: contextMenu.width
height: contextMenu.height height: contextMenu.height
onClicked: { onClicked: {
// Prevent closing when clicking on the menu itself // Prevent closing when clicking on the menu itself
} }
} }

View File

@@ -46,16 +46,19 @@ Item {
var apps = [] var apps = []
if (searchQuery.length === 0) { if (searchQuery.length === 0) {
if (selectedCategory === "All") { if (selectedCategory === "All") {
apps = AppSearchService.getAppsInCategory("All") // HACK: Use function call instead of property apps = AppSearchService.getAppsInCategory(
"All") // HACK: Use function call instead of property
} else { } else {
var categoryApps = AppSearchService.getAppsInCategory(selectedCategory) var categoryApps = AppSearchService.getAppsInCategory(
selectedCategory)
apps = categoryApps.slice(0, maxResults) apps = categoryApps.slice(0, maxResults)
} }
} else { } else {
if (selectedCategory === "All") { if (selectedCategory === "All") {
apps = AppSearchService.searchApplications(searchQuery) apps = AppSearchService.searchApplications(searchQuery)
} else { } else {
var categoryApps = AppSearchService.getAppsInCategory(selectedCategory) var categoryApps = AppSearchService.getAppsInCategory(
selectedCategory)
if (categoryApps.length > 0) { if (categoryApps.length > 0) {
var allSearchResults = AppSearchService.searchApplications( var allSearchResults = AppSearchService.searchApplications(
searchQuery) searchQuery)
@@ -91,7 +94,8 @@ Item {
"icon": app.icon "icon": app.icon
|| "application-x-executable", || "application-x-executable",
"comment": app.comment || "", "comment": app.comment || "",
"categories": app.categories || [], "categories": app.categories
|| [],
"desktopEntry": app "desktopEntry": app
}) })
}) })
@@ -105,7 +109,8 @@ Item {
filteredModel.count - 1) filteredModel.count - 1)
selectedIndex = newIndex selectedIndex = newIndex
} else { } else {
selectedIndex = Math.min(selectedIndex + 1, filteredModel.count - 1) selectedIndex = Math.min(selectedIndex + 1,
filteredModel.count - 1)
} }
} }
} }

View File

@@ -25,7 +25,8 @@ Item {
Rectangle { Rectangle {
height: 36 height: 36
width: (parent.width - (Math.min(categories.length, width: (parent.width - (Math.min(
categories.length,
8) - 1) * Theme.spacingS) / Math.min( 8) - 1) * Theme.spacingS) / Math.min(
categories.length, 8) categories.length, 8)
radius: Theme.cornerRadius radius: Theme.cornerRadius
@@ -33,7 +34,8 @@ Item {
border.color: selectedCategory === modelData ? "transparent" : Qt.rgba( border.color: selectedCategory === modelData ? "transparent" : Qt.rgba(
Theme.outline.r, Theme.outline.r,
Theme.outline.g, Theme.outline.g,
Theme.outline.b, 0.3) Theme.outline.b,
0.3)
StyledText { StyledText {
anchors.centerIn: parent anchors.centerIn: parent
@@ -63,7 +65,9 @@ Item {
spacing: Theme.spacingS spacing: Theme.spacingS
Row { Row {
property var firstRowCategories: categories.slice(0, Math.min(4, categories.length)) property var firstRowCategories: categories.slice(
0, Math.min(4,
categories.length))
width: parent.width width: parent.width
spacing: Theme.spacingS spacing: Theme.spacingS
@@ -73,10 +77,12 @@ Item {
Rectangle { Rectangle {
height: 36 height: 36
width: (parent.width - (parent.firstRowCategories.length - 1) * Theme.spacingS) / parent.firstRowCategories.length width: (parent.width - (parent.firstRowCategories.length - 1)
* Theme.spacingS) / parent.firstRowCategories.length
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: selectedCategory === modelData ? Theme.primary : "transparent" color: selectedCategory === modelData ? Theme.primary : "transparent"
border.color: selectedCategory === modelData ? "transparent" : Qt.rgba( border.color: selectedCategory
=== modelData ? "transparent" : Qt.rgba(
Theme.outline.r, Theme.outline.r,
Theme.outline.g, Theme.outline.g,
Theme.outline.b, 0.3) Theme.outline.b, 0.3)
@@ -104,7 +110,8 @@ Item {
} }
Row { Row {
property var secondRowCategories: categories.slice(4, categories.length) property var secondRowCategories: categories.slice(
4, categories.length)
width: parent.width width: parent.width
spacing: Theme.spacingS spacing: Theme.spacingS
@@ -115,10 +122,12 @@ Item {
Rectangle { Rectangle {
height: 36 height: 36
width: (parent.width - (parent.secondRowCategories.length - 1) * Theme.spacingS) / parent.secondRowCategories.length width: (parent.width - (parent.secondRowCategories.length - 1)
* Theme.spacingS) / parent.secondRowCategories.length
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: selectedCategory === modelData ? Theme.primary : "transparent" color: selectedCategory === modelData ? Theme.primary : "transparent"
border.color: selectedCategory === modelData ? "transparent" : Qt.rgba( border.color: selectedCategory
=== modelData ? "transparent" : Qt.rgba(
Theme.outline.r, Theme.outline.r,
Theme.outline.g, Theme.outline.g,
Theme.outline.b, 0.3) Theme.outline.b, 0.3)

View File

@@ -20,7 +20,8 @@ PanelWindow {
interval: BrightnessService.ddcAvailable ? 500 : 50 interval: BrightnessService.ddcAvailable ? 500 : 50
repeat: false repeat: false
onTriggered: { onTriggered: {
BrightnessService.setBrightnessInternal(pendingValue, BrightnessService.lastIpcDevice) BrightnessService.setBrightnessInternal(
pendingValue, BrightnessService.lastIpcDevice)
} }
} }
@@ -116,14 +117,15 @@ PanelWindow {
DankIcon { DankIcon {
anchors.centerIn: parent anchors.centerIn: parent
name: { name: {
const deviceInfo = BrightnessService.getCurrentDeviceInfo(); const deviceInfo = BrightnessService.getCurrentDeviceInfo()
if (!deviceInfo || deviceInfo.class === "backlight" || deviceInfo.class === "ddc") { if (!deviceInfo || deviceInfo.class === "backlight"
return "brightness_medium"; || deviceInfo.class === "ddc") {
return "brightness_medium"
} else if (deviceInfo.name.includes("kbd")) { } else if (deviceInfo.name.includes("kbd")) {
return "keyboard"; return "keyboard"
} else { } else {
return "lightbulb"; return "lightbulb"
} }
} }
size: Theme.iconSize size: Theme.iconSize
@@ -157,7 +159,9 @@ PanelWindow {
onSliderDragFinished: function (finalValue) { onSliderDragFinished: function (finalValue) {
if (BrightnessService.brightnessAvailable) { if (BrightnessService.brightnessAvailable) {
brightnessDebounceTimer.stop() brightnessDebounceTimer.stop()
BrightnessService.setBrightnessInternal(finalValue, BrightnessService.lastIpcDevice) BrightnessService.setBrightnessInternal(
finalValue,
BrightnessService.lastIpcDevice)
} }
} }

View File

@@ -19,7 +19,8 @@ Column {
displayDate.getMonth(), 1) displayDate.getMonth(), 1)
let dayOfWeek = firstDay.getDay() let dayOfWeek = firstDay.getDay()
let startDate = new Date(firstDay) let startDate = new Date(firstDay)
startDate.setDate(startDate.getDate() - dayOfWeek - 7) // Extra week padding startDate.setDate(startDate.getDate(
) - dayOfWeek - 7) // Extra week padding
let lastDay = new Date(displayDate.getFullYear(), let lastDay = new Date(displayDate.getFullYear(),
displayDate.getMonth() + 1, 0) displayDate.getMonth() + 1, 0)
let endDate = new Date(lastDay) let endDate = new Date(lastDay)
@@ -148,7 +149,8 @@ Column {
Grid { Grid {
property date firstDay: { property date firstDay: {
let date = new Date(displayDate.getFullYear(), displayDate.getMonth(), 1) let date = new Date(displayDate.getFullYear(),
displayDate.getMonth(), 1)
let dayOfWeek = date.getDay() let dayOfWeek = date.getDay()
date.setDate(date.getDate() - dayOfWeek) date.setDate(date.getDate() - dayOfWeek)
return date return date
@@ -197,7 +199,8 @@ Column {
text: dayDate.getDate() text: dayDate.getDate()
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: isSelected ? Theme.surface : isToday ? Theme.primary : isCurrentMonth ? Theme.surfaceText : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.4) color: isSelected ? Theme.surface : isToday ? Theme.primary : isCurrentMonth ? Theme.surfaceText : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.4)
font.weight: isToday || isSelected ? Font.Medium : Font.Normal font.weight: isToday
|| isSelected ? Font.Medium : Font.Normal
} }
Rectangle { Rectangle {
@@ -205,7 +208,8 @@ Column {
anchors.fill: parent anchors.fill: parent
radius: parent.radius radius: parent.radius
visible: CalendarService && CalendarService.khalAvailable visible: CalendarService
&& CalendarService.khalAvailable
&& CalendarService.hasEventsForDate(dayDate) && CalendarService.hasEventsForDate(dayDate)
opacity: { opacity: {
if (isSelected) if (isSelected)

View File

@@ -76,8 +76,8 @@ PanelWindow {
id: mainContainer id: mainContainer
readonly property real targetWidth: Math.min( readonly property real targetWidth: Math.min(
(root.screen ? root.screen.width : Screen.width) * 0.9, (root.screen ? root.screen.width : Screen.width)
600) * 0.9, 600)
function calculateWidth() { function calculateWidth() {
let baseWidth = 320 let baseWidth = 320
@@ -232,7 +232,8 @@ PanelWindow {
property bool hasAnyWidgets: true property bool hasAnyWidgets: true
width: hasAnyWidgets ? parent.width * 0.42 : 0 // Slightly narrower for better proportions width: hasAnyWidgets ? parent.width
* 0.42 : 0 // Slightly narrower for better proportions
height: childrenRect.height height: childrenRect.height
spacing: Theme.spacingM spacing: Theme.spacingM
visible: hasAnyWidgets visible: hasAnyWidgets
@@ -261,7 +262,8 @@ PanelWindow {
- Theme.spacingM : parent.width - Theme.spacingM : parent.width
height: parent.height height: parent.height
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.2) Theme.surfaceVariant.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.08) Theme.outline.b, 0.08)
@@ -316,8 +318,8 @@ PanelWindow {
enabled: shouldBeVisible enabled: shouldBeVisible
onClicked: function (mouse) { onClicked: function (mouse) {
var localPos = mapToItem(mainContainer, mouse.x, mouse.y) var localPos = mapToItem(mainContainer, mouse.x, mouse.y)
if (localPos.x < 0 || localPos.x > mainContainer.width || localPos.y < 0 if (localPos.x < 0 || localPos.x > mainContainer.width
|| localPos.y > mainContainer.height) || localPos.y < 0 || localPos.y > mainContainer.height)
calendarVisible = false calendarVisible = false
} }
} }

View File

@@ -32,7 +32,8 @@ Rectangle {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.12) Theme.surfaceVariant.b, 0.12)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.08)
border.width: 1 border.width: 1
visible: shouldShow visible: shouldShow
layer.enabled: true layer.enabled: true
@@ -73,9 +74,8 @@ Rectangle {
} }
StyledText { StyledText {
text: hasEvents ? (Qt.formatDate( text: hasEvents ? (Qt.formatDate(selectedDate, "MMM d") + " • "
selectedDate, + (selectedDateEvents.length
"MMM d") + " • " + (selectedDateEvents.length
=== 1 ? "1 event" : selectedDateEvents.length === 1 ? "1 event" : selectedDateEvents.length
+ " events")) : Qt.formatDate( + " events")) : Qt.formatDate(
selectedDate, "MMM d") selectedDate, "MMM d")
@@ -142,12 +142,13 @@ Rectangle {
momentum = event.pixelDelta.y * 1.8 momentum = event.pixelDelta.y * 1.8
} else { } else {
// Mouse wheel with angle delta // Mouse wheel with angle delta
momentum = (event.angleDelta.y / 120) * (60 * 2.5) // ~2.5 items per wheel step momentum = (event.angleDelta.y / 120)
* (60 * 2.5) // ~2.5 items per wheel step
} }
let newY = parent.contentY - momentum let newY = parent.contentY - momentum
newY = Math.max(0, newY = Math.max(
Math.min(parent.contentHeight - parent.height, 0, Math.min(parent.contentHeight - parent.height,
newY)) newY))
parent.contentY = newY parent.contentY = newY
momentum *= 0.92 // Decay for smooth momentum momentum *= 0.92 // Decay for smooth momentum
@@ -183,7 +184,8 @@ Rectangle {
} }
border.color: { border.color: {
if (modelData.url && eventMouseArea.containsMouse) if (modelData.url && eventMouseArea.containsMouse)
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.3) return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.3)
else if (eventMouseArea.containsMouse) else if (eventMouseArea.containsMouse)
return Qt.rgba(Theme.primary.r, Theme.primary.g, return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.15) Theme.primary.b, 0.15)
@@ -237,7 +239,8 @@ Rectangle {
DankIcon { DankIcon {
name: "schedule" name: "schedule"
size: Theme.fontSizeSmall size: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
@@ -248,18 +251,21 @@ Rectangle {
return "All day" return "All day"
} else { } else {
let timeFormat = SettingsData.use24HourClock ? "H:mm" : "h:mm AP" let timeFormat = SettingsData.use24HourClock ? "H:mm" : "h:mm AP"
let startTime = Qt.formatTime(modelData.start, timeFormat) let startTime = Qt.formatTime(
modelData.start, timeFormat)
if (modelData.start.toDateString( if (modelData.start.toDateString(
) !== modelData.end.toDateString() ) !== modelData.end.toDateString(
|| modelData.start.getTime() !== modelData.end.getTime()) ) || modelData.start.getTime(
return startTime + " " + Qt.formatTime(modelData.end, ) !== modelData.end.getTime())
timeFormat) return startTime + " " + Qt.formatTime(
modelData.end, timeFormat)
return startTime return startTime
} }
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
font.weight: Font.Normal font.weight: Font.Normal
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -277,7 +283,8 @@ Rectangle {
DankIcon { DankIcon {
name: "location_on" name: "location_on"
size: Theme.fontSizeSmall size: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
@@ -285,7 +292,8 @@ Rectangle {
StyledText { StyledText {
text: modelData.location text: modelData.location
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
elide: Text.ElideRight elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter

View File

@@ -15,7 +15,8 @@ Rectangle {
property string lastValidArtist: "" property string lastValidArtist: ""
property string lastValidAlbum: "" property string lastValidAlbum: ""
property string lastValidArtUrl: "" property string lastValidArtUrl: ""
property real currentPosition: activePlayer && activePlayer.positionSupported ? activePlayer.position : 0 property real currentPosition: activePlayer
&& activePlayer.positionSupported ? activePlayer.position : 0
function ratio() { function ratio() {
if (!activePlayer || activePlayer.length <= 0) { if (!activePlayer || activePlayer.length <= 0) {
@@ -35,7 +36,8 @@ Rectangle {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
Theme.surfaceContainer.b, 0.4) Theme.surfaceContainer.b, 0.4)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.08)
border.width: 1 border.width: 1
layer.enabled: true layer.enabled: true
@@ -43,7 +45,8 @@ Rectangle {
id: positionTimer id: positionTimer
interval: 500 interval: 500
running: activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing running: activePlayer
&& activePlayer.playbackState === MprisPlaybackState.Playing
&& !progressMouseArea.isSeeking && !progressMouseArea.isSeeking
repeat: true repeat: true
onTriggered: { onTriggered: {
@@ -121,7 +124,8 @@ Rectangle {
width: 60 width: 60
height: 60 height: 60
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3) Theme.surfaceVariant.b, 0.3)
Item { Item {
@@ -164,8 +168,8 @@ Rectangle {
spacing: Theme.spacingXS spacing: Theme.spacingXS
StyledText { StyledText {
text: activePlayer && activePlayer.trackTitle || lastValidTitle text: activePlayer && activePlayer.trackTitle
|| "Unknown Track" || lastValidTitle || "Unknown Track"
onTextChanged: { onTextChanged: {
if (activePlayer && activePlayer.trackTitle) if (activePlayer && activePlayer.trackTitle)
lastValidTitle = activePlayer.trackTitle lastValidTitle = activePlayer.trackTitle
@@ -180,14 +184,15 @@ Rectangle {
} }
StyledText { StyledText {
text: activePlayer && activePlayer.trackArtist || lastValidArtist text: activePlayer && activePlayer.trackArtist
|| "Unknown Artist" || lastValidArtist || "Unknown Artist"
onTextChanged: { onTextChanged: {
if (activePlayer && activePlayer.trackArtist) if (activePlayer && activePlayer.trackArtist)
lastValidArtist = activePlayer.trackArtist lastValidArtist = activePlayer.trackArtist
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.8) Theme.surfaceText.b, 0.8)
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -203,7 +208,8 @@ Rectangle {
lastValidAlbum = activePlayer.trackAlbum lastValidAlbum = activePlayer.trackAlbum
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.6) Theme.surfaceText.b, 0.6)
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -226,7 +232,8 @@ Rectangle {
width: parent.width width: parent.width
height: 6 height: 6
radius: 3 radius: 3
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3) Theme.surfaceVariant.b, 0.3)
visible: activePlayer !== null visible: activePlayer !== null
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -237,7 +244,8 @@ Rectangle {
height: parent.height height: parent.height
radius: parent.radius radius: parent.radius
color: Theme.primary color: Theme.primary
width: Math.max(0, Math.min(parent.width, parent.width * ratio())) width: Math.max(0, Math.min(parent.width,
parent.width * ratio()))
Behavior on width { Behavior on width {
NumberAnimation { NumberAnimation {
@@ -283,9 +291,12 @@ Rectangle {
preventStealing: true preventStealing: true
onPressed: function (mouse) { onPressed: function (mouse) {
isSeeking = true isSeeking = true
if (activePlayer && activePlayer.length > 0 && activePlayer.canSeek) { if (activePlayer && activePlayer.length > 0
let ratio = Math.max(0, Math.min( && activePlayer.canSeek) {
1, mouse.x / progressBarBackground.width)) let ratio = Math.max(
0, Math.min(
1,
mouse.x / progressBarBackground.width))
let seekPosition = ratio * activePlayer.length let seekPosition = ratio * activePlayer.length
activePlayer.position = seekPosition activePlayer.position = seekPosition
} }
@@ -295,17 +306,23 @@ Rectangle {
} }
onPositionChanged: function (mouse) { onPositionChanged: function (mouse) {
if (pressed && isSeeking && activePlayer if (pressed && isSeeking && activePlayer
&& activePlayer.length > 0 && activePlayer.canSeek) { && activePlayer.length > 0
let ratio = Math.max(0, Math.min( && activePlayer.canSeek) {
1, mouse.x / progressBarBackground.width)) let ratio = Math.max(
0, Math.min(
1,
mouse.x / progressBarBackground.width))
let seekPosition = ratio * activePlayer.length let seekPosition = ratio * activePlayer.length
activePlayer.position = seekPosition activePlayer.position = seekPosition
} }
} }
onClicked: function (mouse) { onClicked: function (mouse) {
if (activePlayer && activePlayer.length > 0 && activePlayer.canSeek) { if (activePlayer && activePlayer.length > 0
let ratio = Math.max(0, Math.min( && activePlayer.canSeek) {
1, mouse.x / progressBarBackground.width)) let ratio = Math.max(
0, Math.min(
1,
mouse.x / progressBarBackground.width))
let seekPosition = ratio * activePlayer.length let seekPosition = ratio * activePlayer.length
activePlayer.position = seekPosition activePlayer.position = seekPosition
} }
@@ -324,10 +341,14 @@ Rectangle {
preventStealing: true preventStealing: true
onPositionChanged: function (mouse) { onPositionChanged: function (mouse) {
if (progressMouseArea.isSeeking && activePlayer if (progressMouseArea.isSeeking && activePlayer
&& activePlayer.length > 0 && activePlayer.canSeek) { && activePlayer.length > 0
let globalPos = mapToItem(progressBarBackground, mouse.x, mouse.y) && activePlayer.canSeek) {
let globalPos = mapToItem(progressBarBackground,
mouse.x, mouse.y)
let ratio = Math.max( let ratio = Math.max(
0, Math.min(1, globalPos.x / progressBarBackground.width)) 0, Math.min(
1,
globalPos.x / progressBarBackground.width))
let seekPosition = ratio * activePlayer.length let seekPosition = ratio * activePlayer.length
activePlayer.position = seekPosition activePlayer.position = seekPosition
} }
@@ -352,7 +373,8 @@ Rectangle {
width: 28 width: 28
height: 28 height: 28
radius: 14 radius: 14
color: prevBtnArea.containsMouse ? Qt.rgba(Theme.surfaceVariant.r, color: prevBtnArea.containsMouse ? Qt.rgba(
Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, Theme.surfaceVariant.b,
0.12) : "transparent" 0.12) : "transparent"
@@ -374,7 +396,8 @@ Rectangle {
if (!activePlayer) if (!activePlayer)
return return
if (activePlayer.position > 8 && activePlayer.canSeek) { if (activePlayer.position > 8
&& activePlayer.canSeek) {
activePlayer.position = 0 activePlayer.position = 0
} else { } else {
activePlayer.previous() activePlayer.previous()
@@ -401,7 +424,8 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: activePlayer && activePlayer.togglePlaying() onClicked: activePlayer
&& activePlayer.togglePlaying()
} }
} }
@@ -409,7 +433,8 @@ Rectangle {
width: 28 width: 28
height: 28 height: 28
radius: 14 radius: 14
color: nextBtnArea.containsMouse ? Qt.rgba(Theme.surfaceVariant.r, color: nextBtnArea.containsMouse ? Qt.rgba(
Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, Theme.surfaceVariant.b,
0.12) : "transparent" 0.12) : "transparent"

View File

@@ -9,7 +9,8 @@ Rectangle {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
Theme.surfaceContainer.b, 0.4) Theme.surfaceContainer.b, 0.4)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.08)
border.width: 1 border.width: 1
Ref { Ref {
@@ -58,7 +59,8 @@ Rectangle {
Rectangle { Rectangle {
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.1)
} }
Column { Column {
@@ -82,8 +84,7 @@ Rectangle {
} }
StyledText { StyledText {
text: DgopService.processCount + " proc, " text: DgopService.processCount + " proc, " + DgopService.threadCount + " threads"
+ DgopService.threadCount + " threads"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
Theme.surfaceText.b, 0.8) Theme.surfaceText.b, 0.8)
@@ -130,6 +131,7 @@ Rectangle {
} }
// Fallback - return as is but truncated // Fallback - return as is but truncated
return uptimeStr.length > 8 ? uptimeStr.substring(0, 8) + "…" : uptimeStr return uptimeStr.length > 8 ? uptimeStr.substring(0,
8) + "…" : uptimeStr
} }
} }

View File

@@ -13,7 +13,8 @@ Rectangle {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
Theme.surfaceContainer.b, 0.4) Theme.surfaceContainer.b, 0.4)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.08)
border.width: 1 border.width: 1
layer.enabled: true layer.enabled: true
@@ -59,7 +60,8 @@ Rectangle {
id: refreshButton id: refreshButton
name: "refresh" name: "refresh"
size: Theme.iconSize - 6 size: Theme.iconSize - 6
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
Theme.surfaceText.b, 0.3)
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.rightMargin: -Theme.spacingS anchors.rightMargin: -Theme.spacingS
@@ -100,7 +102,8 @@ Rectangle {
spacing: Theme.spacingL spacing: Theme.spacingL
DankIcon { DankIcon {
name: WeatherService.getWeatherIcon(WeatherService.weather.wCode) name: WeatherService.getWeatherIcon(
WeatherService.weather.wCode)
size: Theme.iconSize + 8 size: Theme.iconSize + 8
color: Theme.primary color: Theme.primary
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -123,7 +126,8 @@ Rectangle {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (WeatherService.weather.available) if (WeatherService.weather.available)
SettingsData.setTemperatureUnit(!SettingsData.useFahrenheit) SettingsData.setTemperatureUnit(
!SettingsData.useFahrenheit)
} }
enabled: WeatherService.weather.available enabled: WeatherService.weather.available
} }
@@ -132,7 +136,8 @@ Rectangle {
StyledText { StyledText {
text: WeatherService.weather.city || "" text: WeatherService.weather.city || ""
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
visible: text.length > 0 visible: text.length > 0
} }
@@ -156,7 +161,8 @@ Rectangle {
} }
StyledText { StyledText {
text: WeatherService.weather.humidity ? WeatherService.weather.humidity + "%" : "--" text: WeatherService.weather.humidity ? WeatherService.weather.humidity
+ "%" : "--"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter

View File

@@ -118,14 +118,16 @@ Column {
StyledText { StyledText {
text: { text: {
if (AudioService.subtitle(modelData.name) if (AudioService.subtitle(modelData.name)
&& AudioService.subtitle(modelData.name) !== "") && AudioService.subtitle(
return AudioService.subtitle( modelData.name) !== "")
modelData.name) + (modelData === AudioService.sink ? " • Selected" : "") return AudioService.subtitle(modelData.name)
+ (modelData === AudioService.sink ? " • Selected" : "")
else else
return modelData === AudioService.sink ? "Selected" : "" return modelData === AudioService.sink ? "Selected" : ""
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
visible: text !== "" visible: text !== ""
} }

View File

@@ -117,14 +117,16 @@ Column {
StyledText { StyledText {
text: { text: {
if (AudioService.subtitle(modelData.name) if (AudioService.subtitle(modelData.name)
&& AudioService.subtitle(modelData.name) !== "") && AudioService.subtitle(
return AudioService.subtitle( modelData.name) !== "")
modelData.name) + (modelData === AudioService.source ? " • Selected" : "") return AudioService.subtitle(modelData.name)
+ (modelData === AudioService.source ? " • Selected" : "")
else else
return modelData === AudioService.source ? "Selected" : "" return modelData === AudioService.source ? "Selected" : ""
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
visible: text !== "" visible: text !== ""
} }

View File

@@ -10,10 +10,11 @@ import qs.Widgets
Column { Column {
id: root id: root
property real micLevel: Math.min( property real micLevel: Math.min(100,
100, (AudioService.source
(AudioService.source && AudioService.source.audio && AudioService.source.audio
&& AudioService.source.audio.volume * 100) || 0) && AudioService.source.audio.volume * 100)
|| 0)
property bool micMuted: (AudioService.source && AudioService.source.audio property bool micMuted: (AudioService.source && AudioService.source.audio
&& AudioService.source.audio.muted) || false && AudioService.source.audio.muted) || false
@@ -94,7 +95,8 @@ Column {
x: Math.max(0, Math.min(parent.width - width, x: Math.max(0, Math.min(parent.width - width,
micSliderFill.width - width / 2)) micSliderFill.width - width / 2))
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
scale: micMouseArea.containsMouse || micMouseArea.pressed ? 1.2 : 1 scale: micMouseArea.containsMouse
|| micMouseArea.pressed ? 1.2 : 1
Rectangle { Rectangle {
id: micTooltip id: micTooltip
@@ -151,10 +153,12 @@ Column {
preventStealing: true preventStealing: true
onPressed: mouse => { onPressed: mouse => {
isDragging = true isDragging = true
let ratio = Math.max(0, Math.min( let ratio = Math.max(
1, mouse.x / micSliderTrack.width)) 0, Math.min(1,
mouse.x / micSliderTrack.width))
let newMicLevel = Math.round(ratio * 100) let newMicLevel = Math.round(ratio * 100)
if (AudioService.source && AudioService.source.audio) { if (AudioService.source
&& AudioService.source.audio) {
AudioService.source.audio.muted = false AudioService.source.audio.muted = false
AudioService.source.audio.volume = newMicLevel / 100 AudioService.source.audio.volume = newMicLevel / 100
} }
@@ -165,9 +169,12 @@ Column {
onPositionChanged: mouse => { onPositionChanged: mouse => {
if (pressed && isDragging) { if (pressed && isDragging) {
let ratio = Math.max( let ratio = Math.max(
0, Math.min(1, mouse.x / micSliderTrack.width)) 0, Math.min(
1,
mouse.x / micSliderTrack.width))
let newMicLevel = Math.max( let newMicLevel = Math.max(
0, Math.min(100, Math.round(ratio * 100))) 0, Math.min(100, Math.round(
ratio * 100)))
if (AudioService.source if (AudioService.source
&& AudioService.source.audio) { && AudioService.source.audio) {
AudioService.source.audio.muted = false AudioService.source.audio.muted = false
@@ -176,10 +183,12 @@ Column {
} }
} }
onClicked: mouse => { onClicked: mouse => {
let ratio = Math.max(0, Math.min( let ratio = Math.max(
1, mouse.x / micSliderTrack.width)) 0, Math.min(1,
mouse.x / micSliderTrack.width))
let newMicLevel = Math.round(ratio * 100) let newMicLevel = Math.round(ratio * 100)
if (AudioService.source && AudioService.source.audio) { if (AudioService.source
&& AudioService.source.audio) {
AudioService.source.audio.muted = false AudioService.source.audio.muted = false
AudioService.source.audio.volume = newMicLevel / 100 AudioService.source.audio.volume = newMicLevel / 100
} }
@@ -198,14 +207,15 @@ Column {
preventStealing: true preventStealing: true
onPositionChanged: mouse => { onPositionChanged: mouse => {
if (micMouseArea.isDragging) { if (micMouseArea.isDragging) {
let globalPos = mapToItem(micSliderTrack, let globalPos = mapToItem(
mouse.x, mouse.y) micSliderTrack, mouse.x, mouse.y)
let ratio = Math.max( let ratio = Math.max(
0, 0, Math.min(
Math.min(1, 1,
globalPos.x / micSliderTrack.width)) globalPos.x / micSliderTrack.width))
let newMicLevel = Math.max( let newMicLevel = Math.max(
0, Math.min(100, Math.round(ratio * 100))) 0, Math.min(100, Math.round(
ratio * 100)))
if (AudioService.source if (AudioService.source
&& AudioService.source.audio) { && AudioService.source.audio) {
AudioService.source.audio.muted = false AudioService.source.audio.muted = false

View File

@@ -9,7 +9,8 @@ Column {
property real volumeLevel: Math.min( property real volumeLevel: Math.min(
100, 100,
(AudioService.sink && AudioService.sink.audio (AudioService.sink && AudioService.sink.audio
&& AudioService.sink.audio.volume * 100) || 0) && AudioService.sink.audio.volume * 100)
|| 0)
property bool volumeMuted: (AudioService.sink && AudioService.sink.audio property bool volumeMuted: (AudioService.sink && AudioService.sink.audio
&& AudioService.sink.audio.muted) || false && AudioService.sink.audio.muted) || false
@@ -39,7 +40,8 @@ Column {
target: AudioService.sink target: AudioService.sink
&& AudioService.sink.audio ? AudioService.sink.audio : null && AudioService.sink.audio ? AudioService.sink.audio : null
function onVolumeChanged() { function onVolumeChanged() {
volumeSlider.value = Math.round(AudioService.sink.audio.volume * 100) volumeSlider.value = Math.round(
AudioService.sink.audio.volume * 100)
} }
} }
@@ -57,7 +59,8 @@ Column {
} }
onSliderValueChanged: newValue => { onSliderValueChanged: newValue => {
if (AudioService.sink && AudioService.sink.audio) { if (AudioService.sink
&& AudioService.sink.audio) {
AudioService.sink.audio.muted = false AudioService.sink.audio.muted = false
AudioService.sink.audio.volume = newValue / 100 AudioService.sink.audio.volume = newValue / 100
} }

View File

@@ -28,7 +28,8 @@ Column {
} }
Item { Item {
width: parent.width - scanButton.width - parent.spacing - 150 // Spacer to push button right width: parent.width - scanButton.width - parent.spacing
- 150 // Spacer to push button right
height: 1 height: 1
} }
@@ -38,12 +39,13 @@ Column {
width: Math.max(100, scanText.contentWidth + Theme.spacingL * 2) width: Math.max(100, scanText.contentWidth + Theme.spacingL * 2)
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: scanArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, color: scanArea.containsMouse ? Qt.rgba(Theme.primary.r,
Theme.primary.b,
0.12) : Qt.rgba(Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.08) 0.12) : Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b, 0.08)
border.color: Theme.primary border.color: Theme.primary
border.width: 1 border.width: 1
@@ -134,12 +136,14 @@ Column {
Repeater { Repeater {
model: { model: {
if (!BluetoothService.adapter || !BluetoothService.adapter.discovering if (!BluetoothService.adapter
|| !BluetoothService.adapter.discovering
|| !Bluetooth.devices) || !Bluetooth.devices)
return [] return []
var filtered = Bluetooth.devices.values.filter(dev => { var filtered = Bluetooth.devices.values.filter(dev => {
return dev && !dev.paired return dev
&& !dev.paired
&& !dev.pairing && !dev.pairing
&& !dev.blocked && !dev.blocked
&& (dev.signalStrength === undefined && (dev.signalStrength === undefined
@@ -166,7 +170,8 @@ Column {
Theme.warning.b, 0.12) Theme.warning.b, 0.12)
if (modelData.blocked) if (modelData.blocked)
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.08) return Qt.rgba(Theme.error.r, Theme.error.g,
Theme.error.b, 0.08)
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.08) Theme.surfaceVariant.b, 0.08)
@@ -178,7 +183,8 @@ Column {
if (modelData.blocked) if (modelData.blocked)
return Theme.error return Theme.error
return Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) return Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
} }
border.width: 1 border.width: 1
@@ -236,7 +242,8 @@ Column {
if (modelData.blocked) if (modelData.blocked)
return "Blocked" return "Blocked"
return BluetoothService.getSignalStrength(modelData) return BluetoothService.getSignalStrength(
modelData)
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: { color: {
@@ -246,7 +253,8 @@ Column {
if (modelData.blocked) if (modelData.blocked)
return Theme.error return Theme.error
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, return Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
} }
} }
@@ -254,21 +262,26 @@ Column {
DankIcon { DankIcon {
name: BluetoothService.getSignalIcon(modelData) name: BluetoothService.getSignalIcon(modelData)
size: Theme.fontSizeSmall size: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
visible: modelData.signalStrength !== undefined visible: modelData.signalStrength !== undefined
&& modelData.signalStrength > 0 && !modelData.pairing && modelData.signalStrength > 0
&& !modelData.pairing
&& !modelData.blocked && !modelData.blocked
} }
StyledText { StyledText {
text: (modelData.signalStrength !== undefined text: (modelData.signalStrength !== undefined
&& modelData.signalStrength > 0) ? modelData.signalStrength + "%" : "" && modelData.signalStrength
> 0) ? modelData.signalStrength + "%" : ""
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.5) Theme.surfaceText.b, 0.5)
visible: modelData.signalStrength !== undefined visible: modelData.signalStrength !== undefined
&& modelData.signalStrength > 0 && !modelData.pairing && modelData.signalStrength > 0
&& !modelData.pairing
&& !modelData.blocked && !modelData.blocked
} }
} }
@@ -286,7 +299,8 @@ Column {
visible: modelData.state !== BluetoothDeviceState.Connecting visible: modelData.state !== BluetoothDeviceState.Connecting
color: { color: {
if (!canConnect && !isBusy) if (!canConnect && !isBusy)
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, return Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3) Theme.surfaceVariant.b, 0.3)
if (actionButtonArea.containsMouse && !isBusy) if (actionButtonArea.containsMouse && !isBusy)
@@ -357,7 +371,8 @@ Column {
width: parent.width width: parent.width
spacing: Theme.spacingM spacing: Theme.spacingM
visible: { visible: {
if (!BluetoothService.adapter || !BluetoothService.adapter.discovering if (!BluetoothService.adapter
|| !BluetoothService.adapter.discovering
|| !Bluetooth.devices) || !Bluetooth.devices)
return false return false
@@ -366,7 +381,8 @@ Column {
&& !dev.paired && !dev.paired
&& !dev.pairing && !dev.pairing
&& !dev.blocked && !dev.blocked
&& (dev.signalStrength === undefined && (dev.signalStrength
=== undefined
|| dev.signalStrength > 0) || dev.signalStrength > 0)
}).length }).length
return availableCount === 0 return availableCount === 0
@@ -423,7 +439,8 @@ Column {
&& !dev.paired && !dev.paired
&& !dev.pairing && !dev.pairing
&& !dev.blocked && !dev.blocked
&& (dev.signalStrength === undefined && (dev.signalStrength
=== undefined
|| dev.signalStrength > 0) || dev.signalStrength > 0)
}).length }).length
return availableCount === 0 && !BluetoothService.adapter.discovering return availableCount === 0 && !BluetoothService.adapter.discovering

View File

@@ -40,7 +40,8 @@ Rectangle {
height: menuColumn.implicitHeight + Theme.spacingS * 2 height: menuColumn.implicitHeight + Theme.spacingS * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Theme.popupBackground() color: Theme.popupBackground()
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.08)
border.width: 1 border.width: 1
z: 1000 z: 1000
opacity: menuVisible ? 1 : 0 opacity: menuVisible ? 1 : 0
@@ -109,7 +110,8 @@ Rectangle {
if (root.deviceData.connected) if (root.deviceData.connected)
root.deviceData.disconnect() root.deviceData.disconnect()
else else
BluetoothService.connectDeviceWithTrust(root.deviceData) BluetoothService.connectDeviceWithTrust(
root.deviceData)
} }
root.hide() root.hide()
} }
@@ -133,7 +135,8 @@ Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
} }
} }
@@ -141,7 +144,8 @@ Rectangle {
width: parent.width width: parent.width
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: forgetArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, color: forgetArea.containsMouse ? Qt.rgba(Theme.error.r,
Theme.error.g,
Theme.error.b, Theme.error.b,
0.12) : "transparent" 0.12) : "transparent"

View File

@@ -46,15 +46,10 @@ Column {
height: 60 height: 60
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: btDeviceArea.containsMouse ? Qt.rgba( color: btDeviceArea.containsMouse ? Qt.rgba(
Theme.primary.r, Theme.primary.g,
Theme.primary.b,
0.08) : (modelData.connected ? Qt.rgba(
Theme.primary.r, Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : Qt.rgba( 0.08) : (modelData.connected ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08))
Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b,
0.08))
border.color: modelData.connected ? Theme.primary : "transparent" border.color: modelData.connected ? Theme.primary : "transparent"
border.width: 1 border.width: 1
@@ -88,25 +83,37 @@ Column {
StyledText { StyledText {
text: BluetoothDeviceState.toString(modelData.state) text: BluetoothDeviceState.toString(modelData.state)
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
} }
StyledText { StyledText {
text: { text: {
if (modelData.batteryAvailable && modelData.battery > 0) if (modelData.batteryAvailable
return "• " + Math.round(modelData.battery * 100) + "%" && modelData.battery > 0)
return "• " + Math.round(
modelData.battery * 100) + "%"
var btBattery = BatteryService.bluetoothDevices.find(dev => { var btBattery = BatteryService.bluetoothDevices.find(
return dev.name === (modelData.name || modelData.deviceName) || dev.name.toLowerCase().includes((modelData.name || modelData.deviceName).toLowerCase()) || (modelData.name || modelData.deviceName).toLowerCase( dev => {
return dev.name === (modelData.name
|| modelData.deviceName)
|| dev.name.toLowerCase(
).includes( ).includes(
dev.name.toLowerCase( (modelData.name
|| modelData.deviceName).toLowerCase(
)) ))
|| (modelData.name
|| modelData.deviceName).toLowerCase(
).includes(
dev.name.toLowerCase())
}) })
return btBattery ? "• " + btBattery.percentage + "%" : "" return btBattery ? "• " + btBattery.percentage + "%" : ""
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
visible: text.length > 0 visible: text.length > 0
} }
@@ -120,7 +127,8 @@ Column {
width: 32 width: 32
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: btMenuButtonArea.containsMouse ? Qt.rgba(Theme.surfaceText.r, color: btMenuButtonArea.containsMouse ? Qt.rgba(
Theme.surfaceText.r,
Theme.surfaceText.g, Theme.surfaceText.g,
Theme.surfaceText.b, Theme.surfaceText.b,
0.08) : "transparent" 0.08) : "transparent"
@@ -147,7 +155,8 @@ Column {
if (contextMenu) { if (contextMenu) {
contextMenu.deviceData = modelData contextMenu.deviceData = modelData
let localPos = btMenuButtonArea.mapToItem( let localPos = btMenuButtonArea.mapToItem(
contextMenu.parentItem, btMenuButtonArea.width / 2, contextMenu.parentItem,
btMenuButtonArea.width / 2,
btMenuButtonArea.height) btMenuButtonArea.height)
contextMenu.show(localPos.x, localPos.y) contextMenu.show(localPos.x, localPos.y)
} }

View File

@@ -48,7 +48,8 @@ DankPopout {
UserInfoService.getUptime() UserInfoService.getUptime()
} else { } else {
NetworkService.autoRefreshEnabled = false NetworkService.autoRefreshEnabled = false
if (BluetoothService.adapter && BluetoothService.adapter.discovering) if (BluetoothService.adapter
&& BluetoothService.adapter.discovering)
BluetoothService.adapter.discovering = false BluetoothService.adapter.discovering = false
} }
} }
@@ -112,7 +113,8 @@ DankPopout {
width: parent.width width: parent.width
height: 90 height: 90
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, Theme.surfaceVariant.b,
Theme.getContentBackgroundAlpha() * 0.4) Theme.getContentBackgroundAlpha() * 0.4)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
@@ -150,7 +152,8 @@ DankPopout {
if (PortalService.profileImage === "") if (PortalService.profileImage === "")
return "" return ""
if (PortalService.profileImage.startsWith("/")) if (PortalService.profileImage.startsWith(
"/"))
return "file://" + PortalService.profileImage return "file://" + PortalService.profileImage
return PortalService.profileImage return PortalService.profileImage
@@ -227,7 +230,8 @@ DankPopout {
} }
StyledText { StyledText {
text: "Uptime: " + (UserInfoService.uptime || "Unknown") text: "Uptime: " + (UserInfoService.uptime
|| "Unknown")
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
font.weight: Font.Normal font.weight: Font.Normal
@@ -246,10 +250,13 @@ DankPopout {
iconName: "lock" iconName: "lock"
iconSize: Theme.iconSize - 2 iconSize: Theme.iconSize - 2
iconColor: Theme.surfaceText iconColor: Theme.surfaceText
backgroundColor: Qt.rgba(Theme.surfaceVariant.r, backgroundColor: Qt.rgba(
Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.5) Theme.surfaceVariant.b,
hoverColor: Qt.rgba(Theme.primary.r, Theme.primary.g, 0.5)
hoverColor: Qt.rgba(Theme.primary.r,
Theme.primary.g,
Theme.primary.b, 0.12) Theme.primary.b, 0.12)
onClicked: { onClicked: {
root.close() root.close()
@@ -262,7 +269,8 @@ DankPopout {
height: 40 height: 40
radius: 20 radius: 20
color: powerButton.containsMouse color: powerButton.containsMouse
|| root.powerOptionsExpanded ? Qt.rgba(Theme.error.r, || root.powerOptionsExpanded ? Qt.rgba(
Theme.error.r,
Theme.error.g, Theme.error.g,
Theme.error.b, Theme.error.b,
0.12) : Qt.rgba( 0.12) : Qt.rgba(
@@ -339,10 +347,13 @@ DankPopout {
iconName: "settings" iconName: "settings"
iconSize: Theme.iconSize - 2 iconSize: Theme.iconSize - 2
iconColor: Theme.surfaceText iconColor: Theme.surfaceText
backgroundColor: Qt.rgba(Theme.surfaceVariant.r, backgroundColor: Qt.rgba(
Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.5) Theme.surfaceVariant.b,
hoverColor: Qt.rgba(Theme.primary.r, Theme.primary.g, 0.5)
hoverColor: Qt.rgba(Theme.primary.r,
Theme.primary.g,
Theme.primary.b, 0.12) Theme.primary.b, 0.12)
onClicked: { onClicked: {
root.close() root.close()
@@ -356,7 +367,8 @@ DankPopout {
width: parent.width width: parent.width
height: root.powerOptionsExpanded ? 60 : 0 height: root.powerOptionsExpanded ? 60 : 0
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, Theme.surfaceVariant.b,
Theme.getContentBackgroundAlpha() * 0.4) Theme.getContentBackgroundAlpha() * 0.4)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
@@ -374,7 +386,8 @@ DankPopout {
width: 100 width: 100
height: 34 height: 34
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: logoutButton.containsMouse ? Qt.rgba(Theme.warning.r, color: logoutButton.containsMouse ? Qt.rgba(
Theme.warning.r,
Theme.warning.g, Theme.warning.g,
Theme.warning.b, Theme.warning.b,
0.12) : Qt.rgba( 0.12) : Qt.rgba(
@@ -430,7 +443,8 @@ DankPopout {
width: 100 width: 100
height: 34 height: 34
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: rebootButton.containsMouse ? Qt.rgba(Theme.warning.r, color: rebootButton.containsMouse ? Qt.rgba(
Theme.warning.r,
Theme.warning.g, Theme.warning.g,
Theme.warning.b, Theme.warning.b,
0.12) : Qt.rgba( 0.12) : Qt.rgba(
@@ -486,7 +500,8 @@ DankPopout {
width: 100 width: 100
height: 34 height: 34
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: suspendButton.containsMouse ? Qt.rgba(Theme.primary.r, color: suspendButton.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : Qt.rgba( 0.12) : Qt.rgba(
@@ -542,7 +557,8 @@ DankPopout {
width: 100 width: 100
height: 34 height: 34
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: shutdownButton.containsMouse ? Qt.rgba(Theme.error.r, color: shutdownButton.containsMouse ? Qt.rgba(
Theme.error.r,
Theme.error.g, Theme.error.g,
Theme.error.b, Theme.error.b,
0.12) : Qt.rgba( 0.12) : Qt.rgba(
@@ -614,7 +630,8 @@ DankPopout {
width: parent.width width: parent.width
height: tabBar.height + Theme.spacingM * 2 height: tabBar.height + Theme.spacingM * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.15) Theme.surfaceVariant.b, 0.15)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.06) Theme.outline.b, 0.06)
@@ -675,7 +692,8 @@ DankPopout {
width: parent.width width: parent.width
Layout.fillHeight: true Layout.fillHeight: true
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.1) Theme.surfaceVariant.b, 0.1)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.05) Theme.outline.b, 0.05)
@@ -704,7 +722,8 @@ DankPopout {
Loader { Loader {
anchors.fill: parent anchors.fill: parent
anchors.margins: Theme.spacingS anchors.margins: Theme.spacingS
active: BluetoothService.available && root.currentTab === "bluetooth" active: BluetoothService.available
&& root.currentTab === "bluetooth"
asynchronous: true asynchronous: true
sourceComponent: Component { sourceComponent: Component {
BluetoothTab {} BluetoothTab {}

View File

@@ -34,12 +34,9 @@ Item {
width: parent.width width: parent.width
sourceComponent: settingsComponent sourceComponent: settingsComponent
} }
} }
} }
Component { Component {
id: brightnessComponent id: brightnessComponent
@@ -62,57 +59,62 @@ Item {
visible: BrightnessService.devices.length > 1 visible: BrightnessService.devices.length > 1
text: "Device" text: "Device"
description: { description: {
const deviceInfo = BrightnessService.getCurrentDeviceInfo(); const deviceInfo = BrightnessService.getCurrentDeviceInfo()
if (deviceInfo && deviceInfo.class === "ddc") { if (deviceInfo && deviceInfo.class === "ddc") {
return "DDC changes can be slow and unreliable"; return "DDC changes can be slow and unreliable"
} }
return ""; return ""
} }
currentValue: BrightnessService.currentDevice currentValue: BrightnessService.currentDevice
options: BrightnessService.devices.map(function(d) { options: BrightnessService.devices.map(function (d) {
return d.name; return d.name
}) })
optionIcons: BrightnessService.devices.map(function(d) { optionIcons: BrightnessService.devices.map(function (d) {
if (d.class === "backlight") if (d.class === "backlight")
return "desktop_windows"; return "desktop_windows"
if (d.class === "ddc") if (d.class === "ddc")
return "tv"; return "tv"
if (d.name.includes("kbd")) if (d.name.includes("kbd"))
return "keyboard"; return "keyboard"
return "lightbulb"; return "lightbulb"
}) })
onValueChanged: function(value) { onValueChanged: function (value) {
BrightnessService.setCurrentDevice(value, true); BrightnessService.setCurrentDevice(value, true)
} }
Connections { Connections {
target: BrightnessService target: BrightnessService
function onDevicesChanged() { function onDevicesChanged() {
if (BrightnessService.currentDevice) { if (BrightnessService.currentDevice) {
deviceDropdown.currentValue = BrightnessService.currentDevice; deviceDropdown.currentValue = BrightnessService.currentDevice
} }
// Check if saved device is now available // Check if saved device is now available
const lastDevice = SessionData.lastBrightnessDevice || ""; const lastDevice = SessionData.lastBrightnessDevice
|| ""
if (lastDevice) { if (lastDevice) {
const deviceExists = BrightnessService.devices.some(d => d.name === lastDevice); const deviceExists = BrightnessService.devices.some(
if (deviceExists && (!BrightnessService.currentDevice || BrightnessService.currentDevice !== lastDevice)) { d => d.name === lastDevice)
BrightnessService.setCurrentDevice(lastDevice, false); if (deviceExists
&& (!BrightnessService.currentDevice
|| BrightnessService.currentDevice !== lastDevice)) {
BrightnessService.setCurrentDevice(lastDevice,
false)
} }
} }
} }
function onDeviceSwitched() { function onDeviceSwitched() {
// Force update the description when device switches // Force update the description when device switches
deviceDropdown.description = Qt.binding(function() { deviceDropdown.description = Qt.binding(function () {
const deviceInfo = BrightnessService.getCurrentDeviceInfo(); const deviceInfo = BrightnessService.getCurrentDeviceInfo()
if (deviceInfo && deviceInfo.class === "ddc") { if (deviceInfo && deviceInfo.class === "ddc") {
return "DDC changes can be slow and unreliable"; return "DDC changes can be slow and unreliable"
} }
return ""; return ""
}); })
} }
} }
} }
@@ -123,31 +125,31 @@ Item {
value: BrightnessService.brightnessLevel value: BrightnessService.brightnessLevel
leftIcon: "brightness_low" leftIcon: "brightness_low"
rightIcon: "brightness_high" rightIcon: "brightness_high"
enabled: BrightnessService.brightnessAvailable && BrightnessService.isCurrentDeviceReady() enabled: BrightnessService.brightnessAvailable
&& BrightnessService.isCurrentDeviceReady()
opacity: BrightnessService.isCurrentDeviceReady() ? 1.0 : 0.5 opacity: BrightnessService.isCurrentDeviceReady() ? 1.0 : 0.5
onSliderValueChanged: function(newValue) { onSliderValueChanged: function (newValue) {
brightnessDebounceTimer.pendingValue = newValue; brightnessDebounceTimer.pendingValue = newValue
brightnessDebounceTimer.restart(); brightnessDebounceTimer.restart()
} }
onSliderDragFinished: function(finalValue) { onSliderDragFinished: function (finalValue) {
brightnessDebounceTimer.stop(); brightnessDebounceTimer.stop()
BrightnessService.setBrightnessInternal(finalValue, BrightnessService.currentDevice); BrightnessService.setBrightnessInternal(
finalValue, BrightnessService.currentDevice)
} }
Connections { Connections {
target: BrightnessService target: BrightnessService
function onBrightnessChanged() { function onBrightnessChanged() {
brightnessSlider.value = BrightnessService.brightnessLevel; brightnessSlider.value = BrightnessService.brightnessLevel
} }
function onDeviceSwitched() { function onDeviceSwitched() {
brightnessSlider.value = BrightnessService.brightnessLevel; brightnessSlider.value = BrightnessService.brightnessLevel
} }
} }
} }
} }
} }
Component { Component {
@@ -172,7 +174,11 @@ Item {
width: (parent.width - Theme.spacingM) / 2 width: (parent.width - Theme.spacingM) / 2
height: 80 height: 80
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: BrightnessService.nightModeActive ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : (nightModeToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08)) color: BrightnessService.nightModeActive ? Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.12) : (nightModeToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08))
border.color: BrightnessService.nightModeActive ? Theme.primary : "transparent" border.color: BrightnessService.nightModeActive ? Theme.primary : "transparent"
border.width: BrightnessService.nightModeActive ? 1 : 0 border.width: BrightnessService.nightModeActive ? 1 : 0
@@ -194,7 +200,6 @@ Item {
font.weight: Font.Medium font.weight: Font.Medium
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
} }
MouseArea { MouseArea {
@@ -204,17 +209,20 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
BrightnessService.toggleNightMode(); BrightnessService.toggleNightMode()
} }
} }
} }
Rectangle { Rectangle {
width: (parent.width - Theme.spacingM) / 2 width: (parent.width - Theme.spacingM) / 2
height: 80 height: 80
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Theme.isLightMode ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : (lightModeToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08)) color: Theme.isLightMode ? Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.12) : (lightModeToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08))
border.color: Theme.isLightMode ? Theme.primary : "transparent" border.color: Theme.isLightMode ? Theme.primary : "transparent"
border.width: Theme.isLightMode ? 1 : 0 border.width: Theme.isLightMode ? 1 : 0
@@ -236,7 +244,6 @@ Item {
font.weight: Font.Medium font.weight: Font.Medium
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
} }
MouseArea { MouseArea {
@@ -246,7 +253,7 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Theme.toggleLightMode(); Theme.toggleLightMode()
} }
} }
@@ -255,15 +262,10 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
} }
} }
} }
} }
brightnessDebounceTimer: Timer { brightnessDebounceTimer: Timer {
@@ -271,13 +273,13 @@ Item {
interval: { interval: {
// Use longer interval for DDC devices since ddcutil is slow // Use longer interval for DDC devices since ddcutil is slow
const deviceInfo = BrightnessService.getCurrentDeviceInfo(); const deviceInfo = BrightnessService.getCurrentDeviceInfo()
return (deviceInfo && deviceInfo.class === "ddc") ? 100 : 50; return (deviceInfo && deviceInfo.class === "ddc") ? 100 : 50
} }
repeat: false repeat: false
onTriggered: { onTriggered: {
BrightnessService.setBrightnessInternal(pendingValue, BrightnessService.currentDevice); BrightnessService.setBrightnessInternal(
pendingValue, BrightnessService.currentDevice)
} }
} }
} }

View File

@@ -14,7 +14,8 @@ Rectangle {
height: 80 height: 80
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
if (ethernetPreferenceArea.containsMouse && NetworkService.ethernetConnected if (ethernetPreferenceArea.containsMouse
&& NetworkService.ethernetConnected
&& NetworkService.wifiEnabled && NetworkService.wifiEnabled
&& NetworkService.networkStatus !== "ethernet") && NetworkService.networkStatus !== "ethernet")
return Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, return Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
@@ -23,8 +24,8 @@ Rectangle {
return Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, return Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
Theme.surfaceContainer.b, 0.5) Theme.surfaceContainer.b, 0.5)
} }
border.color: NetworkService.networkStatus === "ethernet" ? Theme.primary : Qt.rgba( border.color: NetworkService.networkStatus
Theme.outline.r, === "ethernet" ? Theme.primary : Qt.rgba(Theme.outline.r,
Theme.outline.g, Theme.outline.g,
Theme.outline.b, Theme.outline.b,
0.12) 0.12)
@@ -52,7 +53,8 @@ Rectangle {
StyledText { StyledText {
text: "Ethernet" text: "Ethernet"
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: NetworkService.networkStatus === "ethernet" ? Theme.primary : Theme.surfaceText color: NetworkService.networkStatus
=== "ethernet" ? Theme.primary : Theme.surfaceText
font.weight: Font.Medium font.weight: Font.Medium
elide: Text.ElideRight elide: Text.ElideRight
} }
@@ -92,20 +94,21 @@ Rectangle {
} }
} }
MouseArea { MouseArea {
id: ethernetPreferenceArea id: ethernetPreferenceArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: (NetworkService.ethernetConnected && NetworkService.wifiEnabled cursorShape: (NetworkService.ethernetConnected
&& NetworkService.wifiEnabled
&& NetworkService.networkStatus && NetworkService.networkStatus
!== "ethernet") ? Qt.PointingHandCursor : Qt.ArrowCursor !== "ethernet") ? Qt.PointingHandCursor : Qt.ArrowCursor
enabled: NetworkService.ethernetConnected && NetworkService.wifiEnabled enabled: NetworkService.ethernetConnected && NetworkService.wifiEnabled
&& NetworkService.networkStatus !== "ethernet" && NetworkService.networkStatus !== "ethernet"
&& !NetworkService.changingNetworkPreference && !NetworkService.changingNetworkPreference
onClicked: { onClicked: {
if (NetworkService.ethernetConnected && NetworkService.wifiEnabled) { if (NetworkService.ethernetConnected
&& NetworkService.wifiEnabled) {
if (NetworkService.networkStatus !== "ethernet") if (NetworkService.networkStatus !== "ethernet")
NetworkService.setNetworkPreference("ethernet") NetworkService.setNetworkPreference("ethernet")

View File

@@ -56,7 +56,8 @@ Rectangle {
text: { text: {
if (!NetworkService.wifiEnabled) if (!NetworkService.wifiEnabled)
return "WiFi is off" return "WiFi is off"
else if (NetworkService.wifiEnabled && NetworkService.currentWifiSSID) else if (NetworkService.wifiEnabled
&& NetworkService.currentWifiSSID)
return NetworkService.currentWifiSSID || "Connected" return NetworkService.currentWifiSSID || "Connected"
else else
return "Not Connected" return "Not Connected"
@@ -71,7 +72,8 @@ Rectangle {
text: { text: {
if (!NetworkService.wifiEnabled) if (!NetworkService.wifiEnabled)
return "Turn on WiFi to see networks" return "Turn on WiFi to see networks"
else if (NetworkService.wifiEnabled && NetworkService.currentWifiSSID) else if (NetworkService.wifiEnabled
&& NetworkService.currentWifiSSID)
return NetworkService.wifiIP || "Connected" return NetworkService.wifiIP || "Connected"
else else
return "Select a network below" return "Select a network below"
@@ -140,14 +142,16 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
anchors.rightMargin: 60 // Exclude toggle area anchors.rightMargin: 60 // Exclude toggle area
hoverEnabled: true hoverEnabled: true
cursorShape: (NetworkService.ethernetConnected && NetworkService.wifiEnabled cursorShape: (NetworkService.ethernetConnected
&& NetworkService.wifiEnabled
&& NetworkService.networkStatus && NetworkService.networkStatus
!== "wifi") ? Qt.PointingHandCursor : Qt.ArrowCursor !== "wifi") ? Qt.PointingHandCursor : Qt.ArrowCursor
enabled: NetworkService.ethernetConnected && NetworkService.wifiEnabled enabled: NetworkService.ethernetConnected && NetworkService.wifiEnabled
&& NetworkService.networkStatus !== "wifi" && NetworkService.networkStatus !== "wifi"
&& !NetworkService.changingNetworkPreference && !NetworkService.changingNetworkPreference
onClicked: { onClicked: {
if (NetworkService.ethernetConnected && NetworkService.wifiEnabled) { if (NetworkService.ethernetConnected
&& NetworkService.wifiEnabled) {
if (NetworkService.networkStatus !== "wifi") if (NetworkService.networkStatus !== "wifi")
NetworkService.setNetworkPreference("wifi") NetworkService.setNetworkPreference("wifi")

View File

@@ -24,12 +24,12 @@ Rectangle {
let finalX = x - menuWidth / 2 let finalX = x - menuWidth / 2
let finalY = y + 4 let finalY = y + 4
finalX = Math.max( finalX = Math.max(
Theme.spacingS, Theme.spacingS, Math.min(
Math.min(finalX, finalX,
parentItem.width - menuWidth - Theme.spacingS)) parentItem.width - menuWidth - Theme.spacingS))
finalY = Math.max( finalY = Math.max(
Theme.spacingS, Theme.spacingS, Math.min(
Math.min(finalY, finalY,
parentItem.height - menuHeight - Theme.spacingS)) parentItem.height - menuHeight - Theme.spacingS))
if (finalY + menuHeight > parentItem.height - Theme.spacingS) { if (finalY + menuHeight > parentItem.height - Theme.spacingS) {
finalY = y - menuHeight - 4 finalY = y - menuHeight - 4
@@ -53,7 +53,8 @@ Rectangle {
height: wifiMenuColumn.implicitHeight + Theme.spacingS * 2 height: wifiMenuColumn.implicitHeight + Theme.spacingS * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Theme.popupBackground() color: Theme.popupBackground()
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.08)
border.width: 1 border.width: 1
z: 1000 z: 1000
opacity: menuVisible ? 1 : 0 opacity: menuVisible ? 1 : 0
@@ -131,7 +132,8 @@ Rectangle {
wifiContextMenuWindow.networkData.ssid) wifiContextMenuWindow.networkData.ssid)
} else if (wifiContextMenuWindow.networkData.secured) { } else if (wifiContextMenuWindow.networkData.secured) {
if (wifiPasswordModalRef) { if (wifiPasswordModalRef) {
wifiPasswordModalRef.show(wifiContextMenuWindow.networkData.ssid) wifiPasswordModalRef.show(
wifiContextMenuWindow.networkData.ssid)
} }
} else { } else {
NetworkService.connectToWifi( NetworkService.connectToWifi(
@@ -161,7 +163,8 @@ Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
} }
} }
@@ -262,7 +265,8 @@ Rectangle {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (wifiContextMenuWindow.networkData && networkInfoModalRef) if (wifiContextMenuWindow.networkData
&& networkInfoModalRef)
networkInfoModalRef.showNetworkInfo( networkInfoModalRef.showNetworkInfo(
wifiContextMenuWindow.networkData.ssid, wifiContextMenuWindow.networkData.ssid,
wifiContextMenuWindow.networkData) wifiContextMenuWindow.networkData)

View File

@@ -110,8 +110,8 @@ Column {
let delta = event.pixelDelta.y let delta = event.pixelDelta.y
!== 0 ? event.pixelDelta.y * 1.8 : event.angleDelta.y / 120 * 60 !== 0 ? event.pixelDelta.y * 1.8 : event.angleDelta.y / 120 * 60
let newY = parent.contentY - delta let newY = parent.contentY - delta
newY = Math.max(0, newY = Math.max(
Math.min(parent.contentHeight - parent.height, 0, Math.min(parent.contentHeight - parent.height,
newY)) newY))
parent.contentY = newY parent.contentY = newY
event.accepted = true event.accepted = true
@@ -187,7 +187,8 @@ Column {
return "Invalid password" return "Invalid password"
if (modelData.saved) if (modelData.saved)
return "Saved" + (modelData.secured ? " • Secured" : " • Open") return "Saved"
+ (modelData.secured ? " • Secured" : " • Open")
return modelData.secured ? "Secured" : "Open" return modelData.secured ? "Secured" : "Open"
} }
@@ -201,7 +202,8 @@ Column {
&& NetworkService.connectingSSID === modelData.ssid) && NetworkService.connectingSSID === modelData.ssid)
return Theme.error return Theme.error
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, return Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
} }
elide: Text.ElideRight elide: Text.ElideRight
@@ -218,7 +220,8 @@ Column {
DankIcon { DankIcon {
name: "lock" name: "lock"
size: Theme.iconSize - 8 size: Theme.iconSize - 8
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.6) Theme.surfaceText.b, 0.6)
visible: modelData.secured visible: modelData.secured
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -255,10 +258,11 @@ Column {
let buttonCenter = wifiMenuButtonArea.width / 2 let buttonCenter = wifiMenuButtonArea.width / 2
let buttonBottom = wifiMenuButtonArea.height let buttonBottom = wifiMenuButtonArea.height
let globalPos = wifiMenuButtonArea.mapToItem( let globalPos = wifiMenuButtonArea.mapToItem(
wifiContextMenuWindow.parentItem, buttonCenter, wifiContextMenuWindow.parentItem,
buttonBottom) buttonCenter, buttonBottom)
Qt.callLater(() => { Qt.callLater(() => {
wifiContextMenuWindow.show(globalPos.x, wifiContextMenuWindow.show(
globalPos.x,
globalPos.y) globalPos.y)
}) })
} }

View File

@@ -103,7 +103,9 @@ Item {
!== 0 ? event.pixelDelta.y * 1.8 : event.angleDelta.y / 120 * 60 !== 0 ? event.pixelDelta.y * 1.8 : event.angleDelta.y / 120 * 60
let newY = parent.contentY - delta let newY = parent.contentY - delta
newY = Math.max( newY = Math.max(
0, Math.min(parent.contentHeight - parent.height, newY)) 0, Math.min(
parent.contentHeight - parent.height,
newY))
parent.contentY = newY parent.contentY = newY
event.accepted = true event.accepted = true
} }
@@ -148,7 +150,9 @@ Item {
!== 0 ? event.pixelDelta.y * 1.8 : event.angleDelta.y / 120 * 60 !== 0 ? event.pixelDelta.y * 1.8 : event.angleDelta.y / 120 * 60
let newY = parent.contentY - delta let newY = parent.contentY - delta
newY = Math.max( newY = Math.max(
0, Math.min(parent.contentHeight - parent.height, newY)) 0, Math.min(
parent.contentHeight - parent.height,
newY))
parent.contentY = newY parent.contentY = newY
event.accepted = true event.accepted = true
} }
@@ -226,7 +230,8 @@ Item {
} }
onVisibleChanged: { onVisibleChanged: {
if (visible && NetworkService.wifiEnabled && NetworkService.wifiNetworks.length === 0) { if (visible && NetworkService.wifiEnabled
&& NetworkService.wifiNetworks.length === 0) {
// Scan when tab becomes visible if we don't have networks cached // Scan when tab becomes visible if we don't have networks cached
NetworkService.scanWifi() NetworkService.scanWifi()
} }

View File

@@ -81,7 +81,8 @@ PanelWindow {
iconName: "close" iconName: "close"
iconSize: Theme.iconSize - 4 iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText iconColor: Theme.surfaceText
hoverColor: Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) hoverColor: Qt.rgba(Theme.error.r, Theme.error.g,
Theme.error.b, 0.12)
onClicked: { onClicked: {
powerMenuVisible = false powerMenuVisible = false
} }
@@ -102,7 +103,8 @@ PanelWindow {
0.08) : Qt.rgba( 0.08) : Qt.rgba(
Theme.surfaceVariant.r, Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.08) Theme.surfaceVariant.b,
0.08)
Row { Row {
anchors.left: parent.left anchors.left: parent.left
@@ -134,7 +136,9 @@ PanelWindow {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
powerMenuVisible = false powerMenuVisible = false
root.powerActionRequested("logout", "Log Out", "Are you sure you want to log out?") root.powerActionRequested(
"logout", "Log Out",
"Are you sure you want to log out?")
} }
} }
} }
@@ -149,7 +153,8 @@ PanelWindow {
0.08) : Qt.rgba( 0.08) : Qt.rgba(
Theme.surfaceVariant.r, Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.08) Theme.surfaceVariant.b,
0.08)
Row { Row {
anchors.left: parent.left anchors.left: parent.left
@@ -181,7 +186,9 @@ PanelWindow {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
powerMenuVisible = false powerMenuVisible = false
root.powerActionRequested("suspend", "Suspend", "Are you sure you want to suspend the system?") root.powerActionRequested(
"suspend", "Suspend",
"Are you sure you want to suspend the system?")
} }
} }
} }
@@ -196,7 +203,8 @@ PanelWindow {
0.08) : Qt.rgba( 0.08) : Qt.rgba(
Theme.surfaceVariant.r, Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.08) Theme.surfaceVariant.b,
0.08)
Row { Row {
anchors.left: parent.left anchors.left: parent.left
@@ -228,7 +236,9 @@ PanelWindow {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
powerMenuVisible = false powerMenuVisible = false
root.powerActionRequested("reboot", "Reboot", "Are you sure you want to reboot the system?") root.powerActionRequested(
"reboot", "Reboot",
"Are you sure you want to reboot the system?")
} }
} }
} }
@@ -243,7 +253,8 @@ PanelWindow {
0.08) : Qt.rgba( 0.08) : Qt.rgba(
Theme.surfaceVariant.r, Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.08) Theme.surfaceVariant.b,
0.08)
Row { Row {
anchors.left: parent.left anchors.left: parent.left
@@ -275,7 +286,9 @@ PanelWindow {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
powerMenuVisible = false powerMenuVisible = false
root.powerActionRequested("poweroff", "Power Off", "Are you sure you want to power off the system?") root.powerActionRequested(
"poweroff", "Power Off",
"Are you sure you want to power off the system?")
} }
} }
} }

View File

@@ -117,7 +117,8 @@ PanelWindow {
anchors.topMargin: 4 anchors.topMargin: 4
anchors.bottomMargin: 1 anchors.bottomMargin: 1
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, color: Qt.rgba(Theme.surfaceContainer.r,
Theme.surfaceContainer.g,
Theme.surfaceContainer.b, backgroundTransparency) Theme.surfaceContainer.b, backgroundTransparency)
radius: Theme.cornerRadius radius: Theme.cornerRadius
border.width: 1 border.width: 1
@@ -165,7 +166,8 @@ PanelWindow {
return null return null
for (var i = 0; i < repeater.count; i++) { for (var i = 0; i < repeater.count; i++) {
var item = repeater.itemAt(i) var item = repeater.itemAt(i)
if (item && item.dockButton && item.dockButton.showTooltip) { if (item && item.dockButton
&& item.dockButton.showTooltip) {
return item.dockButton return item.dockButton
} }
} }
@@ -184,8 +186,8 @@ PanelWindow {
border.color: Theme.outlineMedium border.color: Theme.outlineMedium
y: -height - 8 y: -height - 8
x: hoveredButton ? hoveredButton.mapToItem(dockContainer, x: hoveredButton ? hoveredButton.mapToItem(
hoveredButton.width / 2, dockContainer, hoveredButton.width / 2,
0).x - width / 2 : 0 0).x - width / 2 : 0
StyledText { StyledText {

View File

@@ -26,33 +26,34 @@ Item {
property bool showTooltip: mouseArea.containsMouse && !dragging property bool showTooltip: mouseArea.containsMouse && !dragging
property string tooltipText: { property string tooltipText: {
if (!appData) if (!appData)
return ""; return ""
// For window type, show app name + window title // For window type, show app name + window title
if (appData.type === "window" && showWindowTitle) { if (appData.type === "window" && showWindowTitle) {
var desktopEntry = DesktopEntries.byId(appData.appId); var desktopEntry = DesktopEntries.byId(appData.appId)
var appName = desktopEntry && desktopEntry.name ? desktopEntry.name : appData.appId; var appName = desktopEntry
return appName + (windowTitle ? " • " + windowTitle : ""); && desktopEntry.name ? desktopEntry.name : appData.appId
return appName + (windowTitle ? " • " + windowTitle : "")
} }
// For pinned apps, just show app name // For pinned apps, just show app name
if (!appData.appId) if (!appData.appId)
return ""; return ""
var desktopEntry = DesktopEntries.byId(appData.appId); var desktopEntry = DesktopEntries.byId(appData.appId)
return desktopEntry && desktopEntry.name ? desktopEntry.name : appData.appId; return desktopEntry
&& desktopEntry.name ? desktopEntry.name : appData.appId
} }
width: 40 width: 40
height: 40 height: 40
onIsHoveredChanged: { onIsHoveredChanged: {
if (isHovered) { if (isHovered) {
exitAnimation.stop(); exitAnimation.stop()
if (!bounceAnimation.running) if (!bounceAnimation.running)
bounceAnimation.restart(); bounceAnimation.restart()
} else { } else {
bounceAnimation.stop(); bounceAnimation.stop()
exitAnimation.restart(); exitAnimation.restart()
} }
} }
@@ -78,7 +79,6 @@ Item {
easing.type: Easing.BezierSpline easing.type: Easing.BezierSpline
easing.bezierCurve: Anims.emphasizedDecel easing.bezierCurve: Anims.emphasizedDecel
} }
} }
NumberAnimation { NumberAnimation {
@@ -110,8 +110,7 @@ Item {
repeat: false repeat: false
onTriggered: { onTriggered: {
if (appData && appData.isPinned) if (appData && appData.isPinned)
longPressing = true; longPressing = true
} }
} }
@@ -123,95 +122,114 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: longPressing ? Qt.DragMoveCursor : Qt.PointingHandCursor cursorShape: longPressing ? Qt.DragMoveCursor : Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onPressed: (mouse) => { onPressed: mouse => {
if (mouse.button === Qt.LeftButton && appData && appData.isPinned) { if (mouse.button === Qt.LeftButton && appData
dragStartPos = Qt.point(mouse.x, mouse.y); && appData.isPinned) {
longPressTimer.start(); dragStartPos = Qt.point(mouse.x, mouse.y)
longPressTimer.start()
} }
} }
onReleased: (mouse) => { onReleased: mouse => {
longPressTimer.stop(); longPressTimer.stop()
if (longPressing) { if (longPressing) {
if (dragging && targetIndex >= 0 && targetIndex !== originalIndex && dockApps) if (dragging && targetIndex >= 0
dockApps.movePinnedApp(originalIndex, targetIndex); && targetIndex !== originalIndex && dockApps)
dockApps.movePinnedApp(originalIndex, targetIndex)
longPressing = false; longPressing = false
dragging = false; dragging = false
dragOffset = Qt.point(0, 0); dragOffset = Qt.point(0, 0)
targetIndex = -1; targetIndex = -1
originalIndex = -1; originalIndex = -1
} }
} }
onPositionChanged: (mouse) => { onPositionChanged: mouse => {
if (longPressing && !dragging) { if (longPressing && !dragging) {
var distance = Math.sqrt(Math.pow(mouse.x - dragStartPos.x, 2) + Math.pow(mouse.y - dragStartPos.y, 2)); var distance = Math.sqrt(
Math.pow(mouse.x - dragStartPos.x,
2) + Math.pow(
mouse.y - dragStartPos.y, 2))
if (distance > 5) { if (distance > 5) {
dragging = true; dragging = true
targetIndex = index; targetIndex = index
originalIndex = index; originalIndex = index
} }
} }
if (dragging) { if (dragging) {
dragOffset = Qt.point(mouse.x - dragStartPos.x, mouse.y - dragStartPos.y); dragOffset = Qt.point(
mouse.x - dragStartPos.x,
mouse.y - dragStartPos.y)
if (dockApps) { if (dockApps) {
var threshold = 40; var threshold = 40
var newTargetIndex = targetIndex; var newTargetIndex = targetIndex
if (dragOffset.x > threshold && targetIndex < dockApps.pinnedAppCount - 1) if (dragOffset.x > threshold
newTargetIndex = targetIndex + 1; && targetIndex < dockApps.pinnedAppCount - 1)
else if (dragOffset.x < -threshold && targetIndex > 0) newTargetIndex = targetIndex + 1
newTargetIndex = targetIndex - 1; else if (dragOffset.x < -threshold
&& targetIndex > 0)
newTargetIndex = targetIndex - 1
if (newTargetIndex !== targetIndex) { if (newTargetIndex !== targetIndex) {
targetIndex = newTargetIndex; targetIndex = newTargetIndex
dragStartPos = Qt.point(mouse.x, mouse.y); dragStartPos = Qt.point(mouse.x,
mouse.y)
} }
} }
} }
} }
onClicked: (mouse) => { onClicked: mouse => {
if (!appData || longPressing) if (!appData || longPressing)
return ; return
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
// Handle based on type // Handle based on type
if (appData.type === "pinned") { if (appData.type === "pinned") {
// Launch the pinned app // Launch the pinned app
if (appData && appData.appId) { if (appData && appData.appId) {
var desktopEntry = DesktopEntries.byId(appData.appId); var desktopEntry = DesktopEntries.byId(
appData.appId)
if (desktopEntry) if (desktopEntry)
AppUsageHistoryData.addAppUsage({ AppUsageHistoryData.addAppUsage({
"id": appData.appId, "id": appData.appId,
"name": desktopEntry.name || appData.appId, "name": desktopEntry.name
"icon": desktopEntry.icon || "", || appData.appId,
"exec": desktopEntry.exec || "", "icon": desktopEntry.icon
|| "",
"exec": desktopEntry.exec
|| "",
"comment": desktopEntry.comment || "" "comment": desktopEntry.comment || ""
}); })
Quickshell.execDetached(["gtk-launch", appData.appId]); Quickshell.execDetached(
["gtk-launch", appData.appId])
} }
} else if (appData.type === "window") { } else if (appData.type === "window") {
// Focus the specific window // Focus the specific window
if (appData.windowId) if (appData.windowId)
NiriService.focusWindow(appData.windowId); NiriService.focusWindow(appData.windowId)
} }
} else if (mouse.button === Qt.MiddleButton) { } else if (mouse.button === Qt.MiddleButton) {
if (appData && appData.appId) { if (appData && appData.appId) {
var desktopEntry = DesktopEntries.byId(appData.appId); var desktopEntry = DesktopEntries.byId(
appData.appId)
if (desktopEntry) if (desktopEntry)
AppUsageHistoryData.addAppUsage({ AppUsageHistoryData.addAppUsage({
"id": appData.appId, "id": appData.appId,
"name": desktopEntry.name || appData.appId, "name": desktopEntry.name
"icon": desktopEntry.icon || "", || appData.appId,
"exec": desktopEntry.exec || "", "icon": desktopEntry.icon
"comment": desktopEntry.comment || "" || "",
}); "exec": desktopEntry.exec
|| "",
"comment": desktopEntry.comment
|| ""
})
Quickshell.execDetached(["gtk-launch", appData.appId]); Quickshell.execDetached(
["gtk-launch", appData.appId])
} }
} else if (mouse.button === Qt.RightButton) { } else if (mouse.button === Qt.RightButton) {
if (contextMenu) if (contextMenu)
contextMenu.showForButton(root, appData, 40); contextMenu.showForButton(root, appData, 40)
} }
} }
} }
@@ -224,14 +242,16 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
source: { source: {
if (!appData || !appData.appId) if (!appData || !appData.appId)
return ""; return ""
var desktopEntry = DesktopEntries.byId(appData.appId); var desktopEntry = DesktopEntries.byId(appData.appId)
if (desktopEntry && desktopEntry.icon) { if (desktopEntry && desktopEntry.icon) {
var iconPath = Quickshell.iconPath(desktopEntry.icon, SettingsData.iconTheme === "System Default" ? "" : SettingsData.iconTheme); var iconPath = Quickshell.iconPath(
return iconPath; desktopEntry.icon, SettingsData.iconTheme
=== "System Default" ? "" : SettingsData.iconTheme)
return iconPath
} }
return ""; return ""
} }
smooth: true smooth: true
mipmap: true mipmap: true
@@ -254,19 +274,18 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
text: { text: {
if (!appData || !appData.appId) if (!appData || !appData.appId)
return "?"; return "?"
var desktopEntry = DesktopEntries.byId(appData.appId); var desktopEntry = DesktopEntries.byId(appData.appId)
if (desktopEntry && desktopEntry.name) if (desktopEntry && desktopEntry.name)
return desktopEntry.name.charAt(0).toUpperCase(); return desktopEntry.name.charAt(0).toUpperCase()
return appData.appId.charAt(0).toUpperCase(); return appData.appId.charAt(0).toUpperCase()
} }
font.pixelSize: 14 font.pixelSize: 14
color: Theme.primary color: Theme.primary
font.weight: Font.Bold font.weight: Font.Bold
} }
} }
// Indicator for running/focused state // Indicator for running/focused state
@@ -280,17 +299,18 @@ Item {
visible: appData && (appData.isRunning || appData.type === "window") visible: appData && (appData.isRunning || appData.type === "window")
color: { color: {
if (!appData) if (!appData)
return "transparent"; return "transparent"
// For window type, check if focused // For window type, check if focused
if (appData.type === "window" && appData.isFocused) if (appData.type === "window" && appData.isFocused)
return Theme.primary; return Theme.primary
// For running apps, show dimmer indicator // For running apps, show dimmer indicator
if (appData.isRunning || appData.type === "window") if (appData.isRunning || appData.type === "window")
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6); return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
Theme.surfaceText.b, 0.6)
return "transparent"; return "transparent"
} }
} }
@@ -299,5 +319,4 @@ Item {
y: 0 y: 0
} }
} }

View File

@@ -55,10 +55,12 @@ Item {
items.push({ items.push({
"type": "pinned", "type": "pinned",
"appId": appId, "appId": appId,
"windowId": -1, // Use -1 instead of null to avoid ListModel warnings "windowId": -1,
"windowTitle": "", "windowTitle"// Use -1 instead of null to avoid ListModel warnings
"workspaceId": -1, // Use -1 instead of null : "",
"isPinned": true, "workspaceId": -1,
"isPinned"// Use -1 instead of null
: true,
"isRunning": false, "isRunning": false,
"isFocused": false "isFocused": false
}) })
@@ -67,14 +69,17 @@ Item {
root.pinnedAppCount = pinnedApps.length root.pinnedAppCount = pinnedApps.length
// Add separator between pinned and running if both exist // Add separator between pinned and running if both exist
if (pinnedApps.length > 0 && NiriService.windows.length > 0) { if (pinnedApps.length > 0
&& NiriService.windows.length > 0) {
items.push({ items.push({
"type": "separator", "type": "separator",
"appId": "__SEPARATOR__", "appId": "__SEPARATOR__",
"windowId": -1, // Use -1 instead of null "windowId": -1,
"windowTitle": "", "windowTitle"// Use -1 instead of null
"workspaceId": -1, // Use -1 instead of null : "",
"isPinned": false, "workspaceId": -1,
"isPinned"// Use -1 instead of null
: false,
"isRunning": false, "isRunning": false,
"isFocused": false "isFocused": false
}) })
@@ -84,17 +89,21 @@ Item {
// NiriService.windows is already sorted by sortWindowsByLayout // NiriService.windows is already sorted by sortWindowsByLayout
NiriService.windows.forEach(window => { NiriService.windows.forEach(window => {
// Limit window title length for tooltip // Limit window title length for tooltip
var title = window.title || "(Unnamed)" var title = window.title
|| "(Unnamed)"
if (title.length > 50) { if (title.length > 50) {
title = title.substring(0, 47) + "..." title = title.substring(
0, 47) + "..."
} }
// Check if this window is focused - compare as numbers // Check if this window is focused - compare as numbers
var isFocused = window.id == NiriService.focusedWindowId var isFocused = window.id
== NiriService.focusedWindowId
items.push({ items.push({
"type": "window", "type": "window",
"appId": window.app_id || "", "appId": window.app_id
|| "",
"windowId": window.id || -1, "windowId": window.id || -1,
"windowTitle": title, "windowTitle": title,
"workspaceId": window.workspace_id || -1, "workspaceId": window.workspace_id || -1,
@@ -121,7 +130,8 @@ Item {
visible: model.type === "separator" visible: model.type === "separator"
width: 2 width: 2
height: 20 height: 20
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.3) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.3)
radius: 1 radius: 1
anchors.centerIn: parent anchors.centerIn: parent
} }
@@ -161,7 +171,6 @@ Item {
} }
} }
Connections { Connections {
target: SessionData target: SessionData
function onPinnedAppsChanged() { function onPinnedAppsChanged() {

View File

@@ -187,10 +187,12 @@ PanelWindow {
} }
Rectangle { Rectangle {
visible: !!(root.appData && root.appData.windows && root.appData.windows.count > 0) visible: !!(root.appData && root.appData.windows
&& root.appData.windows.count > 0)
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
} }
Repeater { Repeater {
@@ -202,7 +204,8 @@ PanelWindow {
width: menuColumn.width width: menuColumn.width
height: 28 height: 28
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: windowArea.containsMouse ? Qt.rgba(Theme.primary.r, color: windowArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : "transparent" 0.12) : "transparent"
@@ -235,18 +238,22 @@ PanelWindow {
} }
Rectangle { Rectangle {
visible: !!(root.appData && root.appData.windows && root.appData.windows.count > 1) visible: !!(root.appData && root.appData.windows
&& root.appData.windows.count > 1)
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
} }
Rectangle { Rectangle {
visible: !!(root.appData && root.appData.windows && root.appData.windows.count > 1) visible: !!(root.appData && root.appData.windows
&& root.appData.windows.count > 1)
width: parent.width width: parent.width
height: 28 height: 28
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: closeAllArea.containsMouse ? Qt.rgba(Theme.error.r, color: closeAllArea.containsMouse ? Qt.rgba(
Theme.error.r,
Theme.error.g, Theme.error.g,
Theme.error.b, Theme.error.b,
0.12) : "transparent" 0.12) : "transparent"

View File

@@ -106,8 +106,8 @@ PanelWindow {
Rectangle { Rectangle {
id: menuContainer id: menuContainer
width: Math.min(600, width: Math.min(600, Math.max(
Math.max(250, 250,
windowColumn.implicitWidth + Theme.spacingS * 2)) windowColumn.implicitWidth + Theme.spacingS * 2))
height: Math.max(60, windowColumn.implicitHeight + Theme.spacingS * 2) height: Math.max(60, windowColumn.implicitHeight + Theme.spacingS * 2)
@@ -154,7 +154,8 @@ PanelWindow {
width: windowColumn.width width: windowColumn.width
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: windowArea.containsMouse ? Qt.rgba(Theme.primary.r, color: windowArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : "transparent" 0.12) : "transparent"

View File

@@ -54,8 +54,9 @@ Item {
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
if (text.includes("true")) { if (text.includes("true")) {
console.log("Session is locked on startup, activating lock screen") console.log(
LockScreenService.resetState(); "Session is locked on startup, activating lock screen")
LockScreenService.resetState()
loader.activeAsync = true loader.activeAsync = true
} }
} }
@@ -63,7 +64,8 @@ Item {
onExited: (exitCode, exitStatus) => { onExited: (exitCode, exitStatus) => {
if (exitCode !== 0) { if (exitCode !== 0) {
console.warn("Failed to check initial lock state, exit code:", exitCode) console.warn("Failed to check initial lock state, exit code:",
exitCode)
} }
} }
} }
@@ -76,19 +78,22 @@ Item {
stdout: SplitParser { stdout: SplitParser {
splitMarker: "\n" splitMarker: "\n"
onRead: (line) => { onRead: line => {
if (line.includes("org.freedesktop.login1.Session.Lock")) { if (line.includes("org.freedesktop.login1.Session.Lock")) {
console.log("login1: Lock signal received -> show lock") console.log("login1: Lock signal received -> show lock")
LockScreenService.resetState(); LockScreenService.resetState()
loader.activeAsync = true loader.activeAsync = true
} else if (line.includes("org.freedesktop.login1.Session.Unlock")) { } else if (line.includes(
"org.freedesktop.login1.Session.Unlock")) {
console.log("login1: Unlock signal received -> hide lock") console.log("login1: Unlock signal received -> hide lock")
loader.active = false loader.active = false
} else if (line.includes("LockedHint") && line.includes("true")) { } else if (line.includes("LockedHint") && line.includes(
"true")) {
console.log("login1: LockedHint=true -> show lock") console.log("login1: LockedHint=true -> show lock")
LockScreenService.resetState(); LockScreenService.resetState()
loader.activeAsync = true loader.activeAsync = true
} else if (line.includes("LockedHint") && line.includes("false")) { } else if (line.includes("LockedHint") && line.includes(
"false")) {
console.log("login1: LockedHint=false -> hide lock") console.log("login1: LockedHint=false -> hide lock")
loader.active = false loader.active = false
} }
@@ -102,7 +107,6 @@ Item {
} }
} }
LazyLoader { LazyLoader {
id: loader id: loader
@@ -139,7 +143,7 @@ Item {
function lock(): void { function lock(): void {
console.log("Lock screen requested via IPC") console.log("Lock screen requested via IPC")
LockScreenService.resetState(); LockScreenService.resetState()
loader.activeAsync = true loader.activeAsync = true
} }

View File

@@ -11,7 +11,8 @@ DankListView {
property bool autoScrollDisabled: false property bool autoScrollDisabled: false
onIsUserScrollingChanged: { onIsUserScrollingChanged: {
if (isUserScrolling && keyboardController && keyboardController.keyboardNavigationActive) { if (isUserScrolling && keyboardController
&& keyboardController.keyboardNavigationActive) {
autoScrollDisabled = true autoScrollDisabled = true
} }
} }
@@ -30,10 +31,14 @@ DankListView {
Timer { Timer {
id: positionPreservationTimer id: positionPreservationTimer
interval: 200 interval: 200
running: keyboardController && keyboardController.keyboardNavigationActive && !autoScrollDisabled running: keyboardController
&& keyboardController.keyboardNavigationActive
&& !autoScrollDisabled
repeat: true repeat: true
onTriggered: { onTriggered: {
if (keyboardController && keyboardController.keyboardNavigationActive && !autoScrollDisabled) { if (keyboardController
&& keyboardController.keyboardNavigationActive
&& !autoScrollDisabled) {
keyboardController.ensureVisible() keyboardController.ensureVisible()
} }
} }
@@ -47,8 +52,10 @@ DankListView {
onModelChanged: { onModelChanged: {
if (keyboardController && keyboardController.keyboardNavigationActive) { if (keyboardController && keyboardController.keyboardNavigationActive) {
keyboardController.rebuildFlatNavigation() keyboardController.rebuildFlatNavigation()
Qt.callLater(function() { Qt.callLater(function () {
if (keyboardController && keyboardController.keyboardNavigationActive && !autoScrollDisabled) { if (keyboardController
&& keyboardController.keyboardNavigationActive
&& !autoScrollDisabled) {
keyboardController.ensureVisible() keyboardController.ensureVisible()
} }
}) })
@@ -59,7 +66,8 @@ DankListView {
required property var modelData required property var modelData
required property int index required property int index
readonly property bool isExpanded: NotificationService.expandedGroups[modelData?.key] || false readonly property bool isExpanded: NotificationService.expandedGroups[modelData?.key]
|| false
width: ListView.view.width width: ListView.view.width
height: notificationCardWrapper.height height: notificationCardWrapper.height
@@ -75,28 +83,32 @@ DankListView {
notificationGroup: modelData notificationGroup: modelData
isGroupSelected: { isGroupSelected: {
if (!keyboardController || !keyboardController.keyboardNavigationActive) return false if (!keyboardController
|| !keyboardController.keyboardNavigationActive)
return false
keyboardController.selectionVersion keyboardController.selectionVersion
if (!listView.keyboardActive) return false if (!listView.keyboardActive)
return false
const selection = keyboardController.getCurrentSelection() const selection = keyboardController.getCurrentSelection()
return selection.type === "group" && selection.groupIndex === index return selection.type === "group"
&& selection.groupIndex === index
} }
selectedNotificationIndex: { selectedNotificationIndex: {
if (!keyboardController || !keyboardController.keyboardNavigationActive) return -1 if (!keyboardController
|| !keyboardController.keyboardNavigationActive)
return -1
keyboardController.selectionVersion keyboardController.selectionVersion
if (!listView.keyboardActive) return -1 if (!listView.keyboardActive)
return -1
const selection = keyboardController.getCurrentSelection() const selection = keyboardController.getCurrentSelection()
return (selection.type === "notification" && selection.groupIndex === index) return (selection.type === "notification"
? selection.notificationIndex : -1 && selection.groupIndex === index) ? selection.notificationIndex : -1
} }
keyboardNavigationActive: listView.keyboardActive keyboardNavigationActive: listView.keyboardActive
} }
} }
} }
Connections { Connections {
function onGroupedNotificationsChanged() { function onGroupedNotificationsChanged() {
if (keyboardController) { if (keyboardController) {
@@ -108,7 +120,7 @@ DankListView {
keyboardController.rebuildFlatNavigation() keyboardController.rebuildFlatNavigation()
if (keyboardController.keyboardNavigationActive) { if (keyboardController.keyboardNavigationActive) {
Qt.callLater(function() { Qt.callLater(function () {
if (!autoScrollDisabled) { if (!autoScrollDisabled) {
keyboardController.ensureVisible() keyboardController.ensureVisible()
} }
@@ -118,8 +130,9 @@ DankListView {
} }
function onExpandedGroupsChanged() { function onExpandedGroupsChanged() {
if (keyboardController && keyboardController.keyboardNavigationActive) { if (keyboardController
Qt.callLater(function() { && keyboardController.keyboardNavigationActive) {
Qt.callLater(function () {
if (!autoScrollDisabled) { if (!autoScrollDisabled) {
keyboardController.ensureVisible() keyboardController.ensureVisible()
} }
@@ -128,8 +141,9 @@ DankListView {
} }
function onExpandedMessagesChanged() { function onExpandedMessagesChanged() {
if (keyboardController && keyboardController.keyboardNavigationActive) { if (keyboardController
Qt.callLater(function() { && keyboardController.keyboardNavigationActive) {
Qt.callLater(function () {
if (!autoScrollDisabled) { if (!autoScrollDisabled) {
keyboardController.ensureVisible() keyboardController.ensureVisible()
} }
@@ -139,5 +153,4 @@ DankListView {
target: NotificationService target: NotificationService
} }
} }

View File

@@ -29,7 +29,8 @@ Rectangle {
} }
const baseHeight = 116 const baseHeight = 116
if (descriptionExpanded) { if (descriptionExpanded) {
return baseHeight + descriptionText.contentHeight - (descriptionText.font.pixelSize * 1.2 * 2) return baseHeight + descriptionText.contentHeight
- (descriptionText.font.pixelSize * 1.2 * 2)
} }
return baseHeight return baseHeight
} }
@@ -52,26 +53,34 @@ Rectangle {
color: { color: {
// Keyboard selection highlighting for groups (both collapsed and expanded) // Keyboard selection highlighting for groups (both collapsed and expanded)
if (isGroupSelected && keyboardNavigationActive) { if (isGroupSelected && keyboardNavigationActive) {
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.2) return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.2)
} }
// Very subtle group highlighting when navigating within expanded group // Very subtle group highlighting when navigating within expanded group
if (keyboardNavigationActive && expanded && selectedNotificationIndex >= 0) { if (keyboardNavigationActive && expanded
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.12) && selectedNotificationIndex >= 0) {
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.12)
} }
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.1) return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.1)
} }
border.color: { border.color: {
// Keyboard selection highlighting for groups (both collapsed and expanded) // Keyboard selection highlighting for groups (both collapsed and expanded)
if (isGroupSelected && keyboardNavigationActive) { if (isGroupSelected && keyboardNavigationActive) {
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.5) return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.5)
} }
// Subtle group border when navigating within expanded group // Subtle group border when navigating within expanded group
if (keyboardNavigationActive && expanded && selectedNotificationIndex >= 0) { if (keyboardNavigationActive && expanded
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2) && selectedNotificationIndex >= 0) {
return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.2)
} }
// Critical notification styling // Critical notification styling
if (notificationGroup?.latestNotification?.urgency === NotificationUrgency.Critical) { if (notificationGroup?.latestNotification?.urgency === NotificationUrgency.Critical) {
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.3) return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.3)
} }
return Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.05) return Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.05)
} }
@@ -81,7 +90,8 @@ Rectangle {
return 1.5 return 1.5
} }
// Subtle group border when navigating within expanded group // Subtle group border when navigating within expanded group
if (keyboardNavigationActive && expanded && selectedNotificationIndex >= 0) { if (keyboardNavigationActive && expanded
&& selectedNotificationIndex >= 0) {
return 1 return 1
} }
// Critical notification styling // Critical notification styling
@@ -127,14 +137,13 @@ Rectangle {
Rectangle { Rectangle {
id: iconContainer id: iconContainer
readonly property bool hasNotificationImage: notificationGroup?.latestNotification?.image readonly property bool hasNotificationImage: notificationGroup?.latestNotification?.image && notificationGroup.latestNotification.image !== ""
&& notificationGroup.latestNotification.image
!== ""
width: 55 width: 55
height: 55 height: 55
radius: 27.5 radius: 27.5
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) color: Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.1)
border.color: "transparent" border.color: "transparent"
border.width: 0 border.width: 0
anchors.left: parent.left anchors.left: parent.left
@@ -149,8 +158,9 @@ Rectangle {
return notificationGroup.latestNotification.cleanImage return notificationGroup.latestNotification.cleanImage
if (notificationGroup?.latestNotification?.appIcon) { if (notificationGroup?.latestNotification?.appIcon) {
const appIcon = notificationGroup.latestNotification.appIcon const appIcon = notificationGroup.latestNotification.appIcon
if (appIcon.startsWith("file://") || appIcon.startsWith("http://") if (appIcon.startsWith("file://") || appIcon.startsWith(
|| appIcon.startsWith("https://")) "http://") || appIcon.startsWith(
"https://"))
return appIcon return appIcon
return Quickshell.iconPath(appIcon, "") return Quickshell.iconPath(appIcon, "")
} }
@@ -187,7 +197,8 @@ Rectangle {
StyledText { StyledText {
anchors.centerIn: parent anchors.centerIn: parent
text: (notificationGroup?.count text: (notificationGroup?.count
|| 0) > 99 ? "99+" : (notificationGroup?.count || 0).toString() || 0) > 99 ? "99+" : (notificationGroup?.count
|| 0).toString()
color: Theme.primaryText color: Theme.primaryText
font.pixelSize: 9 font.pixelSize: 9
font.weight: Font.Bold font.weight: Font.Bold
@@ -223,7 +234,8 @@ Rectangle {
const timeStr = notificationGroup?.latestNotification?.timeStr const timeStr = notificationGroup?.latestNotification?.timeStr
|| "" || ""
if (timeStr.length > 0) if (timeStr.length > 0)
return (notificationGroup?.appName || "") + " • " + timeStr return (notificationGroup?.appName
|| "") + " • " + timeStr
else else
return notificationGroup?.appName || "" return notificationGroup?.appName || ""
} }
@@ -235,7 +247,8 @@ Rectangle {
} }
StyledText { StyledText {
text: notificationGroup?.latestNotification?.summary || "" text: notificationGroup?.latestNotification?.summary
|| ""
color: Theme.surfaceText color: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium font.weight: Font.Medium
@@ -264,12 +277,12 @@ Rectangle {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : (parent.hasMoreText cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : (parent.hasMoreText || descriptionExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor
|| descriptionExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: mouse => { onClicked: mouse => {
if (!parent.hoveredLink if (!parent.hoveredLink
&& (parent.hasMoreText || descriptionExpanded)) { && (parent.hasMoreText
|| descriptionExpanded)) {
const messageId = notificationGroup?.latestNotification?.notification?.id + "_desc" const messageId = notificationGroup?.latestNotification?.notification?.id + "_desc"
NotificationService.toggleMessageExpansion( NotificationService.toggleMessageExpansion(
messageId) messageId)
@@ -310,7 +323,6 @@ Rectangle {
width: parent.width width: parent.width
height: 40 height: 40
Row { Row {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@@ -376,8 +388,17 @@ Rectangle {
return baseHeight return baseHeight
} }
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: isSelected ? Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.25) : "transparent" color: isSelected ? Qt.rgba(Theme.surfaceVariant.r,
border.color: isSelected ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.05) Theme.surfaceVariant.g,
Theme.surfaceVariant.b,
0.25) : "transparent"
border.color: isSelected ? Qt.rgba(Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.4) : Qt.rgba(
Theme.outline.r,
Theme.outline.g,
Theme.outline.b, 0.05)
border.width: isSelected ? 1 : 1 border.width: isSelected ? 1 : 1
Behavior on color { Behavior on color {
@@ -417,7 +438,8 @@ Rectangle {
anchors.topMargin: 32 anchors.topMargin: 32
color: Qt.rgba(Theme.primary.r, Theme.primary.g, color: Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.1) Theme.primary.b, 0.1)
border.color: Qt.rgba(Theme.primary.r, Theme.primary.g, border.color: Qt.rgba(Theme.primary.r,
Theme.primary.g,
Theme.primary.b, 0.2) Theme.primary.b, 0.2)
border.width: 1 border.width: 1
@@ -430,8 +452,10 @@ Rectangle {
if (modelData?.appIcon) { if (modelData?.appIcon) {
const appIcon = modelData.appIcon const appIcon = modelData.appIcon
if (appIcon.startsWith("file://") || appIcon.startsWith( if (appIcon.startsWith("file://")
"http://") || appIcon.startsWith("https://")) || appIcon.startsWith("http://")
|| appIcon.startsWith(
"https://"))
return appIcon return appIcon
return Quickshell.iconPath(appIcon, "") return Quickshell.iconPath(appIcon, "")
@@ -444,7 +468,8 @@ Rectangle {
StyledText { StyledText {
anchors.centerIn: parent anchors.centerIn: parent
visible: !parent.hasNotificationImage visible: !parent.hasNotificationImage
&& (!modelData?.appIcon || modelData.appIcon === "") && (!modelData?.appIcon
|| modelData.appIcon === "")
text: { text: {
const appName = modelData?.appName || "?" const appName = modelData?.appName || "?"
return appName.charAt(0).toUpperCase() return appName.charAt(0).toUpperCase()
@@ -506,7 +531,8 @@ Rectangle {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
visible: text.length > 0 visible: text.length > 0
linkColor: Theme.primary linkColor: Theme.primary
onLinkActivated: link => Qt.openUrlExternally(link) onLinkActivated: link => Qt.openUrlExternally(
link)
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : (bodyText.hasMoreText || messageExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : (bodyText.hasMoreText || messageExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor
@@ -516,7 +542,8 @@ Rectangle {
&& (bodyText.hasMoreText && (bodyText.hasMoreText
|| messageExpanded)) { || messageExpanded)) {
NotificationService.toggleMessageExpansion( NotificationService.toggleMessageExpansion(
modelData?.notification?.id || "") modelData?.notification?.id
|| "")
} }
} }
@@ -553,10 +580,13 @@ Rectangle {
Rectangle { Rectangle {
property bool isHovered: false property bool isHovered: false
width: Math.max(actionText.implicitWidth + 12, 50) width: Math.max(
actionText.implicitWidth + 12,
50)
height: 24 height: 24
radius: 4 radius: 4
color: isHovered ? Qt.rgba(Theme.primary.r, color: isHovered ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.1) : "transparent" 0.1) : "transparent"
@@ -564,8 +594,12 @@ Rectangle {
StyledText { StyledText {
id: actionText id: actionText
text: { text: {
const baseText = modelData.text || "View" const baseText = modelData.text
if (keyboardNavigationActive && (isGroupSelected || selectedNotificationIndex >= 0)) { || "View"
if (keyboardNavigationActive
&& (isGroupSelected
|| selectedNotificationIndex
>= 0)) {
return `${baseText} (${index + 1})` return `${baseText} (${index + 1})`
} }
return baseText return baseText
@@ -584,7 +618,8 @@ Rectangle {
onEntered: parent.isHovered = true onEntered: parent.isHovered = true
onExited: parent.isHovered = false onExited: parent.isHovered = false
onClicked: { onClicked: {
if (modelData && modelData.invoke) { if (modelData
&& modelData.invoke) {
modelData.invoke() modelData.invoke()
} }
} }
@@ -595,10 +630,13 @@ Rectangle {
Rectangle { Rectangle {
property bool isHovered: false property bool isHovered: false
width: Math.max(clearText.implicitWidth + 12, 50) width: Math.max(
clearText.implicitWidth + 12,
50)
height: 24 height: 24
radius: 4 radius: 4
color: isHovered ? Qt.rgba(Theme.primary.r, color: isHovered ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.1) : "transparent" 0.1) : "transparent"
@@ -714,7 +752,8 @@ Rectangle {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onEntered: clearButton.isHovered = true onEntered: clearButton.isHovered = true
onExited: clearButton.isHovered = false onExited: clearButton.isHovered = false
onClicked: NotificationService.dismissGroup(notificationGroup?.key || "") onClicked: NotificationService.dismissGroup(
notificationGroup?.key || "")
} }
} }
@@ -724,7 +763,8 @@ Rectangle {
&& !descriptionExpanded && !descriptionExpanded
onClicked: { onClicked: {
root.userInitiatedExpansion = true root.userInitiatedExpansion = true
NotificationService.toggleGroupExpansion(notificationGroup?.key || "") NotificationService.toggleGroupExpansion(
notificationGroup?.key || "")
} }
z: -1 z: -1
} }
@@ -747,7 +787,8 @@ Rectangle {
buttonSize: 28 buttonSize: 28
onClicked: { onClicked: {
root.userInitiatedExpansion = true root.userInitiatedExpansion = true
NotificationService.toggleGroupExpansion(notificationGroup?.key || "") NotificationService.toggleGroupExpansion(
notificationGroup?.key || "")
} }
} }
@@ -757,7 +798,8 @@ Rectangle {
iconName: "close" iconName: "close"
iconSize: 18 iconSize: 18
buttonSize: 28 buttonSize: 28
onClicked: NotificationService.dismissGroup(notificationGroup?.key || "") onClicked: NotificationService.dismissGroup(
notificationGroup?.key || "")
} }
} }

View File

@@ -20,9 +20,10 @@ DankPopout {
id: keyboardController id: keyboardController
listView: null listView: null
isOpen: notificationHistoryVisible isOpen: notificationHistoryVisible
onClose: function() { notificationHistoryVisible = false } onClose: function () {
notificationHistoryVisible = false
}
} }
function setTriggerPosition(x, y, width, section, screen) { function setTriggerPosition(x, y, width, section, screen) {
triggerX = x triggerX = x
@@ -55,13 +56,15 @@ DankPopout {
if (shouldBeVisible) { if (shouldBeVisible) {
NotificationService.disablePopups(true) NotificationService.disablePopups(true)
// Set up keyboard controller when content is loaded // Set up keyboard controller when content is loaded
Qt.callLater(function() { Qt.callLater(function () {
if (contentLoader.item) { if (contentLoader.item) {
contentLoader.item.externalKeyboardController = keyboardController contentLoader.item.externalKeyboardController = keyboardController
// Find the notification list and set up the connection // Find the notification list and set up the connection
var notificationList = findChild(contentLoader.item, "notificationList") var notificationList = findChild(contentLoader.item,
var notificationHeader = findChild(contentLoader.item, "notificationHeader") "notificationList")
var notificationHeader = findChild(contentLoader.item,
"notificationHeader")
if (notificationList) { if (notificationList) {
keyboardController.listView = notificationList keyboardController.listView = notificationList
@@ -112,7 +115,10 @@ DankPopout {
if (NotificationService.groupedNotifications.length === 0) if (NotificationService.groupedNotifications.length === 0)
listHeight = 200 listHeight = 200
baseHeight += Math.min(listHeight, 600) baseHeight += Math.min(listHeight, 600)
return Math.max(300, Math.min(baseHeight, root.screen ? root.screen.height * 0.8 : Screen.height * 0.8)) return Math.max(
300, Math.min(
baseHeight,
root.screen ? root.screen.height * 0.8 : Screen.height * 0.8))
} }
color: Theme.popupBackground() color: Theme.popupBackground()
@@ -127,7 +133,7 @@ DankPopout {
forceActiveFocus() forceActiveFocus()
} }
Keys.onPressed: function(event) { Keys.onPressed: function (event) {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
root.close() root.close()
event.accepted = true event.accepted = true
@@ -176,7 +182,8 @@ DankPopout {
objectName: "notificationList" objectName: "notificationList"
width: parent.width width: parent.width
height: parent.height - notificationContent.cachedHeaderHeight - notificationSettings.height - contentColumnInner.spacing * 2 height: parent.height - notificationContent.cachedHeaderHeight
- notificationSettings.height - contentColumnInner.spacing * 2
} }
} }
} }

View File

@@ -80,7 +80,8 @@ Item {
DankActionButton { DankActionButton {
id: helpButton id: helpButton
iconName: "info" iconName: "info"
iconColor: keyboardController && keyboardController.showKeyboardHints ? Theme.primary : Theme.surfaceText iconColor: keyboardController
&& keyboardController.showKeyboardHints ? Theme.primary : Theme.surfaceText
buttonSize: 28 buttonSize: 28
visible: keyboardController !== null visible: keyboardController !== null
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -108,13 +109,16 @@ Item {
height: 28 height: 28
radius: Theme.cornerRadius radius: Theme.cornerRadius
visible: NotificationService.notifications.length > 0 visible: NotificationService.notifications.length > 0
color: clearArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, color: clearArea.containsMouse ? Qt.rgba(Theme.primary.r,
Theme.primary.b, 0.12) : Qt.rgba( Theme.primary.g,
Theme.primary.b,
0.12) : Qt.rgba(
Theme.surfaceVariant.r, Theme.surfaceVariant.r,
Theme.surfaceVariant.g, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3) Theme.surfaceVariant.b, 0.3)
border.color: clearArea.containsMouse ? Theme.primary : Qt.rgba( border.color: clearArea.containsMouse ? Theme.primary : Qt.rgba(
Theme.outline.r, Theme.outline.g, Theme.outline.r,
Theme.outline.g,
Theme.outline.b, 0.08) Theme.outline.b, 0.08)
border.width: 1 border.width: 1

View File

@@ -30,28 +30,30 @@ QtObject {
for (var i = 0; i < groups.length; i++) { for (var i = 0; i < groups.length; i++) {
var group = groups[i] var group = groups[i]
var isExpanded = NotificationService.expandedGroups[group.key] || false var isExpanded = NotificationService.expandedGroups[group.key]
|| false
// Add the group itself // Add the group itself
nav.push({ nav.push({
type: "group", "type": "group",
groupIndex: i, "groupIndex": i,
notificationIndex: -1, "notificationIndex": -1,
groupKey: group.key, "groupKey": group.key,
notificationId: "" "notificationId": ""
}) })
// If expanded, add individual notifications // If expanded, add individual notifications
if (isExpanded) { if (isExpanded) {
var notifications = group.notifications || [] var notifications = group.notifications || []
for (var j = 0; j < notifications.length; j++) { for (var j = 0; j < notifications.length; j++) {
var notifId = String(notifications[j]?.notification?.id || "") var notifId = String(
notifications[j]?.notification?.id || "")
nav.push({ nav.push({
type: "notification", "type": "notification",
groupIndex: i, "groupIndex": i,
notificationIndex: j, "notificationIndex": j,
groupKey: group.key, "groupKey": group.key,
notificationId: notifId "notificationId": notifId
}) })
} }
} }
@@ -63,17 +65,22 @@ QtObject {
} }
function updateSelectedIndexFromId() { function updateSelectedIndexFromId() {
if (!keyboardNavigationActive) return if (!keyboardNavigationActive)
return
// Find the index that matches our selected ID/key // Find the index that matches our selected ID/key
for (var i = 0; i < flatNavigation.length; i++) { for (var i = 0; i < flatNavigation.length; i++) {
var item = flatNavigation[i] var item = flatNavigation[i]
if (selectedItemType === "group" && item.type === "group" && item.groupKey === selectedGroupKey) { if (selectedItemType === "group" && item.type === "group"
&& item.groupKey === selectedGroupKey) {
selectedFlatIndex = i selectedFlatIndex = i
selectionVersion++ // Trigger UI update selectionVersion++ // Trigger UI update
return return
} else if (selectedItemType === "notification" && item.type === "notification" && String(item.notificationId) === String(selectedNotificationId)) { } else if (selectedItemType === "notification"
&& item.type === "notification" && String(
item.notificationId) === String(
selectedNotificationId)) {
selectedFlatIndex = i selectedFlatIndex = i
selectionVersion++ // Trigger UI update selectionVersion++ // Trigger UI update
return return
@@ -84,7 +91,8 @@ QtObject {
if (selectedItemType === "notification") { if (selectedItemType === "notification") {
for (var j = 0; j < flatNavigation.length; j++) { for (var j = 0; j < flatNavigation.length; j++) {
var groupItem = flatNavigation[j] var groupItem = flatNavigation[j]
if (groupItem.type === "group" && groupItem.groupKey === selectedGroupKey) { if (groupItem.type === "group"
&& groupItem.groupKey === selectedGroupKey) {
selectedFlatIndex = j selectedFlatIndex = j
selectedItemType = "group" selectedItemType = "group"
selectedNotificationId = "" selectedNotificationId = ""
@@ -96,7 +104,8 @@ QtObject {
// If still not found, clamp to valid range and update // If still not found, clamp to valid range and update
if (flatNavigation.length > 0) { if (flatNavigation.length > 0) {
selectedFlatIndex = Math.min(selectedFlatIndex, flatNavigation.length - 1) selectedFlatIndex = Math.min(selectedFlatIndex,
flatNavigation.length - 1)
selectedFlatIndex = Math.max(selectedFlatIndex, 0) selectedFlatIndex = Math.max(selectedFlatIndex, 0)
updateSelectedIdFromIndex() updateSelectedIdFromIndex()
selectionVersion++ // Trigger UI update selectionVersion++ // Trigger UI update
@@ -104,7 +113,8 @@ QtObject {
} }
function updateSelectedIdFromIndex() { function updateSelectedIdFromIndex() {
if (selectedFlatIndex >= 0 && selectedFlatIndex < flatNavigation.length) { if (selectedFlatIndex >= 0
&& selectedFlatIndex < flatNavigation.length) {
var item = flatNavigation[selectedFlatIndex] var item = flatNavigation[selectedFlatIndex]
selectedItemType = item.type selectedItemType = item.type
selectedGroupKey = item.groupKey selectedGroupKey = item.groupKey
@@ -125,14 +135,16 @@ QtObject {
function selectNext() { function selectNext() {
keyboardNavigationActive = true keyboardNavigationActive = true
if (flatNavigation.length === 0) return if (flatNavigation.length === 0)
return
// Re-enable auto-scrolling when arrow keys are used // Re-enable auto-scrolling when arrow keys are used
if (listView && listView.enableAutoScroll) { if (listView && listView.enableAutoScroll) {
listView.enableAutoScroll() listView.enableAutoScroll()
} }
selectedFlatIndex = Math.min(selectedFlatIndex + 1, flatNavigation.length - 1) selectedFlatIndex = Math.min(selectedFlatIndex + 1,
flatNavigation.length - 1)
updateSelectedIdFromIndex() updateSelectedIdFromIndex()
selectionVersion++ selectionVersion++
ensureVisible() ensureVisible()
@@ -140,7 +152,8 @@ QtObject {
function selectPrevious() { function selectPrevious() {
keyboardNavigationActive = true keyboardNavigationActive = true
if (flatNavigation.length === 0) return if (flatNavigation.length === 0)
return
// Re-enable auto-scrolling when arrow keys are used // Re-enable auto-scrolling when arrow keys are used
if (listView && listView.enableAutoScroll) { if (listView && listView.enableAutoScroll) {
@@ -154,18 +167,23 @@ QtObject {
} }
function toggleGroupExpanded() { function toggleGroupExpanded() {
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length) return if (flatNavigation.length === 0
|| selectedFlatIndex >= flatNavigation.length)
return
const currentItem = flatNavigation[selectedFlatIndex] const currentItem = flatNavigation[selectedFlatIndex]
const groups = NotificationService.groupedNotifications const groups = NotificationService.groupedNotifications
const group = groups[currentItem.groupIndex] const group = groups[currentItem.groupIndex]
if (!group) return if (!group)
return
// Prevent expanding groups with < 2 notifications // Prevent expanding groups with < 2 notifications
const notificationCount = group.notifications ? group.notifications.length : 0 const notificationCount = group.notifications ? group.notifications.length : 0
if (notificationCount < 2) return if (notificationCount < 2)
return
const wasExpanded = NotificationService.expandedGroups[group.key] || false const wasExpanded = NotificationService.expandedGroups[group.key]
|| false
const groupIndex = currentItem.groupIndex const groupIndex = currentItem.groupIndex
isTogglingGroup = true isTogglingGroup = true
@@ -175,16 +193,18 @@ QtObject {
// Smart selection after toggle // Smart selection after toggle
if (!wasExpanded) { if (!wasExpanded) {
// Just expanded - move to first notification in the group // Just expanded - move to first notification in the group
for (let i = 0; i < flatNavigation.length; i++) { for (var i = 0; i < flatNavigation.length; i++) {
if (flatNavigation[i].type === "notification" && flatNavigation[i].groupIndex === groupIndex) { if (flatNavigation[i].type === "notification"
&& flatNavigation[i].groupIndex === groupIndex) {
selectedFlatIndex = i selectedFlatIndex = i
break break
} }
} }
} else { } else {
// Just collapsed - stay on the group header // Just collapsed - stay on the group header
for (let i = 0; i < flatNavigation.length; i++) { for (var i = 0; i < flatNavigation.length; i++) {
if (flatNavigation[i].type === "group" && flatNavigation[i].groupIndex === groupIndex) { if (flatNavigation[i].type === "group"
&& flatNavigation[i].groupIndex === groupIndex) {
selectedFlatIndex = i selectedFlatIndex = i
break break
} }
@@ -196,12 +216,15 @@ QtObject {
} }
function handleEnterKey() { function handleEnterKey() {
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length) return if (flatNavigation.length === 0
|| selectedFlatIndex >= flatNavigation.length)
return
const currentItem = flatNavigation[selectedFlatIndex] const currentItem = flatNavigation[selectedFlatIndex]
const groups = NotificationService.groupedNotifications const groups = NotificationService.groupedNotifications
const group = groups[currentItem.groupIndex] const group = groups[currentItem.groupIndex]
if (!group) return if (!group)
return
if (currentItem.type === "group") { if (currentItem.type === "group") {
const notificationCount = group.notifications ? group.notifications.length : 0 const notificationCount = group.notifications ? group.notifications.length : 0
@@ -216,19 +239,25 @@ QtObject {
} }
function toggleTextExpanded() { function toggleTextExpanded() {
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length) return if (flatNavigation.length === 0
|| selectedFlatIndex >= flatNavigation.length)
return
const currentItem = flatNavigation[selectedFlatIndex] const currentItem = flatNavigation[selectedFlatIndex]
const groups = NotificationService.groupedNotifications const groups = NotificationService.groupedNotifications
const group = groups[currentItem.groupIndex] const group = groups[currentItem.groupIndex]
if (!group) return if (!group)
return
var messageId = "" var messageId = ""
if (currentItem.type === "group") { if (currentItem.type === "group") {
messageId = group.latestNotification?.notification?.id + "_desc" messageId = group.latestNotification?.notification?.id + "_desc"
} else if (currentItem.type === "notification" && currentItem.notificationIndex >= 0 && currentItem.notificationIndex < group.notifications.length) { } else if (currentItem.type === "notification"
messageId = group.notifications[currentItem.notificationIndex]?.notification?.id + "_desc" && currentItem.notificationIndex >= 0
&& currentItem.notificationIndex < group.notifications.length) {
messageId = group.notifications[currentItem.notificationIndex]?.notification?.id
+ "_desc"
} }
if (messageId) { if (messageId) {
@@ -237,45 +266,57 @@ QtObject {
} }
function executeAction(actionIndex) { function executeAction(actionIndex) {
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length) return if (flatNavigation.length === 0
|| selectedFlatIndex >= flatNavigation.length)
return
const currentItem = flatNavigation[selectedFlatIndex] const currentItem = flatNavigation[selectedFlatIndex]
const groups = NotificationService.groupedNotifications const groups = NotificationService.groupedNotifications
const group = groups[currentItem.groupIndex] const group = groups[currentItem.groupIndex]
if (!group) return if (!group)
return
var actions = [] var actions = []
if (currentItem.type === "group") { if (currentItem.type === "group") {
actions = group.latestNotification?.actions || [] actions = group.latestNotification?.actions || []
} else if (currentItem.type === "notification" && currentItem.notificationIndex >= 0 && currentItem.notificationIndex < group.notifications.length) { } else if (currentItem.type === "notification"
actions = group.notifications[currentItem.notificationIndex]?.actions || [] && currentItem.notificationIndex >= 0
&& currentItem.notificationIndex < group.notifications.length) {
actions = group.notifications[currentItem.notificationIndex]?.actions
|| []
} }
if (actionIndex >= 0 && actionIndex < actions.length) { if (actionIndex >= 0 && actionIndex < actions.length) {
const action = actions[actionIndex] const action = actions[actionIndex]
if (action.invoke) { if (action.invoke) {
action.invoke() action.invoke()
if (onClose) onClose() if (onClose)
onClose()
} }
} }
} }
function clearSelected() { function clearSelected() {
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length) return if (flatNavigation.length === 0
|| selectedFlatIndex >= flatNavigation.length)
return
const currentItem = flatNavigation[selectedFlatIndex] const currentItem = flatNavigation[selectedFlatIndex]
const groups = NotificationService.groupedNotifications const groups = NotificationService.groupedNotifications
const group = groups[currentItem.groupIndex] const group = groups[currentItem.groupIndex]
if (!group) return if (!group)
return
// Save current state for smart navigation // Save current state for smart navigation
const currentGroupKey = group.key const currentGroupKey = group.key
const isNotification = currentItem.type === "notification" const isNotification = currentItem.type === "notification"
const notificationIndex = currentItem.notificationIndex const notificationIndex = currentItem.notificationIndex
const totalNotificationsInGroup = group.notifications ? group.notifications.length : 0 const totalNotificationsInGroup = group.notifications ? group.notifications.length : 0
const isLastNotificationInGroup = isNotification && totalNotificationsInGroup === 1 const isLastNotificationInGroup = isNotification
const isLastNotificationInList = isNotification && notificationIndex === totalNotificationsInGroup - 1 && totalNotificationsInGroup === 1
const isLastNotificationInList = isNotification
&& notificationIndex === totalNotificationsInGroup - 1
// Store what to select next BEFORE clearing // Store what to select next BEFORE clearing
let nextTargetType = "" let nextTargetType = ""
@@ -286,7 +327,7 @@ QtObject {
NotificationService.dismissGroup(group.key) NotificationService.dismissGroup(group.key)
// Look for next group // Look for next group
for (let i = currentItem.groupIndex + 1; i < groups.length; i++) { for (var i = currentItem.groupIndex + 1; i < groups.length; i++) {
nextTargetType = "group" nextTargetType = "group"
nextTargetGroupKey = groups[i].key nextTargetGroupKey = groups[i].key
break break
@@ -296,13 +337,12 @@ QtObject {
nextTargetType = "group" nextTargetType = "group"
nextTargetGroupKey = groups[currentItem.groupIndex - 1].key nextTargetGroupKey = groups[currentItem.groupIndex - 1].key
} }
} else if (isNotification) { } else if (isNotification) {
const notification = group.notifications[notificationIndex] const notification = group.notifications[notificationIndex]
NotificationService.dismissNotification(notification) NotificationService.dismissNotification(notification)
if (isLastNotificationInGroup) { if (isLastNotificationInGroup) {
for (let i = currentItem.groupIndex + 1; i < groups.length; i++) { for (var i = currentItem.groupIndex + 1; i < groups.length; i++) {
nextTargetType = "group" nextTargetType = "group"
nextTargetGroupKey = groups[i].key nextTargetGroupKey = groups[i].key
break break
@@ -340,15 +380,18 @@ QtObject {
updateSelectedIdFromIndex() updateSelectedIdFromIndex()
} else if (nextTargetGroupKey) { } else if (nextTargetGroupKey) {
let found = false let found = false
for (let i = 0; i < flatNavigation.length; i++) { for (var i = 0; i < flatNavigation.length; i++) {
const item = flatNavigation[i] const item = flatNavigation[i]
if (nextTargetType === "group" && item.type === "group" && item.groupKey === nextTargetGroupKey) { if (nextTargetType === "group" && item.type === "group"
&& item.groupKey === nextTargetGroupKey) {
selectedFlatIndex = i selectedFlatIndex = i
found = true found = true
break break
} else if (nextTargetType === "notification" && item.type === "notification" && } else if (nextTargetType === "notification"
item.groupKey === nextTargetGroupKey && item.notificationIndex === nextTargetNotificationIndex) { && item.type === "notification"
&& item.groupKey === nextTargetGroupKey
&& item.notificationIndex === nextTargetNotificationIndex) {
selectedFlatIndex = i selectedFlatIndex = i
found = true found = true
break break
@@ -356,12 +399,14 @@ QtObject {
} }
if (!found) { if (!found) {
selectedFlatIndex = Math.min(selectedFlatIndex, flatNavigation.length - 1) selectedFlatIndex = Math.min(selectedFlatIndex,
flatNavigation.length - 1)
} }
updateSelectedIdFromIndex() updateSelectedIdFromIndex()
} else { } else {
selectedFlatIndex = Math.min(selectedFlatIndex, flatNavigation.length - 1) selectedFlatIndex = Math.min(selectedFlatIndex,
flatNavigation.length - 1)
updateSelectedIdFromIndex() updateSelectedIdFromIndex()
} }
@@ -369,19 +414,24 @@ QtObject {
} }
function ensureVisible() { function ensureVisible() {
if (flatNavigation.length === 0 || selectedFlatIndex >= flatNavigation.length || !listView) return if (flatNavigation.length === 0
|| selectedFlatIndex >= flatNavigation.length || !listView)
return
const currentItem = flatNavigation[selectedFlatIndex] const currentItem = flatNavigation[selectedFlatIndex]
if (keyboardNavigationActive && currentItem && currentItem.groupIndex >= 0) { if (keyboardNavigationActive && currentItem
&& currentItem.groupIndex >= 0) {
// Always center the selected item for better visibility // Always center the selected item for better visibility
// This ensures the selected item stays in view even when new notifications arrive // This ensures the selected item stays in view even when new notifications arrive
if (currentItem.type === "notification") { if (currentItem.type === "notification") {
// For individual notifications, center on the group but bias towards the notification // For individual notifications, center on the group but bias towards the notification
listView.positionViewAtIndex(currentItem.groupIndex, ListView.Center) listView.positionViewAtIndex(currentItem.groupIndex,
ListView.Center)
} else { } else {
// For group headers, center on the group // For group headers, center on the group
listView.positionViewAtIndex(currentItem.groupIndex, ListView.Center) listView.positionViewAtIndex(currentItem.groupIndex,
ListView.Center)
} }
// Force immediate update // Force immediate update
@@ -390,7 +440,8 @@ QtObject {
} }
function handleKey(event) { function handleKey(event) {
if ((event.key === Qt.Key_Delete || event.key === Qt.Key_Backspace) && (event.modifiers & Qt.ShiftModifier)) { if ((event.key === Qt.Key_Delete || event.key === Qt.Key_Backspace)
&& (event.modifiers & Qt.ShiftModifier)) {
NotificationService.clearAllNotifications() NotificationService.clearAllNotifications()
rebuildFlatNavigation() rebuildFlatNavigation()
if (flatNavigation.length === 0) { if (flatNavigation.length === 0) {
@@ -412,7 +463,8 @@ QtObject {
keyboardNavigationActive = false keyboardNavigationActive = false
event.accepted = true event.accepted = true
} else { } else {
if (onClose) onClose() if (onClose)
onClose()
event.accepted = true event.accepted = true
} }
} else if (event.key === Qt.Key_Down || event.key === 16777237) { } else if (event.key === Qt.Key_Down || event.key === 16777237) {
@@ -462,13 +514,15 @@ QtObject {
if (event.key === Qt.Key_Space) { if (event.key === Qt.Key_Space) {
toggleGroupExpanded() toggleGroupExpanded()
event.accepted = true event.accepted = true
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { } else if (event.key === Qt.Key_Return
|| event.key === Qt.Key_Enter) {
handleEnterKey() handleEnterKey()
event.accepted = true event.accepted = true
} else if (event.key === Qt.Key_E) { } else if (event.key === Qt.Key_E) {
toggleTextExpanded() toggleTextExpanded()
event.accepted = true event.accepted = true
} else if (event.key === Qt.Key_Delete || event.key === Qt.Key_Backspace) { } else if (event.key === Qt.Key_Delete
|| event.key === Qt.Key_Backspace) {
clearSelected() clearSelected()
event.accepted = true event.accepted = true
} else if (event.key >= Qt.Key_1 && event.key <= Qt.Key_9) { } else if (event.key >= Qt.Key_1 && event.key <= Qt.Key_9) {
@@ -486,10 +540,19 @@ QtObject {
// Get current selection info for UI // Get current selection info for UI
function getCurrentSelection() { function getCurrentSelection() {
if (!keyboardNavigationActive || selectedFlatIndex < 0 || selectedFlatIndex >= flatNavigation.length) { if (!keyboardNavigationActive || selectedFlatIndex < 0
return { type: "", groupIndex: -1, notificationIndex: -1 } || selectedFlatIndex >= flatNavigation.length) {
return {
"type": "",
"groupIndex": -1,
"notificationIndex": -1
}
}
const result = flatNavigation[selectedFlatIndex] || {
"type": "",
"groupIndex": -1,
"notificationIndex": -1
} }
const result = flatNavigation[selectedFlatIndex] || { type: "", groupIndex: -1, notificationIndex: -1 }
return result return result
} }
} }

View File

@@ -9,7 +9,8 @@ Rectangle {
height: 80 height: 80
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
Theme.surfaceContainer.b, 0.95)
border.color: Theme.primary border.color: Theme.primary
border.width: 2 border.width: 2
opacity: showHints ? 1 : 0 opacity: showHints ? 1 : 0
@@ -39,7 +40,6 @@ Rectangle {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
} }
Behavior on opacity { Behavior on opacity {
@@ -47,7 +47,5 @@ Rectangle {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
} }

View File

@@ -15,8 +15,10 @@ Rectangle {
visible: expanded visible: expanded
clip: true clip: true
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3) color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1) Theme.surfaceContainer.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.1)
border.width: 1 border.width: 1
Behavior on height { Behavior on height {
@@ -37,34 +39,60 @@ Rectangle {
} }
} }
readonly property var timeoutOptions: [ readonly property var timeoutOptions: [{
{ text: "Never", value: 0 }, "text": "Never",
{ text: "1 second", value: 1000 }, "value": 0
{ text: "3 seconds", value: 3000 }, }, {
{ text: "5 seconds", value: 5000 }, "text": "1 second",
{ text: "8 seconds", value: 8000 }, "value": 1000
{ text: "10 seconds", value: 10000 }, }, {
{ text: "15 seconds", value: 15000 }, "text": "3 seconds",
{ text: "30 seconds", value: 30000 }, "value": 3000
{ text: "1 minute", value: 60000 }, }, {
{ text: "2 minutes", value: 120000 }, "text": "5 seconds",
{ text: "5 minutes", value: 300000 }, "value": 5000
{ text: "10 minutes", value: 600000 } }, {
] "text": "8 seconds",
"value": 8000
}, {
"text": "10 seconds",
"value": 10000
}, {
"text": "15 seconds",
"value": 15000
}, {
"text": "30 seconds",
"value": 30000
}, {
"text": "1 minute",
"value": 60000
}, {
"text": "2 minutes",
"value": 120000
}, {
"text": "5 minutes",
"value": 300000
}, {
"text": "10 minutes",
"value": 600000
}]
function getTimeoutText(value) { function getTimeoutText(value) {
if (value === undefined || value === null || isNaN(value)) { if (value === undefined || value === null || isNaN(value)) {
return "5 seconds" return "5 seconds"
} }
for (let i = 0; i < timeoutOptions.length; i++) { for (var i = 0; i < timeoutOptions.length; i++) {
if (timeoutOptions[i].value === value) { if (timeoutOptions[i].value === value) {
return timeoutOptions[i].text return timeoutOptions[i].text
} }
} }
if (value === 0) return "Never" if (value === 0)
if (value < 1000) return value + "ms" return "Never"
if (value < 60000) return Math.round(value / 1000) + " seconds" if (value < 1000)
return value + "ms"
if (value < 60000)
return Math.round(value / 1000) + " seconds"
return Math.round(value / 60000) + " minutes" return Math.round(value / 60000) + " minutes"
} }
@@ -111,14 +139,16 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: SessionData.doNotDisturb checked: SessionData.doNotDisturb
onToggled: SessionData.setDoNotDisturb(!SessionData.doNotDisturb) onToggled: SessionData.setDoNotDisturb(
!SessionData.doNotDisturb)
} }
} }
Rectangle { Rectangle {
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.1)
} }
StyledText { StyledText {
@@ -135,9 +165,10 @@ Rectangle {
currentValue: getTimeoutText(SettingsData.notificationTimeoutLow) currentValue: getTimeoutText(SettingsData.notificationTimeoutLow)
options: timeoutOptions.map(opt => opt.text) options: timeoutOptions.map(opt => opt.text)
onValueChanged: value => { onValueChanged: value => {
for (let i = 0; i < timeoutOptions.length; i++) { for (var i = 0; i < timeoutOptions.length; i++) {
if (timeoutOptions[i].text === value) { if (timeoutOptions[i].text === value) {
SettingsData.setNotificationTimeoutLow(timeoutOptions[i].value) SettingsData.setNotificationTimeoutLow(
timeoutOptions[i].value)
break break
} }
} }
@@ -151,9 +182,10 @@ Rectangle {
currentValue: getTimeoutText(SettingsData.notificationTimeoutNormal) currentValue: getTimeoutText(SettingsData.notificationTimeoutNormal)
options: timeoutOptions.map(opt => opt.text) options: timeoutOptions.map(opt => opt.text)
onValueChanged: value => { onValueChanged: value => {
for (let i = 0; i < timeoutOptions.length; i++) { for (var i = 0; i < timeoutOptions.length; i++) {
if (timeoutOptions[i].text === value) { if (timeoutOptions[i].text === value) {
SettingsData.setNotificationTimeoutNormal(timeoutOptions[i].value) SettingsData.setNotificationTimeoutNormal(
timeoutOptions[i].value)
break break
} }
} }
@@ -164,12 +196,14 @@ Rectangle {
width: parent.width width: parent.width
text: "Critical Priority" text: "Critical Priority"
description: "Timeout for critical priority notifications" description: "Timeout for critical priority notifications"
currentValue: getTimeoutText(SettingsData.notificationTimeoutCritical) currentValue: getTimeoutText(
SettingsData.notificationTimeoutCritical)
options: timeoutOptions.map(opt => opt.text) options: timeoutOptions.map(opt => opt.text)
onValueChanged: value => { onValueChanged: value => {
for (let i = 0; i < timeoutOptions.length; i++) { for (var i = 0; i < timeoutOptions.length; i++) {
if (timeoutOptions[i].text === value) { if (timeoutOptions[i].text === value) {
SettingsData.setNotificationTimeoutCritical(timeoutOptions[i].value) SettingsData.setNotificationTimeoutCritical(
timeoutOptions[i].value)
break break
} }
} }
@@ -179,7 +213,8 @@ Rectangle {
Rectangle { Rectangle {
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.1)
} }
Item { Item {
@@ -220,7 +255,8 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: SettingsData.notificationOverlayEnabled checked: SettingsData.notificationOverlayEnabled
onToggled: (toggled) => SettingsData.setNotificationOverlayEnabled(toggled) onToggled: toggled => SettingsData.setNotificationOverlayEnabled(
toggled)
} }
} }
} }

View File

@@ -31,7 +31,8 @@ PanelWindow {
exitAnim.restart() exitAnim.restart()
exitWatchdog.restart() exitWatchdog.restart()
if (NotificationService.removeFromVisibleNotifications) if (NotificationService.removeFromVisibleNotifications)
NotificationService.removeFromVisibleNotifications(win.notificationData) NotificationService.removeFromVisibleNotifications(
win.notificationData)
} }
function forceExit() { function forceExit() {
@@ -59,12 +60,13 @@ PanelWindow {
visible: hasValidData visible: hasValidData
WlrLayershell.layer: { WlrLayershell.layer: {
if (!notificationData) return WlrLayershell.Top if (!notificationData)
return WlrLayershell.Top
SettingsData.notificationOverlayEnabled SettingsData.notificationOverlayEnabled
const shouldUseOverlay = (SettingsData.notificationOverlayEnabled) || const shouldUseOverlay = (SettingsData.notificationOverlayEnabled)
(notificationData.urgency === NotificationUrgency.Critical) || (notificationData.urgency === NotificationUrgency.Critical)
return shouldUseOverlay ? WlrLayershell.Overlay : WlrLayershell.Top return shouldUseOverlay ? WlrLayershell.Overlay : WlrLayershell.Top
} }
@@ -136,13 +138,15 @@ PanelWindow {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Theme.popupBackground() color: Theme.popupBackground()
border.color: notificationData && notificationData.urgency border.color: notificationData && notificationData.urgency
=== NotificationUrgency.Critical ? Qt.rgba(Theme.primary.r, === NotificationUrgency.Critical ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.3) : Qt.rgba( 0.3) : Qt.rgba(
Theme.outline.r, Theme.outline.r,
Theme.outline.g, Theme.outline.g,
Theme.outline.b, 0.08) Theme.outline.b,
0.08)
border.width: notificationData border.width: notificationData
&& notificationData.urgency === NotificationUrgency.Critical ? 2 : 1 && notificationData.urgency === NotificationUrgency.Critical ? 2 : 1
clip: true clip: true
@@ -231,7 +235,8 @@ PanelWindow {
width: 55 width: 55
height: 55 height: 55
radius: 27.5 radius: 27.5
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) color: Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.1)
border.color: "transparent" border.color: "transparent"
border.width: 0 border.width: 0
anchors.left: parent.left anchors.left: parent.left
@@ -252,8 +257,9 @@ PanelWindow {
if (notificationData.appIcon) { if (notificationData.appIcon) {
const appIcon = notificationData.appIcon const appIcon = notificationData.appIcon
if (appIcon.startsWith("file://") || appIcon.startsWith( if (appIcon.startsWith("file://")
"http://") || appIcon.startsWith("https://")) || appIcon.startsWith("http://")
|| appIcon.startsWith("https://"))
return appIcon return appIcon
return Quickshell.iconPath(appIcon, "") return Quickshell.iconPath(appIcon, "")
@@ -266,7 +272,8 @@ PanelWindow {
StyledText { StyledText {
anchors.centerIn: parent anchors.centerIn: parent
visible: !parent.hasNotificationImage visible: !parent.hasNotificationImage
&& (!notificationData || !notificationData.appIcon && (!notificationData
|| !notificationData.appIcon
|| notificationData.appIcon === "") || notificationData.appIcon === "")
text: { text: {
const appName = notificationData const appName = notificationData
@@ -307,8 +314,10 @@ PanelWindow {
if (!notificationData) if (!notificationData)
return "" return ""
const appName = notificationData.appName || "" const appName = notificationData.appName
const timeStr = notificationData.timeStr || "" || ""
const timeStr = notificationData.timeStr
|| ""
if (timeStr.length > 0) if (timeStr.length > 0)
return appName + " • " + timeStr return appName + " • " + timeStr
else else
@@ -322,7 +331,8 @@ PanelWindow {
} }
StyledText { StyledText {
text: notificationData ? (notificationData.summary || "") : "" text: notificationData ? (notificationData.summary
|| "") : ""
color: Theme.surfaceText color: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium font.weight: Font.Medium
@@ -333,7 +343,8 @@ PanelWindow {
} }
StyledText { StyledText {
text: notificationData ? (notificationData.htmlBody || "") : "" text: notificationData ? (notificationData.htmlBody
|| "") : ""
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
width: parent.width width: parent.width
@@ -343,7 +354,8 @@ PanelWindow {
visible: text.length > 0 visible: text.length > 0
linkColor: Theme.primary linkColor: Theme.primary
onLinkActivated: link => { onLinkActivated: link => {
return Qt.openUrlExternally(link) return Qt.openUrlExternally(
link)
} }
MouseArea { MouseArea {
@@ -383,7 +395,8 @@ PanelWindow {
z: 20 z: 20
Repeater { Repeater {
model: notificationData ? (notificationData.actions || []) : [] model: notificationData ? (notificationData.actions
|| []) : []
Rectangle { Rectangle {
property bool isHovered: false property bool isHovered: false
@@ -391,8 +404,10 @@ PanelWindow {
width: Math.max(actionText.implicitWidth + 12, 50) width: Math.max(actionText.implicitWidth + 12, 50)
height: 24 height: 24
radius: 4 radius: 4
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, color: isHovered ? Qt.rgba(Theme.primary.r,
Theme.primary.b, 0.1) : "transparent" Theme.primary.g,
Theme.primary.b,
0.1) : "transparent"
StyledText { StyledText {
id: actionText id: actionText
@@ -459,7 +474,8 @@ PanelWindow {
onExited: clearButton.isHovered = false onExited: clearButton.isHovered = false
onClicked: { onClicked: {
if (notificationData && !win.exiting) if (notificationData && !win.exiting)
NotificationService.dismissNotification(notificationData) NotificationService.dismissNotification(
notificationData)
} }
} }
} }

View File

@@ -103,8 +103,8 @@ QtObject {
if (!_isValidWindow(p)) if (!_isValidWindow(p))
continue continue
if (p.notificationData && newWrappers.indexOf(p.notificationData) === -1 if (p.notificationData && newWrappers.indexOf(
&& !p.exiting) { p.notificationData) === -1 && !p.exiting) {
p.notificationData.removedByLimit = true p.notificationData.removedByLimit = true
p.notificationData.popup = false p.notificationData.popup = false
} }
@@ -151,7 +151,8 @@ QtObject {
function _active() { function _active() {
return popupWindows.filter(p => { return popupWindows.filter(p => {
return _isValidWindow(p) && p.notificationData return _isValidWindow(p)
&& p.notificationData
&& p.notificationData.popup && !p.exiting && p.notificationData.popup && !p.exiting
}) })
} }
@@ -173,14 +174,19 @@ QtObject {
return return
const expiredCandidates = activeWindows.filter(p => { const expiredCandidates = activeWindows.filter(p => {
if (!p.notificationData || !p.notificationData.notification) return false if (!p.notificationData
if (p.notificationData.notification.urgency === 2) return false || !p.notificationData.notification)
return false
if (p.notificationData.notification.urgency === 2)
return false
const timeoutMs = p.notificationData.timer ? p.notificationData.timer.interval : 5000 const timeoutMs = p.notificationData.timer ? p.notificationData.timer.interval : 5000
if (timeoutMs === 0) return false if (timeoutMs === 0)
return false
return !p.notificationData.timer.running return !p.notificationData.timer.running
}).sort((a, b) => b.screenY - a.screenY) }).sort(
(a, b) => b.screenY - a.screenY)
if (expiredCandidates.length > 0) { if (expiredCandidates.length > 0) {
const toRemove = expiredCandidates[0] const toRemove = expiredCandidates[0]
@@ -192,15 +198,19 @@ QtObject {
} }
const timeoutCandidates = activeWindows.filter(p => { const timeoutCandidates = activeWindows.filter(p => {
if (!p.notificationData || !p.notificationData.notification) return false if (!p.notificationData
if (p.notificationData.notification.urgency === 2) return false || !p.notificationData.notification)
return false
if (p.notificationData.notification.urgency === 2)
return false
const timeoutMs = p.notificationData.timer ? p.notificationData.timer.interval : 5000 const timeoutMs = p.notificationData.timer ? p.notificationData.timer.interval : 5000
return timeoutMs > 0 return timeoutMs > 0
}).sort((a, b) => { }).sort((a, b) => {
const aTimeout = a.notificationData.timer ? a.notificationData.timer.interval : 5000 const aTimeout = a.notificationData.timer ? a.notificationData.timer.interval : 5000
const bTimeout = b.notificationData.timer ? b.notificationData.timer.interval : 5000 const bTimeout = b.notificationData.timer ? b.notificationData.timer.interval : 5000
if (aTimeout !== bTimeout) return aTimeout - bTimeout if (aTimeout !== bTimeout)
return aTimeout - bTimeout
return b.screenY - a.screenY return b.screenY - a.screenY
}) })

View File

@@ -123,12 +123,14 @@ Column {
width: parent.width - 80 width: parent.width - 80
height: 6 height: 6
radius: 3 radius: 3
color: Qt.rgba(Theme.outline.r, Theme.outline.g, color: Qt.rgba(Theme.outline.r,
Theme.outline.g,
Theme.outline.b, 0.2) Theme.outline.b, 0.2)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Rectangle { Rectangle {
width: parent.width * Math.min(1, modelData / 100) width: parent.width * Math.min(
1, modelData / 100)
height: parent.height height: parent.height
radius: parent.radius radius: parent.radius
color: { color: {
@@ -151,7 +153,8 @@ Column {
} }
StyledText { StyledText {
text: modelData ? modelData.toFixed(0) + "%" : "0%" text: modelData ? modelData.toFixed(
0) + "%" : "0%"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium font.weight: Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
@@ -215,7 +218,8 @@ Column {
width: parent.width width: parent.width
height: 16 height: 16
radius: 8 radius: 8
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
Rectangle { Rectangle {
width: DgopService.totalMemoryKB width: DgopService.totalMemoryKB
@@ -296,7 +300,8 @@ Column {
width: parent.width width: parent.width
height: 16 height: 16
radius: 8 radius: 8
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
Rectangle { Rectangle {
width: DgopService.totalSwapKB width: DgopService.totalSwapKB
@@ -306,7 +311,8 @@ Column {
radius: parent.radius radius: parent.radius
color: { color: {
if (!DgopService.totalSwapKB) if (!DgopService.totalSwapKB)
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, return Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.3) Theme.surfaceText.b, 0.3)
const usage = DgopService.usedSwapKB / DgopService.totalSwapKB const usage = DgopService.usedSwapKB / DgopService.totalSwapKB
@@ -329,8 +335,7 @@ Column {
StyledText { StyledText {
text: DgopService.totalSwapKB text: DgopService.totalSwapKB
> 0 ? ((DgopService.usedSwapKB > 0 ? ((DgopService.usedSwapKB / DgopService.totalSwapKB) * 100).toFixed(
/ DgopService.totalSwapKB) * 100).toFixed(
1) + "% used" : "Not available" 1) + "% used" : "Not available"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Bold font.weight: Font.Bold

View File

@@ -102,7 +102,8 @@ Popup {
onClicked: { onClicked: {
if (processContextMenu.processData) if (processContextMenu.processData)
Quickshell.execDetached( Quickshell.execDetached(
["wl-copy", processContextMenu.processData.pid.toString()]) ["wl-copy", processContextMenu.processData.pid.toString(
)])
processContextMenu.close() processContextMenu.close()
} }
@@ -113,7 +114,8 @@ Popup {
width: parent.width width: parent.width
height: 28 height: 28
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: copyNameArea.containsMouse ? Qt.rgba(Theme.primary.r, color: copyNameArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g, Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.12) : "transparent" 0.12) : "transparent"
@@ -155,7 +157,8 @@ Popup {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
} }
} }
@@ -163,7 +166,8 @@ Popup {
width: parent.width width: parent.width
height: 28 height: 28
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: killArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, color: killArea.containsMouse ? Qt.rgba(Theme.error.r,
Theme.error.g,
Theme.error.b, Theme.error.b,
0.12) : "transparent" 0.12) : "transparent"
enabled: processContextMenu.processData enabled: processContextMenu.processData
@@ -176,7 +180,8 @@ Popup {
text: "Kill Process" text: "Kill Process"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: parent.enabled ? (killArea.containsMouse ? Theme.error : Theme.surfaceText) : Qt.rgba( color: parent.enabled ? (killArea.containsMouse ? Theme.error : Theme.surfaceText) : Qt.rgba(
Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.5) Theme.surfaceText.b, 0.5)
font.weight: Font.Normal font.weight: Font.Normal
} }
@@ -191,7 +196,8 @@ Popup {
onClicked: { onClicked: {
if (processContextMenu.processData) if (processContextMenu.processData)
Quickshell.execDetached( Quickshell.execDetached(
["kill", processContextMenu.processData.pid.toString()]) ["kill", processContextMenu.processData.pid.toString(
)])
processContextMenu.close() processContextMenu.close()
} }
@@ -202,7 +208,8 @@ Popup {
width: parent.width width: parent.width
height: 28 height: 28
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: forceKillArea.containsMouse ? Qt.rgba(Theme.error.r, color: forceKillArea.containsMouse ? Qt.rgba(
Theme.error.r,
Theme.error.g, Theme.error.g,
Theme.error.b, Theme.error.b,
0.12) : "transparent" 0.12) : "transparent"
@@ -217,7 +224,8 @@ Popup {
text: "Force Kill Process" text: "Force Kill Process"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: parent.enabled ? (forceKillArea.containsMouse ? Theme.error : Theme.surfaceText) : Qt.rgba( color: parent.enabled ? (forceKillArea.containsMouse ? Theme.error : Theme.surfaceText) : Qt.rgba(
Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.5) Theme.surfaceText.b, 0.5)
font.weight: Font.Normal font.weight: Font.Normal
} }

View File

@@ -33,8 +33,8 @@ Rectangle {
if (mouse.button === Qt.RightButton) { if (mouse.button === Qt.RightButton) {
if (process && process.pid > 0 && contextMenu) { if (process && process.pid > 0 && contextMenu) {
contextMenu.processData = process contextMenu.processData = process
let globalPos = processMouseArea.mapToGlobal(mouse.x, let globalPos = processMouseArea.mapToGlobal(
mouse.y) mouse.x, mouse.y)
let localPos = contextMenu.parent ? contextMenu.parent.mapFromGlobal( let localPos = contextMenu.parent ? contextMenu.parent.mapFromGlobal(
globalPos.x, globalPos.x,
globalPos.y) : globalPos globalPos.y) : globalPos
@@ -96,7 +96,8 @@ Rectangle {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
if (process && process.cpu > 80) if (process && process.cpu > 80)
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) return Qt.rgba(Theme.error.r, Theme.error.g,
Theme.error.b, 0.12)
if (process && process.cpu > 50) if (process && process.cpu > 50)
return Qt.rgba(Theme.warning.r, Theme.warning.g, return Qt.rgba(Theme.warning.r, Theme.warning.g,
@@ -135,7 +136,8 @@ Rectangle {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
if (process && process.memoryKB > 1024 * 1024) if (process && process.memoryKB > 1024 * 1024)
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) return Qt.rgba(Theme.error.r, Theme.error.g,
Theme.error.b, 0.12)
if (process && process.memoryKB > 512 * 1024) if (process && process.memoryKB > 512 * 1024)
return Qt.rgba(Theme.warning.r, Theme.warning.g, return Qt.rgba(Theme.warning.r, Theme.warning.g,

View File

@@ -96,7 +96,8 @@ DankPopout {
Layout.fillWidth: true Layout.fillWidth: true
height: systemOverview.height + Theme.spacingM * 2 height: systemOverview.height + Theme.spacingM * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.2) Theme.surfaceVariant.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.08) Theme.outline.b, 0.08)
@@ -114,7 +115,8 @@ DankPopout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.1) Theme.surfaceVariant.b, 0.1)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.05) Theme.outline.b, 0.05)

View File

@@ -28,9 +28,11 @@ Column {
height: 20 height: 20
color: { color: {
if (DgopService.currentSort === "name") { if (DgopService.currentSort === "name") {
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.12)
} }
return processHeaderArea.containsMouse ? Qt.rgba(Theme.surfaceText.r, return processHeaderArea.containsMouse ? Qt.rgba(
Theme.surfaceText.r,
Theme.surfaceText.g, Theme.surfaceText.g,
Theme.surfaceText.b, Theme.surfaceText.b,
0.08) : "transparent" 0.08) : "transparent"
@@ -73,9 +75,11 @@ Column {
height: 20 height: 20
color: { color: {
if (DgopService.currentSort === "cpu") { if (DgopService.currentSort === "cpu") {
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.12)
} }
return cpuHeaderArea.containsMouse ? Qt.rgba(Theme.surfaceText.r, return cpuHeaderArea.containsMouse ? Qt.rgba(
Theme.surfaceText.r,
Theme.surfaceText.g, Theme.surfaceText.g,
Theme.surfaceText.b, Theme.surfaceText.b,
0.08) : "transparent" 0.08) : "transparent"
@@ -118,9 +122,11 @@ Column {
height: 20 height: 20
color: { color: {
if (DgopService.currentSort === "memory") { if (DgopService.currentSort === "memory") {
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.12)
} }
return memoryHeaderArea.containsMouse ? Qt.rgba(Theme.surfaceText.r, return memoryHeaderArea.containsMouse ? Qt.rgba(
Theme.surfaceText.r,
Theme.surfaceText.g, Theme.surfaceText.g,
Theme.surfaceText.b, Theme.surfaceText.b,
0.08) : "transparent" 0.08) : "transparent"
@@ -163,9 +169,11 @@ Column {
height: 20 height: 20
color: { color: {
if (DgopService.currentSort === "pid") { if (DgopService.currentSort === "pid") {
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.12)
} }
return pidHeaderArea.containsMouse ? Qt.rgba(Theme.surfaceText.r, return pidHeaderArea.containsMouse ? Qt.rgba(
Theme.surfaceText.r,
Theme.surfaceText.g, Theme.surfaceText.g,
Theme.surfaceText.b, Theme.surfaceText.b,
0.08) : "transparent" 0.08) : "transparent"
@@ -230,6 +238,7 @@ Column {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
// ! TODO - we lost this with dgop // ! TODO - we lost this with dgop
} }
} }

View File

@@ -8,10 +8,10 @@ Row {
width: parent.width width: parent.width
spacing: Theme.spacingM spacing: Theme.spacingM
Component.onCompleted: { Component.onCompleted: {
DgopService.addRef(["cpu", "memory", "system"]); DgopService.addRef(["cpu", "memory", "system"])
} }
Component.onDestruction: { Component.onDestruction: {
DgopService.removeRef(["cpu", "memory", "system"]); DgopService.removeRef(["cpu", "memory", "system"])
} }
Rectangle { Rectangle {
@@ -20,13 +20,22 @@ Row {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
if (DgopService.sortBy === "cpu") if (DgopService.sortBy === "cpu")
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16); return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.16)
else if (cpuCardMouseArea.containsMouse) else if (cpuCardMouseArea.containsMouse)
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12); return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.12)
else else
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08); return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.08)
} }
border.color: DgopService.sortBy === "cpu" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2) border.color: DgopService.sortBy === "cpu" ? Qt.rgba(Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.4) : Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b, 0.2)
border.width: DgopService.sortBy === "cpu" ? 2 : 1 border.width: DgopService.sortBy === "cpu" ? 2 : 1
MouseArea { MouseArea {
@@ -57,7 +66,8 @@ Row {
StyledText { StyledText {
text: { text: {
if (DgopService.cpuUsage === undefined || DgopService.cpuUsage === null) if (DgopService.cpuUsage === undefined
|| DgopService.cpuUsage === null)
return "--%" return "--%"
return DgopService.cpuUsage.toFixed(1) + "%" return DgopService.cpuUsage.toFixed(1) + "%"
} }
@@ -71,32 +81,34 @@ Row {
Rectangle { Rectangle {
width: 1 width: 1
height: 20 height: 20
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
Theme.surfaceText.b, 0.3)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
StyledText { StyledText {
text: { text: {
if (DgopService.cpuTemperature === undefined || DgopService.cpuTemperature === null || DgopService.cpuTemperature <= 0) if (DgopService.cpuTemperature === undefined
return "--°"; || DgopService.cpuTemperature === null
|| DgopService.cpuTemperature <= 0)
return "--°"
return Math.round(DgopService.cpuTemperature) + "°"; return Math.round(DgopService.cpuTemperature) + "°"
} }
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Medium font.weight: Font.Medium
color: { color: {
if (DgopService.cpuTemperature > 80) if (DgopService.cpuTemperature > 80)
return Theme.error; return Theme.error
if (DgopService.cpuTemperature > 60) if (DgopService.cpuTemperature > 60)
return Theme.warning; return Theme.warning
return Theme.surfaceText; return Theme.surfaceText
} }
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
StyledText { StyledText {
@@ -106,23 +118,19 @@ Row {
color: Theme.surfaceText color: Theme.surfaceText
opacity: 0.7 opacity: 0.7
} }
} }
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration
} }
} }
Behavior on border.color { Behavior on border.color {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration
} }
} }
} }
Rectangle { Rectangle {
@@ -131,13 +139,24 @@ Row {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
if (DgopService.sortBy === "memory") if (DgopService.sortBy === "memory")
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.16); return Qt.rgba(Theme.primary.r, Theme.primary.g,
Theme.primary.b, 0.16)
else if (memoryCardMouseArea.containsMouse) else if (memoryCardMouseArea.containsMouse)
return Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.12); return Qt.rgba(Theme.secondary.r, Theme.secondary.g,
Theme.secondary.b, 0.12)
else else
return Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.08); return Qt.rgba(Theme.secondary.r, Theme.secondary.g,
Theme.secondary.b, 0.08)
} }
border.color: DgopService.sortBy === "memory" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.secondary.r, Theme.secondary.g, Theme.secondary.b, 0.2) border.color: DgopService.sortBy === "memory" ? Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.4) : Qt.rgba(
Theme.secondary.r,
Theme.secondary.g,
Theme.secondary.b,
0.2)
border.width: DgopService.sortBy === "memory" ? 2 : 1 border.width: DgopService.sortBy === "memory" ? 2 : 1
MouseArea { MouseArea {
@@ -167,7 +186,8 @@ Row {
spacing: Theme.spacingS spacing: Theme.spacingS
StyledText { StyledText {
text: DgopService.formatSystemMemory(DgopService.usedMemoryKB) text: DgopService.formatSystemMemory(
DgopService.usedMemoryKB)
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
@@ -178,13 +198,15 @@ Row {
Rectangle { Rectangle {
width: 1 width: 1
height: 20 height: 20
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g,
Theme.surfaceText.b, 0.3)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: DgopService.totalSwapKB > 0 visible: DgopService.totalSwapKB > 0
} }
StyledText { StyledText {
text: DgopService.totalSwapKB > 0 ? DgopService.formatSystemMemory(DgopService.usedSwapKB) : "" text: DgopService.totalSwapKB > 0 ? DgopService.formatSystemMemory(
DgopService.usedSwapKB) : ""
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Medium font.weight: Font.Medium
@@ -192,38 +214,35 @@ Row {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: DgopService.totalSwapKB > 0 visible: DgopService.totalSwapKB > 0
} }
} }
StyledText { StyledText {
text: { text: {
if (DgopService.totalSwapKB > 0) if (DgopService.totalSwapKB > 0)
return "of " + DgopService.formatSystemMemory(DgopService.totalMemoryKB) + " + swap"; return "of " + DgopService.formatSystemMemory(
DgopService.totalMemoryKB) + " + swap"
return "of " + DgopService.formatSystemMemory(DgopService.totalMemoryKB); return "of " + DgopService.formatSystemMemory(
DgopService.totalMemoryKB)
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
color: Theme.surfaceText color: Theme.surfaceText
opacity: 0.7 opacity: 0.7
} }
} }
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration
} }
} }
Behavior on border.color { Behavior on border.color {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration
} }
} }
} }
Rectangle { Rectangle {
@@ -231,48 +250,74 @@ Row {
height: 80 height: 80
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) { if (!DgopService.availableGpus
if (gpuCardMouseArea.containsMouse && DgopService.availableGpus.length > 1) || DgopService.availableGpus.length === 0) {
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.16); if (gpuCardMouseArea.containsMouse
&& DgopService.availableGpus.length > 1)
return Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.16)
else else
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08); return Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.08)
} }
var gpu = DgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)]; var gpu = DgopService.availableGpus[Math.min(
var vendor = gpu.vendor.toLowerCase(); SessionData.selectedGpuIndex,
DgopService.availableGpus.length - 1)]
var vendor = gpu.vendor.toLowerCase()
if (vendor.includes("nvidia")) { if (vendor.includes("nvidia")) {
if (gpuCardMouseArea.containsMouse && DgopService.availableGpus.length > 1) if (gpuCardMouseArea.containsMouse
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.2); && DgopService.availableGpus.length > 1)
return Qt.rgba(Theme.success.r, Theme.success.g,
Theme.success.b, 0.2)
else else
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.12); return Qt.rgba(Theme.success.r, Theme.success.g,
Theme.success.b, 0.12)
} else if (vendor.includes("amd")) { } else if (vendor.includes("amd")) {
if (gpuCardMouseArea.containsMouse && DgopService.availableGpus.length > 1) if (gpuCardMouseArea.containsMouse
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.2); && DgopService.availableGpus.length > 1)
return Qt.rgba(Theme.error.r, Theme.error.g,
Theme.error.b, 0.2)
else else
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12); return Qt.rgba(Theme.error.r, Theme.error.g,
Theme.error.b, 0.12)
} else if (vendor.includes("intel")) { } else if (vendor.includes("intel")) {
if (gpuCardMouseArea.containsMouse && DgopService.availableGpus.length > 1) if (gpuCardMouseArea.containsMouse
return Qt.rgba(Theme.info.r, Theme.info.g, Theme.info.b, 0.2); && DgopService.availableGpus.length > 1)
return Qt.rgba(Theme.info.r, Theme.info.g,
Theme.info.b, 0.2)
else else
return Qt.rgba(Theme.info.r, Theme.info.g, Theme.info.b, 0.12); return Qt.rgba(Theme.info.r, Theme.info.g,
Theme.info.b, 0.12)
} }
if (gpuCardMouseArea.containsMouse && DgopService.availableGpus.length > 1) if (gpuCardMouseArea.containsMouse
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.16); && DgopService.availableGpus.length > 1)
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.16)
else else
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08); return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.08)
} }
border.color: { border.color: {
if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) if (!DgopService.availableGpus
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.2); || DgopService.availableGpus.length === 0)
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.2)
var gpu = DgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)]; var gpu = DgopService.availableGpus[Math.min(
var vendor = gpu.vendor.toLowerCase(); SessionData.selectedGpuIndex,
DgopService.availableGpus.length - 1)]
var vendor = gpu.vendor.toLowerCase()
if (vendor.includes("nvidia")) if (vendor.includes("nvidia"))
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.3); return Qt.rgba(Theme.success.r, Theme.success.g,
Theme.success.b, 0.3)
else if (vendor.includes("amd")) else if (vendor.includes("amd"))
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.3); return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.3)
else if (vendor.includes("intel")) else if (vendor.includes("intel"))
return Qt.rgba(Theme.info.r, Theme.info.g, Theme.info.b, 0.3); return Qt.rgba(Theme.info.r, Theme.info.g, Theme.info.b, 0.3)
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.2); return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.2)
} }
border.width: 1 border.width: 1
@@ -282,15 +327,17 @@ Row {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: DgopService.availableGpus.length > 1 ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: DgopService.availableGpus.length
onClicked: (mouse) => { > 1 ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: mouse => {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
if (DgopService.availableGpus.length > 1) { if (DgopService.availableGpus.length > 1) {
var nextIndex = (SessionData.selectedGpuIndex + 1) % DgopService.availableGpus.length; var nextIndex = (SessionData.selectedGpuIndex + 1)
SessionData.setSelectedGpuIndex(nextIndex); % DgopService.availableGpus.length
SessionData.setSelectedGpuIndex(nextIndex)
} }
} else if (mouse.button === Qt.RightButton) { } else if (mouse.button === Qt.RightButton) {
gpuContextMenu.popup(); gpuContextMenu.popup()
} }
} }
} }
@@ -311,52 +358,69 @@ Row {
StyledText { StyledText {
text: { text: {
if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) if (!DgopService.availableGpus
return "No GPU"; || DgopService.availableGpus.length === 0)
return "No GPU"
var gpu = DgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)]; var gpu = DgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex,
DgopService.availableGpus.length - 1)]
// Check if temperature monitoring is enabled for this GPU // Check if temperature monitoring is enabled for this GPU
var tempEnabled = SessionData.enabledGpuPciIds && SessionData.enabledGpuPciIds.indexOf(gpu.pciId) !== -1; var tempEnabled = SessionData.enabledGpuPciIds
var temp = gpu.temperature; && SessionData.enabledGpuPciIds.indexOf(
var hasTemp = tempEnabled && temp !== undefined && temp !== null && temp !== 0; gpu.pciId) !== -1
var temp = gpu.temperature
var hasTemp = tempEnabled && temp !== undefined
&& temp !== null && temp !== 0
if (hasTemp) if (hasTemp)
return Math.round(temp) + "°"; return Math.round(temp) + "°"
else else
return gpu.vendor; return gpu.vendor
} }
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: { color: {
if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) if (!DgopService.availableGpus
return Theme.surfaceText; || DgopService.availableGpus.length === 0)
return Theme.surfaceText
var gpu = DgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)]; var gpu = DgopService.availableGpus[Math.min(
var tempEnabled = SessionData.enabledGpuPciIds && SessionData.enabledGpuPciIds.indexOf(gpu.pciId) !== -1; SessionData.selectedGpuIndex,
var temp = gpu.temperature || 0; DgopService.availableGpus.length - 1)]
var tempEnabled = SessionData.enabledGpuPciIds
&& SessionData.enabledGpuPciIds.indexOf(
gpu.pciId) !== -1
var temp = gpu.temperature || 0
if (tempEnabled && temp > 80) if (tempEnabled && temp > 80)
return Theme.error; return Theme.error
if (tempEnabled && temp > 60) if (tempEnabled && temp > 60)
return Theme.warning; return Theme.warning
return Theme.surfaceText; return Theme.surfaceText
} }
} }
StyledText { StyledText {
text: { text: {
if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) if (!DgopService.availableGpus
return "No GPUs detected"; || DgopService.availableGpus.length === 0)
return "No GPUs detected"
var gpu = DgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)]; var gpu = DgopService.availableGpus[Math.min(
var tempEnabled = SessionData.enabledGpuPciIds && SessionData.enabledGpuPciIds.indexOf(gpu.pciId) !== -1; SessionData.selectedGpuIndex,
var temp = gpu.temperature; DgopService.availableGpus.length - 1)]
var hasTemp = tempEnabled && temp !== undefined && temp !== null && temp !== 0; var tempEnabled = SessionData.enabledGpuPciIds
&& SessionData.enabledGpuPciIds.indexOf(
gpu.pciId) !== -1
var temp = gpu.temperature
var hasTemp = tempEnabled && temp !== undefined
&& temp !== null && temp !== 0
if (hasTemp) if (hasTemp)
return gpu.vendor + " " + gpu.displayName; return gpu.vendor + " " + gpu.displayName
else else
return gpu.displayName; return gpu.displayName
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
@@ -366,7 +430,6 @@ Row {
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 1 maximumLineCount: 1
} }
} }
Menu { Menu {
@@ -376,24 +439,34 @@ Row {
text: "Enable GPU Temperature" text: "Enable GPU Temperature"
checkable: true checkable: true
checked: { checked: {
if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) { if (!DgopService.availableGpus
|| DgopService.availableGpus.length === 0) {
return false return false
} }
var gpu = DgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)] var gpu = DgopService.availableGpus[Math.min(
if (!gpu.pciId) return false SessionData.selectedGpuIndex,
DgopService.availableGpus.length - 1)]
if (!gpu.pciId)
return false
return SessionData.enabledGpuPciIds ? SessionData.enabledGpuPciIds.indexOf(gpu.pciId) !== -1 : false return SessionData.enabledGpuPciIds ? SessionData.enabledGpuPciIds.indexOf(
gpu.pciId) !== -1 : false
} }
onTriggered: { onTriggered: {
if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) { if (!DgopService.availableGpus
|| DgopService.availableGpus.length === 0) {
return return
} }
var gpu = DgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)] var gpu = DgopService.availableGpus[Math.min(
if (!gpu.pciId) return SessionData.selectedGpuIndex,
DgopService.availableGpus.length - 1)]
if (!gpu.pciId)
return
var enabledIds = SessionData.enabledGpuPciIds ? SessionData.enabledGpuPciIds.slice() : [] var enabledIds = SessionData.enabledGpuPciIds ? SessionData.enabledGpuPciIds.slice(
) : []
var index = enabledIds.indexOf(gpu.pciId) var index = enabledIds.indexOf(gpu.pciId)
if (checked && index === -1) { if (checked && index === -1) {
@@ -413,9 +486,6 @@ Row {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration
} }
} }
} }
} }

View File

@@ -65,16 +65,19 @@ ScrollView {
+ " • " + DgopService.kernelVersion + " • " + DgopService.kernelVersion
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
StyledText { StyledText {
text: "Up " + UserInfoService.uptime + " • Boot: " + DgopService.bootTime text: "Up " + UserInfoService.uptime + " • Boot: "
+ DgopService.bootTime
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.6) Theme.surfaceText.b, 0.6)
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@@ -85,7 +88,8 @@ ScrollView {
+ DgopService.threadCount + " threads" + DgopService.threadCount + " threads"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.6) Theme.surfaceText.b, 0.6)
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@@ -95,7 +99,8 @@ ScrollView {
Rectangle { Rectangle {
width: parent.width width: parent.width
height: 1 height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
} }
Row { Row {
@@ -160,7 +165,8 @@ ScrollView {
text: DgopService.motherboard text: DgopService.motherboard
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.8) Theme.surfaceText.b, 0.8)
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -173,7 +179,8 @@ ScrollView {
text: "BIOS " + DgopService.biosVersion text: "BIOS " + DgopService.biosVersion
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -185,7 +192,8 @@ ScrollView {
DgopService.totalMemoryKB) + " RAM" DgopService.totalMemoryKB) + " RAM"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.8) Theme.surfaceText.b, 0.8)
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -199,19 +207,28 @@ ScrollView {
height: gpuColumn.implicitHeight + Theme.spacingL height: gpuColumn.implicitHeight + Theme.spacingL
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
var baseColor = Qt.rgba(Theme.surfaceContainerHigh.r, var baseColor = Qt.rgba(
Theme.surfaceContainerHigh.r,
Theme.surfaceContainerHigh.g, Theme.surfaceContainerHigh.g,
Theme.surfaceContainerHigh.b, 0.4) Theme.surfaceContainerHigh.b, 0.4)
var hoverColor = Qt.rgba(Theme.surfaceContainerHigh.r, var hoverColor = Qt.rgba(
Theme.surfaceContainerHigh.r,
Theme.surfaceContainerHigh.g, Theme.surfaceContainerHigh.g,
Theme.surfaceContainerHigh.b, 0.6) Theme.surfaceContainerHigh.b, 0.6)
if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) { if (!DgopService.availableGpus
return gpuCardMouseArea.containsMouse && DgopService.availableGpus.length > 1 ? hoverColor : baseColor || DgopService.availableGpus.length === 0) {
return gpuCardMouseArea.containsMouse
&& DgopService.availableGpus.length
> 1 ? hoverColor : baseColor
} }
var gpu = DgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)] var gpu = DgopService.availableGpus[Math.min(
var vendor = gpu.fullName.split(' ')[0].toLowerCase() SessionData.selectedGpuIndex,
DgopService.availableGpus.length
- 1)]
var vendor = gpu.fullName.split(
' ')[0].toLowerCase()
var tintColor var tintColor
if (vendor.includes("nvidia")) { if (vendor.includes("nvidia")) {
@@ -221,37 +238,56 @@ ScrollView {
} else if (vendor.includes("intel")) { } else if (vendor.includes("intel")) {
tintColor = Theme.info tintColor = Theme.info
} else { } else {
return gpuCardMouseArea.containsMouse && DgopService.availableGpus.length > 1 ? hoverColor : baseColor return gpuCardMouseArea.containsMouse
&& DgopService.availableGpus.length
> 1 ? hoverColor : baseColor
} }
if (gpuCardMouseArea.containsMouse && DgopService.availableGpus.length > 1) { if (gpuCardMouseArea.containsMouse
return Qt.rgba((hoverColor.r + tintColor.r * 0.1) / 1.1, && DgopService.availableGpus.length > 1) {
return Qt.rgba(
(hoverColor.r + tintColor.r * 0.1) / 1.1,
(hoverColor.g + tintColor.g * 0.1) / 1.1, (hoverColor.g + tintColor.g * 0.1) / 1.1,
(hoverColor.b + tintColor.b * 0.1) / 1.1, 0.6) (hoverColor.b + tintColor.b * 0.1) / 1.1,
0.6)
} else { } else {
return Qt.rgba((baseColor.r + tintColor.r * 0.08) / 1.08, return Qt.rgba(
(baseColor.r + tintColor.r * 0.08) / 1.08,
(baseColor.g + tintColor.g * 0.08) / 1.08, (baseColor.g + tintColor.g * 0.08) / 1.08,
(baseColor.b + tintColor.b * 0.08) / 1.08, 0.4) (baseColor.b + tintColor.b * 0.08) / 1.08,
0.4)
} }
} }
border.width: 1 border.width: 1
border.color: { border.color: {
if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) { if (!DgopService.availableGpus
return Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1) || DgopService.availableGpus.length === 0) {
return Qt.rgba(Theme.outline.r,
Theme.outline.g,
Theme.outline.b, 0.1)
} }
var gpu = DgopService.availableGpus[Math.min(SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)] var gpu = DgopService.availableGpus[Math.min(
var vendor = gpu.fullName.split(' ')[0].toLowerCase() SessionData.selectedGpuIndex,
DgopService.availableGpus.length
- 1)]
var vendor = gpu.fullName.split(
' ')[0].toLowerCase()
if (vendor.includes("nvidia")) { if (vendor.includes("nvidia")) {
return Qt.rgba(Theme.success.r, Theme.success.g, Theme.success.b, 0.3) return Qt.rgba(Theme.success.r,
Theme.success.g,
Theme.success.b, 0.3)
} else if (vendor.includes("amd")) { } else if (vendor.includes("amd")) {
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.3) return Qt.rgba(Theme.error.r, Theme.error.g,
Theme.error.b, 0.3)
} else if (vendor.includes("intel")) { } else if (vendor.includes("intel")) {
return Qt.rgba(Theme.info.r, Theme.info.g, Theme.info.b, 0.3) return Qt.rgba(Theme.info.r, Theme.info.g,
Theme.info.b, 0.3)
} }
return Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1) return Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.1)
} }
MouseArea { MouseArea {
@@ -306,9 +342,7 @@ ScrollView {
return "No GPUs detected" return "No GPUs detected"
} }
var gpu = DgopService.availableGpus[Math.min( var gpu = DgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex, SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)]
DgopService.availableGpus.length
- 1)]
return gpu.fullName return gpu.fullName
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
@@ -328,14 +362,13 @@ ScrollView {
return "Device: N/A" return "Device: N/A"
} }
var gpu = DgopService.availableGpus[Math.min( var gpu = DgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex, SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)]
DgopService.availableGpus.length
- 1)]
return "Device: " + gpu.pciId return "Device: " + gpu.pciId
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.8) Theme.surfaceText.b, 0.8)
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -350,14 +383,13 @@ ScrollView {
return "Driver: N/A" return "Driver: N/A"
} }
var gpu = DgopService.availableGpus[Math.min( var gpu = DgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex, SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)]
DgopService.availableGpus.length
- 1)]
return "Driver: " + gpu.driver return "Driver: " + gpu.driver
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, color: Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.8) Theme.surfaceText.b, 0.8)
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -371,11 +403,10 @@ ScrollView {
return "Temp: --°" return "Temp: --°"
} }
var gpu = DgopService.availableGpus[Math.min( var gpu = DgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex, SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)]
DgopService.availableGpus.length
- 1)]
var temp = gpu.temperature var temp = gpu.temperature
return "Temp: " + ((temp === undefined || temp === null return "Temp: " + ((temp === undefined
|| temp === null
|| temp === 0) ? "--°" : Math.round( || temp === 0) ? "--°" : Math.round(
temp) + "°C") temp) + "°C")
} }
@@ -384,19 +415,19 @@ ScrollView {
color: { color: {
if (!DgopService.availableGpus if (!DgopService.availableGpus
|| DgopService.availableGpus.length === 0) { || DgopService.availableGpus.length === 0) {
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, return Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
} }
var gpu = DgopService.availableGpus[Math.min( var gpu = DgopService.availableGpus[Math.min(
SessionData.selectedGpuIndex, SessionData.selectedGpuIndex, DgopService.availableGpus.length - 1)]
DgopService.availableGpus.length
- 1)]
var temp = gpu.temperature || 0 var temp = gpu.temperature || 0
if (temp > 80) if (temp > 80)
return Theme.error return Theme.error
if (temp > 60) if (temp > 60)
return Theme.warning return Theme.warning
return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, return Qt.rgba(Theme.surfaceText.r,
Theme.surfaceText.g,
Theme.surfaceText.b, 0.7) Theme.surfaceText.b, 0.7)
} }
width: parent.width width: parent.width
@@ -538,7 +569,8 @@ ScrollView {
width: parent.width width: parent.width
height: 24 height: 24
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: diskMouseArea.containsMouse ? Qt.rgba(Theme.surfaceText.r, color: diskMouseArea.containsMouse ? Qt.rgba(
Theme.surfaceText.r,
Theme.surfaceText.g, Theme.surfaceText.g,
Theme.surfaceText.b, Theme.surfaceText.b,
0.04) : "transparent" 0.04) : "transparent"
@@ -614,7 +646,8 @@ ScrollView {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: SettingsData.monoFontFamily font.family: SettingsData.monoFontFamily
color: { color: {
const percent = parseInt(modelData.percent) const percent = parseInt(
modelData.percent)
if (percent > 90) if (percent > 90)
return Theme.error return Theme.error

View File

@@ -24,8 +24,10 @@ Item {
width: parent.width width: parent.width
height: asciiSection.implicitHeight + Theme.spacingL * 2 height: asciiSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -63,7 +65,7 @@ Item {
text: "A desktop shell built with <a href=\"https://quickshell.org\">Quickshell</a>" text: "A desktop shell built with <a href=\"https://quickshell.org\">Quickshell</a>"
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
linkColor: Theme.primary linkColor: Theme.primary
onLinkActivated: (url) => Qt.openUrlExternally(url) onLinkActivated: url => Qt.openUrlExternally(url)
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
width: parent.width width: parent.width
@@ -76,9 +78,7 @@ Item {
propagateComposedEvents: true propagateComposedEvents: true
} }
} }
} }
} }
// Project Information // Project Information
@@ -86,8 +86,10 @@ Item {
width: parent.width width: parent.width
height: projectSection.implicitHeight + Theme.spacingL * 2 height: projectSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -115,16 +117,15 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
StyledText { StyledText {
text: `DankMaterialShell is a modern desktop inspired by <a href="https://m3.material.io/">MUI 3</a>. text: `DankMaterialShell is a modern desktop inspired by <a href="https://m3.material.io/">MUI 3</a>.
<br /><br/>The goal is to provide a high level of functionality and customization so that it can be a suitable replacement for complete desktop environments like Gnome, KDE, or Cosmic. <br /><br/>The goal is to provide a high level of functionality and customization so that it can be a suitable replacement for complete desktop environments like Gnome, KDE, or Cosmic.
` `
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
linkColor: Theme.primary linkColor: Theme.primary
onLinkActivated: (url) => Qt.openUrlExternally(url) onLinkActivated: url => Qt.openUrlExternally(url)
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
@@ -137,7 +138,6 @@ Item {
} }
} }
} }
} }
// Technical Details // Technical Details
@@ -145,8 +145,10 @@ Item {
width: parent.width width: parent.width
height: techSection.implicitHeight + Theme.spacingL * 2 height: techSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -174,7 +176,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Grid { Grid {
@@ -234,7 +235,7 @@ Item {
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
linkColor: Theme.primary linkColor: Theme.primary
onLinkActivated: (url) => Qt.openUrlExternally(url) onLinkActivated: url => Qt.openUrlExternally(url)
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@@ -256,7 +257,7 @@ Item {
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
linkColor: Theme.primary linkColor: Theme.primary
onLinkActivated: (url) => Qt.openUrlExternally(url) onLinkActivated: url => Qt.openUrlExternally(url)
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@@ -265,15 +266,9 @@ Item {
propagateComposedEvents: true propagateComposedEvents: true
} }
} }
} }
} }
} }
} }
} }
} }

View File

@@ -19,7 +19,6 @@ Item {
width: parent.width width: parent.width
spacing: Theme.spacingXL spacing: Theme.spacingXL
// Enable Dock // Enable Dock
StyledRect { StyledRect {
width: parent.width width: parent.width
@@ -50,7 +49,8 @@ Item {
} }
Column { Column {
width: parent.width - Theme.iconSize - Theme.spacingM - enableToggle.width - Theme.spacingM width: parent.width - Theme.iconSize - Theme.spacingM
- enableToggle.width - Theme.spacingM
spacing: Theme.spacingXS spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -68,7 +68,6 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
DankToggle { DankToggle {
@@ -80,11 +79,8 @@ Item {
SettingsData.setShowDock(checked) SettingsData.setShowDock(checked)
} }
} }
} }
} }
} }
// Auto-hide Dock // Auto-hide Dock
@@ -119,7 +115,8 @@ Item {
} }
Column { Column {
width: parent.width - Theme.iconSize - Theme.spacingM - autoHideToggle.width - Theme.spacingM width: parent.width - Theme.iconSize - Theme.spacingM
- autoHideToggle.width - Theme.spacingM
spacing: Theme.spacingXS spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -137,7 +134,6 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
DankToggle { DankToggle {
@@ -149,9 +145,7 @@ Item {
SettingsData.setDockAutoHide(checked) SettingsData.setDockAutoHide(checked)
} }
} }
} }
} }
Behavior on opacity { Behavior on opacity {
@@ -160,7 +154,6 @@ Item {
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
} }
// Dock Transparency Section // Dock Transparency Section
@@ -225,8 +218,6 @@ Item {
} }
} }
} }
} }
} }
} }

View File

@@ -17,56 +17,75 @@ Item {
property bool fontsEnumerated: false property bool fontsEnumerated: false
function enumerateFonts() { function enumerateFonts() {
var fonts = ["Default"]; var fonts = ["Default"]
var availableFonts = Qt.fontFamilies(); var availableFonts = Qt.fontFamilies()
var rootFamilies = []; var rootFamilies = []
var seenFamilies = new Set(); var seenFamilies = new Set()
for (var i = 0; i < availableFonts.length; i++) { for (var i = 0; i < availableFonts.length; i++) {
var fontName = availableFonts[i]; var fontName = availableFonts[i]
if (fontName.startsWith(".")) if (fontName.startsWith("."))
continue; continue
if (fontName === SettingsData.defaultFontFamily) if (fontName === SettingsData.defaultFontFamily)
continue; continue
var rootName = fontName.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i, function(match, suffix) { var rootName = fontName.replace(
return match; / (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i,
}).trim(); "").replace(
/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i,
"").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i,
function (match, suffix) {
return match
}).trim()
if (!seenFamilies.has(rootName) && rootName !== "") { if (!seenFamilies.has(rootName) && rootName !== "") {
seenFamilies.add(rootName); seenFamilies.add(rootName)
rootFamilies.push(rootName); rootFamilies.push(rootName)
} }
} }
cachedFontFamilies = fonts.concat(rootFamilies.sort()); cachedFontFamilies = fonts.concat(rootFamilies.sort())
var monoFonts = ["Default"]; var monoFonts = ["Default"]
var monoFamilies = []; var monoFamilies = []
var seenMonoFamilies = new Set(); var seenMonoFamilies = new Set()
for (var j = 0; j < availableFonts.length; j++) { for (var j = 0; j < availableFonts.length; j++) {
var fontName2 = availableFonts[j]; var fontName2 = availableFonts[j]
if (fontName2.startsWith(".")) if (fontName2.startsWith("."))
continue; continue
if (fontName2 === SettingsData.defaultMonoFontFamily) if (fontName2 === SettingsData.defaultMonoFontFamily)
continue; continue
var lowerName = fontName2.toLowerCase(); var lowerName = fontName2.toLowerCase()
if (lowerName.includes("mono") || lowerName.includes("code") || lowerName.includes("console") || lowerName.includes("terminal") || lowerName.includes("courier") || lowerName.includes("dejavu sans mono") || lowerName.includes("jetbrains") || lowerName.includes("fira") || lowerName.includes("hack") || lowerName.includes("source code") || lowerName.includes("ubuntu mono") || lowerName.includes("cascadia")) { if (lowerName.includes("mono") || lowerName.includes(
var rootName2 = fontName2.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").trim(); "code") || lowerName.includes(
"console") || lowerName.includes(
"terminal") || lowerName.includes(
"courier") || lowerName.includes(
"dejavu sans mono") || lowerName.includes(
"jetbrains") || lowerName.includes(
"fira") || lowerName.includes(
"hack") || lowerName.includes(
"source code") || lowerName.includes(
"ubuntu mono") || lowerName.includes("cascadia")) {
var rootName2 = fontName2.replace(
/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i,
"").replace(
/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i,
"").trim()
if (!seenMonoFamilies.has(rootName2) && rootName2 !== "") { if (!seenMonoFamilies.has(rootName2) && rootName2 !== "") {
seenMonoFamilies.add(rootName2); seenMonoFamilies.add(rootName2)
monoFamilies.push(rootName2); monoFamilies.push(rootName2)
} }
} }
} }
cachedMonoFamilies = monoFonts.concat(monoFamilies.sort()); cachedMonoFamilies = monoFonts.concat(monoFamilies.sort())
} }
Component.onCompleted: { Component.onCompleted: {
// Access WallpaperCyclingService to ensure it's initialized // Access WallpaperCyclingService to ensure it's initialized
WallpaperCyclingService.cyclingActive; WallpaperCyclingService.cyclingActive
if (!fontsEnumerated) { if (!fontsEnumerated) {
enumerateFonts(); enumerateFonts()
fontsEnumerated = true; fontsEnumerated = true
} }
} }
@@ -83,14 +102,15 @@ Item {
width: parent.width width: parent.width
spacing: Theme.spacingXL spacing: Theme.spacingXL
// Wallpaper Section // Wallpaper Section
StyledRect { StyledRect {
width: parent.width width: parent.width
height: wallpaperSection.implicitHeight + Theme.spacingL * 2 height: wallpaperSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -118,7 +138,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Row { Row {
@@ -148,7 +167,6 @@ Item {
maskThresholdMin: 0.5 maskThresholdMin: 0.5
maskSpreadAtMin: 1 maskSpreadAtMin: 1
} }
} }
Rectangle { Rectangle {
@@ -169,7 +187,6 @@ Item {
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
visible: SessionData.wallpaperPath === "" visible: SessionData.wallpaperPath === ""
} }
} }
Column { Column {
@@ -178,7 +195,9 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
StyledText { StyledText {
text: SessionData.wallpaperPath ? SessionData.wallpaperPath.split('/').pop() : "No wallpaper selected" text: SessionData.wallpaperPath ? SessionData.wallpaperPath.split(
'/').pop(
) : "No wallpaper selected"
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText color: Theme.surfaceText
elide: Text.ElideMiddle elide: Text.ElideMiddle
@@ -222,7 +241,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
@@ -230,13 +248,12 @@ Item {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (parentModal) { if (parentModal) {
parentModal.allowFocusOverride = true; parentModal.allowFocusOverride = true
parentModal.shouldHaveFocus = false; parentModal.shouldHaveFocus = false
} }
wallpaperBrowser.open(); wallpaperBrowser.open()
} }
} }
} }
StyledRect { StyledRect {
@@ -263,7 +280,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
@@ -271,16 +287,12 @@ Item {
enabled: SessionData.wallpaperPath !== "" enabled: SessionData.wallpaperPath !== ""
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: { onClicked: {
SessionData.setWallpaper(""); SessionData.setWallpaper("")
} }
} }
} }
} }
} }
} }
// Wallpaper Cycling Section - Full Width // Wallpaper Cycling Section - Full Width
@@ -309,7 +321,8 @@ Item {
} }
Column { Column {
width: parent.width - Theme.iconSize - Theme.spacingM - controlsRow.width - Theme.spacingM width: parent.width - Theme.iconSize - Theme.spacingM
- controlsRow.width - Theme.spacingM
spacing: Theme.spacingXS spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -326,7 +339,6 @@ Item {
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
width: parent.width width: parent.width
} }
} }
Row { Row {
@@ -339,7 +351,11 @@ Item {
width: 60 width: 60
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: prevButtonArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.8) : Theme.primary color: prevButtonArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.8) : Theme.primary
opacity: SessionData.wallpaperPath ? 1 : 0.5 opacity: SessionData.wallpaperPath ? 1 : 0.5
Row { Row {
@@ -359,7 +375,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
@@ -370,17 +385,20 @@ Item {
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
WallpaperCyclingService.cyclePrevManually(); WallpaperCyclingService.cyclePrevManually()
} }
} }
} }
StyledRect { StyledRect {
width: 60 width: 60
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: nextButtonArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.8) : Theme.primary color: nextButtonArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.8) : Theme.primary
opacity: SessionData.wallpaperPath ? 1 : 0.5 opacity: SessionData.wallpaperPath ? 1 : 0.5
Row { Row {
@@ -400,7 +418,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
@@ -411,10 +428,9 @@ Item {
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
WallpaperCyclingService.cycleNextManually(); WallpaperCyclingService.cycleNextManually()
} }
} }
} }
DankToggle { DankToggle {
@@ -422,13 +438,12 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: SessionData.wallpaperCyclingEnabled checked: SessionData.wallpaperCyclingEnabled
onToggled: (toggled) => { onToggled: toggled => {
return SessionData.setWallpaperCyclingEnabled(toggled); return SessionData.setWallpaperCyclingEnabled(
toggled)
} }
} }
} }
} }
// Cycling mode and settings // Cycling mode and settings
@@ -459,12 +474,13 @@ Item {
}, { }, {
"text": "Time" "text": "Time"
}] }]
currentIndex: SessionData.wallpaperCyclingMode === "time" ? 1 : 0 currentIndex: SessionData.wallpaperCyclingMode
onTabClicked: (index) => { === "time" ? 1 : 0
SessionData.setWallpaperCyclingMode(index === 1 ? "time" : "interval"); onTabClicked: index => {
SessionData.setWallpaperCyclingMode(
index === 1 ? "time" : "interval")
} }
} }
} }
// Interval settings // Interval settings
@@ -478,15 +494,17 @@ Item {
description: "How often to change wallpaper" description: "How often to change wallpaper"
options: intervalOptions options: intervalOptions
currentValue: { currentValue: {
const currentSeconds = SessionData.wallpaperCyclingInterval; const currentSeconds = SessionData.wallpaperCyclingInterval
const index = intervalValues.indexOf(currentSeconds); const index = intervalValues.indexOf(
return index >= 0 ? intervalOptions[index] : "5 minutes"; currentSeconds)
return index >= 0 ? intervalOptions[index] : "5 minutes"
} }
onValueChanged: (value) => { onValueChanged: value => {
const index = intervalOptions.indexOf(value); const index = intervalOptions.indexOf(
value)
if (index >= 0) if (index >= 0)
SessionData.setWallpaperCyclingInterval(intervalValues[index]); SessionData.setWallpaperCyclingInterval(
intervalValues[index])
} }
} }
@@ -512,25 +530,28 @@ Item {
topPadding: Theme.spacingS topPadding: Theme.spacingS
bottomPadding: Theme.spacingS bottomPadding: Theme.spacingS
onAccepted: { onAccepted: {
var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(text); var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(
text)
if (isValid) if (isValid)
SessionData.setWallpaperCyclingTime(text); SessionData.setWallpaperCyclingTime(
text)
else else
text = SessionData.wallpaperCyclingTime; text = SessionData.wallpaperCyclingTime
} }
onEditingFinished: { onEditingFinished: {
var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(text); var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(
text)
if (isValid) if (isValid)
SessionData.setWallpaperCyclingTime(text); SessionData.setWallpaperCyclingTime(
text)
else else
text = SessionData.wallpaperCyclingTime; text = SessionData.wallpaperCyclingTime
} }
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
validator: RegularExpressionValidator { validator: RegularExpressionValidator {
regularExpression: /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/ regularExpression: /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/
} }
} }
StyledText { StyledText {
@@ -539,15 +560,10 @@ Item {
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
} }
} }
} }
} }
// Dynamic Theme Section // Dynamic Theme Section
@@ -555,8 +571,10 @@ Item {
width: parent.width width: parent.width
height: dynamicThemeSection.implicitHeight + Theme.spacingL * 2 height: dynamicThemeSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -578,7 +596,8 @@ Item {
} }
Column { Column {
width: parent.width - Theme.iconSize - Theme.spacingM - toggle.width - Theme.spacingM width: parent.width - Theme.iconSize - Theme.spacingM
- toggle.width - Theme.spacingM
spacing: Theme.spacingXS spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -596,7 +615,6 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
DankToggle { DankToggle {
@@ -605,14 +623,13 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: Theme.isDynamicTheme checked: Theme.isDynamicTheme
enabled: ToastService.wallpaperErrorStatus !== "matugen_missing" enabled: ToastService.wallpaperErrorStatus !== "matugen_missing"
onToggled: (toggled) => { onToggled: toggled => {
if (toggled) if (toggled)
Theme.switchTheme(10, true); Theme.switchTheme(10, true)
else else
Theme.switchTheme(0); Theme.switchTheme(0)
} }
} }
} }
StyledText { StyledText {
@@ -623,9 +640,7 @@ Item {
width: parent.width width: parent.width
leftPadding: Theme.iconSize + Theme.spacingM leftPadding: Theme.iconSize + Theme.spacingM
} }
} }
} }
// Display Settings // Display Settings
@@ -633,8 +648,10 @@ Item {
width: parent.width width: parent.width
height: displaySection.implicitHeight + Theme.spacingL * 2 height: displaySection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -662,7 +679,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
DankToggle { DankToggle {
@@ -672,23 +688,22 @@ Item {
text: "Night Mode" text: "Night Mode"
description: "Apply warm color temperature to reduce eye strain" description: "Apply warm color temperature to reduce eye strain"
checked: BrightnessService.nightModeActive checked: BrightnessService.nightModeActive
onToggled: (checked) => { onToggled: checked => {
if (checked !== BrightnessService.nightModeActive) { if (checked !== BrightnessService.nightModeActive) {
if (checked) if (checked)
BrightnessService.enableNightMode(); BrightnessService.enableNightMode()
else else
BrightnessService.disableNightMode(); BrightnessService.disableNightMode()
} }
} }
Connections { Connections {
function onNightModeActiveChanged() { function onNightModeActiveChanged() {
nightModeToggle.checked = BrightnessService.nightModeActive; nightModeToggle.checked = BrightnessService.nightModeActive
} }
target: BrightnessService target: BrightnessService
} }
} }
DankDropdown { DankDropdown {
@@ -699,15 +714,17 @@ Item {
opacity: !BrightnessService.nightModeActive ? 1 : 0.6 opacity: !BrightnessService.nightModeActive ? 1 : 0.6
currentValue: SessionData.nightModeTemperature + "K" currentValue: SessionData.nightModeTemperature + "K"
options: { options: {
var temps = []; var temps = []
for (var i = 2500; i <= 6000; i += 500) { for (var i = 2500; i <= 6000; i += 500) {
temps.push(i + "K"); temps.push(i + "K")
} }
return temps; return temps
} }
onValueChanged: (value) => { onValueChanged: value => {
var temp = parseInt(value.replace("K", "")); var temp = parseInt(
SessionData.setNightModeTemperature(temp); value.replace("K", ""))
SessionData.setNightModeTemperature(
temp)
} }
} }
@@ -716,15 +733,13 @@ Item {
text: "Light Mode" text: "Light Mode"
description: "Use light theme instead of dark theme" description: "Use light theme instead of dark theme"
checked: SessionData.isLightMode checked: SessionData.isLightMode
onToggled: (checked) => { onToggled: checked => {
SessionData.setLightMode(checked); SessionData.setLightMode(checked)
Theme.isLightMode = checked; Theme.isLightMode = checked
PortalService.setLightMode(checked); PortalService.setLightMode(checked)
} }
} }
} }
} }
// Font Settings // Font Settings
@@ -732,8 +747,10 @@ Item {
width: parent.width width: parent.width
height: fontSection.implicitHeight + Theme.spacingL * 2 height: fontSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -761,7 +778,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
DankDropdown { DankDropdown {
@@ -770,19 +786,20 @@ Item {
description: "Select system font family" description: "Select system font family"
currentValue: { currentValue: {
if (SettingsData.fontFamily === SettingsData.defaultFontFamily) if (SettingsData.fontFamily === SettingsData.defaultFontFamily)
return "Default"; return "Default"
else else
return SettingsData.fontFamily || "Default"; return SettingsData.fontFamily || "Default"
} }
enableFuzzySearch: true enableFuzzySearch: true
popupWidthOffset: 100 popupWidthOffset: 100
maxPopupHeight: 400 maxPopupHeight: 400
options: cachedFontFamilies options: cachedFontFamilies
onValueChanged: (value) => { onValueChanged: value => {
if (value.startsWith("Default")) if (value.startsWith("Default"))
SettingsData.setFontFamily(SettingsData.defaultFontFamily); SettingsData.setFontFamily(
SettingsData.defaultFontFamily)
else else
SettingsData.setFontFamily(value); SettingsData.setFontFamily(value)
} }
} }
@@ -793,63 +810,63 @@ Item {
currentValue: { currentValue: {
switch (SettingsData.fontWeight) { switch (SettingsData.fontWeight) {
case Font.Thin: case Font.Thin:
return "Thin"; return "Thin"
case Font.ExtraLight: case Font.ExtraLight:
return "Extra Light"; return "Extra Light"
case Font.Light: case Font.Light:
return "Light"; return "Light"
case Font.Normal: case Font.Normal:
return "Regular"; return "Regular"
case Font.Medium: case Font.Medium:
return "Medium"; return "Medium"
case Font.DemiBold: case Font.DemiBold:
return "Demi Bold"; return "Demi Bold"
case Font.Bold: case Font.Bold:
return "Bold"; return "Bold"
case Font.ExtraBold: case Font.ExtraBold:
return "Extra Bold"; return "Extra Bold"
case Font.Black: case Font.Black:
return "Black"; return "Black"
default: default:
return "Regular"; return "Regular"
} }
} }
options: ["Thin", "Extra Light", "Light", "Regular", "Medium", "Demi Bold", "Bold", "Extra Bold", "Black"] options: ["Thin", "Extra Light", "Light", "Regular", "Medium", "Demi Bold", "Bold", "Extra Bold", "Black"]
onValueChanged: (value) => { onValueChanged: value => {
var weight; var weight
switch (value) { switch (value) {
case "Thin": case "Thin":
weight = Font.Thin; weight = Font.Thin
break; break
case "Extra Light": case "Extra Light":
weight = Font.ExtraLight; weight = Font.ExtraLight
break; break
case "Light": case "Light":
weight = Font.Light; weight = Font.Light
break; break
case "Regular": case "Regular":
weight = Font.Normal; weight = Font.Normal
break; break
case "Medium": case "Medium":
weight = Font.Medium; weight = Font.Medium
break; break
case "Demi Bold": case "Demi Bold":
weight = Font.DemiBold; weight = Font.DemiBold
break; break
case "Bold": case "Bold":
weight = Font.Bold; weight = Font.Bold
break; break
case "Extra Bold": case "Extra Bold":
weight = Font.ExtraBold; weight = Font.ExtraBold
break; break
case "Black": case "Black":
weight = Font.Black; weight = Font.Black
break; break
default: default:
weight = Font.Normal; weight = Font.Normal
break; break
} }
SettingsData.setFontWeight(weight); SettingsData.setFontWeight(weight)
} }
} }
@@ -859,24 +876,24 @@ Item {
description: "Select monospace font for process list and technical displays" description: "Select monospace font for process list and technical displays"
currentValue: { currentValue: {
if (SettingsData.monoFontFamily === SettingsData.defaultMonoFontFamily) if (SettingsData.monoFontFamily === SettingsData.defaultMonoFontFamily)
return "Default"; return "Default"
return SettingsData.monoFontFamily || "Default"; return SettingsData.monoFontFamily || "Default"
} }
enableFuzzySearch: true enableFuzzySearch: true
popupWidthOffset: 100 popupWidthOffset: 100
maxPopupHeight: 400 maxPopupHeight: 400
options: cachedMonoFamilies options: cachedMonoFamilies
onValueChanged: (value) => { onValueChanged: value => {
if (value === "Default") if (value === "Default")
SettingsData.setMonoFontFamily(SettingsData.defaultMonoFontFamily); SettingsData.setMonoFontFamily(
SettingsData.defaultMonoFontFamily)
else else
SettingsData.setMonoFontFamily(value); SettingsData.setMonoFontFamily(
value)
} }
} }
} }
} }
// Corner Radius // Corner Radius
@@ -884,8 +901,10 @@ Item {
width: parent.width width: parent.width
height: cornerRadiusSection.implicitHeight + Theme.spacingL * 2 height: cornerRadiusSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -934,19 +953,17 @@ Item {
maximum: 32 maximum: 32
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: newValue => {
SettingsData.setCornerRadius(newValue); SettingsData.setCornerRadius(
newValue)
} }
} }
} }
} }
} }
} }
} }
FileBrowserModal { FileBrowserModal {
id: wallpaperBrowser id: wallpaperBrowser
@@ -954,18 +971,17 @@ Item {
browserIcon: "wallpaper" browserIcon: "wallpaper"
browserType: "wallpaper" browserType: "wallpaper"
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"] fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
onFileSelected: (path) => { onFileSelected: path => {
SessionData.setWallpaper(path); SessionData.setWallpaper(path)
close(); close()
} }
onDialogClosed: { onDialogClosed: {
if (parentModal) { if (parentModal) {
parentModal.allowFocusOverride = false; parentModal.allowFocusOverride = false
parentModal.shouldHaveFocus = Qt.binding(() => { parentModal.shouldHaveFocus = Qt.binding(() => {
return parentModal.shouldBeVisible; return parentModal.shouldBeVisible
}); })
} }
} }
} }
} }

View File

@@ -34,8 +34,10 @@ Item {
property var rankedAppsModel: { property var rankedAppsModel: {
var apps = [] var apps = []
for (var appId in (AppUsageHistoryData.appUsageRanking || {})) { for (var appId in (AppUsageHistoryData.appUsageRanking
var appData = (AppUsageHistoryData.appUsageRanking || {})[appId] || {})) {
var appData = (AppUsageHistoryData.appUsageRanking
|| {})[appId]
apps.push({ apps.push({
"id": appId, "id": appId,
"name": appData.name, "name": appData.name,
@@ -79,7 +81,8 @@ Item {
} }
Item { Item {
width: parent.width - parent.children[0].width - parent.children[1].width width: parent.width - parent.children[0].width
- parent.children[1].width
- clearAllButton.width - Theme.spacingM * 3 - clearAllButton.width - Theme.spacingM * 3
height: 1 height: 1
} }
@@ -124,7 +127,8 @@ Item {
color: Qt.rgba(Theme.surfaceContainer.r, color: Qt.rgba(Theme.surfaceContainer.r,
Theme.surfaceContainer.g, Theme.surfaceContainer.g,
Theme.surfaceContainer.b, 0.3) Theme.surfaceContainer.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r,
Theme.outline.g,
Theme.outline.b, 0.1) Theme.outline.b, 0.1)
border.width: 1 border.width: 1
@@ -162,7 +166,8 @@ Item {
spacing: 2 spacing: 2
StyledText { StyledText {
text: modelData.name || "Unknown App" text: modelData.name
|| "Unknown App"
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium font.weight: Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
@@ -176,9 +181,12 @@ Item {
var date = new Date(modelData.lastUsed) var date = new Date(modelData.lastUsed)
var now = new Date() var now = new Date()
var diffMs = now - date var diffMs = now - date
var diffMins = Math.floor(diffMs / (1000 * 60)) var diffMins = Math.floor(
var diffHours = Math.floor(diffMs / (1000 * 60 * 60)) diffMs / (1000 * 60))
var diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)) var diffHours = Math.floor(
diffMs / (1000 * 60 * 60))
var diffDays = Math.floor(
diffMs / (1000 * 60 * 60 * 24))
if (diffMins < 1) if (diffMins < 1)
return "Last launched just now" return "Last launched just now"
@@ -210,11 +218,14 @@ Item {
iconName: "close" iconName: "close"
iconSize: 16 iconSize: 16
iconColor: Theme.error iconColor: Theme.error
hoverColor: Qt.rgba(Theme.error.r, Theme.error.g, hoverColor: Qt.rgba(Theme.error.r,
Theme.error.g,
Theme.error.b, 0.12) Theme.error.b, 0.12)
onClicked: { onClicked: {
var currentRanking = Object.assign( var currentRanking = Object.assign(
{}, AppUsageHistoryData.appUsageRanking || {}) {},
AppUsageHistoryData.appUsageRanking
|| {})
delete currentRanking[modelData.id] delete currentRanking[modelData.id]
AppUsageHistoryData.appUsageRanking = currentRanking AppUsageHistoryData.appUsageRanking = currentRanking
SettingsData.saveSettings() SettingsData.saveSettings()

View File

@@ -33,7 +33,8 @@ Column {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: parent.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, color: parent.containsMouse ? Qt.rgba(Theme.primary.r,
Theme.primary.g,
Theme.primary.b, Theme.primary.b,
0.08) : "transparent" 0.08) : "transparent"
radius: Theme.radiusS radius: Theme.radiusS

View File

@@ -12,54 +12,73 @@ Item {
property bool fontsEnumerated: false property bool fontsEnumerated: false
function enumerateFonts() { function enumerateFonts() {
var fonts = ["Default"]; var fonts = ["Default"]
var availableFonts = Qt.fontFamilies(); var availableFonts = Qt.fontFamilies()
var rootFamilies = []; var rootFamilies = []
var seenFamilies = new Set(); var seenFamilies = new Set()
for (var i = 0; i < availableFonts.length; i++) { for (var i = 0; i < availableFonts.length; i++) {
var fontName = availableFonts[i]; var fontName = availableFonts[i]
if (fontName.startsWith(".")) if (fontName.startsWith("."))
continue; continue
if (fontName === SettingsData.defaultFontFamily) if (fontName === SettingsData.defaultFontFamily)
continue; continue
var rootName = fontName.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i, function(match, suffix) { var rootName = fontName.replace(
return match; / (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i,
}).trim(); "").replace(
/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i,
"").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i,
function (match, suffix) {
return match
}).trim()
if (!seenFamilies.has(rootName) && rootName !== "") { if (!seenFamilies.has(rootName) && rootName !== "") {
seenFamilies.add(rootName); seenFamilies.add(rootName)
rootFamilies.push(rootName); rootFamilies.push(rootName)
} }
} }
cachedFontFamilies = fonts.concat(rootFamilies.sort()); cachedFontFamilies = fonts.concat(rootFamilies.sort())
var monoFonts = ["Default"]; var monoFonts = ["Default"]
var monoFamilies = []; var monoFamilies = []
var seenMonoFamilies = new Set(); var seenMonoFamilies = new Set()
for (var j = 0; j < availableFonts.length; j++) { for (var j = 0; j < availableFonts.length; j++) {
var fontName2 = availableFonts[j]; var fontName2 = availableFonts[j]
if (fontName2.startsWith(".")) if (fontName2.startsWith("."))
continue; continue
if (fontName2 === SettingsData.defaultMonoFontFamily) if (fontName2 === SettingsData.defaultMonoFontFamily)
continue; continue
var lowerName = fontName2.toLowerCase(); var lowerName = fontName2.toLowerCase()
if (lowerName.includes("mono") || lowerName.includes("code") || lowerName.includes("console") || lowerName.includes("terminal") || lowerName.includes("courier") || lowerName.includes("dejavu sans mono") || lowerName.includes("jetbrains") || lowerName.includes("fira") || lowerName.includes("hack") || lowerName.includes("source code") || lowerName.includes("ubuntu mono") || lowerName.includes("cascadia")) { if (lowerName.includes("mono") || lowerName.includes(
var rootName2 = fontName2.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").trim(); "code") || lowerName.includes(
"console") || lowerName.includes(
"terminal") || lowerName.includes(
"courier") || lowerName.includes(
"dejavu sans mono") || lowerName.includes(
"jetbrains") || lowerName.includes(
"fira") || lowerName.includes(
"hack") || lowerName.includes(
"source code") || lowerName.includes(
"ubuntu mono") || lowerName.includes("cascadia")) {
var rootName2 = fontName2.replace(
/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i,
"").replace(
/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i,
"").trim()
if (!seenMonoFamilies.has(rootName2) && rootName2 !== "") { if (!seenMonoFamilies.has(rootName2) && rootName2 !== "") {
seenMonoFamilies.add(rootName2); seenMonoFamilies.add(rootName2)
monoFamilies.push(rootName2); monoFamilies.push(rootName2)
} }
} }
} }
cachedMonoFamilies = monoFonts.concat(monoFamilies.sort()); cachedMonoFamilies = monoFonts.concat(monoFamilies.sort())
} }
Component.onCompleted: { Component.onCompleted: {
if (!fontsEnumerated) { if (!fontsEnumerated) {
enumerateFonts(); enumerateFonts()
fontsEnumerated = true; fontsEnumerated = true
} }
} }
@@ -81,8 +100,10 @@ Item {
width: parent.width width: parent.width
height: themeSection.implicitHeight + Theme.spacingL * 2 height: themeSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -110,7 +131,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Column { Column {
@@ -128,10 +148,11 @@ Item {
StyledText { StyledText {
text: { text: {
if (Theme.isDynamicTheme) if (Theme.isDynamicTheme)
return "Wallpaper-based dynamic colors"; return "Wallpaper-based dynamic colors"
var descriptions = ["Material blue inspired by modern interfaces", "Deep blue inspired by material 3", "Rich purple tones for BB elegance", "Natural green for productivity", "Energetic orange for creativity", "Bold red for impact", "Cool cyan for tranquility", "Vibrant pink for expression", "Warm amber for comfort", "Soft coral for gentle warmth"]; var descriptions = ["Material blue inspired by modern interfaces", "Deep blue inspired by material 3", "Rich purple tones for BB elegance", "Natural green for productivity", "Energetic orange for creativity", "Bold red for impact", "Cool cyan for tranquility", "Vibrant pink for expression", "Warm amber for comfort", "Soft coral for gentle warmth"]
return descriptions[Theme.currentThemeIndex] || "Select a theme"; return descriptions[Theme.currentThemeIndex]
|| "Select a theme"
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
@@ -140,7 +161,6 @@ Item {
width: Math.min(parent.width, 400) width: Math.min(parent.width, 400)
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
} }
Column { Column {
@@ -160,8 +180,10 @@ Item {
radius: 16 radius: 16
color: Theme.themes[index].primary color: Theme.themes[index].primary
border.color: Theme.outline border.color: Theme.outline
border.width: (Theme.currentThemeIndex === index && !Theme.isDynamicTheme) ? 2 : 1 border.width: (Theme.currentThemeIndex === index
scale: (Theme.currentThemeIndex === index && !Theme.isDynamicTheme) ? 1.1 : 1 && !Theme.isDynamicTheme) ? 2 : 1
scale: (Theme.currentThemeIndex === index
&& !Theme.isDynamicTheme) ? 1.1 : 1
Rectangle { Rectangle {
width: nameText.contentWidth + Theme.spacingS * 2 width: nameText.contentWidth + Theme.spacingS * 2
@@ -183,7 +205,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
MouseArea { MouseArea {
@@ -193,7 +214,7 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Theme.switchTheme(index, false); Theme.switchTheme(index, false)
} }
} }
@@ -202,7 +223,6 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
Behavior on border.width { Behavior on border.width {
@@ -210,13 +230,9 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
} }
} }
} }
Row { Row {
@@ -248,7 +264,8 @@ Item {
anchors.bottom: parent.top anchors.bottom: parent.top
anchors.bottomMargin: Theme.spacingXS anchors.bottomMargin: Theme.spacingXS
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: mouseArea2.containsMouse && themeIndex < Theme.themes.length visible: mouseArea2.containsMouse
&& themeIndex < Theme.themes.length
StyledText { StyledText {
id: nameText2 id: nameText2
@@ -258,7 +275,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
MouseArea { MouseArea {
@@ -269,8 +285,7 @@ Item {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (themeIndex < Theme.themes.length) if (themeIndex < Theme.themes.length)
Theme.switchTheme(themeIndex); Theme.switchTheme(themeIndex)
} }
} }
@@ -279,7 +294,6 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
Behavior on border.width { Behavior on border.width {
@@ -287,13 +301,9 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
} }
} }
} }
Item { Item {
@@ -307,18 +317,26 @@ Item {
radius: 20 radius: 20
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
color: { color: {
if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing") if (ToastService.wallpaperErrorStatus === "error"
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12); || ToastService.wallpaperErrorStatus === "matugen_missing")
return Qt.rgba(Theme.error.r,
Theme.error.g,
Theme.error.b, 0.12)
else else
return Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3); return Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
} }
border.color: { border.color: {
if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing") if (ToastService.wallpaperErrorStatus === "error"
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.5); || ToastService.wallpaperErrorStatus === "matugen_missing")
return Qt.rgba(Theme.error.r,
Theme.error.g,
Theme.error.b, 0.5)
else if (Theme.isDynamicTheme) else if (Theme.isDynamicTheme)
return Theme.primary; return Theme.primary
else else
return Theme.outline; return Theme.outline
} }
border.width: Theme.isDynamicTheme ? 2 : 1 border.width: Theme.isDynamicTheme ? 2 : 1
scale: Theme.isDynamicTheme ? 1.1 : (autoMouseArea.containsMouse ? 1.02 : 1) scale: Theme.isDynamicTheme ? 1.1 : (autoMouseArea.containsMouse ? 1.02 : 1)
@@ -329,17 +347,21 @@ Item {
DankIcon { DankIcon {
name: { name: {
if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing") if (ToastService.wallpaperErrorStatus === "error"
return "error"; || ToastService.wallpaperErrorStatus
=== "matugen_missing")
return "error"
else else
return "palette"; return "palette"
} }
size: 16 size: 16
color: { color: {
if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing") if (ToastService.wallpaperErrorStatus === "error"
return Theme.error; || ToastService.wallpaperErrorStatus
=== "matugen_missing")
return Theme.error
else else
return Theme.surfaceText; return Theme.surfaceText
} }
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
@@ -347,23 +369,25 @@ Item {
StyledText { StyledText {
text: { text: {
if (ToastService.wallpaperErrorStatus === "error") if (ToastService.wallpaperErrorStatus === "error")
return "Error"; return "Error"
else if (ToastService.wallpaperErrorStatus === "matugen_missing") else if (ToastService.wallpaperErrorStatus
return "No matugen"; === "matugen_missing")
return "No matugen"
else else
return "Auto"; return "Auto"
} }
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: { color: {
if (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing") if (ToastService.wallpaperErrorStatus === "error"
return Theme.error; || ToastService.wallpaperErrorStatus
=== "matugen_missing")
return Theme.error
else else
return Theme.surfaceText; return Theme.surfaceText
} }
font.weight: Font.Medium font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
@@ -374,11 +398,13 @@ Item {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (ToastService.wallpaperErrorStatus === "matugen_missing") if (ToastService.wallpaperErrorStatus === "matugen_missing")
ToastService.showError("matugen not found - install matugen package for dynamic theming"); ToastService.showError(
"matugen not found - install matugen package for dynamic theming")
else if (ToastService.wallpaperErrorStatus === "error") else if (ToastService.wallpaperErrorStatus === "error")
ToastService.showError("Wallpaper processing failed - check wallpaper path"); ToastService.showError(
"Wallpaper processing failed - check wallpaper path")
else else
Theme.switchTheme(10, true); Theme.switchTheme(10, true)
} }
} }
@@ -392,25 +418,30 @@ Item {
anchors.bottom: parent.top anchors.bottom: parent.top
anchors.bottomMargin: Theme.spacingS anchors.bottomMargin: Theme.spacingS
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: autoMouseArea.containsMouse && (!Theme.isDynamicTheme || ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing") visible: autoMouseArea.containsMouse
&& (!Theme.isDynamicTheme
|| ToastService.wallpaperErrorStatus === "error"
|| ToastService.wallpaperErrorStatus
=== "matugen_missing")
StyledText { StyledText {
id: autoTooltipText id: autoTooltipText
text: { text: {
if (ToastService.wallpaperErrorStatus === "matugen_missing") if (ToastService.wallpaperErrorStatus === "matugen_missing")
return "Install matugen package for dynamic themes"; return "Install matugen package for dynamic themes"
else else
return "Dynamic wallpaper-based colors"; return "Dynamic wallpaper-based colors"
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: (ToastService.wallpaperErrorStatus === "error" || ToastService.wallpaperErrorStatus === "matugen_missing") ? Theme.error : Theme.surfaceText color: (ToastService.wallpaperErrorStatus === "error"
|| ToastService.wallpaperErrorStatus
=== "matugen_missing") ? Theme.error : Theme.surfaceText
anchors.centerIn: parent anchors.centerIn: parent
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: Math.min(implicitWidth, 250) width: Math.min(implicitWidth, 250)
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
} }
Behavior on scale { Behavior on scale {
@@ -418,7 +449,6 @@ Item {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
Behavior on color { Behavior on color {
@@ -426,7 +456,6 @@ Item {
duration: Theme.mediumDuration duration: Theme.mediumDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
Behavior on border.color { Behavior on border.color {
@@ -434,15 +463,10 @@ Item {
duration: Theme.mediumDuration duration: Theme.mediumDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
} }
} }
} }
} }
// Transparency Settings // Transparency Settings
@@ -450,8 +474,10 @@ Item {
width: parent.width width: parent.width
height: transparencySection.implicitHeight + Theme.spacingL * 2 height: transparencySection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -479,7 +505,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Column { Column {
@@ -496,16 +521,17 @@ Item {
DankSlider { DankSlider {
width: parent.width width: parent.width
height: 24 height: 24
value: Math.round(SettingsData.topBarTransparency * 100) value: Math.round(
SettingsData.topBarTransparency * 100)
minimum: 0 minimum: 0
maximum: 100 maximum: 100
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: newValue => {
SettingsData.setTopBarTransparency(newValue / 100); SettingsData.setTopBarTransparency(
newValue / 100)
} }
} }
} }
Column { Column {
@@ -522,16 +548,17 @@ Item {
DankSlider { DankSlider {
width: parent.width width: parent.width
height: 24 height: 24
value: Math.round(SettingsData.topBarWidgetTransparency * 100) value: Math.round(
SettingsData.topBarWidgetTransparency * 100)
minimum: 0 minimum: 0
maximum: 100 maximum: 100
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: newValue => {
SettingsData.setTopBarWidgetTransparency(newValue / 100); SettingsData.setTopBarWidgetTransparency(
newValue / 100)
} }
} }
} }
Column { Column {
@@ -548,20 +575,19 @@ Item {
DankSlider { DankSlider {
width: parent.width width: parent.width
height: 24 height: 24
value: Math.round(SettingsData.popupTransparency * 100) value: Math.round(
SettingsData.popupTransparency * 100)
minimum: 0 minimum: 0
maximum: 100 maximum: 100
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: newValue => {
SettingsData.setPopupTransparency(newValue / 100); SettingsData.setPopupTransparency(
newValue / 100)
} }
} }
} }
} }
} }
// System Configuration Warning // System Configuration Warning
@@ -569,8 +595,10 @@ Item {
width: parent.width width: parent.width
height: warningText.implicitHeight + Theme.spacingM * 2 height: warningText.implicitHeight + Theme.spacingM * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.12) color: Qt.rgba(Theme.warning.r, Theme.warning.g,
border.color: Qt.rgba(Theme.warning.r, Theme.warning.g, Theme.warning.b, 0.3) Theme.warning.b, 0.12)
border.color: Qt.rgba(Theme.warning.r, Theme.warning.g,
Theme.warning.b, 0.3)
border.width: 1 border.width: 1
Row { Row {
@@ -595,9 +623,7 @@ Item {
width: parent.width - Theme.iconSizeSmall - Theme.spacingM width: parent.width - Theme.iconSizeSmall - Theme.spacingM
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
} }
// Icon Theme // Icon Theme
@@ -605,8 +631,10 @@ Item {
width: parent.width width: parent.width
height: iconThemeSection.implicitHeight + Theme.spacingL * 2 height: iconThemeSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -637,21 +665,20 @@ Item {
popupWidthOffset: 100 popupWidthOffset: 100
maxPopupHeight: 236 maxPopupHeight: 236
options: { options: {
SettingsData.detectAvailableIconThemes(); SettingsData.detectAvailableIconThemes()
return SettingsData.availableIconThemes; return SettingsData.availableIconThemes
} }
onValueChanged: (value) => { onValueChanged: value => {
SettingsData.setIconTheme(value); SettingsData.setIconTheme(value)
if (value !== "System Default" && !SettingsData.qt5ctAvailable && !SettingsData.qt6ctAvailable) if (value !== "System Default"
ToastService.showWarning("qt5ct or qt6ct not found - Qt app themes may not update without these tools"); && !SettingsData.qt5ctAvailable
&& !SettingsData.qt6ctAvailable)
ToastService.showWarning(
"qt5ct or qt6ct not found - Qt app themes may not update without these tools")
} }
} }
} }
} }
} }
// System App Theming // System App Theming
@@ -659,8 +686,10 @@ Item {
width: parent.width width: parent.width
height: systemThemingSection.implicitHeight + Theme.spacingL * 2 height: systemThemingSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
visible: Theme.isDynamicTheme && Colors.matugenAvailable visible: Theme.isDynamicTheme && Colors.matugenAvailable
@@ -689,7 +718,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
DankToggle { DankToggle {
@@ -697,9 +725,10 @@ Item {
text: "Theme GTK Applications" text: "Theme GTK Applications"
description: Colors.gtkThemingEnabled ? "File managers, text editors, and system dialogs will match your theme" : "GTK theming not available (install gsettings)" description: Colors.gtkThemingEnabled ? "File managers, text editors, and system dialogs will match your theme" : "GTK theming not available (install gsettings)"
enabled: Colors.gtkThemingEnabled enabled: Colors.gtkThemingEnabled
checked: Colors.gtkThemingEnabled && SettingsData.gtkThemingEnabled checked: Colors.gtkThemingEnabled
onToggled: function(checked) { && SettingsData.gtkThemingEnabled
SettingsData.setGtkThemingEnabled(checked); onToggled: function (checked) {
SettingsData.setGtkThemingEnabled(checked)
} }
} }
@@ -708,18 +737,14 @@ Item {
text: "Theme Qt Applications" text: "Theme Qt Applications"
description: Colors.qtThemingEnabled ? "Qt applications will match your theme colors" : "Qt theming not available (install qt5ct or qt6ct)" description: Colors.qtThemingEnabled ? "Qt applications will match your theme colors" : "Qt theming not available (install qt5ct or qt6ct)"
enabled: Colors.qtThemingEnabled enabled: Colors.qtThemingEnabled
checked: Colors.qtThemingEnabled && SettingsData.qtThemingEnabled checked: Colors.qtThemingEnabled
onToggled: function(checked) { && SettingsData.qtThemingEnabled
SettingsData.setQtThemingEnabled(checked); onToggled: function (checked) {
SettingsData.setQtThemingEnabled(checked)
} }
} }
} }
} }
} }
} }
} }

View File

@@ -24,8 +24,10 @@ Item {
width: parent.width width: parent.width
height: timeSection.implicitHeight + Theme.spacingL * 2 height: timeSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -47,7 +49,8 @@ Item {
} }
Column { Column {
width: parent.width - Theme.iconSize - Theme.spacingM - toggle.width - Theme.spacingM width: parent.width - Theme.iconSize - Theme.spacingM
- toggle.width - Theme.spacingM
spacing: Theme.spacingXS spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -65,7 +68,6 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
DankToggle { DankToggle {
@@ -73,15 +75,13 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: SettingsData.use24HourClock checked: SettingsData.use24HourClock
onToggled: (checked) => { onToggled: checked => {
return SettingsData.setClockFormat(checked); return SettingsData.setClockFormat(
checked)
} }
} }
} }
} }
} }
// Date Format Section // Date Format Section
@@ -89,8 +89,10 @@ Item {
width: parent.width width: parent.width
height: dateSection.implicitHeight + Theme.spacingL * 2 height: dateSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -118,14 +120,15 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
DankDropdown { DankDropdown {
width: parent.width width: parent.width
height: 50 height: 50
text: "Top Bar Format" text: "Top Bar Format"
description: "Preview: " + Qt.formatDate(new Date(), SettingsData.clockDateFormat) description: "Preview: " + Qt.formatDate(
new Date(),
SettingsData.clockDateFormat)
currentValue: { currentValue: {
// Find matching preset or show "Custom" // Find matching preset or show "Custom"
const presets = [{ const presets = [{
@@ -152,14 +155,15 @@ Item {
}, { }, {
"format": "dddd, MMMM d", "format": "dddd, MMMM d",
"label": "Full Day & Month" "label": "Full Day & Month"
}]; }]
const match = presets.find((p) => { const match = presets.find(p => {
return p.format === SettingsData.clockDateFormat; return p.format
}); === SettingsData.clockDateFormat
return match ? match.label : "Custom: " + SettingsData.clockDateFormat; })
return match ? match.label : "Custom: " + SettingsData.clockDateFormat
} }
options: ["Day Date", "Day Month Date", "Month Date", "Numeric (M/D)", "Numeric (D/M)", "Full with Year", "ISO Date", "Full Day & Month", "Custom..."] options: ["Day Date", "Day Month Date", "Month Date", "Numeric (M/D)", "Numeric (D/M)", "Full with Year", "ISO Date", "Full Day & Month", "Custom..."]
onValueChanged: (value) => { onValueChanged: value => {
const formatMap = { const formatMap = {
"Day Date": "ddd d", "Day Date": "ddd d",
"Day Month Date": "ddd MMM d", "Day Month Date": "ddd MMM d",
@@ -169,12 +173,13 @@ Item {
"Full with Year": "ddd d MMM yyyy", "Full with Year": "ddd d MMM yyyy",
"ISO Date": "yyyy-MM-dd", "ISO Date": "yyyy-MM-dd",
"Full Day & Month": "dddd, MMMM d" "Full Day & Month": "dddd, MMMM d"
}; }
if (value === "Custom...") { if (value === "Custom...") {
customFormatInput.visible = true; customFormatInput.visible = true
} else { } else {
customFormatInput.visible = false; customFormatInput.visible = false
SettingsData.setClockDateFormat(formatMap[value]); SettingsData.setClockDateFormat(
formatMap[value])
} }
} }
} }
@@ -183,7 +188,9 @@ Item {
width: parent.width width: parent.width
height: 50 height: 50
text: "Lock Screen Format" text: "Lock Screen Format"
description: "Preview: " + Qt.formatDate(new Date(), SettingsData.lockDateFormat) description: "Preview: " + Qt.formatDate(
new Date(),
SettingsData.lockDateFormat)
currentValue: { currentValue: {
// Find matching preset or show "Custom" // Find matching preset or show "Custom"
const presets = [{ const presets = [{
@@ -210,14 +217,15 @@ Item {
}, { }, {
"format": "dddd, MMMM d", "format": "dddd, MMMM d",
"label": "Full Day & Month" "label": "Full Day & Month"
}]; }]
const match = presets.find((p) => { const match = presets.find(p => {
return p.format === SettingsData.lockDateFormat; return p.format
}); === SettingsData.lockDateFormat
return match ? match.label : "Custom: " + SettingsData.lockDateFormat; })
return match ? match.label : "Custom: " + SettingsData.lockDateFormat
} }
options: ["Day Date", "Day Month Date", "Month Date", "Numeric (M/D)", "Numeric (D/M)", "Full with Year", "ISO Date", "Full Day & Month", "Custom..."] options: ["Day Date", "Day Month Date", "Month Date", "Numeric (M/D)", "Numeric (D/M)", "Full with Year", "ISO Date", "Full Day & Month", "Custom..."]
onValueChanged: (value) => { onValueChanged: value => {
const formatMap = { const formatMap = {
"Day Date": "ddd d", "Day Date": "ddd d",
"Day Month Date": "ddd MMM d", "Day Month Date": "ddd MMM d",
@@ -227,12 +235,13 @@ Item {
"Full with Year": "ddd d MMM yyyy", "Full with Year": "ddd d MMM yyyy",
"ISO Date": "yyyy-MM-dd", "ISO Date": "yyyy-MM-dd",
"Full Day & Month": "dddd, MMMM d" "Full Day & Month": "dddd, MMMM d"
}; }
if (value === "Custom...") { if (value === "Custom...") {
customLockFormatInput.visible = true; customLockFormatInput.visible = true
} else { } else {
customLockFormatInput.visible = false; customLockFormatInput.visible = false
SettingsData.setLockDateFormat(formatMap[value]); SettingsData.setLockDateFormat(
formatMap[value])
} }
} }
} }
@@ -246,8 +255,7 @@ Item {
text: SettingsData.clockDateFormat text: SettingsData.clockDateFormat
onTextChanged: { onTextChanged: {
if (visible && text) if (visible && text)
SettingsData.setClockDateFormat(text); SettingsData.setClockDateFormat(text)
} }
} }
@@ -260,8 +268,7 @@ Item {
text: SettingsData.lockDateFormat text: SettingsData.lockDateFormat
onTextChanged: { onTextChanged: {
if (visible && text) if (visible && text)
SettingsData.setLockDateFormat(text); SettingsData.setLockDateFormat(text)
} }
} }
@@ -269,8 +276,11 @@ Item {
width: parent.width width: parent.width
height: formatHelp.implicitHeight + Theme.spacingM * 2 height: formatHelp.implicitHeight + Theme.spacingM * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.2) color: Qt.rgba(Theme.surfaceVariant.r,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1) Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.1)
border.width: 1 border.width: 1
Column { Column {
@@ -324,7 +334,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
} }
} }
Column { Column {
@@ -360,21 +369,12 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
} }
} }
} }
} }
} }
} }
} }
} }
} }
} }

View File

@@ -246,11 +246,16 @@ Item {
"id": widget.id, "id": widget.id,
"enabled": enabled "enabled": enabled
} }
if (widget.size !== undefined) newWidget.size = widget.size if (widget.size !== undefined)
if (widget.selectedGpuIndex !== undefined) newWidget.selectedGpuIndex = widget.selectedGpuIndex newWidget.size = widget.size
else if (widget.id === "gpuTemp") newWidget.selectedGpuIndex = 0 if (widget.selectedGpuIndex !== undefined)
if (widget.pciId !== undefined) newWidget.pciId = widget.pciId newWidget.selectedGpuIndex = widget.selectedGpuIndex
else if (widget.id === "gpuTemp") newWidget.pciId = "" else if (widget.id === "gpuTemp")
newWidget.selectedGpuIndex = 0
if (widget.pciId !== undefined)
newWidget.pciId = widget.pciId
else if (widget.id === "gpuTemp")
newWidget.pciId = ""
widgets[i] = newWidget widgets[i] = newWidget
} }
break break
@@ -297,8 +302,10 @@ Item {
"enabled": widget.enabled, "enabled": widget.enabled,
"size": newSize "size": newSize
} }
if (widget.selectedGpuIndex !== undefined) newWidget.selectedGpuIndex = widget.selectedGpuIndex if (widget.selectedGpuIndex !== undefined)
if (widget.pciId !== undefined) newWidget.pciId = widget.pciId newWidget.selectedGpuIndex = widget.selectedGpuIndex
if (widget.pciId !== undefined)
newWidget.pciId = widget.pciId
widgets[i] = newWidget widgets[i] = newWidget
} }
break break
@@ -328,16 +335,21 @@ Item {
"id": widget, "id": widget,
"enabled": true, "enabled": true,
"selectedGpuIndex": selectedGpuIndex, "selectedGpuIndex": selectedGpuIndex,
"pciId": DgopService.availableGpus && DgopService.availableGpus.length > selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : "" "pciId": DgopService.availableGpus
&& DgopService.availableGpus.length
> selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : ""
} }
} else { } else {
var newWidget = { var newWidget = {
"id": widget.id, "id": widget.id,
"enabled": widget.enabled, "enabled": widget.enabled,
"selectedGpuIndex": selectedGpuIndex, "selectedGpuIndex": selectedGpuIndex,
"pciId": DgopService.availableGpus && DgopService.availableGpus.length > selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : "" "pciId": DgopService.availableGpus
&& DgopService.availableGpus.length
> selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : ""
} }
if (widget.size !== undefined) newWidget.size = widget.size if (widget.size !== undefined)
newWidget.size = widget.size
widgets[widgetIndex] = newWidget widgets[widgetIndex] = newWidget
} }
} }
@@ -361,7 +373,8 @@ Item {
widgetData = SettingsData.topBarRightWidgets || [] widgetData = SettingsData.topBarRightWidgets || []
widgetData.forEach(widget => { widgetData.forEach(widget => {
var widgetId = typeof widget === "string" ? widget : widget.id var widgetId = typeof widget === "string" ? widget : widget.id
var widgetEnabled = typeof widget === "string" ? true : widget.enabled var widgetEnabled = typeof widget
=== "string" ? true : widget.enabled
var widgetSize = typeof widget === "string" ? undefined : widget.size var widgetSize = typeof widget === "string" ? undefined : widget.size
var widgetSelectedGpuIndex = typeof widget var widgetSelectedGpuIndex = typeof widget
=== "string" ? undefined : widget.selectedGpuIndex === "string" ? undefined : widget.selectedGpuIndex
@@ -396,8 +409,8 @@ Item {
if (!SettingsData.topBarRightWidgets) if (!SettingsData.topBarRightWidgets)
SettingsData.setTopBarRightWidgets(defaultRightWidgets) SettingsData.setTopBarRightWidgets(defaultRightWidgets)
const sections = ["left", "center", "right"]
["left", "center", "right"].forEach(sectionId => { sections.forEach(sectionId => {
var widgets = [] var widgets = []
if (sectionId === "left") if (sectionId === "left")
widgets = SettingsData.topBarLeftWidgets.slice() widgets = SettingsData.topBarLeftWidgets.slice()
@@ -406,16 +419,12 @@ Item {
else if (sectionId === "right") else if (sectionId === "right")
widgets = SettingsData.topBarRightWidgets.slice() widgets = SettingsData.topBarRightWidgets.slice()
var updated = false var updated = false
for (var i = 0; i for (var i = 0; i < widgets.length; i++) {
< widgets.length; i++) {
var widget = widgets[i] var widget = widgets[i]
if (typeof widget === "object" if (typeof widget === "object"
&& widget.id === "spacer" && widget.id === "spacer"
&& !widget.size) { && !widget.size) {
widgets[i] = Object.assign( widgets[i] = Object.assign({}, widget, {
{},
widget,
{
"size": 20 "size": 20
}) })
updated = true updated = true
@@ -423,14 +432,11 @@ Item {
} }
if (updated) { if (updated) {
if (sectionId === "left") if (sectionId === "left")
SettingsData.setTopBarLeftWidgets( SettingsData.setTopBarLeftWidgets(widgets)
widgets)
else if (sectionId === "center") else if (sectionId === "center")
SettingsData.setTopBarCenterWidgets( SettingsData.setTopBarCenterWidgets(widgets)
widgets)
else if (sectionId === "right") else if (sectionId === "right")
SettingsData.setTopBarRightWidgets( SettingsData.setTopBarRightWidgets(widgets)
widgets)
} }
}) })
} }
@@ -453,8 +459,10 @@ Item {
width: parent.width width: parent.width
height: topBarAutoHideSection.implicitHeight + Theme.spacingL * 2 height: topBarAutoHideSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -476,7 +484,8 @@ Item {
} }
Column { Column {
width: parent.width - Theme.iconSize - Theme.spacingM - autoHideToggle.width - Theme.spacingM width: parent.width - Theme.iconSize - Theme.spacingM
- autoHideToggle.width - Theme.spacingM
spacing: Theme.spacingXS spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -494,7 +503,6 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
DankToggle { DankToggle {
@@ -502,15 +510,13 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: SettingsData.topBarAutoHide checked: SettingsData.topBarAutoHide
onToggled: (toggled) => { onToggled: toggled => {
return SettingsData.setTopBarAutoHide(toggled); return SettingsData.setTopBarAutoHide(
toggled)
} }
} }
} }
} }
} }
// Spacing // Spacing
@@ -518,8 +524,10 @@ Item {
width: parent.width width: parent.width
height: topBarSpacingSection.implicitHeight + Theme.spacingL * 2 height: topBarSpacingSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -547,7 +555,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Column { Column {
@@ -569,11 +576,11 @@ Item {
maximum: 32 maximum: 32
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: newValue => {
SettingsData.setTopBarSpacing(newValue); SettingsData.setTopBarSpacing(
newValue)
} }
} }
} }
DankToggle { DankToggle {
@@ -581,13 +588,12 @@ Item {
text: "Square Corners" text: "Square Corners"
description: "Disable corner radius for the top bar (always square corners)" description: "Disable corner radius for the top bar (always square corners)"
checked: SettingsData.topBarSquareCorners checked: SettingsData.topBarSquareCorners
onToggled: (checked) => { onToggled: checked => {
SettingsData.setTopBarSquareCorners(checked); SettingsData.setTopBarSquareCorners(
checked)
} }
} }
} }
} }
// Widget Management Section // Widget Management Section
@@ -595,8 +601,10 @@ Item {
width: parent.width width: parent.width
height: widgetManagementSection.implicitHeight + Theme.spacingL * 2 height: widgetManagementSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -643,7 +651,8 @@ Item {
border.color: resetArea.containsMouse ? Theme.outline : Qt.rgba( border.color: resetArea.containsMouse ? Theme.outline : Qt.rgba(
Theme.outline.r, Theme.outline.r,
Theme.outline.g, Theme.outline.g,
Theme.outline.b, 0.5) Theme.outline.b,
0.5)
Row { Row {
anchors.centerIn: parent anchors.centerIn: parent
@@ -672,9 +681,12 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
SettingsData.setTopBarLeftWidgets(defaultLeftWidgets) SettingsData.setTopBarLeftWidgets(
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets) defaultLeftWidgets)
SettingsData.setTopBarRightWidgets(defaultRightWidgets) SettingsData.setTopBarCenterWidgets(
defaultCenterWidgets)
SettingsData.setTopBarRightWidgets(
defaultRightWidgets)
} }
} }
@@ -713,8 +725,11 @@ Item {
width: parent.width width: parent.width
height: leftSection.implicitHeight + Theme.spacingL * 2 height: leftSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
WidgetsTabSection { WidgetsTabSection {
@@ -727,42 +742,47 @@ Item {
allWidgets: topBarTab.baseWidgetDefinitions allWidgets: topBarTab.baseWidgetDefinitions
items: topBarTab.getItemsForSection("left") items: topBarTab.getItemsForSection("left")
onItemEnabledChanged: (sectionId, itemId, enabled) => { onItemEnabledChanged: (sectionId, itemId, enabled) => {
topBarTab.handleItemEnabledChanged(sectionId, topBarTab.handleItemEnabledChanged(
itemId, sectionId,
enabled) itemId, enabled)
} }
onItemOrderChanged: newOrder => { onItemOrderChanged: newOrder => {
topBarTab.handleItemOrderChanged("left", topBarTab.handleItemOrderChanged(
newOrder) "left", newOrder)
} }
onAddWidget: sectionId => { onAddWidget: sectionId => {
widgetSelectionPopup.allWidgets = topBarTab.baseWidgetDefinitions widgetSelectionPopup.allWidgets
= topBarTab.baseWidgetDefinitions
widgetSelectionPopup.targetSection = sectionId widgetSelectionPopup.targetSection = sectionId
widgetSelectionPopup.safeOpen() widgetSelectionPopup.safeOpen()
} }
onRemoveWidget: (sectionId, widgetIndex) => { onRemoveWidget: (sectionId, widgetIndex) => {
topBarTab.removeWidgetFromSection(sectionId, topBarTab.removeWidgetFromSection(
widgetIndex) sectionId, widgetIndex)
} }
onSpacerSizeChanged: (sectionId, itemId, newSize) => { onSpacerSizeChanged: (sectionId, itemId, newSize) => {
topBarTab.handleSpacerSizeChanged(sectionId, topBarTab.handleSpacerSizeChanged(
itemId, sectionId, itemId, newSize)
newSize)
} }
onCompactModeChanged: (widgetId, value) => { onCompactModeChanged: (widgetId, value) => {
if (widgetId === "clock") { if (widgetId === "clock") {
SettingsData.setClockCompactMode(value) SettingsData.setClockCompactMode(
value)
} else if (widgetId === "music") { } else if (widgetId === "music") {
SettingsData.setMediaSize(value) SettingsData.setMediaSize(
value)
} else if (widgetId === "focusedWindow") { } else if (widgetId === "focusedWindow") {
SettingsData.setFocusedWindowCompactMode(value) SettingsData.setFocusedWindowCompactMode(
value)
} else if (widgetId === "runningApps") { } else if (widgetId === "runningApps") {
SettingsData.setRunningAppsCompactMode(value) SettingsData.setRunningAppsCompactMode(
value)
} }
} }
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => { onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
topBarTab.handleGpuSelectionChanged( topBarTab.handleGpuSelectionChanged(
sectionId, widgetIndex, selectedIndex) sectionId, widgetIndex,
selectedIndex)
} }
} }
} }
@@ -772,8 +792,11 @@ Item {
width: parent.width width: parent.width
height: centerSection.implicitHeight + Theme.spacingL * 2 height: centerSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
WidgetsTabSection { WidgetsTabSection {
@@ -786,42 +809,47 @@ Item {
allWidgets: topBarTab.baseWidgetDefinitions allWidgets: topBarTab.baseWidgetDefinitions
items: topBarTab.getItemsForSection("center") items: topBarTab.getItemsForSection("center")
onItemEnabledChanged: (sectionId, itemId, enabled) => { onItemEnabledChanged: (sectionId, itemId, enabled) => {
topBarTab.handleItemEnabledChanged(sectionId, topBarTab.handleItemEnabledChanged(
itemId, sectionId,
enabled) itemId, enabled)
} }
onItemOrderChanged: newOrder => { onItemOrderChanged: newOrder => {
topBarTab.handleItemOrderChanged("center", topBarTab.handleItemOrderChanged(
newOrder) "center", newOrder)
} }
onAddWidget: sectionId => { onAddWidget: sectionId => {
widgetSelectionPopup.allWidgets = topBarTab.baseWidgetDefinitions widgetSelectionPopup.allWidgets
= topBarTab.baseWidgetDefinitions
widgetSelectionPopup.targetSection = sectionId widgetSelectionPopup.targetSection = sectionId
widgetSelectionPopup.safeOpen() widgetSelectionPopup.safeOpen()
} }
onRemoveWidget: (sectionId, widgetIndex) => { onRemoveWidget: (sectionId, widgetIndex) => {
topBarTab.removeWidgetFromSection(sectionId, topBarTab.removeWidgetFromSection(
widgetIndex) sectionId, widgetIndex)
} }
onSpacerSizeChanged: (sectionId, itemId, newSize) => { onSpacerSizeChanged: (sectionId, itemId, newSize) => {
topBarTab.handleSpacerSizeChanged(sectionId, topBarTab.handleSpacerSizeChanged(
itemId, sectionId, itemId, newSize)
newSize)
} }
onCompactModeChanged: (widgetId, value) => { onCompactModeChanged: (widgetId, value) => {
if (widgetId === "clock") { if (widgetId === "clock") {
SettingsData.setClockCompactMode(value) SettingsData.setClockCompactMode(
value)
} else if (widgetId === "music") { } else if (widgetId === "music") {
SettingsData.setMediaSize(value) SettingsData.setMediaSize(
value)
} else if (widgetId === "focusedWindow") { } else if (widgetId === "focusedWindow") {
SettingsData.setFocusedWindowCompactMode(value) SettingsData.setFocusedWindowCompactMode(
value)
} else if (widgetId === "runningApps") { } else if (widgetId === "runningApps") {
SettingsData.setRunningAppsCompactMode(value) SettingsData.setRunningAppsCompactMode(
value)
} }
} }
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => { onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
topBarTab.handleGpuSelectionChanged( topBarTab.handleGpuSelectionChanged(
sectionId, widgetIndex, selectedIndex) sectionId, widgetIndex,
selectedIndex)
} }
} }
} }
@@ -831,8 +859,11 @@ Item {
width: parent.width width: parent.width
height: rightSection.implicitHeight + Theme.spacingL * 2 height: rightSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
WidgetsTabSection { WidgetsTabSection {
@@ -845,42 +876,47 @@ Item {
allWidgets: topBarTab.baseWidgetDefinitions allWidgets: topBarTab.baseWidgetDefinitions
items: topBarTab.getItemsForSection("right") items: topBarTab.getItemsForSection("right")
onItemEnabledChanged: (sectionId, itemId, enabled) => { onItemEnabledChanged: (sectionId, itemId, enabled) => {
topBarTab.handleItemEnabledChanged(sectionId, topBarTab.handleItemEnabledChanged(
itemId, sectionId,
enabled) itemId, enabled)
} }
onItemOrderChanged: newOrder => { onItemOrderChanged: newOrder => {
topBarTab.handleItemOrderChanged("right", topBarTab.handleItemOrderChanged(
newOrder) "right", newOrder)
} }
onAddWidget: sectionId => { onAddWidget: sectionId => {
widgetSelectionPopup.allWidgets = topBarTab.baseWidgetDefinitions widgetSelectionPopup.allWidgets
= topBarTab.baseWidgetDefinitions
widgetSelectionPopup.targetSection = sectionId widgetSelectionPopup.targetSection = sectionId
widgetSelectionPopup.safeOpen() widgetSelectionPopup.safeOpen()
} }
onRemoveWidget: (sectionId, widgetIndex) => { onRemoveWidget: (sectionId, widgetIndex) => {
topBarTab.removeWidgetFromSection(sectionId, topBarTab.removeWidgetFromSection(
widgetIndex) sectionId, widgetIndex)
} }
onSpacerSizeChanged: (sectionId, itemId, newSize) => { onSpacerSizeChanged: (sectionId, itemId, newSize) => {
topBarTab.handleSpacerSizeChanged(sectionId, topBarTab.handleSpacerSizeChanged(
itemId, sectionId, itemId, newSize)
newSize)
} }
onCompactModeChanged: (widgetId, value) => { onCompactModeChanged: (widgetId, value) => {
if (widgetId === "clock") { if (widgetId === "clock") {
SettingsData.setClockCompactMode(value) SettingsData.setClockCompactMode(
value)
} else if (widgetId === "music") { } else if (widgetId === "music") {
SettingsData.setMediaSize(value) SettingsData.setMediaSize(
value)
} else if (widgetId === "focusedWindow") { } else if (widgetId === "focusedWindow") {
SettingsData.setFocusedWindowCompactMode(value) SettingsData.setFocusedWindowCompactMode(
value)
} else if (widgetId === "runningApps") { } else if (widgetId === "runningApps") {
SettingsData.setRunningAppsCompactMode(value) SettingsData.setRunningAppsCompactMode(
value)
} }
} }
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => { onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
topBarTab.handleGpuSelectionChanged( topBarTab.handleGpuSelectionChanged(
sectionId, widgetIndex, selectedIndex) sectionId, widgetIndex,
selectedIndex)
} }
} }
} }
@@ -893,7 +929,8 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
onWidgetSelected: (widgetId, targetSection) => { onWidgetSelected: (widgetId, targetSection) => {
topBarTab.addWidgetToSection(widgetId, targetSection) topBarTab.addWidgetToSection(widgetId,
targetSection)
} }
} }
} }

View File

@@ -24,8 +24,10 @@ Item {
width: parent.width width: parent.width
height: enableWeatherSection.implicitHeight + Theme.spacingL * 2 height: enableWeatherSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -47,7 +49,8 @@ Item {
} }
Column { Column {
width: parent.width - Theme.iconSize - Theme.spacingM - enableToggle.width - Theme.spacingM width: parent.width - Theme.iconSize - Theme.spacingM
- enableToggle.width - Theme.spacingM
spacing: Theme.spacingXS spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -65,7 +68,6 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
DankToggle { DankToggle {
@@ -73,15 +75,13 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: SettingsData.weatherEnabled checked: SettingsData.weatherEnabled
onToggled: (checked) => { onToggled: checked => {
return SettingsData.setWeatherEnabled(checked); return SettingsData.setWeatherEnabled(
checked)
} }
} }
} }
} }
} }
// Temperature Unit // Temperature Unit
@@ -89,8 +89,10 @@ Item {
width: parent.width width: parent.width
height: temperatureSection.implicitHeight + Theme.spacingL * 2 height: temperatureSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
visible: SettingsData.weatherEnabled visible: SettingsData.weatherEnabled
opacity: visible ? 1 : 0 opacity: visible ? 1 : 0
@@ -114,7 +116,8 @@ Item {
} }
Column { Column {
width: parent.width - Theme.iconSize - Theme.spacingM - temperatureToggle.width - Theme.spacingM width: parent.width - Theme.iconSize - Theme.spacingM
- temperatureToggle.width - Theme.spacingM
spacing: Theme.spacingXS spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -132,7 +135,6 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
DankToggle { DankToggle {
@@ -140,13 +142,12 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: SettingsData.useFahrenheit checked: SettingsData.useFahrenheit
onToggled: (checked) => { onToggled: checked => {
return SettingsData.setTemperatureUnit(checked); return SettingsData.setTemperatureUnit(
checked)
} }
} }
} }
} }
Behavior on opacity { Behavior on opacity {
@@ -155,7 +156,6 @@ Item {
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
} }
// Location Settings // Location Settings
@@ -163,8 +163,10 @@ Item {
width: parent.width width: parent.width
height: locationSection.implicitHeight + Theme.spacingL * 2 height: locationSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
visible: SettingsData.weatherEnabled visible: SettingsData.weatherEnabled
opacity: visible ? 1 : 0 opacity: visible ? 1 : 0
@@ -188,7 +190,8 @@ Item {
} }
Column { Column {
width: parent.width - Theme.iconSize - Theme.spacingM - autoLocationToggle.width - Theme.spacingM width: parent.width - Theme.iconSize - Theme.spacingM
- autoLocationToggle.width - Theme.spacingM
spacing: Theme.spacingXS spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -206,7 +209,6 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
DankToggle { DankToggle {
@@ -214,11 +216,11 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: SettingsData.useAutoLocation checked: SettingsData.useAutoLocation
onToggled: (checked) => { onToggled: checked => {
return SettingsData.setAutoLocation(checked); return SettingsData.setAutoLocation(
checked)
} }
} }
} }
Column { Column {
@@ -245,12 +247,12 @@ Item {
currentLocation: SettingsData.weatherLocation currentLocation: SettingsData.weatherLocation
placeholderText: "New York, NY" placeholderText: "New York, NY"
onLocationSelected: (displayName, coordinates) => { onLocationSelected: (displayName, coordinates) => {
SettingsData.setWeatherLocation(displayName, coordinates); SettingsData.setWeatherLocation(
displayName,
coordinates)
} }
} }
} }
} }
Behavior on opacity { Behavior on opacity {
@@ -259,11 +261,7 @@ Item {
easing.type: Theme.emphasizedEasing easing.type: Theme.emphasizedEasing
} }
} }
} }
} }
} }
} }

View File

@@ -24,8 +24,10 @@ Item {
width: parent.width width: parent.width
height: launcherButtonSection.implicitHeight + Theme.spacingL * 2 height: launcherButtonSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3) color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2) Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -95,8 +97,10 @@ Item {
bottomPadding: Theme.spacingXS bottomPadding: Theme.spacingXS
onEditingFinished: { onEditingFinished: {
var color = text.trim() var color = text.trim()
if (color === "" || /^#[0-9A-Fa-f]{6}$/.test(color)) if (color === ""
SettingsData.setOSLogoColorOverride(color) || /^#[0-9A-Fa-f]{6}$/.test(color))
SettingsData.setOSLogoColorOverride(
color)
else else
text = SettingsData.osLogoColorOverride text = SettingsData.osLogoColorOverride
} }
@@ -119,7 +123,8 @@ Item {
height: 20 height: 20
minimum: 0 minimum: 0
maximum: 100 maximum: 100
value: Math.round(SettingsData.osLogoBrightness * 100) value: Math.round(
SettingsData.osLogoBrightness * 100)
unit: "%" unit: "%"
showValue: true showValue: true
onSliderValueChanged: newValue => { onSliderValueChanged: newValue => {
@@ -145,7 +150,8 @@ Item {
height: 20 height: 20
minimum: 0 minimum: 0
maximum: 200 maximum: 200
value: Math.round(SettingsData.osLogoContrast * 100) value: Math.round(
SettingsData.osLogoContrast * 100)
unit: "%" unit: "%"
showValue: true showValue: true
onSliderValueChanged: newValue => { onSliderValueChanged: newValue => {
@@ -208,7 +214,8 @@ Item {
description: "Show workspace index numbers in the top bar workspace switcher" description: "Show workspace index numbers in the top bar workspace switcher"
checked: SettingsData.showWorkspaceIndex checked: SettingsData.showWorkspaceIndex
onToggled: checked => { onToggled: checked => {
return SettingsData.setShowWorkspaceIndex(checked) return SettingsData.setShowWorkspaceIndex(
checked)
} }
} }
@@ -218,7 +225,8 @@ Item {
description: "Always show a minimum of 3 workspaces, even if fewer are available" description: "Always show a minimum of 3 workspaces, even if fewer are available"
checked: SettingsData.showWorkspacePadding checked: SettingsData.showWorkspacePadding
onToggled: checked => { onToggled: checked => {
return SettingsData.setShowWorkspacePadding(checked) return SettingsData.setShowWorkspacePadding(
checked)
} }
} }
} }
@@ -277,9 +285,11 @@ Item {
width: parent.width width: parent.width
height: workspaceIconRow.implicitHeight + Theme.spacingM height: workspaceIconRow.implicitHeight + Theme.spacingM
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, color: Qt.rgba(Theme.surfaceContainer.r,
Theme.surfaceContainer.g,
Theme.surfaceContainer.b, 0.5) Theme.surfaceContainer.b, 0.5)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r,
Theme.outline.g,
Theme.outline.b, 0.3) Theme.outline.b, 0.3)
border.width: 1 border.width: 1
@@ -308,26 +318,33 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Component.onCompleted: { Component.onCompleted: {
var iconData = SettingsData.getWorkspaceNameIcon(modelData) var iconData = SettingsData.getWorkspaceNameIcon(
modelData)
if (iconData) { if (iconData) {
setIcon(iconData.value, iconData.type) setIcon(iconData.value,
iconData.type)
} }
} }
onIconSelected: (iconName, iconType) => { onIconSelected: (iconName, iconType) => {
SettingsData.setWorkspaceNameIcon(modelData, { SettingsData.setWorkspaceNameIcon(
type: iconType, modelData, {
value: iconName "type": iconType,
"value": iconName
}) })
setIcon(iconName, iconType) setIcon(iconName,
iconType)
} }
Connections { Connections {
target: SettingsData target: SettingsData
function onWorkspaceIconsUpdated() { function onWorkspaceIconsUpdated() {
var iconData = SettingsData.getWorkspaceNameIcon(modelData) var iconData = SettingsData.getWorkspaceNameIcon(
modelData)
if (iconData) { if (iconData) {
iconPicker.setIcon(iconData.value, iconData.type) iconPicker.setIcon(
iconData.value,
iconData.type)
} else { } else {
iconPicker.setIcon("", "icon") iconPicker.setIcon("", "icon")
} }
@@ -358,7 +375,8 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
SettingsData.removeWorkspaceNameIcon(modelData) SettingsData.removeWorkspaceNameIcon(
modelData)
} }
} }
} }

View File

@@ -245,11 +245,16 @@ Item {
"id": widget.id, "id": widget.id,
"enabled": enabled "enabled": enabled
} }
if (widget.size !== undefined) newWidget.size = widget.size if (widget.size !== undefined)
if (widget.selectedGpuIndex !== undefined) newWidget.selectedGpuIndex = widget.selectedGpuIndex newWidget.size = widget.size
else if (widget.id === "gpuTemp") newWidget.selectedGpuIndex = 0 if (widget.selectedGpuIndex !== undefined)
if (widget.pciId !== undefined) newWidget.pciId = widget.pciId newWidget.selectedGpuIndex = widget.selectedGpuIndex
else if (widget.id === "gpuTemp") newWidget.pciId = "" else if (widget.id === "gpuTemp")
newWidget.selectedGpuIndex = 0
if (widget.pciId !== undefined)
newWidget.pciId = widget.pciId
else if (widget.id === "gpuTemp")
newWidget.pciId = ""
widgets[i] = newWidget widgets[i] = newWidget
} }
break break
@@ -296,8 +301,10 @@ Item {
"enabled": widget.enabled, "enabled": widget.enabled,
"size": newSize "size": newSize
} }
if (widget.selectedGpuIndex !== undefined) newWidget.selectedGpuIndex = widget.selectedGpuIndex if (widget.selectedGpuIndex !== undefined)
if (widget.pciId !== undefined) newWidget.pciId = widget.pciId newWidget.selectedGpuIndex = widget.selectedGpuIndex
if (widget.pciId !== undefined)
newWidget.pciId = widget.pciId
widgets[i] = newWidget widgets[i] = newWidget
} }
break break
@@ -327,16 +334,21 @@ Item {
"id": widget, "id": widget,
"enabled": true, "enabled": true,
"selectedGpuIndex": selectedGpuIndex, "selectedGpuIndex": selectedGpuIndex,
"pciId": DgopService.availableGpus && DgopService.availableGpus.length > selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : "" "pciId": DgopService.availableGpus
&& DgopService.availableGpus.length
> selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : ""
} }
} else { } else {
var newWidget = { var newWidget = {
"id": widget.id, "id": widget.id,
"enabled": widget.enabled, "enabled": widget.enabled,
"selectedGpuIndex": selectedGpuIndex, "selectedGpuIndex": selectedGpuIndex,
"pciId": DgopService.availableGpus && DgopService.availableGpus.length > selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : "" "pciId": DgopService.availableGpus
&& DgopService.availableGpus.length
> selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : ""
} }
if (widget.size !== undefined) newWidget.size = widget.size if (widget.size !== undefined)
newWidget.size = widget.size
widgets[widgetIndex] = newWidget widgets[widgetIndex] = newWidget
} }
} }
@@ -360,7 +372,8 @@ Item {
widgetData = SettingsData.topBarRightWidgets || [] widgetData = SettingsData.topBarRightWidgets || []
widgetData.forEach(widget => { widgetData.forEach(widget => {
var widgetId = typeof widget === "string" ? widget : widget.id var widgetId = typeof widget === "string" ? widget : widget.id
var widgetEnabled = typeof widget === "string" ? true : widget.enabled var widgetEnabled = typeof widget
=== "string" ? true : widget.enabled
var widgetSize = typeof widget === "string" ? undefined : widget.size var widgetSize = typeof widget === "string" ? undefined : widget.size
var widgetSelectedGpuIndex = typeof widget var widgetSelectedGpuIndex = typeof widget
=== "string" ? undefined : widget.selectedGpuIndex === "string" ? undefined : widget.selectedGpuIndex
@@ -394,9 +407,9 @@ Item {
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets) SettingsData.setTopBarCenterWidgets(defaultCenterWidgets)
if (!SettingsData.topBarRightWidgets) if (!SettingsData.topBarRightWidgets)
SettingsData.setTopBarRightWidgets(defaultRightWidgets) SettingsData.setTopBarRightWidgets(
defaultRightWidgets)["left""center""right"].forEach(
["left", "center", "right"].forEach(sectionId => { sectionId => {
var widgets = [] var widgets = []
if (sectionId === "left") if (sectionId === "left")
widgets = SettingsData.topBarLeftWidgets.slice() widgets = SettingsData.topBarLeftWidgets.slice()
@@ -405,16 +418,11 @@ Item {
else if (sectionId === "right") else if (sectionId === "right")
widgets = SettingsData.topBarRightWidgets.slice() widgets = SettingsData.topBarRightWidgets.slice()
var updated = false var updated = false
for (var i = 0; i for (var i = 0; i < widgets.length; i++) {
< widgets.length; i++) {
var widget = widgets[i] var widget = widgets[i]
if (typeof widget === "object" if (typeof widget === "object"
&& widget.id === "spacer" && widget.id === "spacer" && !widget.size) {
&& !widget.size) { widgets[i] = Object.assign({}, widget, {
widgets[i] = Object.assign(
{},
widget,
{
"size": 20 "size": 20
}) })
updated = true updated = true
@@ -422,14 +430,11 @@ Item {
} }
if (updated) { if (updated) {
if (sectionId === "left") if (sectionId === "left")
SettingsData.setTopBarLeftWidgets( SettingsData.setTopBarLeftWidgets(widgets)
widgets)
else if (sectionId === "center") else if (sectionId === "center")
SettingsData.setTopBarCenterWidgets( SettingsData.setTopBarCenterWidgets(widgets)
widgets)
else if (sectionId === "right") else if (sectionId === "right")
SettingsData.setTopBarRightWidgets( SettingsData.setTopBarRightWidgets(widgets)
widgets)
} }
}) })
} }
@@ -480,7 +485,8 @@ Item {
border.color: resetArea.containsMouse ? Theme.outline : Qt.rgba( border.color: resetArea.containsMouse ? Theme.outline : Qt.rgba(
Theme.outline.r, Theme.outline.r,
Theme.outline.g, Theme.outline.g,
Theme.outline.b, 0.5) Theme.outline.b,
0.5)
Row { Row {
anchors.centerIn: parent anchors.centerIn: parent
@@ -509,9 +515,12 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
SettingsData.setTopBarLeftWidgets(defaultLeftWidgets) SettingsData.setTopBarLeftWidgets(
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets) defaultLeftWidgets)
SettingsData.setTopBarRightWidgets(defaultRightWidgets) SettingsData.setTopBarCenterWidgets(
defaultCenterWidgets)
SettingsData.setTopBarRightWidgets(
defaultRightWidgets)
} }
} }
@@ -565,42 +574,46 @@ Item {
allWidgets: widgetsTab.baseWidgetDefinitions allWidgets: widgetsTab.baseWidgetDefinitions
items: widgetsTab.getItemsForSection("left") items: widgetsTab.getItemsForSection("left")
onItemEnabledChanged: (sectionId, itemId, enabled) => { onItemEnabledChanged: (sectionId, itemId, enabled) => {
widgetsTab.handleItemEnabledChanged(sectionId, widgetsTab.handleItemEnabledChanged(
itemId, sectionId, itemId, enabled)
enabled)
} }
onItemOrderChanged: newOrder => { onItemOrderChanged: newOrder => {
widgetsTab.handleItemOrderChanged("left", widgetsTab.handleItemOrderChanged(
newOrder) "left", newOrder)
} }
onAddWidget: sectionId => { onAddWidget: sectionId => {
widgetSelectionPopup.allWidgets = widgetsTab.baseWidgetDefinitions widgetSelectionPopup.allWidgets
= widgetsTab.baseWidgetDefinitions
widgetSelectionPopup.targetSection = sectionId widgetSelectionPopup.targetSection = sectionId
widgetSelectionPopup.safeOpen() widgetSelectionPopup.safeOpen()
} }
onRemoveWidget: (sectionId, widgetIndex) => { onRemoveWidget: (sectionId, widgetIndex) => {
widgetsTab.removeWidgetFromSection(sectionId, widgetsTab.removeWidgetFromSection(
widgetIndex) sectionId, widgetIndex)
} }
onSpacerSizeChanged: (sectionId, itemId, newSize) => { onSpacerSizeChanged: (sectionId, itemId, newSize) => {
widgetsTab.handleSpacerSizeChanged(sectionId, widgetsTab.handleSpacerSizeChanged(
itemId, sectionId, itemId, newSize)
newSize)
} }
onCompactModeChanged: (widgetId, value) => { onCompactModeChanged: (widgetId, value) => {
if (widgetId === "clock") { if (widgetId === "clock") {
SettingsData.setClockCompactMode(value) SettingsData.setClockCompactMode(
value)
} else if (widgetId === "music") { } else if (widgetId === "music") {
SettingsData.setMediaSize(value) SettingsData.setMediaSize(
value)
} else if (widgetId === "focusedWindow") { } else if (widgetId === "focusedWindow") {
SettingsData.setFocusedWindowCompactMode(value) SettingsData.setFocusedWindowCompactMode(
value)
} else if (widgetId === "runningApps") { } else if (widgetId === "runningApps") {
SettingsData.setRunningAppsCompactMode(value) SettingsData.setRunningAppsCompactMode(
value)
} }
} }
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => { onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
widgetsTab.handleGpuSelectionChanged( widgetsTab.handleGpuSelectionChanged(
sectionId, widgetIndex, selectedIndex) sectionId, widgetIndex,
selectedIndex)
} }
} }
@@ -612,42 +625,46 @@ Item {
allWidgets: widgetsTab.baseWidgetDefinitions allWidgets: widgetsTab.baseWidgetDefinitions
items: widgetsTab.getItemsForSection("center") items: widgetsTab.getItemsForSection("center")
onItemEnabledChanged: (sectionId, itemId, enabled) => { onItemEnabledChanged: (sectionId, itemId, enabled) => {
widgetsTab.handleItemEnabledChanged(sectionId, widgetsTab.handleItemEnabledChanged(
itemId, sectionId, itemId, enabled)
enabled)
} }
onItemOrderChanged: newOrder => { onItemOrderChanged: newOrder => {
widgetsTab.handleItemOrderChanged("center", widgetsTab.handleItemOrderChanged(
newOrder) "center", newOrder)
} }
onAddWidget: sectionId => { onAddWidget: sectionId => {
widgetSelectionPopup.allWidgets = widgetsTab.baseWidgetDefinitions widgetSelectionPopup.allWidgets
= widgetsTab.baseWidgetDefinitions
widgetSelectionPopup.targetSection = sectionId widgetSelectionPopup.targetSection = sectionId
widgetSelectionPopup.safeOpen() widgetSelectionPopup.safeOpen()
} }
onRemoveWidget: (sectionId, widgetIndex) => { onRemoveWidget: (sectionId, widgetIndex) => {
widgetsTab.removeWidgetFromSection(sectionId, widgetsTab.removeWidgetFromSection(
widgetIndex) sectionId, widgetIndex)
} }
onSpacerSizeChanged: (sectionId, itemId, newSize) => { onSpacerSizeChanged: (sectionId, itemId, newSize) => {
widgetsTab.handleSpacerSizeChanged(sectionId, widgetsTab.handleSpacerSizeChanged(
itemId, sectionId, itemId, newSize)
newSize)
} }
onCompactModeChanged: (widgetId, value) => { onCompactModeChanged: (widgetId, value) => {
if (widgetId === "clock") { if (widgetId === "clock") {
SettingsData.setClockCompactMode(value) SettingsData.setClockCompactMode(
value)
} else if (widgetId === "music") { } else if (widgetId === "music") {
SettingsData.setMediaSize(value) SettingsData.setMediaSize(
value)
} else if (widgetId === "focusedWindow") { } else if (widgetId === "focusedWindow") {
SettingsData.setFocusedWindowCompactMode(value) SettingsData.setFocusedWindowCompactMode(
value)
} else if (widgetId === "runningApps") { } else if (widgetId === "runningApps") {
SettingsData.setRunningAppsCompactMode(value) SettingsData.setRunningAppsCompactMode(
value)
} }
} }
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => { onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
widgetsTab.handleGpuSelectionChanged( widgetsTab.handleGpuSelectionChanged(
sectionId, widgetIndex, selectedIndex) sectionId, widgetIndex,
selectedIndex)
} }
} }
@@ -659,42 +676,46 @@ Item {
allWidgets: widgetsTab.baseWidgetDefinitions allWidgets: widgetsTab.baseWidgetDefinitions
items: widgetsTab.getItemsForSection("right") items: widgetsTab.getItemsForSection("right")
onItemEnabledChanged: (sectionId, itemId, enabled) => { onItemEnabledChanged: (sectionId, itemId, enabled) => {
widgetsTab.handleItemEnabledChanged(sectionId, widgetsTab.handleItemEnabledChanged(
itemId, sectionId, itemId, enabled)
enabled)
} }
onItemOrderChanged: newOrder => { onItemOrderChanged: newOrder => {
widgetsTab.handleItemOrderChanged("right", widgetsTab.handleItemOrderChanged(
newOrder) "right", newOrder)
} }
onAddWidget: sectionId => { onAddWidget: sectionId => {
widgetSelectionPopup.allWidgets = widgetsTab.baseWidgetDefinitions widgetSelectionPopup.allWidgets
= widgetsTab.baseWidgetDefinitions
widgetSelectionPopup.targetSection = sectionId widgetSelectionPopup.targetSection = sectionId
widgetSelectionPopup.safeOpen() widgetSelectionPopup.safeOpen()
} }
onRemoveWidget: (sectionId, widgetIndex) => { onRemoveWidget: (sectionId, widgetIndex) => {
widgetsTab.removeWidgetFromSection(sectionId, widgetsTab.removeWidgetFromSection(
widgetIndex) sectionId, widgetIndex)
} }
onSpacerSizeChanged: (sectionId, itemId, newSize) => { onSpacerSizeChanged: (sectionId, itemId, newSize) => {
widgetsTab.handleSpacerSizeChanged(sectionId, widgetsTab.handleSpacerSizeChanged(
itemId, sectionId, itemId, newSize)
newSize)
} }
onCompactModeChanged: (widgetId, value) => { onCompactModeChanged: (widgetId, value) => {
if (widgetId === "clock") { if (widgetId === "clock") {
SettingsData.setClockCompactMode(value) SettingsData.setClockCompactMode(
value)
} else if (widgetId === "music") { } else if (widgetId === "music") {
SettingsData.setMediaSize(value) SettingsData.setMediaSize(
value)
} else if (widgetId === "focusedWindow") { } else if (widgetId === "focusedWindow") {
SettingsData.setFocusedWindowCompactMode(value) SettingsData.setFocusedWindowCompactMode(
value)
} else if (widgetId === "runningApps") { } else if (widgetId === "runningApps") {
SettingsData.setRunningAppsCompactMode(value) SettingsData.setRunningAppsCompactMode(
value)
} }
} }
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => { onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
widgetsTab.handleGpuSelectionChanged( widgetsTab.handleGpuSelectionChanged(
sectionId, widgetIndex, selectedIndex) sectionId, widgetIndex,
selectedIndex)
} }
} }
} }
@@ -742,7 +763,8 @@ Item {
description: "Show workspace index numbers in the top bar workspace switcher" description: "Show workspace index numbers in the top bar workspace switcher"
checked: SettingsData.showWorkspaceIndex checked: SettingsData.showWorkspaceIndex
onToggled: checked => { onToggled: checked => {
return SettingsData.setShowWorkspaceIndex(checked) return SettingsData.setShowWorkspaceIndex(
checked)
} }
} }
@@ -752,7 +774,8 @@ Item {
description: "Always show a minimum of 3 workspaces, even if fewer are available" description: "Always show a minimum of 3 workspaces, even if fewer are available"
checked: SettingsData.showWorkspacePadding checked: SettingsData.showWorkspacePadding
onToggled: checked => { onToggled: checked => {
return SettingsData.setShowWorkspacePadding(checked) return SettingsData.setShowWorkspacePadding(
checked)
} }
} }
} }
@@ -811,9 +834,11 @@ Item {
width: parent.width width: parent.width
height: workspaceIconRow.implicitHeight + Theme.spacingM height: workspaceIconRow.implicitHeight + Theme.spacingM
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, color: Qt.rgba(Theme.surfaceContainer.r,
Theme.surfaceContainer.g,
Theme.surfaceContainer.b, 0.5) Theme.surfaceContainer.b, 0.5)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r,
Theme.outline.g,
Theme.outline.b, 0.3) Theme.outline.b, 0.3)
border.width: 1 border.width: 1
@@ -842,26 +867,33 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Component.onCompleted: { Component.onCompleted: {
var iconData = SettingsData.getWorkspaceNameIcon(modelData) var iconData = SettingsData.getWorkspaceNameIcon(
modelData)
if (iconData) { if (iconData) {
setIcon(iconData.value, iconData.type) setIcon(iconData.value,
iconData.type)
} }
} }
onIconSelected: (iconName, iconType) => { onIconSelected: (iconName, iconType) => {
SettingsData.setWorkspaceNameIcon(modelData, { SettingsData.setWorkspaceNameIcon(
type: iconType, modelData, {
value: iconName "type": iconType,
"value": iconName
}) })
setIcon(iconName, iconType) setIcon(iconName,
iconType)
} }
Connections { Connections {
target: SettingsData target: SettingsData
function onWorkspaceIconsUpdated() { function onWorkspaceIconsUpdated() {
var iconData = SettingsData.getWorkspaceNameIcon(modelData) var iconData = SettingsData.getWorkspaceNameIcon(
modelData)
if (iconData) { if (iconData) {
iconPicker.setIcon(iconData.value, iconData.type) iconPicker.setIcon(
iconData.value,
iconData.type)
} else { } else {
iconPicker.setIcon("", "icon") iconPicker.setIcon("", "icon")
} }
@@ -892,7 +924,8 @@ Item {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
SettingsData.removeWorkspaceNameIcon(modelData) SettingsData.removeWorkspaceNameIcon(
modelData)
} }
} }
} }
@@ -909,13 +942,13 @@ Item {
} }
} }
DankWidgetSelectionPopup { DankWidgetSelectionPopup {
id: widgetSelectionPopup id: widgetSelectionPopup
anchors.centerIn: parent anchors.centerIn: parent
onWidgetSelected: (widgetId, targetSection) => { onWidgetSelected: (widgetId, targetSection) => {
widgetsTab.addWidgetToSection(widgetId, targetSection) widgetsTab.addWidgetToSection(widgetId,
targetSection)
} }
} }
} }

View File

@@ -75,7 +75,8 @@ Column {
anchors.fill: parent anchors.fill: parent
anchors.margins: 2 anchors.margins: 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, color: Qt.rgba(Theme.surfaceContainer.r,
Theme.surfaceContainer.g,
Theme.surfaceContainer.b, 0.8) Theme.surfaceContainer.b, 0.8)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2) Theme.outline.b, 0.2)
@@ -121,7 +122,8 @@ Column {
text: modelData.description text: modelData.description
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: modelData.enabled ? Theme.outline : Qt.rgba( color: modelData.enabled ? Theme.outline : Qt.rgba(
Theme.outline.r, Theme.outline.g, Theme.outline.r,
Theme.outline.g,
Theme.outline.b, 0.6) Theme.outline.b, 0.6)
elide: Text.ElideRight elide: Text.ElideRight
width: parent.width width: parent.width
@@ -156,7 +158,8 @@ Column {
} }
return DgopService.availableGpus return DgopService.availableGpus
&& DgopService.availableGpus.length && DgopService.availableGpus.length
> 0 ? DgopService.availableGpus[0].driver.toUpperCase() : "" > 0 ? DgopService.availableGpus[0].driver.toUpperCase(
) : ""
} }
options: { options: {
var gpuOptions = [] var gpuOptions = []
@@ -164,15 +167,19 @@ Column {
&& DgopService.availableGpus.length > 0) { && DgopService.availableGpus.length > 0) {
for (var i = 0; i < DgopService.availableGpus.length; i++) { for (var i = 0; i < DgopService.availableGpus.length; i++) {
var gpu = DgopService.availableGpus[i] var gpu = DgopService.availableGpus[i]
gpuOptions.push(gpu.driver.toUpperCase()) gpuOptions.push(
gpu.driver.toUpperCase(
))
} }
} }
return gpuOptions return gpuOptions
} }
onValueChanged: value => { onValueChanged: value => {
var gpuIndex = options.indexOf(value) var gpuIndex = options.indexOf(
value)
if (gpuIndex >= 0) { if (gpuIndex >= 0) {
root.gpuSelectionChanged(root.sectionId, root.gpuSelectionChanged(
root.sectionId,
index, gpuIndex) index, gpuIndex)
} }
} }
@@ -182,7 +189,12 @@ Column {
Item { Item {
width: 32 width: 32
height: 32 height: 32
visible: (modelData.warning !== undefined && modelData.warning !== "") && (modelData.id === "cpuUsage" || modelData.id === "memUsage" || modelData.id === "cpuTemp" || modelData.id === "gpuTemp") visible: (modelData.warning !== undefined
&& modelData.warning !== "")
&& (modelData.id === "cpuUsage"
|| modelData.id === "memUsage"
|| modelData.id === "cpuTemp"
|| modelData.id === "gpuTemp")
DankIcon { DankIcon {
name: "warning" name: "warning"
@@ -202,15 +214,20 @@ Column {
Rectangle { Rectangle {
id: warningTooltip id: warningTooltip
property string warningText: (modelData.warning !== undefined && modelData.warning !== "") ? modelData.warning : "" property string warningText: (modelData.warning !== undefined
&& modelData.warning
!== "") ? modelData.warning : ""
width: Math.min(250, warningTooltipText.implicitWidth) + Theme.spacingM * 2 width: Math.min(
250,
warningTooltipText.implicitWidth) + Theme.spacingM * 2
height: warningTooltipText.implicitHeight + Theme.spacingS * 2 height: warningTooltipText.implicitHeight + Theme.spacingS * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Theme.surfaceContainer color: Theme.surfaceContainer
border.color: Theme.outline border.color: Theme.outline
border.width: 1 border.width: 1
visible: warningArea.containsMouse && warningText !== "" visible: warningArea.containsMouse
&& warningText !== ""
opacity: visible ? 1 : 0 opacity: visible ? 1 : 0
x: -width - Theme.spacingS x: -width - Theme.spacingS
y: (parent.height - height) / 2 y: (parent.height - height) / 2
@@ -238,7 +255,10 @@ Column {
Row { Row {
spacing: Theme.spacingXS spacing: Theme.spacingXS
visible: modelData.id === "clock" || modelData.id === "music" || modelData.id === "focusedWindow" || modelData.id === "runningApps" visible: modelData.id === "clock"
|| modelData.id === "music"
|| modelData.id === "focusedWindow"
|| modelData.id === "runningApps"
DankActionButton { DankActionButton {
id: smallSizeButton id: smallSizeButton
@@ -246,7 +266,8 @@ Column {
visible: modelData.id === "music" visible: modelData.id === "music"
iconName: "photo_size_select_small" iconName: "photo_size_select_small"
iconSize: 16 iconSize: 16
iconColor: SettingsData.mediaSize === 0 ? Theme.primary : Theme.outline iconColor: SettingsData.mediaSize
=== 0 ? Theme.primary : Theme.outline
onClicked: { onClicked: {
root.compactModeChanged("music", 0) root.compactModeChanged("music", 0)
} }
@@ -258,7 +279,8 @@ Column {
visible: modelData.id === "music" visible: modelData.id === "music"
iconName: "photo_size_select_actual" iconName: "photo_size_select_actual"
iconSize: 16 iconSize: 16
iconColor: SettingsData.mediaSize === 1 ? Theme.primary : Theme.outline iconColor: SettingsData.mediaSize
=== 1 ? Theme.primary : Theme.outline
onClicked: { onClicked: {
root.compactModeChanged("music", 1) root.compactModeChanged("music", 1)
} }
@@ -270,7 +292,8 @@ Column {
visible: modelData.id === "music" visible: modelData.id === "music"
iconName: "photo_size_select_large" iconName: "photo_size_select_large"
iconSize: 16 iconSize: 16
iconColor: SettingsData.mediaSize === 2 ? Theme.primary : Theme.outline iconColor: SettingsData.mediaSize
=== 2 ? Theme.primary : Theme.outline
onClicked: { onClicked: {
root.compactModeChanged("music", 2) root.compactModeChanged("music", 2)
} }
@@ -279,27 +302,41 @@ Column {
DankActionButton { DankActionButton {
id: compactModeButton id: compactModeButton
buttonSize: 28 buttonSize: 28
visible: modelData.id === "clock" || modelData.id === "focusedWindow" || modelData.id === "runningApps" visible: modelData.id === "clock"
|| modelData.id === "focusedWindow"
|| modelData.id === "runningApps"
iconName: { iconName: {
if (modelData.id === "clock") return SettingsData.clockCompactMode ? "zoom_out" : "zoom_in" if (modelData.id === "clock")
if (modelData.id === "focusedWindow") return SettingsData.focusedWindowCompactMode ? "zoom_out" : "zoom_in" return SettingsData.clockCompactMode ? "zoom_out" : "zoom_in"
if (modelData.id === "runningApps") return SettingsData.runningAppsCompactMode ? "zoom_out" : "zoom_in" if (modelData.id === "focusedWindow")
return SettingsData.focusedWindowCompactMode ? "zoom_out" : "zoom_in"
if (modelData.id === "runningApps")
return SettingsData.runningAppsCompactMode ? "zoom_out" : "zoom_in"
return "zoom_in" return "zoom_in"
} }
iconSize: 16 iconSize: 16
iconColor: { iconColor: {
if (modelData.id === "clock") return SettingsData.clockCompactMode ? Theme.primary : Theme.outline if (modelData.id === "clock")
if (modelData.id === "focusedWindow") return SettingsData.focusedWindowCompactMode ? Theme.primary : Theme.outline return SettingsData.clockCompactMode ? Theme.primary : Theme.outline
if (modelData.id === "runningApps") return SettingsData.runningAppsCompactMode ? Theme.primary : Theme.outline if (modelData.id === "focusedWindow")
return SettingsData.focusedWindowCompactMode ? Theme.primary : Theme.outline
if (modelData.id === "runningApps")
return SettingsData.runningAppsCompactMode ? Theme.primary : Theme.outline
return Theme.outline return Theme.outline
} }
onClicked: { onClicked: {
if (modelData.id === "clock") { if (modelData.id === "clock") {
root.compactModeChanged("clock", !SettingsData.clockCompactMode) root.compactModeChanged(
"clock",
!SettingsData.clockCompactMode)
} else if (modelData.id === "focusedWindow") { } else if (modelData.id === "focusedWindow") {
root.compactModeChanged("focusedWindow", !SettingsData.focusedWindowCompactMode) root.compactModeChanged(
"focusedWindow",
!SettingsData.focusedWindowCompactMode)
} else if (modelData.id === "runningApps") { } else if (modelData.id === "runningApps") {
root.compactModeChanged("runningApps", !SettingsData.runningAppsCompactMode) root.compactModeChanged(
"runningApps",
!SettingsData.runningAppsCompactMode)
} }
} }
} }
@@ -342,7 +379,8 @@ Column {
iconSize: 18 iconSize: 18
iconColor: modelData.enabled ? Theme.primary : Theme.outline iconColor: modelData.enabled ? Theme.primary : Theme.outline
onClicked: { onClicked: {
root.itemEnabledChanged(root.sectionId, modelData.id, root.itemEnabledChanged(root.sectionId,
modelData.id,
!modelData.enabled) !modelData.enabled)
} }
} }
@@ -360,7 +398,9 @@ Column {
onClicked: { onClicked: {
var currentSize = modelData.size || 20 var currentSize = modelData.size || 20
var newSize = Math.max(5, currentSize - 5) var newSize = Math.max(5, currentSize - 5)
root.spacerSizeChanged(root.sectionId, modelData.id, newSize) root.spacerSizeChanged(root.sectionId,
modelData.id,
newSize)
} }
} }
@@ -378,8 +418,11 @@ Column {
iconColor: Theme.outline iconColor: Theme.outline
onClicked: { onClicked: {
var currentSize = modelData.size || 20 var currentSize = modelData.size || 20
var newSize = Math.min(5000, currentSize + 5) var newSize = Math.min(5000,
root.spacerSizeChanged(root.sectionId, modelData.id, newSize) currentSize + 5)
root.spacerSizeChanged(root.sectionId,
modelData.id,
newSize)
} }
} }
} }
@@ -417,12 +460,15 @@ Column {
delegateItem.z = 1 delegateItem.z = 1
if (drag.active) { if (drag.active) {
var newIndex = Math.round( var newIndex = Math.round(
delegateItem.y / (delegateItem.height + itemsList.spacing)) delegateItem.y / (delegateItem.height
newIndex = Math.max(0, Math.min(newIndex, + itemsList.spacing))
newIndex = Math.max(
0, Math.min(newIndex,
root.items.length - 1)) root.items.length - 1))
if (newIndex !== index) { if (newIndex !== index) {
var newItems = root.items.slice() var newItems = root.items.slice()
var draggedItem = newItems.splice(index, 1)[0] var draggedItem = newItems.splice(index,
1)[0]
newItems.splice(newIndex, 0, draggedItem) newItems.splice(newIndex, 0, draggedItem)
root.itemOrderChanged(newItems.map(item => { root.itemOrderChanged(newItems.map(item => {
return ({ return ({

View File

@@ -39,7 +39,8 @@ PanelWindow {
} }
} }
width: ToastService.hasDetails ? 380 : messageText.implicitWidth + Theme.iconSize + Theme.spacingM * 3 + Theme.spacingL * 2 width: ToastService.hasDetails ? 380 : messageText.implicitWidth + Theme.iconSize
+ Theme.spacingM * 3 + Theme.spacingL * 2
height: toastContent.height + Theme.spacingL * 2 height: toastContent.height + Theme.spacingL * 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
y: Theme.barHeight - 4 + SettingsData.topBarSpacing + 2 y: Theme.barHeight - 4 + SettingsData.topBarSpacing + 2
@@ -177,7 +178,8 @@ PanelWindow {
property bool showTooltip: false property bool showTooltip: false
onClicked: { onClicked: {
Quickshell.execDetached(["wl-copy", ToastService.currentDetails]) Quickshell.execDetached(
["wl-copy", ToastService.currentDetails])
showTooltip = true showTooltip = true
tooltipTimer.start() tooltipTimer.start()
} }
@@ -237,7 +239,6 @@ PanelWindow {
} }
} }
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration

View File

@@ -49,7 +49,8 @@ Item {
height: { height: {
if (root.isPlaying && CavaService.values.length > index) { if (root.isPlaying && CavaService.values.length > index) {
const rawLevel = CavaService.values[index] || 0 const rawLevel = CavaService.values[index] || 0
const scaledLevel = Math.sqrt(Math.min(Math.max(rawLevel, 0), const scaledLevel = Math.sqrt(
Math.min(Math.max(rawLevel, 0),
100) / 100) * 100 100) / 100) * 100
const maxHeight = Theme.iconSize - 2 const maxHeight = Theme.iconSize - 2
const minHeight = 3 const minHeight = 3

View File

@@ -131,8 +131,8 @@ Rectangle {
var currentScreen = parentScreen || Screen var currentScreen = parentScreen || Screen
var screenX = currentScreen.x || 0 var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX var relativeX = globalPos.x - screenX
popupTarget.setTriggerPosition(relativeX, popupTarget.setTriggerPosition(
Theme.barHeight + Theme.spacingXS, relativeX, Theme.barHeight + Theme.spacingXS,
width, section, currentScreen) width, section, currentScreen)
} }
toggleBatteryPopup() toggleBatteryPopup()

View File

@@ -50,7 +50,6 @@ DankPopout {
shouldBeVisible: false shouldBeVisible: false
visible: shouldBeVisible visible: shouldBeVisible
content: Component { content: Component {
Rectangle { Rectangle {
id: batteryContent id: batteryContent
@@ -167,7 +166,8 @@ DankPopout {
width: parent.width width: parent.width
height: 80 height: 80
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, Theme.surfaceVariant.b,
Theme.getContentBackgroundAlpha() * 0.4) Theme.getContentBackgroundAlpha() * 0.4)
border.color: BatteryService.isCharging ? Theme.primary : (BatteryService.isLowBattery ? Theme.error : Theme.outlineMedium) border.color: BatteryService.isCharging ? Theme.primary : (BatteryService.isLowBattery ? Theme.error : Theme.outlineMedium)
@@ -187,7 +187,8 @@ DankPopout {
return "power" return "power"
// Check if plugged in but not charging (like at 80% charge limit) // Check if plugged in but not charging (like at 80% charge limit)
if (!BatteryService.isCharging && BatteryService.isPluggedIn) { if (!BatteryService.isCharging
&& BatteryService.isPluggedIn) {
if (BatteryService.batteryLevel >= 90) if (BatteryService.batteryLevel >= 90)
return "battery_charging_full" return "battery_charging_full"
if (BatteryService.batteryLevel >= 80) if (BatteryService.batteryLevel >= 80)
@@ -235,10 +236,12 @@ DankPopout {
} }
size: Theme.iconSizeLarge size: Theme.iconSizeLarge
color: { color: {
if (BatteryService.isLowBattery && !BatteryService.isCharging) if (BatteryService.isLowBattery
&& !BatteryService.isCharging)
return Theme.error return Theme.error
if (BatteryService.isCharging || BatteryService.isPluggedIn) if (BatteryService.isCharging
|| BatteryService.isPluggedIn)
return Theme.primary return Theme.primary
return Theme.surfaceText return Theme.surfaceText
@@ -291,8 +294,7 @@ DankPopout {
text: { text: {
let time = BatteryService.formatTimeRemaining() let time = BatteryService.formatTimeRemaining()
if (time !== "Unknown") if (time !== "Unknown")
return BatteryService.isCharging ? "Time until full: " return BatteryService.isCharging ? "Time until full: " + time : "Time remaining: " + time
+ time : "Time remaining: " + time
return "" return ""
} }
@@ -308,7 +310,8 @@ DankPopout {
width: parent.width width: parent.width
height: 80 height: 80
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r,
Theme.surfaceVariant.g,
Theme.surfaceVariant.b, Theme.surfaceVariant.b,
Theme.getContentBackgroundAlpha() * 0.4) Theme.getContentBackgroundAlpha() * 0.4)
border.color: Theme.outlineMedium border.color: Theme.outlineMedium
@@ -380,7 +383,8 @@ DankPopout {
if (BatteryService.batteryHealth === "N/A") if (BatteryService.batteryHealth === "N/A")
return Theme.surfaceText return Theme.surfaceText
var healthNum = parseInt(BatteryService.batteryHealth) var healthNum = parseInt(
BatteryService.batteryHealth)
return healthNum < 80 ? Theme.error : Theme.surfaceText return healthNum < 80 ? Theme.error : Theme.surfaceText
} }
} }
@@ -398,7 +402,8 @@ DankPopout {
} }
StyledText { StyledText {
text: BatteryService.batteryCapacity > 0 ? BatteryService.batteryCapacity.toFixed( text: BatteryService.batteryCapacity
> 0 ? BatteryService.batteryCapacity.toFixed(
1) + " Wh" : "Unknown" 1) + " Wh" : "Unknown"
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText color: Theme.surfaceText
@@ -424,9 +429,7 @@ DankPopout {
spacing: Theme.spacingS spacing: Theme.spacingS
Repeater { Repeater {
model: (typeof PowerProfiles model: (typeof PowerProfiles !== "undefined") ? [PowerProfile.PowerSaver, PowerProfile.Balanced].concat(PowerProfiles.hasPerformanceProfile ? [PowerProfile.Performance] : []) : [PowerProfile.PowerSaver, PowerProfile.Balanced, PowerProfile.Performance]
!== "undefined") ? [PowerProfile.PowerSaver, PowerProfile.Balanced].concat(
PowerProfiles.hasPerformanceProfile ? [PowerProfile.Performance] : []) : [PowerProfile.PowerSaver, PowerProfile.Balanced, PowerProfile.Performance]
Rectangle { Rectangle {
width: parent.width width: parent.width
@@ -435,7 +438,8 @@ DankPopout {
color: profileArea.containsMouse ? Theme.primaryHoverLight : (root.isActiveProfile(modelData) ? Theme.primaryPressed : Theme.surfaceLight) color: profileArea.containsMouse ? Theme.primaryHoverLight : (root.isActiveProfile(modelData) ? Theme.primaryPressed : Theme.surfaceLight)
border.color: root.isActiveProfile( border.color: root.isActiveProfile(
modelData) ? Theme.primary : Theme.outlineLight modelData) ? Theme.primary : Theme.outlineLight
border.width: root.isActiveProfile(modelData) ? 2 : 1 border.width: root.isActiveProfile(
modelData) ? 2 : 1
Row { Row {
anchors.left: parent.left anchors.left: parent.left
@@ -444,7 +448,8 @@ DankPopout {
spacing: Theme.spacingM spacing: Theme.spacingM
DankIcon { DankIcon {
name: Theme.getPowerProfileIcon(modelData) name: Theme.getPowerProfileIcon(
modelData)
size: Theme.iconSize size: Theme.iconSize
color: root.isActiveProfile( color: root.isActiveProfile(
modelData) ? Theme.primary : Theme.surfaceText modelData) ? Theme.primary : Theme.surfaceText
@@ -456,7 +461,8 @@ DankPopout {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
StyledText { StyledText {
text: Theme.getPowerProfileLabel(modelData) text: Theme.getPowerProfileLabel(
modelData)
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: root.isActiveProfile( color: root.isActiveProfile(
modelData) ? Theme.primary : Theme.surfaceText modelData) ? Theme.primary : Theme.surfaceText
@@ -465,7 +471,8 @@ DankPopout {
} }
StyledText { StyledText {
text: Theme.getPowerProfileDescription(modelData) text: Theme.getPowerProfileDescription(
modelData)
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceTextMedium color: Theme.surfaceTextMedium
} }
@@ -495,7 +502,8 @@ DankPopout {
border.color: Theme.primarySelected border.color: Theme.primarySelected
border.width: 1 border.width: 1
visible: (typeof PowerProfiles !== "undefined") visible: (typeof PowerProfiles !== "undefined")
&& PowerProfiles.degradationReason !== PerformanceDegradationReason.None && PowerProfiles.degradationReason
!== PerformanceDegradationReason.None
Row { Row {
anchors.left: parent.left anchors.left: parent.left

View File

@@ -12,17 +12,18 @@ Rectangle {
property var popupTarget: null property var popupTarget: null
property var parentScreen: null property var parentScreen: null
signal clockClicked() signal clockClicked
width: clockRow.implicitWidth + Theme.spacingS * 2 width: clockRow.implicitWidth + Theme.spacingS * 2
height: 30 height: 30
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
const baseColor = clockMouseArea.containsMouse ? Theme.primaryHover : Theme.surfaceTextHover; const baseColor = clockMouseArea.containsMouse ? Theme.primaryHover : Theme.surfaceTextHover
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency); return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
baseColor.a * Theme.widgetTransparency)
} }
Component.onCompleted: { Component.onCompleted: {
root.currentDate = systemClock.date; root.currentDate = systemClock.date
} }
Row { Row {
@@ -32,7 +33,10 @@ Rectangle {
spacing: Theme.spacingS spacing: Theme.spacingS
StyledText { StyledText {
text: SettingsData.use24HourClock ? Qt.formatTime(root.currentDate, "H:mm") : Qt.formatTime(root.currentDate, "h:mm AP") text: SettingsData.use24HourClock ? Qt.formatTime(
root.currentDate,
"H:mm") : Qt.formatTime(
root.currentDate, "h:mm AP")
font.pixelSize: Theme.fontSizeMedium - 1 font.pixelSize: Theme.fontSizeMedium - 1
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -53,7 +57,6 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: !SettingsData.clockCompactMode visible: !SettingsData.clockCompactMode
} }
} }
SystemClock { SystemClock {
@@ -71,13 +74,15 @@ Rectangle {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onPressed: { onPressed: {
if (popupTarget && popupTarget.setTriggerPosition) { if (popupTarget && popupTarget.setTriggerPosition) {
var globalPos = mapToGlobal(0, 0); var globalPos = mapToGlobal(0, 0)
var currentScreen = parentScreen || Screen; var currentScreen = parentScreen || Screen
var screenX = currentScreen.x || 0; var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX; var relativeX = globalPos.x - screenX
popupTarget.setTriggerPosition(relativeX, Theme.barHeight + Theme.spacingXS, width, section, currentScreen); popupTarget.setTriggerPosition(
relativeX, Theme.barHeight + Theme.spacingXS,
width, section, currentScreen)
} }
root.clockClicked(); root.clockClicked()
} }
} }
@@ -86,7 +91,5 @@ Rectangle {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
} }

View File

@@ -36,7 +36,8 @@ Rectangle {
return NetworkService.wifiSignalIcon return NetworkService.wifiSignalIcon
} }
size: Theme.iconSize - 8 size: Theme.iconSize - 8
color: NetworkService.networkStatus !== "disconnected" ? Theme.primary : Theme.outlineButton color: NetworkService.networkStatus
!== "disconnected" ? Theme.primary : Theme.outlineButton
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: true visible: true
} }
@@ -60,7 +61,8 @@ Rectangle {
name: { name: {
if (AudioService.sink && AudioService.sink.audio) { if (AudioService.sink && AudioService.sink.audio) {
if (AudioService.sink.audio.muted || AudioService.sink.audio.volume === 0) if (AudioService.sink.audio.muted
|| AudioService.sink.audio.volume === 0)
return "volume_off" return "volume_off"
else if (AudioService.sink.audio.volume * 100 < 33) else if (AudioService.sink.audio.volume * 100 < 33)
return "volume_down" return "volume_down"
@@ -70,7 +72,8 @@ Rectangle {
return "volume_up" return "volume_up"
} }
size: Theme.iconSize - 8 size: Theme.iconSize - 8
color: audioWheelArea.containsMouse || controlCenterArea.containsMouse color: audioWheelArea.containsMouse
|| controlCenterArea.containsMouse
|| root.isActive ? Theme.primary : Theme.surfaceText || root.isActive ? Theme.primary : Theme.surfaceText
anchors.centerIn: parent anchors.centerIn: parent
} }
@@ -83,8 +86,10 @@ Rectangle {
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
onWheel: function (wheelEvent) { onWheel: function (wheelEvent) {
let delta = wheelEvent.angleDelta.y let delta = wheelEvent.angleDelta.y
let currentVolume = (AudioService.sink && AudioService.sink.audio let currentVolume = (AudioService.sink
&& AudioService.sink.audio.volume * 100) || 0 && AudioService.sink.audio
&& AudioService.sink.audio.volume * 100)
|| 0
let newVolume let newVolume
if (delta > 0) if (delta > 0)
newVolume = Math.min(100, currentVolume + 5) newVolume = Math.min(100, currentVolume + 5)
@@ -120,8 +125,8 @@ Rectangle {
var currentScreen = parentScreen || Screen var currentScreen = parentScreen || Screen
var screenX = currentScreen.x || 0 var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX var relativeX = globalPos.x - screenX
popupTarget.setTriggerPosition(relativeX, popupTarget.setTriggerPosition(
Theme.barHeight + Theme.spacingXS, relativeX, Theme.barHeight + Theme.spacingXS,
width, section, currentScreen) width, section, currentScreen)
} }
root.clicked() root.clicked()

View File

@@ -41,8 +41,8 @@ Rectangle {
var currentScreen = parentScreen || Screen var currentScreen = parentScreen || Screen
var screenX = currentScreen.x || 0 var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX var relativeX = globalPos.x - screenX
popupTarget.setTriggerPosition(relativeX, popupTarget.setTriggerPosition(
Theme.barHeight + Theme.spacingXS, relativeX, Theme.barHeight + Theme.spacingXS,
width, section, currentScreen) width, section, currentScreen)
} }
DgopService.setSortBy("cpu") DgopService.setSortBy("cpu")

View File

@@ -41,8 +41,8 @@ Rectangle {
var currentScreen = parentScreen || Screen var currentScreen = parentScreen || Screen
var screenX = currentScreen.x || 0 var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX var relativeX = globalPos.x - screenX
popupTarget.setTriggerPosition(relativeX, popupTarget.setTriggerPosition(
Theme.barHeight + Theme.spacingXS, relativeX, Theme.barHeight + Theme.spacingXS,
width, section, currentScreen) width, section, currentScreen)
} }
DgopService.setSortBy("cpu") DgopService.setSortBy("cpu")

View File

@@ -13,15 +13,18 @@ Rectangle {
readonly property int maxNormalWidth: 456 readonly property int maxNormalWidth: 456
readonly property int maxCompactWidth: 288 readonly property int maxCompactWidth: 288
width: compactMode ? Math.min(baseWidth, maxCompactWidth) : Math.min(baseWidth, maxNormalWidth) width: compactMode ? Math.min(baseWidth,
maxCompactWidth) : Math.min(baseWidth,
maxNormalWidth)
height: 30 height: 30
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
if (!NiriService.focusedWindowTitle) if (!NiriService.focusedWindowTitle)
return "transparent"; return "transparent"
const baseColor = mouseArea.containsMouse ? Theme.primaryHover : Theme.surfaceTextHover; const baseColor = mouseArea.containsMouse ? Theme.primaryHover : Theme.surfaceTextHover
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency); return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
baseColor.a * Theme.widgetTransparency)
} }
clip: true clip: true
visible: NiriService.niriAvailable && NiriService.focusedWindowTitle visible: NiriService.niriAvailable && NiriService.focusedWindowTitle
@@ -37,16 +40,17 @@ Rectangle {
text: { text: {
if (!NiriService.focusedWindowId) if (!NiriService.focusedWindowId)
return ""; return ""
var window = NiriService.windows.find((w) => { var window = NiriService.windows.find(w => {
return w.id == NiriService.focusedWindowId; return w.id == NiriService.focusedWindowId
}); })
if (!window || !window.app_id) if (!window || !window.app_id)
return ""; return ""
var desktopEntry = DesktopEntries.byId(window.app_id); var desktopEntry = DesktopEntries.byId(window.app_id)
return desktopEntry && desktopEntry.name ? desktopEntry.name : window.app_id; return desktopEntry
&& desktopEntry.name ? desktopEntry.name : window.app_id
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium font.weight: Font.Medium
@@ -70,20 +74,24 @@ Rectangle {
id: titleText id: titleText
text: { text: {
var title = NiriService.focusedWindowTitle || ""; var title = NiriService.focusedWindowTitle || ""
var appName = appText.text; var appName = appText.text
if (!title || !appName) return title; if (!title || !appName)
return title
// Remove app name from end of title if it exists there // Remove app name from end of title if it exists there
if (title.endsWith(" - " + appName)) { if (title.endsWith(" - " + appName)) {
return title.substring(0, title.length - (" - " + appName).length); return title.substring(
0, title.length - (" - " + appName).length)
} }
if (title.endsWith(appName)) { if (title.endsWith(appName)) {
return title.substring(0, title.length - appName.length).replace(/ - $/, ""); return title.substring(
0, title.length - appName.length).replace(
/ - $/, "")
} }
return title; return title
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium font.weight: Font.Medium
@@ -94,7 +102,6 @@ Rectangle {
width: Math.min(implicitWidth, compactMode ? 280 : 250) width: Math.min(implicitWidth, compactMode ? 280 : 250)
visible: text.length > 0 visible: text.length > 0
} }
} }
MouseArea { MouseArea {
@@ -109,7 +116,6 @@ Rectangle {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
Behavior on width { Behavior on width {
@@ -117,7 +123,5 @@ Rectangle {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
} }

View File

@@ -38,7 +38,10 @@ Rectangle {
} }
Component.onCompleted: { Component.onCompleted: {
DgopService.addRef(["gpu"]) DgopService.addRef(["gpu"])
console.log("GpuTemperature widget - pciId:", widgetData ? widgetData.pciId : "no widgetData", "selectedGpuIndex:", widgetData ? widgetData.selectedGpuIndex : "no widgetData") console.log("GpuTemperature widget - pciId:",
widgetData ? widgetData.pciId : "no widgetData",
"selectedGpuIndex:",
widgetData ? widgetData.selectedGpuIndex : "no widgetData")
// Add this widget's PCI ID to the service // Add this widget's PCI ID to the service
if (widgetData && widgetData.pciId) { if (widgetData && widgetData.pciId) {
console.log("Adding GPU PCI ID to service:", widgetData.pciId) console.log("Adding GPU PCI ID to service:", widgetData.pciId)
@@ -80,8 +83,8 @@ Rectangle {
var currentScreen = parentScreen || Screen var currentScreen = parentScreen || Screen
var screenX = currentScreen.x || 0 var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX var relativeX = globalPos.x - screenX
popupTarget.setTriggerPosition(relativeX, popupTarget.setTriggerPosition(
Theme.barHeight + Theme.spacingXS, relativeX, Theme.barHeight + Theme.spacingXS,
width, section, currentScreen) width, section, currentScreen)
} }
DgopService.setSortBy("cpu") DgopService.setSortBy("cpu")
@@ -136,7 +139,8 @@ Rectangle {
interval: 100 interval: 100
running: false running: false
onTriggered: { onTriggered: {
if (DgopService.availableGpus && DgopService.availableGpus.length > 0) { if (DgopService.availableGpus
&& DgopService.availableGpus.length > 0) {
const firstGpu = DgopService.availableGpus[0] const firstGpu = DgopService.availableGpus[0]
if (firstGpu && firstGpu.pciId) { if (firstGpu && firstGpu.pciId) {
// Save the first GPU's PCI ID to this widget's settings // Save the first GPU's PCI ID to this widget's settings
@@ -182,5 +186,4 @@ Rectangle {
} }
} }
} }
} }

View File

@@ -16,9 +16,7 @@ Rectangle {
height: 30 height: 30
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
const baseColor = mouseArea.containsMouse const baseColor = mouseArea.containsMouse ? Theme.primaryPressed : (IdleInhibitorService.idleInhibited ? Theme.primaryHover : Theme.secondaryHover)
? Theme.primaryPressed
: (IdleInhibitorService.idleInhibited ? Theme.primaryHover : Theme.secondaryHover)
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
baseColor.a * Theme.widgetTransparency) baseColor.a * Theme.widgetTransparency)
} }
@@ -42,7 +40,6 @@ Rectangle {
} }
} }
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {
duration: Theme.shortDuration duration: Theme.shortDuration

View File

@@ -29,19 +29,19 @@ Item {
var currentScreen = parentScreen || Screen var currentScreen = parentScreen || Screen
var screenX = currentScreen.x || 0 var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX var relativeX = globalPos.x - screenX
popupTarget.setTriggerPosition(relativeX, popupTarget.setTriggerPosition(
Theme.barHeight + Theme.spacingXS, relativeX, Theme.barHeight + Theme.spacingXS,
width, section, currentScreen) width, section, currentScreen)
} }
root.clicked() root.clicked()
} }
} }
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceTextHover.r, Theme.surfaceTextHover.g, Theme.surfaceTextHover.b, color: Qt.rgba(Theme.surfaceTextHover.r, Theme.surfaceTextHover.g,
Theme.surfaceTextHover.b,
Theme.surfaceTextHover.a * Theme.widgetTransparency) Theme.surfaceTextHover.a * Theme.widgetTransparency)
SystemLogo { SystemLogo {
@@ -61,6 +61,5 @@ Item {
size: Theme.iconSize - 6 size: Theme.iconSize - 6
color: Theme.surfaceText color: Theme.surfaceText
} }
} }
} }

View File

@@ -11,10 +11,13 @@ Rectangle {
readonly property bool playerAvailable: activePlayer !== null readonly property bool playerAvailable: activePlayer !== null
property bool compactMode: false property bool compactMode: false
readonly property int textWidth: { readonly property int textWidth: {
switch(SettingsData.mediaSize) { switch (SettingsData.mediaSize) {
case 0: return 0 // No text in small mode case 0:
case 2: return 180 // Large text area return 0 // No text in small mode
default: return 120 // Medium text area case 2:
return 180 // Large text area
default:
return 120 // Medium text area
} }
} }
@@ -119,7 +122,8 @@ Rectangle {
let identity = activePlayer.identity || "" let identity = activePlayer.identity || ""
let isWebMedia = identity.toLowerCase().includes("firefox") let isWebMedia = identity.toLowerCase().includes("firefox")
|| identity.toLowerCase().includes( || identity.toLowerCase().includes(
"chrome") || identity.toLowerCase().includes("chromium") "chrome") || identity.toLowerCase(
).includes("chromium")
|| identity.toLowerCase().includes( || identity.toLowerCase().includes(
"edge") || identity.toLowerCase().includes("safari") "edge") || identity.toLowerCase().includes("safari")
let title = "" let title = ""
@@ -151,27 +155,36 @@ Rectangle {
SequentialAnimation { SequentialAnimation {
id: scrollAnimation id: scrollAnimation
running: mediaText.needsScrolling && textContainer.visible running: mediaText.needsScrolling
&& textContainer.visible
loops: Animation.Infinite loops: Animation.Infinite
PauseAnimation { duration: 2000 } PauseAnimation {
duration: 2000
}
NumberAnimation { NumberAnimation {
target: mediaText target: mediaText
property: "scrollOffset" property: "scrollOffset"
from: 0 from: 0
to: mediaText.implicitWidth - textContainer.width + 5 to: mediaText.implicitWidth - textContainer.width + 5
duration: Math.max(1000, (mediaText.implicitWidth - textContainer.width + 5) * 60) duration: Math.max(
1000,
(mediaText.implicitWidth - textContainer.width + 5) * 60)
easing.type: Easing.Linear easing.type: Easing.Linear
} }
PauseAnimation { duration: 2000 } PauseAnimation {
duration: 2000
}
NumberAnimation { NumberAnimation {
target: mediaText target: mediaText
property: "scrollOffset" property: "scrollOffset"
to: 0 to: 0
duration: Math.max(1000, (mediaText.implicitWidth - textContainer.width + 5) * 60) duration: Math.max(
1000,
(mediaText.implicitWidth - textContainer.width + 5) * 60)
easing.type: Easing.Linear easing.type: Easing.Linear
} }
} }
@@ -184,18 +197,21 @@ Rectangle {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: root.playerAvailable && root.opacity > 0 && root.width > 0 && textContainer.visible enabled: root.playerAvailable && root.opacity > 0
&& root.width > 0 && textContainer.visible
hoverEnabled: enabled hoverEnabled: enabled
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onPressed: { onPressed: {
if (root.popupTarget && root.popupTarget.setTriggerPosition) { if (root.popupTarget
&& root.popupTarget.setTriggerPosition) {
var globalPos = mapToGlobal(0, 0) var globalPos = mapToGlobal(0, 0)
var currentScreen = root.parentScreen || Screen var currentScreen = root.parentScreen || Screen
var screenX = currentScreen.x || 0 var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX var relativeX = globalPos.x - screenX
root.popupTarget.setTriggerPosition( root.popupTarget.setTriggerPosition(
relativeX, Theme.barHeight + Theme.spacingXS, root.width, relativeX,
root.section, currentScreen) Theme.barHeight + Theme.spacingXS,
root.width, root.section, currentScreen)
} }
root.clicked() root.clicked()
} }

View File

@@ -55,8 +55,8 @@ Rectangle {
var currentScreen = parentScreen || Screen var currentScreen = parentScreen || Screen
var screenX = currentScreen.x || 0 var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX var relativeX = globalPos.x - screenX
popupTarget.setTriggerPosition(relativeX, popupTarget.setTriggerPosition(
Theme.barHeight + Theme.spacingXS, relativeX, Theme.barHeight + Theme.spacingXS,
width, section, currentScreen) width, section, currentScreen)
} }
root.clicked() root.clicked()

View File

@@ -84,7 +84,6 @@ Rectangle {
anchors.top: parent.top anchors.top: parent.top
anchors.rightMargin: -2 anchors.rightMargin: -2
anchors.topMargin: -1 anchors.topMargin: -1
} }
} }

View File

@@ -41,8 +41,8 @@ Rectangle {
var currentScreen = parentScreen || Screen var currentScreen = parentScreen || Screen
var screenX = currentScreen.x || 0 var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX var relativeX = globalPos.x - screenX
popupTarget.setTriggerPosition(relativeX, popupTarget.setTriggerPosition(
Theme.barHeight + Theme.spacingXS, relativeX, Theme.barHeight + Theme.spacingXS,
width, section, currentScreen) width, section, currentScreen)
} }
DgopService.setSortBy("memory") DgopService.setSortBy("memory")

View File

@@ -17,11 +17,13 @@ Rectangle {
property Item windowRoot: (Window.window ? Window.window.contentItem : null) property Item windowRoot: (Window.window ? Window.window.contentItem : null)
readonly property int windowCount: NiriService.windows.length readonly property int windowCount: NiriService.windows.length
readonly property int calculatedWidth: { readonly property int calculatedWidth: {
if (windowCount === 0) return 0; if (windowCount === 0)
return 0
if (SettingsData.runningAppsCompactMode) { if (SettingsData.runningAppsCompactMode) {
return windowCount * 24 + (windowCount - 1) * Theme.spacingXS + Theme.spacingS * 2; return windowCount * 24 + (windowCount - 1) * Theme.spacingXS + Theme.spacingS * 2
} else { } else {
return windowCount * (24 + Theme.spacingXS + 120) + (windowCount - 1) * Theme.spacingXS + Theme.spacingS * 2; return windowCount * (24 + Theme.spacingXS + 120)
+ (windowCount - 1) * Theme.spacingXS + Theme.spacingS * 2
} }
} }
@@ -32,10 +34,11 @@ Rectangle {
clip: false clip: false
color: { color: {
if (windowCount === 0) if (windowCount === 0)
return "transparent"; return "transparent"
const baseColor = Theme.secondaryHover; const baseColor = Theme.secondaryHover
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency); return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
baseColor.a * Theme.widgetTransparency)
} }
Row { Row {
@@ -52,17 +55,19 @@ Rectangle {
delegate: Item { delegate: Item {
id: delegateItem id: delegateItem
property bool isFocused: String(modelData.id) === String(NiriService.focusedWindowId) property bool isFocused: String(modelData.id) === String(
NiriService.focusedWindowId)
property string appId: modelData.app_id || "" property string appId: modelData.app_id || ""
property string windowTitle: modelData.title || "(Unnamed)" property string windowTitle: modelData.title || "(Unnamed)"
property int windowId: modelData.id property int windowId: modelData.id
property string tooltipText: { property string tooltipText: {
var appName = "Unknown"; var appName = "Unknown"
if (appId) { if (appId) {
var desktopEntry = DesktopEntries.byId(appId); var desktopEntry = DesktopEntries.byId(appId)
appName = desktopEntry && desktopEntry.name ? desktopEntry.name : appId; appName = desktopEntry
&& desktopEntry.name ? desktopEntry.name : appId
} }
return appName + (windowTitle ? " • " + windowTitle : ""); return appName + (windowTitle ? " • " + windowTitle : "")
} }
width: SettingsData.runningAppsCompactMode ? 24 : (24 + Theme.spacingXS + 120) width: SettingsData.runningAppsCompactMode ? 24 : (24 + Theme.spacingXS + 120)
@@ -73,9 +78,21 @@ Rectangle {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
if (isFocused) if (isFocused)
return mouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.3) : Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2); return mouseArea.containsMouse ? Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.3) : Qt.rgba(
Theme.primary.r,
Theme.primary.g,
Theme.primary.b,
0.2)
else else
return mouseArea.containsMouse ? Qt.rgba(Theme.primaryHover.r, Theme.primaryHover.g, Theme.primaryHover.b, 0.1) : "transparent"; return mouseArea.containsMouse ? Qt.rgba(
Theme.primaryHover.r,
Theme.primaryHover.g,
Theme.primaryHover.b,
0.1) : "transparent"
} }
Behavior on color { Behavior on color {
@@ -83,9 +100,7 @@ Rectangle {
duration: Theme.shortDuration duration: Theme.shortDuration
easing.type: Theme.standardEasing easing.type: Theme.standardEasing
} }
} }
} }
// App icon // App icon
@@ -99,14 +114,17 @@ Rectangle {
height: 18 height: 18
source: { source: {
if (!appId) if (!appId)
return ""; return ""
var desktopEntry = DesktopEntries.byId(appId); var desktopEntry = DesktopEntries.byId(appId)
if (desktopEntry && desktopEntry.icon) { if (desktopEntry && desktopEntry.icon) {
var iconPath = Quickshell.iconPath(desktopEntry.icon, SettingsData.iconTheme === "System Default" ? "" : SettingsData.iconTheme); var iconPath = Quickshell.iconPath(
return iconPath; desktopEntry.icon,
SettingsData.iconTheme
=== "System Default" ? "" : SettingsData.iconTheme)
return iconPath
} }
return ""; return ""
} }
smooth: true smooth: true
mipmap: true mipmap: true
@@ -122,13 +140,13 @@ Rectangle {
visible: !iconImg.visible visible: !iconImg.visible
text: { text: {
if (!appId) if (!appId)
return "?"; return "?"
var desktopEntry = DesktopEntries.byId(appId); var desktopEntry = DesktopEntries.byId(appId)
if (desktopEntry && desktopEntry.name) if (desktopEntry && desktopEntry.name)
return desktopEntry.name.charAt(0).toUpperCase(); return desktopEntry.name.charAt(0).toUpperCase()
return appId.charAt(0).toUpperCase(); return appId.charAt(0).toUpperCase()
} }
font.pixelSize: 10 font.pixelSize: 10
color: Theme.surfaceText color: Theme.surfaceText
@@ -158,32 +176,33 @@ Rectangle {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
NiriService.focusWindow(windowId); NiriService.focusWindow(windowId)
} }
onEntered: { onEntered: {
root.hoveredItem = delegateItem; root.hoveredItem = delegateItem
var globalPos = delegateItem.mapToGlobal(delegateItem.width / 2, delegateItem.height); var globalPos = delegateItem.mapToGlobal(
tooltipLoader.active = true; delegateItem.width / 2, delegateItem.height)
tooltipLoader.active = true
if (tooltipLoader.item) { if (tooltipLoader.item) {
var tooltipY = Theme.barHeight + SettingsData.topBarSpacing + Theme.spacingXS; var tooltipY = Theme.barHeight
tooltipLoader.item.showTooltip(delegateItem.tooltipText, globalPos.x, tooltipY, root.parentScreen); + SettingsData.topBarSpacing + Theme.spacingXS
tooltipLoader.item.showTooltip(
delegateItem.tooltipText, globalPos.x,
tooltipY, root.parentScreen)
} }
} }
onExited: { onExited: {
if (root.hoveredItem === delegateItem) { if (root.hoveredItem === delegateItem) {
root.hoveredItem = null; root.hoveredItem = null
if (tooltipLoader.item) if (tooltipLoader.item)
tooltipLoader.item.hideTooltip(); tooltipLoader.item.hideTooltip()
tooltipLoader.active = false; tooltipLoader.active = false
} }
} }
} }
} }
} }
} }
Loader { Loader {
@@ -191,9 +210,6 @@ Rectangle {
active: false active: false
sourceComponent: RunningAppsTooltip { sourceComponent: RunningAppsTooltip {}
} }
}
} }

View File

@@ -27,7 +27,9 @@ PanelWindow {
} }
screen: targetScreen screen: targetScreen
implicitWidth: Math.min(300, Math.max(120, textContent.implicitWidth + Theme.spacingM * 2)) implicitWidth: Math.min(300, Math.max(
120,
textContent.implicitWidth + Theme.spacingM * 2))
implicitHeight: textContent.implicitHeight + Theme.spacingS * 2 implicitHeight: textContent.implicitHeight + Theme.spacingS * 2
color: "transparent" color: "transparent"
visible: false visible: false

View File

@@ -95,7 +95,8 @@ Rectangle {
if (!trayItem) if (!trayItem)
return return
if (mouse.button === Qt.LeftButton && !trayItem.onlyMenu) { if (mouse.button === Qt.LeftButton
&& !trayItem.onlyMenu) {
trayItem.activate() trayItem.activate()
return return
} }

View File

@@ -59,31 +59,44 @@ PanelWindow {
function forceWidgetRefresh() { function forceWidgetRefresh() {
// Force reload of all widget sections to handle race condition on desktop hardware // Force reload of all widget sections to handle race condition on desktop hardware
if (leftSection) leftSection.visible = false if (leftSection)
if (centerSection) centerSection.visible = false leftSection.visible = false
if (rightSection) rightSection.visible = false if (centerSection)
centerSection.visible = false
if (rightSection)
rightSection.visible = false
Qt.callLater(() => { Qt.callLater(() => {
if (leftSection) leftSection.visible = true if (leftSection)
if (centerSection) centerSection.visible = true leftSection.visible = true
if (rightSection) rightSection.visible = true if (centerSection)
centerSection.visible = true
if (rightSection)
rightSection.visible = true
}) })
} }
function updateGpuTempConfig() { function updateGpuTempConfig() {
const allWidgets = [...(SettingsData.topBarLeftWidgets || []), const allWidgets = [...(SettingsData.topBarLeftWidgets
...(SettingsData.topBarCenterWidgets || []), || []), ...(SettingsData.topBarCenterWidgets
...(SettingsData.topBarRightWidgets || [])] || []), ...(SettingsData.topBarRightWidgets
|| [])]
const hasGpuTempWidget = allWidgets.some(widget => { const hasGpuTempWidget = allWidgets.some(widget => {
const widgetId = typeof widget === "string" ? widget : widget.id const widgetId = typeof widget
=== "string" ? widget : widget.id
const widgetEnabled = typeof widget === "string" ? true : (widget.enabled !== false) const widgetEnabled = typeof widget === "string" ? true : (widget.enabled !== false)
return widgetId === "gpuTemp" && widgetEnabled return widgetId === "gpuTemp"
&& widgetEnabled
}) })
DgopService.gpuTempEnabled = hasGpuTempWidget || SessionData.nvidiaGpuTempEnabled || SessionData.nonNvidiaGpuTempEnabled DgopService.gpuTempEnabled = hasGpuTempWidget
DgopService.nvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nvidiaGpuTempEnabled || SessionData.nvidiaGpuTempEnabled
DgopService.nonNvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nonNvidiaGpuTempEnabled || SessionData.nonNvidiaGpuTempEnabled
DgopService.nvidiaGpuTempEnabled = hasGpuTempWidget
|| SessionData.nvidiaGpuTempEnabled
DgopService.nonNvidiaGpuTempEnabled = hasGpuTempWidget
|| SessionData.nonNvidiaGpuTempEnabled
} }
Connections { Connections {
@@ -189,8 +202,10 @@ PanelWindow {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
radius: SettingsData.topBarSquareCorners ? 0 : Theme.cornerRadius radius: SettingsData.topBarSquareCorners ? 0 : Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, color: Qt.rgba(Theme.surfaceContainer.r,
Theme.surfaceContainer.b, root.backgroundTransparency) Theme.surfaceContainer.g,
Theme.surfaceContainer.b,
root.backgroundTransparency)
layer.enabled: true layer.enabled: true
Rectangle { Rectangle {
@@ -203,7 +218,8 @@ PanelWindow {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Qt.rgba(Theme.surfaceTint.r, Theme.surfaceTint.g, color: Qt.rgba(Theme.surfaceTint.r,
Theme.surfaceTint.g,
Theme.surfaceTint.b, 0.04) Theme.surfaceTint.b, 0.04)
radius: parent.radius radius: parent.radius
@@ -242,8 +258,7 @@ PanelWindow {
readonly property int launcherButtonWidth: 40 readonly property int launcherButtonWidth: 40
readonly property int workspaceSwitcherWidth: 120 // Approximate readonly property int workspaceSwitcherWidth: 120 // Approximate
readonly property int focusedAppMaxWidth: 456 // Fixed width since we don't have focusedApp reference readonly property int focusedAppMaxWidth: 456 // Fixed width since we don't have focusedApp reference
readonly property int estimatedLeftSectionWidth: launcherButtonWidth + workspaceSwitcherWidth readonly property int estimatedLeftSectionWidth: launcherButtonWidth + workspaceSwitcherWidth + focusedAppMaxWidth + (Theme.spacingXS * 2)
+ focusedAppMaxWidth + (Theme.spacingXS * 2)
readonly property int rightSectionWidth: rightSection.width readonly property int rightSectionWidth: rightSection.width
readonly property int clockWidth: 120 // Approximate clock width readonly property int clockWidth: 120 // Approximate clock width
readonly property int mediaMaxWidth: 280 // Normal max width readonly property int mediaMaxWidth: 280 // Normal max width
@@ -254,19 +269,17 @@ PanelWindow {
readonly property int clockLeftEdge: (availableWidth - clockWidth) / 2 readonly property int clockLeftEdge: (availableWidth - clockWidth) / 2
readonly property int clockRightEdge: clockLeftEdge + clockWidth readonly property int clockRightEdge: clockLeftEdge + clockWidth
readonly property int leftSectionRightEdge: estimatedLeftSectionWidth readonly property int leftSectionRightEdge: estimatedLeftSectionWidth
readonly property int mediaLeftEdge: clockLeftEdge - mediaMaxWidth - Theme.spacingS readonly property int mediaLeftEdge: clockLeftEdge - mediaMaxWidth
- Theme.spacingS
readonly property int rightSectionLeftEdge: availableWidth - rightSectionWidth readonly property int rightSectionLeftEdge: availableWidth - rightSectionWidth
readonly property int leftToClockGap: Math.max( readonly property int leftToClockGap: Math.max(
0, 0,
clockLeftEdge - leftSectionRightEdge) clockLeftEdge - leftSectionRightEdge)
readonly property int leftToMediaGap: mediaMaxWidth > 0 ? Math.max( readonly property int leftToMediaGap: mediaMaxWidth > 0 ? Math.max(0, mediaLeftEdge - leftSectionRightEdge) : leftToClockGap
0,
mediaLeftEdge - leftSectionRightEdge) : leftToClockGap
readonly property int mediaToClockGap: mediaMaxWidth > 0 ? Theme.spacingS : 0 readonly property int mediaToClockGap: mediaMaxWidth > 0 ? Theme.spacingS : 0
readonly property int clockToRightGap: validLayout ? Math.max( readonly property int clockToRightGap: validLayout ? Math.max(
0, 0,
rightSectionLeftEdge rightSectionLeftEdge - clockRightEdge) : 1000
- clockRightEdge) : 1000
readonly property bool spacingTight: validLayout readonly property bool spacingTight: validLayout
&& (leftToMediaGap < 150 && (leftToMediaGap < 150
|| clockToRightGap < 100) || clockToRightGap < 100)
@@ -396,9 +409,12 @@ PanelWindow {
property int spacerSize: model.size || 20 property int spacerSize: model.size || 20
anchors.verticalCenter: parent ? parent.verticalCenter : undefined anchors.verticalCenter: parent ? parent.verticalCenter : undefined
active: topBarContent.getWidgetVisible(model.widgetId) active: topBarContent.getWidgetVisible(
sourceComponent: topBarContent.getWidgetComponent(model.widgetId) model.widgetId)
opacity: topBarContent.getWidgetEnabled(model.enabled) ? 1 : 0 sourceComponent: topBarContent.getWidgetComponent(
model.widgetId)
opacity: topBarContent.getWidgetEnabled(
model.enabled) ? 1 : 0
asynchronous: false asynchronous: false
} }
} }
@@ -443,7 +459,8 @@ PanelWindow {
let parentCenterX = width / 2 let parentCenterX = width / 2
if (totalWidgets % 2 === 1) { if (totalWidgets % 2 === 1) {
let middleIndex = Math.floor(totalWidgets / 2) let middleIndex = Math.floor(totalWidgets / 2)
let currentX = parentCenterX - (centerWidgets[middleIndex].width / 2) let currentX = parentCenterX
- (centerWidgets[middleIndex].width / 2)
centerWidgets[middleIndex].x = currentX centerWidgets[middleIndex].x = currentX
centerWidgets[middleIndex].anchors.horizontalCenter = undefined centerWidgets[middleIndex].anchors.horizontalCenter = undefined
currentX = centerWidgets[middleIndex].x currentX = centerWidgets[middleIndex].x
@@ -452,7 +469,8 @@ PanelWindow {
centerWidgets[i].x = currentX centerWidgets[i].x = currentX
centerWidgets[i].anchors.horizontalCenter = undefined centerWidgets[i].anchors.horizontalCenter = undefined
} }
currentX = centerWidgets[middleIndex].x + centerWidgets[middleIndex].width currentX = centerWidgets[middleIndex].x
+ centerWidgets[middleIndex].width
for (var i = middleIndex + 1; i < totalWidgets; i++) { for (var i = middleIndex + 1; i < totalWidgets; i++) {
currentX += spacing currentX += spacing
centerWidgets[i].x = currentX centerWidgets[i].x = currentX
@@ -475,7 +493,8 @@ PanelWindow {
centerWidgets[i].x = currentX centerWidgets[i].x = currentX
centerWidgets[i].anchors.horizontalCenter = undefined centerWidgets[i].anchors.horizontalCenter = undefined
} }
currentX = centerWidgets[rightMiddleIndex].x + centerWidgets[rightMiddleIndex].width currentX = centerWidgets[rightMiddleIndex].x
+ centerWidgets[rightMiddleIndex].width
for (var i = rightMiddleIndex + 1; i < totalWidgets; i++) { for (var i = rightMiddleIndex + 1; i < totalWidgets; i++) {
currentX += spacing currentX += spacing
centerWidgets[i].x = currentX centerWidgets[i].x = currentX
@@ -517,17 +536,22 @@ PanelWindow {
property int spacerSize: model.size || 20 property int spacerSize: model.size || 20
anchors.verticalCenter: parent ? parent.verticalCenter : undefined anchors.verticalCenter: parent ? parent.verticalCenter : undefined
active: topBarContent.getWidgetVisible(model.widgetId) active: topBarContent.getWidgetVisible(
sourceComponent: topBarContent.getWidgetComponent(model.widgetId) model.widgetId)
opacity: topBarContent.getWidgetEnabled(model.enabled) ? 1 : 0 sourceComponent: topBarContent.getWidgetComponent(
model.widgetId)
opacity: topBarContent.getWidgetEnabled(
model.enabled) ? 1 : 0
asynchronous: false asynchronous: false
onLoaded: { onLoaded: {
if (item) { if (item) {
item.onWidthChanged.connect(centerSection.updateLayout) item.onWidthChanged.connect(
centerSection.updateLayout)
if (model.widgetId === "spacer") if (model.widgetId === "spacer")
item.spacerSize = Qt.binding(() => { item.spacerSize = Qt.binding(() => {
return model.size || 20 return model.size
|| 20
}) })
Qt.callLater(centerSection.updateLayout) Qt.callLater(centerSection.updateLayout)
} }
@@ -564,15 +588,17 @@ PanelWindow {
property int spacerSize: model.size || 20 property int spacerSize: model.size || 20
anchors.verticalCenter: parent ? parent.verticalCenter : undefined anchors.verticalCenter: parent ? parent.verticalCenter : undefined
active: topBarContent.getWidgetVisible(model.widgetId) active: topBarContent.getWidgetVisible(
sourceComponent: topBarContent.getWidgetComponent(model.widgetId) model.widgetId)
opacity: topBarContent.getWidgetEnabled(model.enabled) ? 1 : 0 sourceComponent: topBarContent.getWidgetComponent(
model.widgetId)
opacity: topBarContent.getWidgetEnabled(
model.enabled) ? 1 : 0
asynchronous: false asynchronous: false
} }
} }
} }
Component { Component {
id: clipboardComponent id: clipboardComponent
@@ -582,7 +608,9 @@ PanelWindow {
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
const baseColor = clipboardArea.containsMouse ? Theme.primaryHover : Theme.secondaryHover const baseColor = clipboardArea.containsMouse ? Theme.primaryHover : Theme.secondaryHover
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, return Qt.rgba(
baseColor.r, baseColor.g,
baseColor.b,
baseColor.a * Theme.widgetTransparency) baseColor.a * Theme.widgetTransparency)
} }
@@ -695,7 +723,8 @@ PanelWindow {
onClockClicked: { onClockClicked: {
centcomPopoutLoader.active = true centcomPopoutLoader.active = true
if (centcomPopoutLoader.item) { if (centcomPopoutLoader.item) {
centcomPopoutLoader.item.calendarVisible = !centcomPopoutLoader.item.calendarVisible centcomPopoutLoader.item.calendarVisible
= !centcomPopoutLoader.item.calendarVisible
} }
} }
} }
@@ -705,7 +734,8 @@ PanelWindow {
id: mediaComponent id: mediaComponent
Media { Media {
compactMode: topBarContent.spacingTight || topBarContent.overlapping compactMode: topBarContent.spacingTight
|| topBarContent.overlapping
section: { section: {
if (parent && parent.parent === leftSection) if (parent && parent.parent === leftSection)
return "left" return "left"
@@ -723,7 +753,8 @@ PanelWindow {
onClicked: { onClicked: {
centcomPopoutLoader.active = true centcomPopoutLoader.active = true
if (centcomPopoutLoader.item) { if (centcomPopoutLoader.item) {
centcomPopoutLoader.item.calendarVisible = !centcomPopoutLoader.item.calendarVisible centcomPopoutLoader.item.calendarVisible
= !centcomPopoutLoader.item.calendarVisible
} }
} }
} }
@@ -750,7 +781,8 @@ PanelWindow {
onClicked: { onClicked: {
centcomPopoutLoader.active = true centcomPopoutLoader.active = true
if (centcomPopoutLoader.item) { if (centcomPopoutLoader.item) {
centcomPopoutLoader.item.calendarVisible = !centcomPopoutLoader.item.calendarVisible centcomPopoutLoader.item.calendarVisible
= !centcomPopoutLoader.item.calendarVisible
} }
} }
} }
@@ -1004,7 +1036,8 @@ PanelWindow {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: "transparent" color: "transparent"
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r,
Theme.outline.g,
Theme.outline.b, 0.1) Theme.outline.b, 0.1)
border.width: 1 border.width: 1
radius: 2 radius: 2

View File

@@ -66,8 +66,8 @@ Rectangle {
var currentScreen = parentScreen || Screen var currentScreen = parentScreen || Screen
var screenX = currentScreen.x || 0 var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX var relativeX = globalPos.x - screenX
popupTarget.setTriggerPosition(relativeX, popupTarget.setTriggerPosition(
Theme.barHeight + Theme.spacingXS, relativeX, Theme.barHeight + Theme.spacingXS,
width, section, currentScreen) width, section, currentScreen)
} }
root.clicked() root.clicked()

View File

@@ -24,7 +24,8 @@ Rectangle {
} }
function getDisplayWorkspaces() { function getDisplayWorkspaces() {
if (!NiriService.niriAvailable || NiriService.allWorkspaces.length === 0) if (!NiriService.niriAvailable
|| NiriService.allWorkspaces.length === 0)
return [1, 2] return [1, 2]
if (!root.screenName) if (!root.screenName)
@@ -40,7 +41,8 @@ Rectangle {
} }
function getDisplayActiveWorkspace() { function getDisplayActiveWorkspace() {
if (!NiriService.niriAvailable || NiriService.allWorkspaces.length === 0) if (!NiriService.niriAvailable
|| NiriService.allWorkspaces.length === 0)
return 1 return 1
if (!root.screenName) if (!root.screenName)
@@ -83,10 +85,7 @@ Rectangle {
function onNiriAvailableChanged() { function onNiriAvailableChanged() {
if (NiriService.niriAvailable) { if (NiriService.niriAvailable) {
root.workspaceList root.workspaceList = SettingsData.showWorkspacePadding ? root.padWorkspaces(root.getDisplayWorkspaces()) : root.getDisplayWorkspaces()
= SettingsData.showWorkspacePadding ? root.padWorkspaces(
root.getDisplayWorkspaces(
)) : root.getDisplayWorkspaces()
root.currentWorkspace = root.getDisplayActiveWorkspace() root.currentWorkspace = root.getDisplayActiveWorkspace()
} }
} }
@@ -119,17 +118,22 @@ Rectangle {
property bool isHovered: mouseArea.containsMouse property bool isHovered: mouseArea.containsMouse
property int sequentialNumber: index + 1 property int sequentialNumber: index + 1
property var workspaceData: { property var workspaceData: {
if (isPlaceholder || !NiriService.niriAvailable) return null if (isPlaceholder || !NiriService.niriAvailable)
return null
for (var i = 0; i < NiriService.allWorkspaces.length; i++) { for (var i = 0; i < NiriService.allWorkspaces.length; i++) {
var ws = NiriService.allWorkspaces[i] var ws = NiriService.allWorkspaces[i]
if (ws.idx + 1 === modelData) return ws if (ws.idx + 1 === modelData)
return ws
} }
return null return null
} }
property var iconData: workspaceData && workspaceData.name ? SettingsData.getWorkspaceNameIcon(workspaceData.name) : null property var iconData: workspaceData
&& workspaceData.name ? SettingsData.getWorkspaceNameIcon(
workspaceData.name) : null
property bool hasIcon: iconData !== null property bool hasIcon: iconData !== null
width: isActive ? Theme.spacingXL + Theme.spacingM : Theme.spacingL + Theme.spacingXS width: isActive ? Theme.spacingXL + Theme.spacingM : Theme.spacingL
+ Theme.spacingXS
height: Theme.spacingL height: Theme.spacingL
radius: height / 2 radius: height / 2
color: isActive ? Theme.primary : isPlaceholder ? Theme.surfaceTextLight : isHovered ? Theme.outlineButton : Theme.surfaceTextAlpha color: isActive ? Theme.primary : isPlaceholder ? Theme.surfaceTextLight : isHovered ? Theme.outlineButton : Theme.surfaceTextAlpha
@@ -151,10 +155,10 @@ Rectangle {
DankIcon { DankIcon {
visible: hasIcon && iconData.type === "icon" visible: hasIcon && iconData.type === "icon"
anchors.centerIn: parent anchors.centerIn: parent
name: hasIcon && iconData.type === "icon" ? iconData.value : "" name: hasIcon
&& iconData.type === "icon" ? iconData.value : ""
size: Theme.fontSizeSmall size: Theme.fontSizeSmall
color: isActive ? Qt.rgba( color: isActive ? Qt.rgba(Theme.surfaceContainer.r,
Theme.surfaceContainer.r,
Theme.surfaceContainer.g, Theme.surfaceContainer.g,
Theme.surfaceContainer.b, Theme.surfaceContainer.b,
0.95) : Theme.surfaceTextMedium 0.95) : Theme.surfaceTextMedium
@@ -165,14 +169,15 @@ Rectangle {
StyledText { StyledText {
visible: hasIcon && iconData.type === "text" visible: hasIcon && iconData.type === "text"
anchors.centerIn: parent anchors.centerIn: parent
text: hasIcon && iconData.type === "text" ? iconData.value : "" text: hasIcon
color: isActive ? Qt.rgba( && iconData.type === "text" ? iconData.value : ""
Theme.surfaceContainer.r, color: isActive ? Qt.rgba(Theme.surfaceContainer.r,
Theme.surfaceContainer.g, Theme.surfaceContainer.g,
Theme.surfaceContainer.b, Theme.surfaceContainer.b,
0.95) : Theme.surfaceTextMedium 0.95) : Theme.surfaceTextMedium
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.weight: isActive && !isPlaceholder ? Font.DemiBold : Font.Normal font.weight: isActive
&& !isPlaceholder ? Font.DemiBold : Font.Normal
} }
// Number display (secondary priority, only when no icon) // Number display (secondary priority, only when no icon)
@@ -186,7 +191,8 @@ Rectangle {
Theme.surfaceContainer.b, Theme.surfaceContainer.b,
0.95) : isPlaceholder ? Theme.surfaceTextAlpha : Theme.surfaceTextMedium 0.95) : isPlaceholder ? Theme.surfaceTextAlpha : Theme.surfaceTextMedium
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.weight: isActive && !isPlaceholder ? Font.DemiBold : Font.Normal font.weight: isActive
&& !isPlaceholder ? Font.DemiBold : Font.Normal
} }
Behavior on width { Behavior on width {

View File

@@ -138,7 +138,8 @@ PanelWindow {
unit: "%" unit: "%"
Component.onCompleted: { Component.onCompleted: {
if (AudioService.sink && AudioService.sink.audio) if (AudioService.sink && AudioService.sink.audio)
value = Math.round(AudioService.sink.audio.volume * 100) value = Math.round(
AudioService.sink.audio.volume * 100)
} }
onSliderValueChanged: function (newValue) { onSliderValueChanged: function (newValue) {
if (AudioService.sink && AudioService.sink.audio) { if (AudioService.sink && AudioService.sink.audio) {

View File

@@ -47,15 +47,18 @@ Singleton {
if (nameLower === queryLower) { if (nameLower === queryLower) {
finalScore = nameScore * 100 finalScore = nameScore * 100
} else if (nameLower.startsWith(queryLower)) { } else if (nameLower.startsWith(
queryLower)) {
finalScore = nameScore * 50 finalScore = nameScore * 50
} else if (nameLower.includes(" " + queryLower) } else if (nameLower.includes(
" " + queryLower)
|| nameLower.includes( || nameLower.includes(
queryLower + " ") queryLower + " ")
|| nameLower.endsWith( || nameLower.endsWith(
" " + queryLower)) { " " + queryLower)) {
finalScore = nameScore * 25 finalScore = nameScore * 25
} else if (nameLower.includes(queryLower)) { } else if (nameLower.includes(
queryLower)) {
finalScore = nameScore * 10 finalScore = nameScore * 10
} else { } else {
finalScore = nameScore * 2 + commentScore * 0.1 finalScore = nameScore * 2 + commentScore * 0.1
@@ -150,7 +153,8 @@ Singleton {
} }
return applications.filter(app => { return applications.filter(app => {
var appCategories = getCategoriesForApp(app) var appCategories = getCategoriesForApp(
app)
return appCategories.includes(category) return appCategories.includes(category)
}) })
} }

View File

@@ -125,7 +125,8 @@ Singleton {
root.sink.audio.muted = false root.sink.audio.muted = false
} }
const currentVolume = Math.round(root.sink.audio.volume * 100) const currentVolume = Math.round(root.sink.audio.volume * 100)
const newVolume = Math.max(0, Math.min(100, currentVolume + parseInt( const newVolume = Math.max(0, Math.min(100,
currentVolume + parseInt(
step || "5"))) step || "5")))
root.sink.audio.volume = newVolume / 100 root.sink.audio.volume = newVolume / 100
root.volumeChanged() root.volumeChanged()
@@ -140,7 +141,8 @@ Singleton {
root.sink.audio.muted = false root.sink.audio.muted = false
} }
const currentVolume = Math.round(root.sink.audio.volume * 100) const currentVolume = Math.round(root.sink.audio.volume * 100)
const newVolume = Math.max(0, Math.min(100, currentVolume - parseInt( const newVolume = Math.max(0, Math.min(100,
currentVolume - parseInt(
step || "5"))) step || "5")))
root.sink.audio.volume = newVolume / 100 root.sink.audio.volume = newVolume / 100
root.volumeChanged() root.volumeChanged()
@@ -169,7 +171,8 @@ Singleton {
let result = "Audio Status:\n" let result = "Audio Status:\n"
if (root.sink && root.sink.audio) { if (root.sink && root.sink.audio) {
const volume = Math.round(root.sink.audio.volume * 100) const volume = Math.round(root.sink.audio.volume * 100)
result += "Output: " + volume + "%" + (root.sink.audio.muted ? " (muted)" : "") + "\n" result += "Output: " + volume + "%"
+ (root.sink.audio.muted ? " (muted)" : "") + "\n"
} else { } else {
result += "Output: No sink available\n" result += "Output: No sink available\n"
} }

Some files were not shown because too many files have changed in this diff Show More