mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-04 03:22:12 -04:00
logger: add a dedicated QML logging Singleton
- adds log.info/error/debug/warn/fatal - adds ability to write logs to any file - add CLI options in addition to env to set log levels
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Modals.Common
|
||||
import qs.Widgets
|
||||
@@ -7,6 +6,7 @@ import qs.Services
|
||||
|
||||
DankModal {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("AppPickerModal")
|
||||
|
||||
property string title: I18n.tr("Select Application")
|
||||
property string targetData: ""
|
||||
@@ -30,52 +30,52 @@ DankModal {
|
||||
onBackgroundClicked: close()
|
||||
|
||||
onDialogClosed: {
|
||||
searchQuery = ""
|
||||
selectedIndex = 0
|
||||
keyboardNavigationActive = false
|
||||
searchQuery = "";
|
||||
selectedIndex = 0;
|
||||
keyboardNavigationActive = false;
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
searchQuery = ""
|
||||
updateApplicationList()
|
||||
selectedIndex = 0
|
||||
searchQuery = "";
|
||||
updateApplicationList();
|
||||
selectedIndex = 0;
|
||||
Qt.callLater(() => {
|
||||
if (contentLoader.item && contentLoader.item.searchField) {
|
||||
contentLoader.item.searchField.text = ""
|
||||
contentLoader.item.searchField.forceActiveFocus()
|
||||
contentLoader.item.searchField.text = "";
|
||||
contentLoader.item.searchField.forceActiveFocus();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function updateApplicationList() {
|
||||
applicationsModel.clear()
|
||||
const apps = AppSearchService.applications
|
||||
const usageHistory = usageHistoryKey && SettingsData[usageHistoryKey] ? SettingsData[usageHistoryKey] : {}
|
||||
let filteredApps = []
|
||||
applicationsModel.clear();
|
||||
const apps = AppSearchService.applications;
|
||||
const usageHistory = usageHistoryKey && SettingsData[usageHistoryKey] ? SettingsData[usageHistoryKey] : {};
|
||||
let filteredApps = [];
|
||||
|
||||
for (const app of apps) {
|
||||
if (!app || !app.categories) continue
|
||||
|
||||
let matchesCategory = categoryFilter.length === 0
|
||||
if (!app || !app.categories)
|
||||
continue;
|
||||
let matchesCategory = categoryFilter.length === 0;
|
||||
|
||||
if (categoryFilter.length > 0) {
|
||||
try {
|
||||
for (const cat of app.categories) {
|
||||
if (categoryFilter.includes(cat)) {
|
||||
matchesCategory = true
|
||||
break
|
||||
matchesCategory = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("AppPicker: Error iterating categories for", app.name, ":", e)
|
||||
continue
|
||||
log.warn("AppPicker: Error iterating categories for", app.name, ":", e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (matchesCategory) {
|
||||
const name = app.name || ""
|
||||
const lowerName = name.toLowerCase()
|
||||
const lowerQuery = searchQuery.toLowerCase()
|
||||
const name = app.name || "";
|
||||
const lowerName = name.toLowerCase();
|
||||
const lowerQuery = searchQuery.toLowerCase();
|
||||
|
||||
if (searchQuery === "" || lowerName.includes(lowerQuery)) {
|
||||
filteredApps.push({
|
||||
@@ -84,21 +84,21 @@ DankModal {
|
||||
exec: app.exec || app.execString || "",
|
||||
startupClass: app.startupWMClass || "",
|
||||
appData: app
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filteredApps.sort((a, b) => {
|
||||
const aId = a.appData.id || a.appData.execString || a.appData.exec || ""
|
||||
const bId = b.appData.id || b.appData.execString || b.appData.exec || ""
|
||||
const aUsage = usageHistory[aId] ? usageHistory[aId].count : 0
|
||||
const bUsage = usageHistory[bId] ? usageHistory[bId].count : 0
|
||||
const aId = a.appData.id || a.appData.execString || a.appData.exec || "";
|
||||
const bId = b.appData.id || b.appData.execString || b.appData.exec || "";
|
||||
const aUsage = usageHistory[aId] ? usageHistory[aId].count : 0;
|
||||
const bUsage = usageHistory[bId] ? usageHistory[bId].count : 0;
|
||||
if (aUsage !== bUsage) {
|
||||
return bUsage - aUsage
|
||||
return bUsage - aUsage;
|
||||
}
|
||||
return (a.name || "").localeCompare(b.name || "")
|
||||
})
|
||||
return (a.name || "").localeCompare(b.name || "");
|
||||
});
|
||||
|
||||
filteredApps.forEach(app => {
|
||||
applicationsModel.append({
|
||||
@@ -107,10 +107,10 @@ DankModal {
|
||||
exec: app.exec,
|
||||
startupClass: app.startupClass,
|
||||
appId: app.appData.id || app.appData.execString || app.appData.exec || ""
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
console.log("AppPicker: Found " + filteredApps.length + " applications")
|
||||
log.debug("AppPicker: Found " + filteredApps.length + " applications");
|
||||
}
|
||||
|
||||
onSearchQueryChanged: updateApplicationList()
|
||||
@@ -129,56 +129,57 @@ DankModal {
|
||||
focus: true
|
||||
|
||||
Keys.onEscapePressed: event => {
|
||||
root.close()
|
||||
event.accepted = true
|
||||
root.close();
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
Keys.onPressed: event => {
|
||||
if (applicationsModel.count === 0) return
|
||||
if (applicationsModel.count === 0)
|
||||
return;
|
||||
|
||||
// Toggle view mode with Tab key
|
||||
if (event.key === Qt.Key_Tab) {
|
||||
root.viewMode = root.viewMode === "grid" ? "list" : "grid"
|
||||
event.accepted = true
|
||||
return
|
||||
root.viewMode = root.viewMode === "grid" ? "list" : "grid";
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (root.viewMode === "grid") {
|
||||
if (event.key === Qt.Key_Left) {
|
||||
root.keyboardNavigationActive = true
|
||||
root.selectedIndex = Math.max(0, root.selectedIndex - 1)
|
||||
event.accepted = true
|
||||
root.keyboardNavigationActive = true;
|
||||
root.selectedIndex = Math.max(0, root.selectedIndex - 1);
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Right) {
|
||||
root.keyboardNavigationActive = true
|
||||
root.selectedIndex = Math.min(applicationsModel.count - 1, root.selectedIndex + 1)
|
||||
event.accepted = true
|
||||
root.keyboardNavigationActive = true;
|
||||
root.selectedIndex = Math.min(applicationsModel.count - 1, root.selectedIndex + 1);
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Up) {
|
||||
root.keyboardNavigationActive = true
|
||||
root.selectedIndex = Math.max(0, root.selectedIndex - root.gridColumns)
|
||||
event.accepted = true
|
||||
root.keyboardNavigationActive = true;
|
||||
root.selectedIndex = Math.max(0, root.selectedIndex - root.gridColumns);
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Down) {
|
||||
root.keyboardNavigationActive = true
|
||||
root.selectedIndex = Math.min(applicationsModel.count - 1, root.selectedIndex + root.gridColumns)
|
||||
event.accepted = true
|
||||
root.keyboardNavigationActive = true;
|
||||
root.selectedIndex = Math.min(applicationsModel.count - 1, root.selectedIndex + root.gridColumns);
|
||||
event.accepted = true;
|
||||
}
|
||||
} else {
|
||||
if (event.key === Qt.Key_Up) {
|
||||
root.keyboardNavigationActive = true
|
||||
root.selectedIndex = Math.max(0, root.selectedIndex - 1)
|
||||
event.accepted = true
|
||||
root.keyboardNavigationActive = true;
|
||||
root.selectedIndex = Math.max(0, root.selectedIndex - 1);
|
||||
event.accepted = true;
|
||||
} else if (event.key === Qt.Key_Down) {
|
||||
root.keyboardNavigationActive = true
|
||||
root.selectedIndex = Math.min(applicationsModel.count - 1, root.selectedIndex + 1)
|
||||
event.accepted = true
|
||||
root.keyboardNavigationActive = true;
|
||||
root.selectedIndex = Math.min(applicationsModel.count - 1, root.selectedIndex + 1);
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||
if (root.selectedIndex >= 0 && root.selectedIndex < applicationsModel.count) {
|
||||
const app = applicationsModel.get(root.selectedIndex)
|
||||
launchApplication(app)
|
||||
const app = applicationsModel.get(root.selectedIndex);
|
||||
launchApplication(app);
|
||||
}
|
||||
event.accepted = true
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +218,7 @@ DankModal {
|
||||
iconColor: root.viewMode === "list" ? Theme.primary : Theme.surfaceText
|
||||
backgroundColor: root.viewMode === "list" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||
onClicked: {
|
||||
root.viewMode = "list"
|
||||
root.viewMode = "list";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +230,7 @@ DankModal {
|
||||
iconColor: root.viewMode === "grid" ? Theme.primary : Theme.surfaceText
|
||||
backgroundColor: root.viewMode === "grid" ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||
onClicked: {
|
||||
root.viewMode = "grid"
|
||||
root.viewMode = "grid";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,42 +258,42 @@ DankModal {
|
||||
keyForwardTargets: [appContent]
|
||||
|
||||
onTextEdited: {
|
||||
root.searchQuery = text
|
||||
root.searchQuery = text;
|
||||
}
|
||||
|
||||
Keys.onPressed: function (event) {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
root.close()
|
||||
event.accepted = true
|
||||
return
|
||||
root.close();
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const isEnterKey = [Qt.Key_Return, Qt.Key_Enter].includes(event.key)
|
||||
const hasText = text.length > 0
|
||||
const isEnterKey = [Qt.Key_Return, Qt.Key_Enter].includes(event.key);
|
||||
const hasText = text.length > 0;
|
||||
|
||||
if (isEnterKey && hasText) {
|
||||
if (root.keyboardNavigationActive && applicationsModel.count > 0) {
|
||||
const app = applicationsModel.get(root.selectedIndex)
|
||||
launchApplication(app)
|
||||
const app = applicationsModel.get(root.selectedIndex);
|
||||
launchApplication(app);
|
||||
} else if (applicationsModel.count > 0) {
|
||||
const app = applicationsModel.get(0)
|
||||
launchApplication(app)
|
||||
const app = applicationsModel.get(0);
|
||||
launchApplication(app);
|
||||
}
|
||||
event.accepted = true
|
||||
return
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const navigationKeys = [Qt.Key_Down, Qt.Key_Up, Qt.Key_Left, Qt.Key_Right, Qt.Key_Tab, Qt.Key_Backtab]
|
||||
const isNavigationKey = navigationKeys.includes(event.key)
|
||||
const isEmptyEnter = isEnterKey && !hasText
|
||||
const navigationKeys = [Qt.Key_Down, Qt.Key_Up, Qt.Key_Left, Qt.Key_Right, Qt.Key_Tab, Qt.Key_Backtab];
|
||||
const isNavigationKey = navigationKeys.includes(event.key);
|
||||
const isEmptyEnter = isEnterKey && !hasText;
|
||||
|
||||
event.accepted = !(isNavigationKey || isEmptyEnter)
|
||||
event.accepted = !(isNavigationKey || isEmptyEnter);
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onShouldBeVisibleChanged() {
|
||||
if (!root.shouldBeVisible) {
|
||||
searchField.focus = false
|
||||
searchField.focus = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,12 +304,12 @@ DankModal {
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: {
|
||||
let usedHeight = 40 + Theme.spacingS
|
||||
usedHeight += 52 + Theme.spacingS
|
||||
let usedHeight = 40 + Theme.spacingS;
|
||||
usedHeight += 52 + Theme.spacingS;
|
||||
if (root.showTargetData) {
|
||||
usedHeight += 36 + Theme.spacingS
|
||||
usedHeight += 36 + Theme.spacingS;
|
||||
}
|
||||
return parent.height - usedHeight
|
||||
return parent.height - usedHeight;
|
||||
}
|
||||
radius: Theme.cornerRadius
|
||||
color: "transparent"
|
||||
@@ -320,14 +321,14 @@ DankModal {
|
||||
property int itemSpacing: Theme.spacingS
|
||||
|
||||
function ensureVisible(index) {
|
||||
if (index < 0 || index >= count) return
|
||||
|
||||
const itemY = index * (itemHeight + itemSpacing)
|
||||
const itemBottom = itemY + itemHeight
|
||||
if (index < 0 || index >= count)
|
||||
return;
|
||||
const itemY = index * (itemHeight + itemSpacing);
|
||||
const itemBottom = itemY + itemHeight;
|
||||
if (itemY < contentY) {
|
||||
contentY = itemY
|
||||
contentY = itemY;
|
||||
} else if (itemBottom > contentY + height) {
|
||||
contentY = itemBottom - height
|
||||
contentY = itemBottom - height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,9 +344,9 @@ DankModal {
|
||||
spacing: itemSpacing
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
root.selectedIndex = currentIndex
|
||||
root.selectedIndex = currentIndex;
|
||||
if (root.keyboardNavigationActive) {
|
||||
ensureVisible(currentIndex)
|
||||
ensureVisible(currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,11 +361,11 @@ DankModal {
|
||||
hoverUpdatesSelection: true
|
||||
|
||||
onItemClicked: (idx, modelData) => {
|
||||
launchApplication(modelData)
|
||||
launchApplication(modelData);
|
||||
}
|
||||
|
||||
onKeyboardNavigationReset: {
|
||||
root.keyboardNavigationActive = false
|
||||
root.keyboardNavigationActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -373,14 +374,14 @@ DankModal {
|
||||
id: appGrid
|
||||
|
||||
function ensureVisible(index) {
|
||||
if (index < 0 || index >= count) return
|
||||
|
||||
const itemY = Math.floor(index / root.gridColumns) * cellHeight
|
||||
const itemBottom = itemY + cellHeight
|
||||
if (index < 0 || index >= count)
|
||||
return;
|
||||
const itemY = Math.floor(index / root.gridColumns) * cellHeight;
|
||||
const itemBottom = itemY + cellHeight;
|
||||
if (itemY < contentY) {
|
||||
contentY = itemY
|
||||
contentY = itemY;
|
||||
} else if (itemBottom > contentY + height) {
|
||||
contentY = itemBottom - height
|
||||
contentY = itemBottom - height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,9 +398,9 @@ DankModal {
|
||||
currentIndex: root.selectedIndex
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
root.selectedIndex = currentIndex
|
||||
root.selectedIndex = currentIndex;
|
||||
if (root.keyboardNavigationActive) {
|
||||
ensureVisible(currentIndex)
|
||||
ensureVisible(currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,11 +414,11 @@ DankModal {
|
||||
hoverUpdatesSelection: true
|
||||
|
||||
onItemClicked: (idx, modelData) => {
|
||||
launchApplication(modelData)
|
||||
launchApplication(modelData);
|
||||
}
|
||||
|
||||
onKeyboardNavigationReset: {
|
||||
root.keyboardNavigationActive = false
|
||||
root.keyboardNavigationActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -449,22 +450,22 @@ DankModal {
|
||||
}
|
||||
|
||||
function launchApplication(app) {
|
||||
if (!app) return
|
||||
|
||||
root.applicationSelected(app, root.targetData)
|
||||
if (!app)
|
||||
return;
|
||||
root.applicationSelected(app, root.targetData);
|
||||
|
||||
if (usageHistoryKey && app.appId) {
|
||||
const usageHistory = SettingsData[usageHistoryKey] || {}
|
||||
const currentCount = usageHistory[app.appId] ? usageHistory[app.appId].count : 0
|
||||
const usageHistory = SettingsData[usageHistoryKey] || {};
|
||||
const currentCount = usageHistory[app.appId] ? usageHistory[app.appId].count : 0;
|
||||
usageHistory[app.appId] = {
|
||||
count: currentCount + 1,
|
||||
lastUsed: Date.now(),
|
||||
name: app.name
|
||||
}
|
||||
SettingsData.set(usageHistoryKey, usageHistory)
|
||||
};
|
||||
SettingsData.set(usageHistoryKey, usageHistory);
|
||||
}
|
||||
|
||||
root.close()
|
||||
root.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import qs.Widgets
|
||||
|
||||
DankModal {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("BluetoothPairingModal")
|
||||
|
||||
layerNamespace: "dms:bluetooth-pairing"
|
||||
|
||||
@@ -24,7 +25,7 @@ DankModal {
|
||||
property string passkeyInput: ""
|
||||
|
||||
function show(pairingData) {
|
||||
console.log("BluetoothPairingModal.show() called:", JSON.stringify(pairingData));
|
||||
log.debug("BluetoothPairingModal.show() called:", JSON.stringify(pairingData));
|
||||
token = pairingData.token || "";
|
||||
deviceName = pairingData.deviceName || "";
|
||||
deviceAddress = pairingData.deviceAddr || "";
|
||||
@@ -33,7 +34,7 @@ DankModal {
|
||||
pinInput = "";
|
||||
passkeyInput = "";
|
||||
|
||||
console.log("BluetoothPairingModal: Calling open()");
|
||||
log.debug("Calling open()");
|
||||
open();
|
||||
Qt.callLater(() => {
|
||||
if (contentLoader.item) {
|
||||
|
||||
@@ -2,9 +2,11 @@ import QtQuick
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Modals
|
||||
import qs.Services
|
||||
|
||||
AppPickerModal {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("BrowserPickerModal")
|
||||
|
||||
property string url: ""
|
||||
|
||||
@@ -17,35 +19,44 @@ AppPickerModal {
|
||||
showTargetData: true
|
||||
|
||||
function shellEscape(str) {
|
||||
return "'" + str.replace(/'/g, "'\\''") + "'"
|
||||
return "'" + str.replace(/'/g, "'\\''") + "'";
|
||||
}
|
||||
|
||||
onApplicationSelected: (app, url) => {
|
||||
if (!app) return
|
||||
if (!app)
|
||||
return;
|
||||
let cmd = app.exec || "";
|
||||
const escapedUrl = shellEscape(url);
|
||||
|
||||
let cmd = app.exec || ""
|
||||
const escapedUrl = shellEscape(url)
|
||||
|
||||
let hasField = false
|
||||
if (cmd.includes("%u")) { cmd = cmd.replace("%u", escapedUrl); hasField = true }
|
||||
else if (cmd.includes("%U")) { cmd = cmd.replace("%U", escapedUrl); hasField = true }
|
||||
else if (cmd.includes("%f")) { cmd = cmd.replace("%f", escapedUrl); hasField = true }
|
||||
else if (cmd.includes("%F")) { cmd = cmd.replace("%F", escapedUrl); hasField = true }
|
||||
|
||||
cmd = cmd.replace(/%[ikc]/g, "")
|
||||
|
||||
if (!hasField) {
|
||||
cmd += " " + escapedUrl
|
||||
let hasField = false;
|
||||
if (cmd.includes("%u")) {
|
||||
cmd = cmd.replace("%u", escapedUrl);
|
||||
hasField = true;
|
||||
} else if (cmd.includes("%U")) {
|
||||
cmd = cmd.replace("%U", escapedUrl);
|
||||
hasField = true;
|
||||
} else if (cmd.includes("%f")) {
|
||||
cmd = cmd.replace("%f", escapedUrl);
|
||||
hasField = true;
|
||||
} else if (cmd.includes("%F")) {
|
||||
cmd = cmd.replace("%F", escapedUrl);
|
||||
hasField = true;
|
||||
}
|
||||
|
||||
console.log("BrowserPicker: Launching", cmd)
|
||||
cmd = cmd.replace(/%[ikc]/g, "");
|
||||
|
||||
if (!hasField) {
|
||||
cmd += " " + escapedUrl;
|
||||
}
|
||||
|
||||
log.debug("BrowserPicker: Launching", cmd);
|
||||
|
||||
Quickshell.execDetached({
|
||||
command: ["sh", "-c", cmd]
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
onViewModeChanged: {
|
||||
SettingsData.set("browserPickerViewMode", viewMode)
|
||||
SettingsData.set("browserPickerViewMode", viewMode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import qs.Widgets
|
||||
|
||||
Item {
|
||||
id: thumbnail
|
||||
readonly property var log: Log.scoped("ClipboardThumbnail")
|
||||
|
||||
required property var entry
|
||||
required property string entryType
|
||||
@@ -52,7 +53,7 @@ Item {
|
||||
modal.activeImageLoads--;
|
||||
}
|
||||
if (response.error) {
|
||||
console.warn("ClipboardThumbnail: Failed to load image:", entry.id);
|
||||
log.warn("Failed to load image:", entry.id);
|
||||
return;
|
||||
}
|
||||
const data = response.result?.data;
|
||||
|
||||
@@ -7,6 +7,7 @@ import qs.Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("DankModal")
|
||||
|
||||
property string layerNamespace: "dms:modal"
|
||||
property alias content: contentLoader.sourceComponent
|
||||
@@ -246,10 +247,10 @@ Item {
|
||||
return WlrLayershell.Overlay;
|
||||
switch (Quickshell.env("DMS_MODAL_LAYER")) {
|
||||
case "bottom":
|
||||
console.error("DankModal: 'bottom' layer is not valid for modals. Defaulting to 'top' layer.");
|
||||
log.error("'bottom' layer is not valid for modals. Defaulting to 'top' layer.");
|
||||
return WlrLayershell.Top;
|
||||
case "background":
|
||||
console.error("DankModal: 'background' layer is not valid for modals. Defaulting to 'top' layer.");
|
||||
log.error("'background' layer is not valid for modals. Defaulting to 'top' layer.");
|
||||
return WlrLayershell.Top;
|
||||
case "overlay":
|
||||
return WlrLayershell.Overlay;
|
||||
|
||||
@@ -9,6 +9,7 @@ import qs.Widgets
|
||||
|
||||
DankModal {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("DankColorPickerModal")
|
||||
|
||||
layerNamespace: "dms:color-picker"
|
||||
|
||||
@@ -50,17 +51,17 @@ DankModal {
|
||||
|
||||
function toggle() {
|
||||
if (shouldBeVisible) {
|
||||
hide();
|
||||
hide();
|
||||
} else {
|
||||
show();
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
function toggleInstant() {
|
||||
if (shouldBeVisible) {
|
||||
hideInstant();
|
||||
hideInstant();
|
||||
} else {
|
||||
show();
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ DankModal {
|
||||
hideInstant();
|
||||
Proc.runCommand("dms-color-pick", ["dms", "color", "pick", "--json"], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("dms color pick exited with code:", exitCode);
|
||||
log.warn("dms color pick exited with code:", exitCode);
|
||||
root.show();
|
||||
return;
|
||||
}
|
||||
@@ -120,11 +121,11 @@ DankModal {
|
||||
if (result.hex) {
|
||||
applyPickedColor(result.hex);
|
||||
} else {
|
||||
console.warn("Failed to parse dms color pick output: missing hex");
|
||||
log.warn("Failed to parse dms color pick output: missing hex");
|
||||
root.show();
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Failed to parse dms color pick JSON:", e);
|
||||
log.warn("Failed to parse dms color pick JSON:", e);
|
||||
root.show();
|
||||
}
|
||||
}, 0, Proc.noTimeout);
|
||||
@@ -142,39 +143,39 @@ DankModal {
|
||||
onBackgroundClicked: hide()
|
||||
|
||||
IpcHandler {
|
||||
function open(): string {
|
||||
root.show();
|
||||
return "COLOR_PICKER_MODAL_OPEN_SUCCESS";
|
||||
}
|
||||
function open(): string {
|
||||
root.show();
|
||||
return "COLOR_PICKER_MODAL_OPEN_SUCCESS";
|
||||
}
|
||||
|
||||
function openColor(color: string): string {
|
||||
root.selectedColor = Qt.color(color);
|
||||
root.currentColor = Qt.color(color);
|
||||
root.updateFromColor(Qt.color(color));
|
||||
return open();
|
||||
}
|
||||
function openColor(color: string): string {
|
||||
root.selectedColor = Qt.color(color);
|
||||
root.currentColor = Qt.color(color);
|
||||
root.updateFromColor(Qt.color(color));
|
||||
return open();
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
root.hide();
|
||||
return "COLOR_PICKER_MODAL_CLOSE_SUCCESS";
|
||||
}
|
||||
function close(): string {
|
||||
root.hide();
|
||||
return "COLOR_PICKER_MODAL_CLOSE_SUCCESS";
|
||||
}
|
||||
|
||||
function closeInstant(): string {
|
||||
root.hideInstant();
|
||||
return "COLOR_PICKER_MODAL_CLOSE_INSTANT_SUCCESS";
|
||||
}
|
||||
function closeInstant(): string {
|
||||
root.hideInstant();
|
||||
return "COLOR_PICKER_MODAL_CLOSE_INSTANT_SUCCESS";
|
||||
}
|
||||
|
||||
function toggle(): string {
|
||||
root.toggle();
|
||||
return "COLOR_PICKER_MODAL_TOGGLE_SUCCESS";
|
||||
}
|
||||
function toggle(): string {
|
||||
root.toggle();
|
||||
return "COLOR_PICKER_MODAL_TOGGLE_SUCCESS";
|
||||
}
|
||||
|
||||
function toggleInstant(): string {
|
||||
root.toggleInstant();
|
||||
return "COLOR_PICKER_MODAL_TOGGLE_INSTANT_SUCCESS";
|
||||
}
|
||||
function toggleInstant(): string {
|
||||
root.toggleInstant();
|
||||
return "COLOR_PICKER_MODAL_TOGGLE_INSTANT_SUCCESS";
|
||||
}
|
||||
|
||||
target: "color-picker"
|
||||
target: "color-picker"
|
||||
}
|
||||
|
||||
content: Component {
|
||||
|
||||
@@ -8,6 +8,7 @@ import qs.Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("DankLauncherV2Modal")
|
||||
|
||||
visible: false
|
||||
|
||||
@@ -323,10 +324,10 @@ Item {
|
||||
WlrLayershell.layer: {
|
||||
switch (Quickshell.env("DMS_MODAL_LAYER")) {
|
||||
case "bottom":
|
||||
console.error("DankModal: 'bottom' layer is not valid for modals. Defaulting to 'top' layer.");
|
||||
log.error("DankModal: 'bottom' layer is not valid for modals. Defaulting to 'top' layer.");
|
||||
return WlrLayershell.Top;
|
||||
case "background":
|
||||
console.error("DankModal: 'background' layer is not valid for modals. Defaulting to 'top' layer.");
|
||||
log.error("DankModal: 'background' layer is not valid for modals. Defaulting to 'top' layer.");
|
||||
return WlrLayershell.Top;
|
||||
case "overlay":
|
||||
return WlrLayershell.Overlay;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("GreeterDoctorPage")
|
||||
|
||||
property bool isRunning: false
|
||||
property bool hasRun: false
|
||||
@@ -228,9 +230,7 @@ Item {
|
||||
text: {
|
||||
if (root.errorCount === 0)
|
||||
return I18n.tr("All checks passed", "greeter doctor page success");
|
||||
return root.errorCount === 1
|
||||
? I18n.tr("%1 issue found", "greeter doctor page error count").arg(root.errorCount)
|
||||
: I18n.tr("%1 issues found", "greeter doctor page error count").arg(root.errorCount);
|
||||
return root.errorCount === 1 ? I18n.tr("%1 issue found", "greeter doctor page error count").arg(root.errorCount) : I18n.tr("%1 issues found", "greeter doctor page error count").arg(root.errorCount);
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: root.errorCount > 0 ? Theme.error : Theme.surfaceVariantText
|
||||
@@ -412,7 +412,7 @@ Item {
|
||||
else
|
||||
root.selectedFilter = "ok";
|
||||
} catch (e) {
|
||||
console.error("GreeterDoctorPage: Failed to parse doctor output:", e);
|
||||
log.error("Failed to parse doctor output:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import qs.Widgets
|
||||
|
||||
FloatingWindow {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("GreeterModal")
|
||||
|
||||
property bool disablePopupTransparency: true
|
||||
property int currentPage: 0
|
||||
@@ -105,7 +106,7 @@ FloatingWindow {
|
||||
root.cheatsheetData = JSON.parse(trimmed);
|
||||
root.cheatsheetLoaded = true;
|
||||
} catch (e) {
|
||||
console.warn("Greeter: Failed to parse cheatsheet:", e);
|
||||
log.warn("Greeter: Failed to parse cheatsheet:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import qs.Widgets
|
||||
|
||||
FloatingWindow {
|
||||
id: processListModal
|
||||
readonly property var log: Log.scoped("ProcessListModal")
|
||||
|
||||
property bool disablePopupTransparency: true
|
||||
property int currentTab: 0
|
||||
@@ -22,7 +23,7 @@ FloatingWindow {
|
||||
|
||||
function show() {
|
||||
if (!DgopService.dgopAvailable) {
|
||||
console.warn("ProcessListModal: dgop is not available");
|
||||
log.warn("dgop is not available");
|
||||
return;
|
||||
}
|
||||
visible = true;
|
||||
@@ -36,7 +37,7 @@ FloatingWindow {
|
||||
|
||||
function toggle() {
|
||||
if (!DgopService.dgopAvailable) {
|
||||
console.warn("ProcessListModal: dgop is not available");
|
||||
log.warn("dgop is not available");
|
||||
return;
|
||||
}
|
||||
visible = !visible;
|
||||
@@ -44,7 +45,7 @@ FloatingWindow {
|
||||
|
||||
function focusOrToggle() {
|
||||
if (!DgopService.dgopAvailable) {
|
||||
console.warn("ProcessListModal: dgop is not available");
|
||||
log.warn("dgop is not available");
|
||||
return;
|
||||
}
|
||||
if (visible) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import qs.Widgets
|
||||
|
||||
FloatingWindow {
|
||||
id: root
|
||||
readonly property var log: Log.scoped("WorkspaceRenameModal")
|
||||
|
||||
property bool disablePopupTransparency: true
|
||||
readonly property int inputFieldHeight: Theme.fontSizeMedium + Theme.spacingL * 2
|
||||
@@ -39,7 +40,7 @@ FloatingWindow {
|
||||
} else if (CompositorService.isHyprland) {
|
||||
HyprlandService.renameWorkspace(name);
|
||||
} else {
|
||||
console.warn("WorkspaceRenameModal: rename not supported for this compositor");
|
||||
log.warn("rename not supported for this compositor");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user