mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
@@ -108,13 +108,14 @@ Item {
|
|||||||
id: barRepeaterModel
|
id: barRepeaterModel
|
||||||
values: {
|
values: {
|
||||||
const configs = SettingsData.barConfigs;
|
const configs = SettingsData.barConfigs;
|
||||||
return configs
|
return configs.map(c => ({
|
||||||
.map(c => ({ id: c.id, position: c.position }))
|
id: c.id,
|
||||||
.sort((a, b) => {
|
position: c.position
|
||||||
const aVertical = a.position === SettingsData.Position.Left || a.position === SettingsData.Position.Right;
|
})).sort((a, b) => {
|
||||||
const bVertical = b.position === SettingsData.Position.Left || b.position === SettingsData.Position.Right;
|
const aVertical = a.position === SettingsData.Position.Left || a.position === SettingsData.Position.Right;
|
||||||
return aVertical - bVertical;
|
const bVertical = b.position === SettingsData.Position.Left || b.position === SettingsData.Position.Right;
|
||||||
});
|
return aVertical - bVertical;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,9 +143,34 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property bool dockEnabled: false
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: dockRecreateDebounce
|
||||||
|
interval: 500
|
||||||
|
repeat: false
|
||||||
|
onTriggered: {
|
||||||
|
root.dockEnabled = false;
|
||||||
|
Qt.callLater(() => {
|
||||||
|
root.dockEnabled = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
dockRecreateDebounce.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: SettingsData
|
||||||
|
function onBarConfigsChanged() {
|
||||||
|
dockRecreateDebounce.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: dockLoader
|
id: dockLoader
|
||||||
active: true
|
active: root.dockEnabled
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
|
|
||||||
property var currentPosition: SettingsData.dockPosition
|
property var currentPosition: SettingsData.dockPosition
|
||||||
@@ -440,62 +466,71 @@ Item {
|
|||||||
title: I18n.tr("Open with...")
|
title: I18n.tr("Open with...")
|
||||||
|
|
||||||
function shellEscape(str) {
|
function shellEscape(str) {
|
||||||
return "'" + str.replace(/'/g, "'\\''") + "'"
|
return "'" + str.replace(/'/g, "'\\''") + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
onApplicationSelected: (app, filePath) => {
|
onApplicationSelected: (app, filePath) => {
|
||||||
if (!app) return
|
if (!app)
|
||||||
|
return;
|
||||||
|
let cmd = app.exec || "";
|
||||||
|
const escapedPath = shellEscape(filePath);
|
||||||
|
const escapedUri = shellEscape("file://" + filePath);
|
||||||
|
|
||||||
let cmd = app.exec || ""
|
let hasField = false;
|
||||||
const escapedPath = shellEscape(filePath)
|
if (cmd.includes("%f")) {
|
||||||
const escapedUri = shellEscape("file://" + filePath)
|
cmd = cmd.replace("%f", escapedPath);
|
||||||
|
hasField = true;
|
||||||
let hasField = false
|
} else if (cmd.includes("%F")) {
|
||||||
if (cmd.includes("%f")) { cmd = cmd.replace("%f", escapedPath); hasField = true }
|
cmd = cmd.replace("%F", escapedPath);
|
||||||
else if (cmd.includes("%F")) { cmd = cmd.replace("%F", escapedPath); hasField = true }
|
hasField = true;
|
||||||
else if (cmd.includes("%u")) { cmd = cmd.replace("%u", escapedUri); hasField = true }
|
} else if (cmd.includes("%u")) {
|
||||||
else if (cmd.includes("%U")) { cmd = cmd.replace("%U", escapedUri); hasField = true }
|
cmd = cmd.replace("%u", escapedUri);
|
||||||
|
hasField = true;
|
||||||
cmd = cmd.replace(/%[ikc]/g, "")
|
} else if (cmd.includes("%U")) {
|
||||||
|
cmd = cmd.replace("%U", escapedUri);
|
||||||
if (!hasField) {
|
hasField = true;
|
||||||
cmd += " " + escapedPath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("FilePicker: Launching", cmd)
|
cmd = cmd.replace(/%[ikc]/g, "");
|
||||||
|
|
||||||
|
if (!hasField) {
|
||||||
|
cmd += " " + escapedPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("FilePicker: Launching", cmd);
|
||||||
|
|
||||||
Quickshell.execDetached({
|
Quickshell.execDetached({
|
||||||
command: ["sh", "-c", cmd]
|
command: ["sh", "-c", cmd]
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: DMSService
|
target: DMSService
|
||||||
function onOpenUrlRequested(url) {
|
function onOpenUrlRequested(url) {
|
||||||
browserPickerModal.url = url
|
browserPickerModal.url = url;
|
||||||
browserPickerModal.open()
|
browserPickerModal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAppPickerRequested(data) {
|
function onAppPickerRequested(data) {
|
||||||
console.log("DMSShell: App picker requested with data:", JSON.stringify(data))
|
console.log("DMSShell: App picker requested with data:", JSON.stringify(data));
|
||||||
|
|
||||||
if (!data || !data.target) {
|
if (!data || !data.target) {
|
||||||
console.warn("DMSShell: Invalid app picker request data")
|
console.warn("DMSShell: Invalid app picker request data");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
filePickerModal.targetData = data.target
|
filePickerModal.targetData = data.target;
|
||||||
filePickerModal.targetDataLabel = data.requestType || "file"
|
filePickerModal.targetDataLabel = data.requestType || "file";
|
||||||
|
|
||||||
if (data.categories && data.categories.length > 0) {
|
if (data.categories && data.categories.length > 0) {
|
||||||
filePickerModal.categoryFilter = data.categories
|
filePickerModal.categoryFilter = data.categories;
|
||||||
} else {
|
} else {
|
||||||
filePickerModal.categoryFilter = []
|
filePickerModal.categoryFilter = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
filePickerModal.usageHistoryKey = "filePickerUsageHistory"
|
filePickerModal.usageHistoryKey = "filePickerUsageHistory";
|
||||||
filePickerModal.open()
|
filePickerModal.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user