mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
Compare commits
5 Commits
7cb39f00ad
...
f2be6cfeb1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2be6cfeb1 | ||
|
|
65486ed3cf | ||
|
|
cc30e2a9e4 | ||
|
|
ac68451cdf | ||
|
|
0f6ae11c3d |
@@ -1,5 +1,12 @@
|
|||||||
This file is more of a quick reference so I know what to account for before next releases.
|
This file is more of a quick reference so I know what to account for before next releases.
|
||||||
|
|
||||||
|
# 1.4.0
|
||||||
|
|
||||||
|
- Overhauled system monitor, graphs, styling
|
||||||
|
- dbus API for plugins, KDEConnect
|
||||||
|
- new dank16 algorithm
|
||||||
|
- launcher actions, customize env, args, name, icon
|
||||||
|
|
||||||
# 1.2.0
|
# 1.2.0
|
||||||
|
|
||||||
- Added clipboard and clipboard history integration
|
- Added clipboard and clipboard history integration
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Singleton {
|
|||||||
property bool _isReadOnly: false
|
property bool _isReadOnly: false
|
||||||
property bool _hasUnsavedChanges: false
|
property bool _hasUnsavedChanges: false
|
||||||
property var _loadedSessionSnapshot: null
|
property var _loadedSessionSnapshot: null
|
||||||
|
readonly property var _hooks: ({})
|
||||||
readonly property string _stateUrl: StandardPaths.writableLocation(StandardPaths.GenericStateLocation)
|
readonly property string _stateUrl: StandardPaths.writableLocation(StandardPaths.GenericStateLocation)
|
||||||
readonly property string _stateDir: Paths.strip(_stateUrl)
|
readonly property string _stateDir: Paths.strip(_stateUrl)
|
||||||
|
|
||||||
@@ -102,6 +103,10 @@ Singleton {
|
|||||||
property string weatherLocation: "New York, NY"
|
property string weatherLocation: "New York, NY"
|
||||||
property string weatherCoordinates: "40.7128,-74.0060"
|
property string weatherCoordinates: "40.7128,-74.0060"
|
||||||
|
|
||||||
|
property var hiddenApps: []
|
||||||
|
property var appOverrides: ({})
|
||||||
|
property bool searchAppActions: true
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (!isGreeterMode) {
|
if (!isGreeterMode) {
|
||||||
loadSettings();
|
loadSettings();
|
||||||
@@ -261,6 +266,10 @@ Singleton {
|
|||||||
_checkSessionWritable();
|
_checkSessionWritable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set(key, value) {
|
||||||
|
Spec.set(root, key, value, saveSettings, _hooks);
|
||||||
|
}
|
||||||
|
|
||||||
function migrateFromUndefinedToV1(settings) {
|
function migrateFromUndefinedToV1(settings) {
|
||||||
console.info("SessionData: Migrating configuration from undefined to version 1");
|
console.info("SessionData: Migrating configuration from undefined to version 1");
|
||||||
if (typeof SettingsData !== "undefined") {
|
if (typeof SettingsData !== "undefined") {
|
||||||
@@ -906,6 +915,61 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hideApp(appId) {
|
||||||
|
if (!appId)
|
||||||
|
return;
|
||||||
|
const current = [...hiddenApps];
|
||||||
|
if (current.indexOf(appId) === -1) {
|
||||||
|
current.push(appId);
|
||||||
|
hiddenApps = current;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showApp(appId) {
|
||||||
|
if (!appId)
|
||||||
|
return;
|
||||||
|
hiddenApps = hiddenApps.filter(id => id !== appId);
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function isAppHidden(appId) {
|
||||||
|
return appId && hiddenApps.indexOf(appId) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAppOverride(appId, overrides) {
|
||||||
|
if (!appId)
|
||||||
|
return;
|
||||||
|
const newOverrides = Object.assign({}, appOverrides);
|
||||||
|
if (!overrides || Object.keys(overrides).length === 0) {
|
||||||
|
delete newOverrides[appId];
|
||||||
|
} else {
|
||||||
|
newOverrides[appId] = overrides;
|
||||||
|
}
|
||||||
|
appOverrides = newOverrides;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAppOverride(appId) {
|
||||||
|
if (!appId)
|
||||||
|
return null;
|
||||||
|
return appOverrides[appId] || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearAppOverride(appId) {
|
||||||
|
if (!appId)
|
||||||
|
return;
|
||||||
|
const newOverrides = Object.assign({}, appOverrides);
|
||||||
|
delete newOverrides[appId];
|
||||||
|
appOverrides = newOverrides;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSearchAppActions(enabled) {
|
||||||
|
searchAppActions = enabled;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
function syncWallpaperForCurrentMode() {
|
function syncWallpaperForCurrentMode() {
|
||||||
if (!perModeWallpaper)
|
if (!perModeWallpaper)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ Singleton {
|
|||||||
property bool reverseScrolling: false
|
property bool reverseScrolling: false
|
||||||
property bool dwlShowAllTags: false
|
property bool dwlShowAllTags: false
|
||||||
property string workspaceColorMode: "default"
|
property string workspaceColorMode: "default"
|
||||||
property string workspaceOccupiedColorMode: "default"
|
property string workspaceOccupiedColorMode: "none"
|
||||||
property string workspaceUnfocusedColorMode: "default"
|
property string workspaceUnfocusedColorMode: "default"
|
||||||
property string workspaceUrgentColorMode: "default"
|
property string workspaceUrgentColorMode: "default"
|
||||||
property bool workspaceFocusedBorderEnabled: false
|
property bool workspaceFocusedBorderEnabled: false
|
||||||
|
|||||||
@@ -55,9 +55,23 @@ var SPEC = {
|
|||||||
enabledGpuPciIds: { def: [] },
|
enabledGpuPciIds: { def: [] },
|
||||||
|
|
||||||
wifiDeviceOverride: { def: "" },
|
wifiDeviceOverride: { def: "" },
|
||||||
weatherHourlyDetailed: { def: true }
|
weatherHourlyDetailed: { def: true },
|
||||||
|
|
||||||
|
hiddenApps: { def: [] },
|
||||||
|
appOverrides: { def: {} },
|
||||||
|
searchAppActions: { def: true }
|
||||||
};
|
};
|
||||||
|
|
||||||
function getValidKeys() {
|
function getValidKeys() {
|
||||||
return Object.keys(SPEC).concat(["configVersion"]);
|
return Object.keys(SPEC).concat(["configVersion"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set(root, key, value, saveFn, hooks) {
|
||||||
|
if (!(key in SPEC)) return;
|
||||||
|
root[key] = value;
|
||||||
|
var hookName = SPEC[key].onChange;
|
||||||
|
if (hookName && hooks && hooks[hookName]) {
|
||||||
|
hooks[hookName](root);
|
||||||
|
}
|
||||||
|
saveFn();
|
||||||
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ var SPEC = {
|
|||||||
reverseScrolling: { def: false },
|
reverseScrolling: { def: false },
|
||||||
dwlShowAllTags: { def: false },
|
dwlShowAllTags: { def: false },
|
||||||
workspaceColorMode: { def: "default" },
|
workspaceColorMode: { def: "default" },
|
||||||
workspaceOccupiedColorMode: { def: "default" },
|
workspaceOccupiedColorMode: { def: "none" },
|
||||||
workspaceUnfocusedColorMode: { def: "default" },
|
workspaceUnfocusedColorMode: { def: "default" },
|
||||||
workspaceUrgentColorMode: { def: "default" },
|
workspaceUrgentColorMode: { def: "default" },
|
||||||
workspaceFocusedBorderEnabled: { def: false },
|
workspaceFocusedBorderEnabled: { def: false },
|
||||||
|
|||||||
@@ -71,6 +71,14 @@ FloatingWindow {
|
|||||||
return (bytes / (1024 * 1024 * 1024)).toFixed(2) + " GB/s";
|
return (bytes / (1024 * 1024 * 1024)).toFixed(2) + " GB/s";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nextTab() {
|
||||||
|
currentTab = (currentTab + 1) % 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
function previousTab() {
|
||||||
|
currentTab = (currentTab - 1 + 4) % 4;
|
||||||
|
}
|
||||||
|
|
||||||
objectName: "processListModal"
|
objectName: "processListModal"
|
||||||
title: I18n.tr("System Monitor", "sysmon window title")
|
title: I18n.tr("System Monitor", "sysmon window title")
|
||||||
minimumSize: Qt.size(750, 550)
|
minimumSize: Qt.size(750, 550)
|
||||||
@@ -79,16 +87,25 @@ FloatingWindow {
|
|||||||
color: Theme.surfaceContainer
|
color: Theme.surfaceContainer
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
|
onCurrentTabChanged: {
|
||||||
|
if (visible && currentTab === 0 && searchField.visible)
|
||||||
|
searchField.forceActiveFocus();
|
||||||
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
closingModal();
|
closingModal();
|
||||||
searchText = "";
|
searchText = "";
|
||||||
expandedPid = "";
|
expandedPid = "";
|
||||||
|
if (processesTabLoader.item)
|
||||||
|
processesTabLoader.item.reset();
|
||||||
DgopService.removeRef(["cpu", "memory", "network", "disk", "system"]);
|
DgopService.removeRef(["cpu", "memory", "network", "disk", "system"]);
|
||||||
} else {
|
} else {
|
||||||
DgopService.addRef(["cpu", "memory", "network", "disk", "system"]);
|
DgopService.addRef(["cpu", "memory", "network", "disk", "system"]);
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (contentFocusScope)
|
if (currentTab === 0 && searchField.visible)
|
||||||
|
searchField.forceActiveFocus();
|
||||||
|
else if (contentFocusScope)
|
||||||
contentFocusScope.forceActiveFocus();
|
contentFocusScope.forceActiveFocus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -96,6 +113,11 @@ FloatingWindow {
|
|||||||
|
|
||||||
ProcessContextMenu {
|
ProcessContextMenu {
|
||||||
id: processContextMenu
|
id: processContextMenu
|
||||||
|
parentFocusItem: contentFocusScope
|
||||||
|
onProcessKilled: {
|
||||||
|
if (processesTabLoader.item)
|
||||||
|
processesTabLoader.item.forceRefresh(3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FocusScope {
|
FocusScope {
|
||||||
@@ -108,6 +130,9 @@ FloatingWindow {
|
|||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
|
if (processContextMenu.visible)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case Qt.Key_1:
|
case Qt.Key_1:
|
||||||
currentTab = 0;
|
currentTab = 0;
|
||||||
@@ -125,12 +150,25 @@ FloatingWindow {
|
|||||||
currentTab = 3;
|
currentTab = 3;
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
|
case Qt.Key_Tab:
|
||||||
|
nextTab();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Backtab:
|
||||||
|
previousTab();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
case Qt.Key_Escape:
|
case Qt.Key_Escape:
|
||||||
if (searchText.length > 0) {
|
if (searchText.length > 0) {
|
||||||
searchText = "";
|
searchText = "";
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (currentTab === 0 && processesTabLoader.item?.keyboardNavigationActive) {
|
||||||
|
processesTabLoader.item.reset();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
hide();
|
hide();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
@@ -142,6 +180,9 @@ FloatingWindow {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentTab === 0 && processesTabLoader.item)
|
||||||
|
processesTabLoader.item.handleKey(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -336,6 +377,8 @@ FloatingWindow {
|
|||||||
text: searchText
|
text: searchText
|
||||||
visible: currentTab === 0
|
visible: currentTab === 0
|
||||||
onTextChanged: searchText = text
|
onTextChanged: searchText = text
|
||||||
|
ignoreUpDownKeys: true
|
||||||
|
keyForwardTargets: [contentFocusScope]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals.Spotlight
|
import qs.Modals.Spotlight
|
||||||
@@ -19,6 +20,10 @@ Item {
|
|||||||
property string searchMode: "apps"
|
property string searchMode: "apps"
|
||||||
property bool usePopupContextMenu: false
|
property bool usePopupContextMenu: false
|
||||||
|
|
||||||
|
property bool editMode: false
|
||||||
|
property var editingApp: null
|
||||||
|
property string editAppId: ""
|
||||||
|
|
||||||
function resetScroll() {
|
function resetScroll() {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
resultsView.resetScroll();
|
resultsView.resetScroll();
|
||||||
@@ -43,6 +48,49 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openEditMode(app) {
|
||||||
|
if (!app)
|
||||||
|
return;
|
||||||
|
editingApp = app;
|
||||||
|
editAppId = app.id || app.execString || app.exec || "";
|
||||||
|
const existing = SessionData.getAppOverride(editAppId);
|
||||||
|
editNameField.text = existing?.name || "";
|
||||||
|
editIconField.text = existing?.icon || "";
|
||||||
|
editCommentField.text = existing?.comment || "";
|
||||||
|
editEnvVarsField.text = existing?.envVars || "";
|
||||||
|
editExtraFlagsField.text = existing?.extraFlags || "";
|
||||||
|
editMode = true;
|
||||||
|
Qt.callLater(() => editNameField.forceActiveFocus());
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeEditMode() {
|
||||||
|
editMode = false;
|
||||||
|
editingApp = null;
|
||||||
|
editAppId = "";
|
||||||
|
Qt.callLater(() => searchField.forceActiveFocus());
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveAppOverride() {
|
||||||
|
const override = {};
|
||||||
|
if (editNameField.text.trim())
|
||||||
|
override.name = editNameField.text.trim();
|
||||||
|
if (editIconField.text.trim())
|
||||||
|
override.icon = editIconField.text.trim();
|
||||||
|
if (editCommentField.text.trim())
|
||||||
|
override.comment = editCommentField.text.trim();
|
||||||
|
if (editEnvVarsField.text.trim())
|
||||||
|
override.envVars = editEnvVarsField.text.trim();
|
||||||
|
if (editExtraFlagsField.text.trim())
|
||||||
|
override.extraFlags = editExtraFlagsField.text.trim();
|
||||||
|
SessionData.setAppOverride(editAppId, override);
|
||||||
|
closeEditMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetAppOverride() {
|
||||||
|
SessionData.clearAppOverride(editAppId);
|
||||||
|
closeEditMode();
|
||||||
|
}
|
||||||
|
|
||||||
onSearchModeChanged: {
|
onSearchModeChanged: {
|
||||||
if (searchMode === "files") {
|
if (searchMode === "files") {
|
||||||
appLauncher.keyboardNavigationActive = false;
|
appLauncher.keyboardNavigationActive = false;
|
||||||
@@ -55,10 +103,16 @@ Item {
|
|||||||
focus: true
|
focus: true
|
||||||
clip: false
|
clip: false
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
|
if (editMode) {
|
||||||
|
if (event.key === Qt.Key_Escape) {
|
||||||
|
closeEditMode();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
if (parentModal)
|
if (parentModal)
|
||||||
parentModal.hide();
|
parentModal.hide();
|
||||||
|
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
} else if (event.key === Qt.Key_Down) {
|
} else if (event.key === Qt.Key_Down) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
@@ -155,7 +209,6 @@ Item {
|
|||||||
if (searchMode === "apps" && appLauncher.model.count > 0) {
|
if (searchMode === "apps" && appLauncher.model.count > 0) {
|
||||||
const selectedApp = appLauncher.model.get(appLauncher.selectedIndex);
|
const selectedApp = appLauncher.model.get(appLauncher.selectedIndex);
|
||||||
const menu = usePopupContextMenu ? popupContextMenu : layerContextMenuLoader.item;
|
const menu = usePopupContextMenu ? popupContextMenu : layerContextMenuLoader.item;
|
||||||
|
|
||||||
if (selectedApp && menu && resultsView) {
|
if (selectedApp && menu && resultsView) {
|
||||||
const itemPos = resultsView.getSelectedItemPosition();
|
const itemPos = resultsView.getSelectedItemPosition();
|
||||||
const contentPos = resultsView.mapToItem(spotlightKeyHandler, itemPos.x, itemPos.y);
|
const contentPos = resultsView.mapToItem(spotlightKeyHandler, itemPos.x, itemPos.y);
|
||||||
@@ -168,7 +221,6 @@ Item {
|
|||||||
|
|
||||||
AppLauncher {
|
AppLauncher {
|
||||||
id: appLauncher
|
id: appLauncher
|
||||||
|
|
||||||
viewMode: SettingsData.spotlightModalViewMode
|
viewMode: SettingsData.spotlightModalViewMode
|
||||||
gridColumns: SettingsData.appLauncherGridColumns
|
gridColumns: SettingsData.appLauncherGridColumns
|
||||||
onAppLaunched: () => {
|
onAppLaunched: () => {
|
||||||
@@ -185,7 +237,6 @@ Item {
|
|||||||
|
|
||||||
FileSearchController {
|
FileSearchController {
|
||||||
id: fileSearchController
|
id: fileSearchController
|
||||||
|
|
||||||
onFileOpened: () => {
|
onFileOpened: () => {
|
||||||
if (parentModal)
|
if (parentModal)
|
||||||
parentModal.hide();
|
parentModal.hide();
|
||||||
@@ -197,7 +248,6 @@ Item {
|
|||||||
|
|
||||||
SpotlightContextMenuPopup {
|
SpotlightContextMenuPopup {
|
||||||
id: popupContextMenu
|
id: popupContextMenu
|
||||||
|
|
||||||
parent: spotlightKeyHandler
|
parent: spotlightKeyHandler
|
||||||
appLauncher: spotlightKeyHandler.appLauncher
|
appLauncher: spotlightKeyHandler.appLauncher
|
||||||
parentHandler: spotlightKeyHandler
|
parentHandler: spotlightKeyHandler
|
||||||
@@ -231,20 +281,37 @@ Item {
|
|||||||
target: parentModal
|
target: parentModal
|
||||||
function onSpotlightOpenChanged() {
|
function onSpotlightOpenChanged() {
|
||||||
if (parentModal && !parentModal.spotlightOpen) {
|
if (parentModal && !parentModal.spotlightOpen) {
|
||||||
if (layerContextMenuLoader.item) {
|
if (layerContextMenuLoader.item)
|
||||||
layerContextMenuLoader.item.hide();
|
layerContextMenuLoader.item.hide();
|
||||||
}
|
|
||||||
popupContextMenu.hide();
|
popupContextMenu.hide();
|
||||||
|
if (editMode)
|
||||||
|
closeEditMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
enabled: parentModal !== null
|
enabled: parentModal !== null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: popupContextMenu
|
||||||
|
function onEditAppRequested(app) {
|
||||||
|
spotlightKeyHandler.openEditMode(app);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: layerContextMenuLoader.item
|
||||||
|
function onEditAppRequested(app) {
|
||||||
|
spotlightKeyHandler.openEditMode(app);
|
||||||
|
}
|
||||||
|
enabled: layerContextMenuLoader.item !== null
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
clip: false
|
clip: false
|
||||||
|
visible: !editMode
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: searchRow
|
id: searchRow
|
||||||
@@ -275,18 +342,14 @@ Item {
|
|||||||
ignoreTabKeys: true
|
ignoreTabKeys: true
|
||||||
keyForwardTargets: [spotlightKeyHandler]
|
keyForwardTargets: [spotlightKeyHandler]
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps")
|
||||||
appLauncher.searchQuery = text;
|
appLauncher.searchQuery = text;
|
||||||
}
|
|
||||||
}
|
|
||||||
onTextEdited: {
|
|
||||||
updateSearchMode();
|
|
||||||
}
|
}
|
||||||
|
onTextEdited: updateSearchMode()
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
if (parentModal)
|
if (parentModal)
|
||||||
parentModal.hide();
|
parentModal.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 || event.key === Qt.Key_Enter) && text.length > 0) {
|
||||||
if (searchMode === "apps") {
|
if (searchMode === "apps") {
|
||||||
@@ -334,13 +397,10 @@ Item {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: listViewArea
|
id: listViewArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: () => {
|
onClicked: appLauncher.setViewMode("list")
|
||||||
appLauncher.setViewMode("list");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,13 +419,10 @@ Item {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: gridViewArea
|
id: gridViewArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: () => {
|
onClicked: appLauncher.setViewMode("grid")
|
||||||
appLauncher.setViewMode("grid");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,7 +436,6 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: filenameFilterButton
|
id: filenameFilterButton
|
||||||
|
|
||||||
width: 36
|
width: 36
|
||||||
height: 36
|
height: 36
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
@@ -394,13 +450,10 @@ Item {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: filenameFilterArea
|
id: filenameFilterArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: () => {
|
onClicked: fileSearchController.searchField = "filename"
|
||||||
fileSearchController.searchField = "filename";
|
|
||||||
}
|
|
||||||
onEntered: {
|
onEntered: {
|
||||||
filenameTooltipLoader.active = true;
|
filenameTooltipLoader.active = true;
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
@@ -413,7 +466,6 @@ Item {
|
|||||||
onExited: {
|
onExited: {
|
||||||
if (filenameTooltipLoader.item)
|
if (filenameTooltipLoader.item)
|
||||||
filenameTooltipLoader.item.hide();
|
filenameTooltipLoader.item.hide();
|
||||||
|
|
||||||
filenameTooltipLoader.active = false;
|
filenameTooltipLoader.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -421,7 +473,6 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: contentFilterButton
|
id: contentFilterButton
|
||||||
|
|
||||||
width: 36
|
width: 36
|
||||||
height: 36
|
height: 36
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
@@ -436,13 +487,10 @@ Item {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: contentFilterArea
|
id: contentFilterArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: () => {
|
onClicked: fileSearchController.searchField = "body"
|
||||||
fileSearchController.searchField = "body";
|
|
||||||
}
|
|
||||||
onEntered: {
|
onEntered: {
|
||||||
contentTooltipLoader.active = true;
|
contentTooltipLoader.active = true;
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
@@ -455,7 +503,6 @@ Item {
|
|||||||
onExited: {
|
onExited: {
|
||||||
if (contentTooltipLoader.item)
|
if (contentTooltipLoader.item)
|
||||||
contentTooltipLoader.item.hide();
|
contentTooltipLoader.item.hide();
|
||||||
|
|
||||||
contentTooltipLoader.active = false;
|
contentTooltipLoader.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -474,13 +521,10 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
appLauncher: spotlightKeyHandler.appLauncher
|
appLauncher: spotlightKeyHandler.appLauncher
|
||||||
visible: searchMode === "apps"
|
visible: searchMode === "apps"
|
||||||
|
|
||||||
onItemRightClicked: (index, modelData, mouseX, mouseY) => {
|
onItemRightClicked: (index, modelData, mouseX, mouseY) => {
|
||||||
const menu = usePopupContextMenu ? popupContextMenu : layerContextMenuLoader.item;
|
const menu = usePopupContextMenu ? popupContextMenu : layerContextMenuLoader.item;
|
||||||
|
|
||||||
if (menu?.show) {
|
if (menu?.show) {
|
||||||
const isPopup = menu.contentItem !== undefined;
|
const isPopup = menu.contentItem !== undefined;
|
||||||
|
|
||||||
if (isPopup) {
|
if (isPopup) {
|
||||||
const localPos = popupContextMenu.parent.mapFromItem(null, mouseX, mouseY);
|
const localPos = popupContextMenu.parent.mapFromItem(null, mouseX, mouseY);
|
||||||
menu.show(localPos.x, localPos.y, modelData, false);
|
menu.show(localPos.x, localPos.y, modelData, false);
|
||||||
@@ -500,16 +544,320 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FocusScope {
|
||||||
|
id: editView
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingM
|
||||||
|
visible: editMode
|
||||||
|
focus: editMode
|
||||||
|
|
||||||
|
Keys.onPressed: event => {
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_Escape:
|
||||||
|
closeEditMode();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Return:
|
||||||
|
case Qt.Key_Enter:
|
||||||
|
if (event.modifiers & Qt.ControlModifier) {
|
||||||
|
saveAppOverride();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
case Qt.Key_S:
|
||||||
|
if (event.modifiers & Qt.ControlModifier) {
|
||||||
|
saveAppOverride();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
case Qt.Key_R:
|
||||||
|
if ((event.modifiers & Qt.ControlModifier) && SessionData.getAppOverride(editAppId) !== null) {
|
||||||
|
resetAppOverride();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: backButtonArea.containsMouse ? Theme.surfaceHover : "transparent"
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
name: "arrow_back"
|
||||||
|
size: 20
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: backButtonArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: closeEditMode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
source: editingApp?.icon ? "image://icon/" + editingApp.icon : "image://icon/application-x-executable"
|
||||||
|
sourceSize.width: 40
|
||||||
|
sourceSize.height: 40
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Edit App")
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: editingApp?.name || ""
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 1
|
||||||
|
color: Theme.outlineMedium
|
||||||
|
}
|
||||||
|
|
||||||
|
Flickable {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - y - buttonsRow.height - Theme.spacingM
|
||||||
|
contentHeight: editFieldsColumn.height
|
||||||
|
clip: true
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: editFieldsColumn
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Name")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: editNameField
|
||||||
|
width: parent.width
|
||||||
|
height: 44
|
||||||
|
placeholderText: editingApp?.name || ""
|
||||||
|
keyNavigationTab: editIconField
|
||||||
|
keyNavigationBacktab: editExtraFlagsField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Icon")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: editIconField
|
||||||
|
width: parent.width
|
||||||
|
height: 44
|
||||||
|
placeholderText: editingApp?.icon || ""
|
||||||
|
keyNavigationTab: editCommentField
|
||||||
|
keyNavigationBacktab: editNameField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Description")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: editCommentField
|
||||||
|
width: parent.width
|
||||||
|
height: 44
|
||||||
|
placeholderText: editingApp?.comment || ""
|
||||||
|
keyNavigationTab: editEnvVarsField
|
||||||
|
keyNavigationBacktab: editIconField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Environment Variables")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "KEY=value KEY2=value2"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall - 1
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: editEnvVarsField
|
||||||
|
width: parent.width
|
||||||
|
height: 44
|
||||||
|
placeholderText: "VAR=value"
|
||||||
|
keyNavigationTab: editExtraFlagsField
|
||||||
|
keyNavigationBacktab: editCommentField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Extra Arguments")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: editExtraFlagsField
|
||||||
|
width: parent.width
|
||||||
|
height: 44
|
||||||
|
placeholderText: "--flag --option=value"
|
||||||
|
keyNavigationTab: editNameField
|
||||||
|
keyNavigationBacktab: editEnvVarsField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: buttonsRow
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: resetButton
|
||||||
|
width: 90
|
||||||
|
height: 40
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: resetButtonArea.containsMouse ? Theme.surfacePressed : Theme.surfaceVariantAlpha
|
||||||
|
visible: SessionData.getAppOverride(editAppId) !== null
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Reset")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.error
|
||||||
|
font.weight: Font.Medium
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: resetButtonArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: resetAppOverride()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: cancelButton
|
||||||
|
width: 90
|
||||||
|
height: 40
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: cancelButtonArea.containsMouse ? Theme.surfacePressed : Theme.surfaceVariantAlpha
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Cancel")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: cancelButtonArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: closeEditMode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: saveButton
|
||||||
|
width: 90
|
||||||
|
height: 40
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: saveButtonArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.9) : Theme.primary
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Save")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.primaryText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: saveButtonArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: saveAppOverride()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: filenameTooltipLoader
|
id: filenameTooltipLoader
|
||||||
|
|
||||||
active: false
|
active: false
|
||||||
sourceComponent: DankTooltip {}
|
sourceComponent: DankTooltip {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: contentTooltipLoader
|
id: contentTooltipLoader
|
||||||
|
|
||||||
active: false
|
active: false
|
||||||
sourceComponent: DankTooltip {}
|
sourceComponent: DankTooltip {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import Quickshell.Widgets
|
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals.Spotlight
|
import qs.Modals.Spotlight
|
||||||
|
|
||||||
@@ -19,6 +18,8 @@ PanelWindow {
|
|||||||
property real menuPositionX: 0
|
property real menuPositionX: 0
|
||||||
property real menuPositionY: 0
|
property real menuPositionY: 0
|
||||||
|
|
||||||
|
signal editAppRequested(var app)
|
||||||
|
|
||||||
readonly property real shadowBuffer: 5
|
readonly property real shadowBuffer: 5
|
||||||
|
|
||||||
screen: parentModal?.effectiveScreen
|
screen: parentModal?.effectiveScreen
|
||||||
@@ -106,6 +107,7 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onHideRequested: root.hide()
|
onHideRequested: root.hide()
|
||||||
|
onEditAppRequested: app => root.editAppRequested(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|||||||
@@ -68,6 +68,27 @@ Item {
|
|||||||
hideRequested();
|
hideRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly property bool isRegularApp: desktopEntry && !currentApp?.isPlugin && !currentApp?.isCore && !currentApp?.isAction && !currentApp?.isBuiltInLauncher
|
||||||
|
|
||||||
|
signal editAppRequested(var app)
|
||||||
|
|
||||||
|
function hideCurrentApp() {
|
||||||
|
if (!desktopEntry)
|
||||||
|
return;
|
||||||
|
const appId = desktopEntry.id || desktopEntry.execString || "";
|
||||||
|
SessionData.hideApp(appId);
|
||||||
|
if (appLauncher)
|
||||||
|
appLauncher.updateFilteredModel();
|
||||||
|
hideRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
function editCurrentApp() {
|
||||||
|
if (!desktopEntry)
|
||||||
|
return;
|
||||||
|
editAppRequested(desktopEntry);
|
||||||
|
hideRequested();
|
||||||
|
}
|
||||||
|
|
||||||
readonly property var menuItems: {
|
readonly property var menuItems: {
|
||||||
const items = [];
|
const items = [];
|
||||||
|
|
||||||
@@ -103,6 +124,21 @@ Item {
|
|||||||
action: togglePin
|
action: togglePin
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (isRegularApp) {
|
||||||
|
items.push({
|
||||||
|
type: "item",
|
||||||
|
icon: "visibility_off",
|
||||||
|
text: I18n.tr("Hide App"),
|
||||||
|
action: hideCurrentApp
|
||||||
|
});
|
||||||
|
items.push({
|
||||||
|
type: "item",
|
||||||
|
icon: "edit",
|
||||||
|
text: I18n.tr("Edit App"),
|
||||||
|
action: editCurrentApp
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (desktopEntry && desktopEntry.actions) {
|
if (desktopEntry && desktopEntry.actions) {
|
||||||
items.push({
|
items.push({
|
||||||
type: "separator"
|
type: "separator"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Quickshell
|
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals.Spotlight
|
import qs.Modals.Spotlight
|
||||||
|
|
||||||
@@ -11,6 +10,8 @@ Popup {
|
|||||||
property var parentHandler: null
|
property var parentHandler: null
|
||||||
property var searchField: null
|
property var searchField: null
|
||||||
|
|
||||||
|
signal editAppRequested(var app)
|
||||||
|
|
||||||
function show(x, y, app, fromKeyboard) {
|
function show(x, y, app, fromKeyboard) {
|
||||||
fromKeyboard = fromKeyboard || false;
|
fromKeyboard = fromKeyboard || false;
|
||||||
menuContent.currentApp = app;
|
menuContent.currentApp = app;
|
||||||
@@ -53,7 +54,7 @@ Popup {
|
|||||||
if (parentHandler) {
|
if (parentHandler) {
|
||||||
parentHandler.enabled = true;
|
parentHandler.enabled = true;
|
||||||
}
|
}
|
||||||
if (searchField) {
|
if (searchField?.visible) {
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
searchField.forceActiveFocus();
|
searchField.forceActiveFocus();
|
||||||
});
|
});
|
||||||
@@ -84,5 +85,6 @@ Popup {
|
|||||||
id: menuContent
|
id: menuContent
|
||||||
appLauncher: root.appLauncher
|
appLauncher: root.appLauncher
|
||||||
onHideRequested: root.hide()
|
onHideRequested: root.hide()
|
||||||
|
onEditAppRequested: app => root.editAppRequested(app)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,20 @@ DankModal {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showWithEditApp(app) {
|
||||||
|
openedFromOverview = false;
|
||||||
|
isClosing = false;
|
||||||
|
resetContent();
|
||||||
|
spotlightOpen = true;
|
||||||
|
open();
|
||||||
|
Qt.callLater(() => {
|
||||||
|
if (spotlightContent?.appLauncher)
|
||||||
|
spotlightContent.appLauncher.ensureInitialized();
|
||||||
|
if (spotlightContent?.openEditMode)
|
||||||
|
spotlightContent.openEditMode(app);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
openedFromOverview = false;
|
openedFromOverview = false;
|
||||||
isClosing = true;
|
isClosing = true;
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Widgets
|
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals.Spotlight
|
import qs.Modals.Spotlight
|
||||||
import qs.Modules.AppDrawer
|
import qs.Modules.AppDrawer
|
||||||
import qs.Services
|
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
DankPopout {
|
DankPopout {
|
||||||
@@ -15,6 +11,63 @@ DankPopout {
|
|||||||
|
|
||||||
property string searchMode: "apps"
|
property string searchMode: "apps"
|
||||||
property alias fileSearch: fileSearchController
|
property alias fileSearch: fileSearchController
|
||||||
|
property bool editMode: false
|
||||||
|
property var editingApp: null
|
||||||
|
property string editAppId: ""
|
||||||
|
|
||||||
|
function openEditMode(app) {
|
||||||
|
if (!app)
|
||||||
|
return;
|
||||||
|
editingApp = app;
|
||||||
|
editAppId = app.id || app.execString || app.exec || "";
|
||||||
|
const existing = SessionData.getAppOverride(editAppId);
|
||||||
|
if (contentLoader.item) {
|
||||||
|
contentLoader.item.searchField.focus = false;
|
||||||
|
contentLoader.item.editNameField.text = existing?.name || "";
|
||||||
|
contentLoader.item.editIconField.text = existing?.icon || "";
|
||||||
|
contentLoader.item.editCommentField.text = existing?.comment || "";
|
||||||
|
contentLoader.item.editEnvVarsField.text = existing?.envVars || "";
|
||||||
|
contentLoader.item.editExtraFlagsField.text = existing?.extraFlags || "";
|
||||||
|
}
|
||||||
|
editMode = true;
|
||||||
|
Qt.callLater(() => {
|
||||||
|
if (contentLoader.item?.editNameField)
|
||||||
|
contentLoader.item.editNameField.forceActiveFocus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeEditMode() {
|
||||||
|
editMode = false;
|
||||||
|
editingApp = null;
|
||||||
|
editAppId = "";
|
||||||
|
Qt.callLater(() => {
|
||||||
|
if (contentLoader.item?.searchField)
|
||||||
|
contentLoader.item.searchField.forceActiveFocus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveAppOverride() {
|
||||||
|
const override = {};
|
||||||
|
if (contentLoader.item) {
|
||||||
|
if (contentLoader.item.editNameField.text.trim())
|
||||||
|
override.name = contentLoader.item.editNameField.text.trim();
|
||||||
|
if (contentLoader.item.editIconField.text.trim())
|
||||||
|
override.icon = contentLoader.item.editIconField.text.trim();
|
||||||
|
if (contentLoader.item.editCommentField.text.trim())
|
||||||
|
override.comment = contentLoader.item.editCommentField.text.trim();
|
||||||
|
if (contentLoader.item.editEnvVarsField.text.trim())
|
||||||
|
override.envVars = contentLoader.item.editEnvVarsField.text.trim();
|
||||||
|
if (contentLoader.item.editExtraFlagsField.text.trim())
|
||||||
|
override.extraFlags = contentLoader.item.editExtraFlagsField.text.trim();
|
||||||
|
}
|
||||||
|
SessionData.setAppOverride(editAppId, override);
|
||||||
|
closeEditMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetAppOverride() {
|
||||||
|
SessionData.clearAppOverride(editAppId);
|
||||||
|
closeEditMode();
|
||||||
|
}
|
||||||
|
|
||||||
function updateSearchMode(text) {
|
function updateSearchMode(text) {
|
||||||
if (text.startsWith("/")) {
|
if (text.startsWith("/")) {
|
||||||
@@ -42,16 +95,25 @@ DankPopout {
|
|||||||
popupHeight: 600
|
popupHeight: 600
|
||||||
triggerWidth: 40
|
triggerWidth: 40
|
||||||
positioning: ""
|
positioning: ""
|
||||||
|
contentHandlesKeys: editMode
|
||||||
|
|
||||||
onBackgroundClicked: {
|
onBackgroundClicked: {
|
||||||
if (contextMenu.visible) {
|
if (contextMenu.visible) {
|
||||||
contextMenu.close();
|
contextMenu.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (editMode) {
|
||||||
|
closeEditMode();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
searchMode = "apps";
|
searchMode = "apps";
|
||||||
|
editMode = false;
|
||||||
|
editingApp = null;
|
||||||
|
editAppId = "";
|
||||||
appLauncher.ensureInitialized();
|
appLauncher.ensureInitialized();
|
||||||
appLauncher.searchQuery = "";
|
appLauncher.searchQuery = "";
|
||||||
appLauncher.selectedIndex = 0;
|
appLauncher.selectedIndex = 0;
|
||||||
@@ -100,8 +162,45 @@ DankPopout {
|
|||||||
LayoutMirroring.childrenInherit: true
|
LayoutMirroring.childrenInherit: true
|
||||||
|
|
||||||
property alias searchField: searchField
|
property alias searchField: searchField
|
||||||
|
property alias keyHandler: keyHandler
|
||||||
|
property alias editNameField: editNameField
|
||||||
|
property alias editIconField: editIconField
|
||||||
|
property alias editCommentField: editCommentField
|
||||||
|
property alias editEnvVarsField: editEnvVarsField
|
||||||
|
property alias editExtraFlagsField: editExtraFlagsField
|
||||||
|
|
||||||
|
focus: true
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
|
Keys.onPressed: function (event) {
|
||||||
|
if (appDrawerPopout.editMode) {
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_Escape:
|
||||||
|
appDrawerPopout.closeEditMode();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Return:
|
||||||
|
case Qt.Key_Enter:
|
||||||
|
if (event.modifiers & Qt.ControlModifier) {
|
||||||
|
appDrawerPopout.saveAppOverride();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
case Qt.Key_S:
|
||||||
|
if (event.modifiers & Qt.ControlModifier) {
|
||||||
|
appDrawerPopout.saveAppOverride();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
case Qt.Key_R:
|
||||||
|
if ((event.modifiers & Qt.ControlModifier) && SessionData.getAppOverride(appDrawerPopout.editAppId) !== null) {
|
||||||
|
appDrawerPopout.resetAppOverride();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
smooth: true
|
smooth: true
|
||||||
@@ -140,7 +239,7 @@ DankPopout {
|
|||||||
id: keyHandler
|
id: keyHandler
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
focus: true
|
focus: !appDrawerPopout.editMode
|
||||||
|
|
||||||
function selectNext() {
|
function selectNext() {
|
||||||
switch (appDrawerPopout.searchMode) {
|
switch (appDrawerPopout.searchMode) {
|
||||||
@@ -172,6 +271,29 @@ DankPopout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSelectedItemPosition() {
|
||||||
|
const index = appLauncher.selectedIndex;
|
||||||
|
if (appLauncher.viewMode === "list") {
|
||||||
|
const y = index * (appList.itemHeight + appList.itemSpacing) - appList.contentY;
|
||||||
|
return Qt.point(appList.width / 2, y + appList.itemHeight / 2 + appList.y);
|
||||||
|
}
|
||||||
|
const row = Math.floor(index / appGrid.actualColumns);
|
||||||
|
const col = index % appGrid.actualColumns;
|
||||||
|
const x = col * appGrid.cellWidth + appGrid.cellWidth / 2;
|
||||||
|
const y = row * appGrid.cellHeight - appGrid.contentY + appGrid.cellHeight / 2 + appGrid.y;
|
||||||
|
return Qt.point(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
function openContextMenuForSelected() {
|
||||||
|
if (appDrawerPopout.searchMode !== "apps" || appLauncher.model.count === 0)
|
||||||
|
return;
|
||||||
|
const selectedApp = appLauncher.model.get(appLauncher.selectedIndex);
|
||||||
|
if (!selectedApp)
|
||||||
|
return;
|
||||||
|
const pos = getSelectedItemPosition();
|
||||||
|
contextMenu.show(pos.x, pos.y, selectedApp, true);
|
||||||
|
}
|
||||||
|
|
||||||
readonly property var keyMappings: {
|
readonly property var keyMappings: {
|
||||||
const mappings = {};
|
const mappings = {};
|
||||||
mappings[Qt.Key_Escape] = () => appDrawerPopout.close();
|
mappings[Qt.Key_Escape] = () => appDrawerPopout.close();
|
||||||
@@ -181,6 +303,8 @@ DankPopout {
|
|||||||
mappings[Qt.Key_Enter] = () => keyHandler.activateSelected();
|
mappings[Qt.Key_Enter] = () => keyHandler.activateSelected();
|
||||||
mappings[Qt.Key_Tab] = () => appDrawerPopout.searchMode === "apps" && appLauncher.viewMode === "grid" ? appLauncher.selectNextInRow() : keyHandler.selectNext();
|
mappings[Qt.Key_Tab] = () => appDrawerPopout.searchMode === "apps" && appLauncher.viewMode === "grid" ? appLauncher.selectNextInRow() : keyHandler.selectNext();
|
||||||
mappings[Qt.Key_Backtab] = () => appDrawerPopout.searchMode === "apps" && appLauncher.viewMode === "grid" ? appLauncher.selectPreviousInRow() : keyHandler.selectPrevious();
|
mappings[Qt.Key_Backtab] = () => appDrawerPopout.searchMode === "apps" && appLauncher.viewMode === "grid" ? appLauncher.selectPreviousInRow() : keyHandler.selectPrevious();
|
||||||
|
mappings[Qt.Key_Menu] = () => keyHandler.openContextMenuForSelected();
|
||||||
|
mappings[Qt.Key_F10] = () => keyHandler.openContextMenuForSelected();
|
||||||
|
|
||||||
if (appDrawerPopout.searchMode === "apps" && appLauncher.viewMode === "grid") {
|
if (appDrawerPopout.searchMode === "apps" && appLauncher.viewMode === "grid") {
|
||||||
mappings[Qt.Key_Right] = () => I18n.isRtl ? appLauncher.selectPreviousInRow() : appLauncher.selectNextInRow();
|
mappings[Qt.Key_Right] = () => I18n.isRtl ? appLauncher.selectPreviousInRow() : appLauncher.selectNextInRow();
|
||||||
@@ -191,6 +315,9 @@ DankPopout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Keys.onPressed: function (event) {
|
Keys.onPressed: function (event) {
|
||||||
|
if (appDrawerPopout.editMode)
|
||||||
|
return;
|
||||||
|
|
||||||
if (keyMappings[event.key]) {
|
if (keyMappings[event.key]) {
|
||||||
keyMappings[event.key]();
|
keyMappings[event.key]();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
@@ -198,9 +325,8 @@ DankPopout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const hasCtrl = event.modifiers & Qt.ControlModifier;
|
const hasCtrl = event.modifiers & Qt.ControlModifier;
|
||||||
if (!hasCtrl) {
|
if (!hasCtrl)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case Qt.Key_N:
|
case Qt.Key_N:
|
||||||
@@ -234,6 +360,7 @@ DankPopout {
|
|||||||
x: Theme.spacingS
|
x: Theme.spacingS
|
||||||
y: Theme.spacingS
|
y: Theme.spacingS
|
||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
visible: !appDrawerPopout.editMode
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@@ -487,7 +614,7 @@ DankPopout {
|
|||||||
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, false);
|
||||||
}
|
}
|
||||||
onKeyboardNavigationReset: {
|
onKeyboardNavigationReset: {
|
||||||
appLauncher.keyboardNavigationActive = false;
|
appLauncher.keyboardNavigationActive = false;
|
||||||
@@ -574,7 +701,7 @@ DankPopout {
|
|||||||
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, false);
|
||||||
}
|
}
|
||||||
onKeyboardNavigationReset: {
|
onKeyboardNavigationReset: {
|
||||||
appLauncher.keyboardNavigationActive = false;
|
appLauncher.keyboardNavigationActive = false;
|
||||||
@@ -615,6 +742,281 @@ DankPopout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: editView
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.spacingS
|
||||||
|
visible: appDrawerPopout.editMode
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: backButtonArea.containsMouse ? Theme.surfaceHover : "transparent"
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
name: "arrow_back"
|
||||||
|
size: 20
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: backButtonArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: appDrawerPopout.closeEditMode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
source: appDrawerPopout.editingApp?.icon ? "image://icon/" + appDrawerPopout.editingApp.icon : "image://icon/application-x-executable"
|
||||||
|
sourceSize.width: 40
|
||||||
|
sourceSize.height: 40
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Edit App")
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: appDrawerPopout.editingApp?.name || ""
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 1
|
||||||
|
color: Theme.outlineMedium
|
||||||
|
}
|
||||||
|
|
||||||
|
Flickable {
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - y - editButtonsRow.height - Theme.spacingM
|
||||||
|
contentHeight: editFieldsColumn.height
|
||||||
|
clip: true
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: editFieldsColumn
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Name")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: editNameField
|
||||||
|
width: parent.width
|
||||||
|
height: 44
|
||||||
|
focus: true
|
||||||
|
placeholderText: appDrawerPopout.editingApp?.name || ""
|
||||||
|
keyNavigationTab: editIconField
|
||||||
|
keyNavigationBacktab: editExtraFlagsField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Icon")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: editIconField
|
||||||
|
width: parent.width
|
||||||
|
height: 44
|
||||||
|
placeholderText: appDrawerPopout.editingApp?.icon || ""
|
||||||
|
keyNavigationTab: editCommentField
|
||||||
|
keyNavigationBacktab: editNameField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Description")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: editCommentField
|
||||||
|
width: parent.width
|
||||||
|
height: 44
|
||||||
|
placeholderText: appDrawerPopout.editingApp?.comment || ""
|
||||||
|
keyNavigationTab: editEnvVarsField
|
||||||
|
keyNavigationBacktab: editIconField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Environment Variables")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: "KEY=value KEY2=value2"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall - 1
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: editEnvVarsField
|
||||||
|
width: parent.width
|
||||||
|
height: 44
|
||||||
|
placeholderText: "VAR=value"
|
||||||
|
keyNavigationTab: editExtraFlagsField
|
||||||
|
keyNavigationBacktab: editCommentField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Extra Arguments")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
}
|
||||||
|
|
||||||
|
DankTextField {
|
||||||
|
id: editExtraFlagsField
|
||||||
|
width: parent.width
|
||||||
|
height: 44
|
||||||
|
placeholderText: "--flag --option=value"
|
||||||
|
keyNavigationTab: editNameField
|
||||||
|
keyNavigationBacktab: editEnvVarsField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: editButtonsRow
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 90
|
||||||
|
height: 40
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: resetButtonArea.containsMouse ? Theme.surfacePressed : Theme.surfaceVariantAlpha
|
||||||
|
visible: SessionData.getAppOverride(appDrawerPopout.editAppId) !== null
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Reset")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.error
|
||||||
|
font.weight: Font.Medium
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: resetButtonArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: appDrawerPopout.resetAppOverride()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 90
|
||||||
|
height: 40
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: cancelButtonArea.containsMouse ? Theme.surfacePressed : Theme.surfaceVariantAlpha
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Cancel")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: cancelButtonArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: appDrawerPopout.closeEditMode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 90
|
||||||
|
height: 40
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: saveButtonArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.9) : Theme.primary
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Save")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.onPrimary
|
||||||
|
font.weight: Font.Medium
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: saveButtonArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: appDrawerPopout.saveAppOverride()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: contextMenu.visible
|
visible: contextMenu.visible
|
||||||
@@ -624,338 +1026,21 @@ DankPopout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Popup {
|
SpotlightContextMenuPopup {
|
||||||
id: contextMenu
|
id: contextMenu
|
||||||
|
|
||||||
property var currentApp: null
|
parent: contentLoader.item
|
||||||
readonly property var desktopEntry: (currentApp && !currentApp.isPlugin && appLauncher && appLauncher._uniqueApps && currentApp.appIndex >= 0 && currentApp.appIndex < appLauncher._uniqueApps.length) ? appLauncher._uniqueApps[currentApp.appIndex] : null
|
appLauncher: appLauncher
|
||||||
readonly property string appId: desktopEntry ? (desktopEntry.id || desktopEntry.execString || "") : ""
|
parentHandler: contentLoader.item?.keyHandler ?? null
|
||||||
readonly property bool isPinned: appId && SessionData.isPinnedApp(appId)
|
searchField: contentLoader.item?.searchField ?? null
|
||||||
|
visible: false
|
||||||
|
z: 1000
|
||||||
|
}
|
||||||
|
|
||||||
function show(x, y, app) {
|
Connections {
|
||||||
currentApp = app;
|
target: contextMenu
|
||||||
let finalX = x + 4;
|
function onEditAppRequested(app) {
|
||||||
let finalY = y + 4;
|
appDrawerPopout.openEditMode(app);
|
||||||
|
|
||||||
if (contextMenu.parent) {
|
|
||||||
const parentWidth = contextMenu.parent.width;
|
|
||||||
const parentHeight = contextMenu.parent.height;
|
|
||||||
const menuWidth = contextMenu.width;
|
|
||||||
const menuHeight = contextMenu.height;
|
|
||||||
|
|
||||||
if (finalX + menuWidth > parentWidth) {
|
|
||||||
finalX = Math.max(0, parentWidth - menuWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (finalY + menuHeight > parentHeight) {
|
|
||||||
finalY = Math.max(0, parentHeight - menuHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
contextMenu.x = finalX;
|
|
||||||
contextMenu.y = finalY;
|
|
||||||
contextMenu.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
function hide() {
|
|
||||||
contextMenu.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
width: Math.max(180, menuColumn.implicitWidth + Theme.spacingS * 2)
|
|
||||||
height: menuColumn.implicitHeight + Theme.spacingS * 2
|
|
||||||
padding: 0
|
|
||||||
closePolicy: Popup.CloseOnPressOutside
|
|
||||||
modal: false
|
|
||||||
dim: false
|
|
||||||
|
|
||||||
background: Rectangle {
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.topMargin: 4
|
|
||||||
anchors.leftMargin: 2
|
|
||||||
anchors.rightMargin: -2
|
|
||||||
anchors.bottomMargin: -4
|
|
||||||
radius: parent.radius
|
|
||||||
color: Qt.rgba(0, 0, 0, 0.15)
|
|
||||||
z: -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enter: Transition {
|
|
||||||
NumberAnimation {
|
|
||||||
property: "opacity"
|
|
||||||
from: 0
|
|
||||||
to: 1
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.emphasizedEasing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit: Transition {
|
|
||||||
NumberAnimation {
|
|
||||||
property: "opacity"
|
|
||||||
from: 1
|
|
||||||
to: 0
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.emphasizedEasing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: menuColumn
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Theme.spacingS
|
|
||||||
spacing: 1
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: 32
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: pinMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.spacingS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: contextMenu.isPinned ? "keep_off" : "push_pin"
|
|
||||||
size: Theme.iconSize - 2
|
|
||||||
color: Theme.surfaceText
|
|
||||||
opacity: 0.7
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: contextMenu.isPinned ? I18n.tr("Unpin from Dock") : I18n.tr("Pin to Dock")
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Normal
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: pinMouseArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
if (!contextMenu.desktopEntry) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contextMenu.isPinned) {
|
|
||||||
SessionData.removePinnedApp(contextMenu.appId);
|
|
||||||
} else {
|
|
||||||
SessionData.addPinnedApp(contextMenu.appId);
|
|
||||||
}
|
|
||||||
contextMenu.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width - Theme.spacingS * 2
|
|
||||||
height: 5
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: parent.width
|
|
||||||
height: 1
|
|
||||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: contextMenu.desktopEntry && contextMenu.desktopEntry.actions ? contextMenu.desktopEntry.actions : []
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: Math.max(parent.width, actionRow.implicitWidth + Theme.spacingS * 2)
|
|
||||||
height: 32
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: actionMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: actionRow
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.spacingS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
Item {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: Theme.iconSize - 2
|
|
||||||
height: Theme.iconSize - 2
|
|
||||||
visible: modelData.icon && modelData.icon !== ""
|
|
||||||
|
|
||||||
IconImage {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: modelData.icon ? Quickshell.iconPath(modelData.icon, true) : ""
|
|
||||||
smooth: true
|
|
||||||
asynchronous: true
|
|
||||||
visible: status === Image.Ready
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: modelData.name || ""
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Normal
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: actionMouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
if (modelData && contextMenu.desktopEntry) {
|
|
||||||
SessionService.launchDesktopAction(contextMenu.desktopEntry, modelData);
|
|
||||||
if (contextMenu.currentApp) {
|
|
||||||
appLauncher.appLaunched(contextMenu.currentApp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
contextMenu.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
visible: contextMenu.desktopEntry && contextMenu.desktopEntry.actions && contextMenu.desktopEntry.actions.length > 0
|
|
||||||
width: parent.width - Theme.spacingS * 2
|
|
||||||
height: 5
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: parent.width
|
|
||||||
height: 1
|
|
||||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: 32
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: launchMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.spacingS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: "launch"
|
|
||||||
size: Theme.iconSize - 2
|
|
||||||
color: Theme.surfaceText
|
|
||||||
opacity: 0.7
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: I18n.tr("Launch")
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Normal
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: launchMouseArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
if (contextMenu.currentApp)
|
|
||||||
appLauncher.launchApp(contextMenu.currentApp);
|
|
||||||
|
|
||||||
contextMenu.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
visible: SessionService.nvidiaCommand
|
|
||||||
width: parent.width - Theme.spacingS * 2
|
|
||||||
height: 5
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: parent.width
|
|
||||||
height: 1
|
|
||||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
visible: SessionService.nvidiaCommand
|
|
||||||
width: parent.width
|
|
||||||
height: 32
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: nvidiaMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.spacingS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: "memory"
|
|
||||||
size: Theme.iconSize - 2
|
|
||||||
color: Theme.surfaceText
|
|
||||||
opacity: 0.7
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: I18n.tr("Launch on dGPU")
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Normal
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: nvidiaMouseArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
if (contextMenu.desktopEntry) {
|
|
||||||
SessionService.launchDesktopEntry(contextMenu.desktopEntry, true);
|
|
||||||
if (contextMenu.currentApp) {
|
|
||||||
appLauncher.appLaunched(contextMenu.currentApp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
contextMenu.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,16 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: SessionData
|
||||||
|
function onHiddenAppsChanged() {
|
||||||
|
updateFilteredModel();
|
||||||
|
}
|
||||||
|
function onAppOverridesChanged() {
|
||||||
|
updateFilteredModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateFilteredModel() {
|
function updateFilteredModel() {
|
||||||
if (suppressUpdatesWhileLaunching) {
|
if (suppressUpdatesWhileLaunching) {
|
||||||
suppressUpdatesWhileLaunching = false;
|
suppressUpdatesWhileLaunching = false;
|
||||||
@@ -124,7 +134,7 @@ Item {
|
|||||||
emptyTriggerItems = emptyTriggerItems.concat(items);
|
emptyTriggerItems = emptyTriggerItems.concat(items);
|
||||||
});
|
});
|
||||||
const coreItems = AppSearchService.getCoreApps("");
|
const coreItems = AppSearchService.getCoreApps("");
|
||||||
apps = AppSearchService.applications.concat(emptyTriggerItems).concat(coreItems);
|
apps = AppSearchService.getVisibleApplications().concat(emptyTriggerItems).concat(coreItems);
|
||||||
} else {
|
} else {
|
||||||
apps = AppSearchService.getAppsInCategory(selectedCategory).slice(0, maxResults);
|
apps = AppSearchService.getAppsInCategory(selectedCategory).slice(0, maxResults);
|
||||||
const coreItems = AppSearchService.getCoreApps("").filter(app => app.categories.includes(selectedCategory));
|
const coreItems = AppSearchService.getCoreApps("").filter(app => app.categories.includes(selectedCategory));
|
||||||
@@ -205,6 +215,7 @@ Item {
|
|||||||
"isPlugin": isPluginItem,
|
"isPlugin": isPluginItem,
|
||||||
"isCore": app.isCore === true,
|
"isCore": app.isCore === true,
|
||||||
"isBuiltInLauncher": app.isBuiltInLauncher === true,
|
"isBuiltInLauncher": app.isBuiltInLauncher === true,
|
||||||
|
"isAction": app.isAction === true,
|
||||||
"appIndex": uniqueApps.length - 1,
|
"appIndex": uniqueApps.length - 1,
|
||||||
"pinned": app._pinned === true
|
"pinned": app._pinned === true
|
||||||
});
|
});
|
||||||
@@ -283,6 +294,13 @@ Item {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (appData.isAction && actualApp.parentApp && actualApp.actionData) {
|
||||||
|
SessionService.launchDesktopAction(actualApp.parentApp, actualApp.actionData);
|
||||||
|
appLaunched(appData);
|
||||||
|
AppUsageHistoryData.addAppUsage(actualApp.parentApp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SessionService.launchDesktopEntry(actualApp);
|
SessionService.launchDesktopEntry(actualApp);
|
||||||
appLaunched(appData);
|
appLaunched(appData);
|
||||||
AppUsageHistoryData.addAppUsage(actualApp);
|
AppUsageHistoryData.addAppUsage(actualApp);
|
||||||
|
|||||||
@@ -757,12 +757,13 @@ Item {
|
|||||||
}
|
}
|
||||||
property bool isOccupied: {
|
property bool isOccupied: {
|
||||||
if (CompositorService.isHyprland)
|
if (CompositorService.isHyprland)
|
||||||
return Array.from(Hyprland.toplevels?.values || [])
|
return Array.from(Hyprland.toplevels?.values || []).some(tl => tl.workspace?.id === modelData?.id);
|
||||||
.some(tl => tl.workspace?.id === modelData?.id);
|
|
||||||
if (CompositorService.isDwl)
|
if (CompositorService.isDwl)
|
||||||
return modelData.clients > 0;
|
return modelData.clients > 0;
|
||||||
if (CompositorService.isNiri)
|
if (CompositorService.isNiri) {
|
||||||
return NiriService.windows?.some(win => win.workspace_id === modelData?.id) ?? false;
|
const workspace = NiriService.allWorkspaces.find(ws => ws.idx + 1 === modelData && ws.output === root.effectiveScreenName);
|
||||||
|
return workspace ? (NiriService.windows?.some(win => win.workspace_id === workspace.id) ?? false) : false;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
property bool isPlaceholder: {
|
property bool isPlaceholder: {
|
||||||
@@ -848,16 +849,18 @@ Item {
|
|||||||
|
|
||||||
readonly property color occupiedColor: {
|
readonly property color occupiedColor: {
|
||||||
switch (SettingsData.workspaceOccupiedColorMode) {
|
switch (SettingsData.workspaceOccupiedColorMode) {
|
||||||
|
case "sec":
|
||||||
|
return Theme.secondary;
|
||||||
case "s":
|
case "s":
|
||||||
return Theme.surface;
|
return Theme.surface;
|
||||||
case "sc":
|
case "sc":
|
||||||
return Theme.surfaceContainer;
|
return Theme.surfaceContainer;
|
||||||
case "sch":
|
case "sch":
|
||||||
return Theme.surfaceContainerHigh;
|
return Theme.surfaceContainerHigh;
|
||||||
case "none":
|
case "schh":
|
||||||
return unfocusedColor;
|
return Theme.surfaceContainerHighest;
|
||||||
default:
|
default:
|
||||||
return Theme.secondary;
|
return unfocusedColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,30 +182,20 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onOpenRequested: {
|
onOpenRequested: {
|
||||||
if (hasUnsavedChanges()) {
|
textEditor.autoSaveToSession();
|
||||||
root.pendingAction = "open";
|
if (textEditor.text.length > 0) {
|
||||||
root.confirmationDialogOpen = true;
|
createNewTab();
|
||||||
confirmationDialogLoader.active = true;
|
|
||||||
if (confirmationDialogLoader.item)
|
|
||||||
confirmationDialogLoader.item.open();
|
|
||||||
} else {
|
|
||||||
root.fileDialogOpen = true;
|
|
||||||
loadBrowserLoader.active = true;
|
|
||||||
if (loadBrowserLoader.item)
|
|
||||||
loadBrowserLoader.item.open();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
root.fileDialogOpen = true;
|
||||||
|
loadBrowserLoader.active = true;
|
||||||
|
if (loadBrowserLoader.item)
|
||||||
|
loadBrowserLoader.item.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
onNewRequested: {
|
onNewRequested: {
|
||||||
if (hasUnsavedChanges()) {
|
textEditor.autoSaveToSession();
|
||||||
root.pendingAction = "new";
|
createNewTab();
|
||||||
root.confirmationDialogOpen = true;
|
|
||||||
confirmationDialogLoader.active = true;
|
|
||||||
if (confirmationDialogLoader.item)
|
|
||||||
confirmationDialogLoader.item.open();
|
|
||||||
} else {
|
|
||||||
createNewTab();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onEscapePressed: {
|
onEscapePressed: {
|
||||||
@@ -266,7 +256,7 @@ Item {
|
|||||||
id: saveBrowserLoader
|
id: saveBrowserLoader
|
||||||
active: false
|
active: false
|
||||||
|
|
||||||
FileBrowserModal {
|
FileBrowserSurfaceModal {
|
||||||
id: saveBrowser
|
id: saveBrowser
|
||||||
|
|
||||||
browserTitle: I18n.tr("Save Notepad File")
|
browserTitle: I18n.tr("Save Notepad File")
|
||||||
@@ -332,7 +322,7 @@ Item {
|
|||||||
id: loadBrowserLoader
|
id: loadBrowserLoader
|
||||||
active: false
|
active: false
|
||||||
|
|
||||||
FileBrowserModal {
|
FileBrowserSurfaceModal {
|
||||||
id: loadBrowser
|
id: loadBrowser
|
||||||
|
|
||||||
browserTitle: I18n.tr("Open Notepad File")
|
browserTitle: I18n.tr("Open Notepad File")
|
||||||
|
|||||||
@@ -52,20 +52,15 @@ Column {
|
|||||||
|
|
||||||
readonly property bool isActive: NotepadStorageService.currentTabIndex === index
|
readonly property bool isActive: NotepadStorageService.currentTabIndex === index
|
||||||
readonly property bool isHovered: tabMouseArea.containsMouse && !closeMouseArea.containsMouse
|
readonly property bool isHovered: tabMouseArea.containsMouse && !closeMouseArea.containsMouse
|
||||||
readonly property real calculatedWidth: {
|
readonly property real tabWidth: 128
|
||||||
const textWidth = tabText.paintedWidth || 100;
|
|
||||||
const closeButtonWidth = NotepadStorageService.tabs.length > 1 ? 20 : 0;
|
|
||||||
const spacing = Theme.spacingXS;
|
|
||||||
const padding = Theme.spacingM * 2;
|
|
||||||
return Math.max(120, Math.min(200, textWidth + closeButtonWidth + spacing + padding));
|
|
||||||
}
|
|
||||||
|
|
||||||
width: calculatedWidth
|
width: tabWidth
|
||||||
height: 32
|
height: 32
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: isActive ? Theme.primaryPressed : isHovered ? Theme.primaryHoverLight : Theme.withAlpha(Theme.primaryPressed, 0)
|
color: isActive ? Theme.primaryPressed : isHovered ? Theme.primaryHoverLight : Theme.withAlpha(Theme.primaryPressed, 0)
|
||||||
border.width: isActive ? 0 : 1
|
border.width: isActive ? 0 : 1
|
||||||
border.color: Theme.outlineMedium
|
border.color: Theme.outlineMedium
|
||||||
|
clip: true
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: tabMouseArea
|
id: tabMouseArea
|
||||||
@@ -79,11 +74,14 @@ Column {
|
|||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: tabContent
|
id: tabContent
|
||||||
anchors.centerIn: parent
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: Theme.spacingM
|
||||||
|
anchors.rightMargin: Theme.spacingM
|
||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: tabText
|
id: tabText
|
||||||
|
width: parent.width - (tabCloseButton.visible ? tabCloseButton.width + Theme.spacingXS : 0)
|
||||||
text: {
|
text: {
|
||||||
var prefix = "";
|
var prefix = "";
|
||||||
if (hasUnsavedChangesForTab(modelData)) {
|
if (hasUnsavedChangesForTab(modelData)) {
|
||||||
@@ -96,6 +94,7 @@ Column {
|
|||||||
font.weight: isActive ? Font.Medium : Font.Normal
|
font.weight: isActive ? Font.Medium : Font.Normal
|
||||||
elide: Text.ElideMiddle
|
elide: Text.ElideMiddle
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
|
wrapMode: Text.NoWrap
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ Column {
|
|||||||
|
|
||||||
TextArea.flickable: TextArea {
|
TextArea.flickable: TextArea {
|
||||||
id: textArea
|
id: textArea
|
||||||
placeholderText: I18n.tr("Start typing your notes here...")
|
placeholderText: ""
|
||||||
placeholderTextColor: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
placeholderTextColor: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||||
font.family: SettingsData.notepadUseMonospace ? SettingsData.monoFontFamily : (SettingsData.notepadFontFamily || SettingsData.fontFamily)
|
font.family: SettingsData.notepadUseMonospace ? SettingsData.monoFontFamily : (SettingsData.notepadFontFamily || SettingsData.fontFamily)
|
||||||
font.pixelSize: SettingsData.notepadFontSize * SettingsData.fontScale
|
font.pixelSize: SettingsData.notepadFontSize * SettingsData.fontScale
|
||||||
@@ -404,6 +404,22 @@ Column {
|
|||||||
topPadding: Theme.spacingM
|
topPadding: Theme.spacingM
|
||||||
rightPadding: Theme.spacingM
|
rightPadding: Theme.spacingM
|
||||||
bottomPadding: Theme.spacingM
|
bottomPadding: Theme.spacingM
|
||||||
|
cursorDelegate: Rectangle {
|
||||||
|
width: 1.5
|
||||||
|
radius: 1
|
||||||
|
color: Theme.surfaceText
|
||||||
|
x: textArea.cursorRectangle.x
|
||||||
|
y: textArea.cursorRectangle.y
|
||||||
|
height: textArea.cursorRectangle.height
|
||||||
|
opacity: 1.0
|
||||||
|
|
||||||
|
SequentialAnimation on opacity {
|
||||||
|
running: textArea.activeFocus
|
||||||
|
loops: Animation.Infinite
|
||||||
|
PropertyAnimation { from: 1.0; to: 0.0; duration: 650; easing.type: Easing.InOutQuad }
|
||||||
|
PropertyAnimation { from: 0.0; to: 1.0; duration: 650; easing.type: Easing.InOutQuad }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
loadCurrentTabContent()
|
loadCurrentTabContent()
|
||||||
@@ -480,6 +496,20 @@ Column {
|
|||||||
color: "transparent"
|
color: "transparent"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: placeholderOverlay
|
||||||
|
text: I18n.tr("Start typing your notes here...")
|
||||||
|
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||||
|
font.family: textArea.font.family
|
||||||
|
font.pixelSize: textArea.font.pixelSize
|
||||||
|
visible: textArea.text.length === 0
|
||||||
|
anchors.left: textArea.left
|
||||||
|
anchors.top: textArea.top
|
||||||
|
anchors.leftMargin: textArea.leftPadding
|
||||||
|
anchors.topMargin: textArea.topPadding
|
||||||
|
z: textArea.z + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,61 @@ Popup {
|
|||||||
id: processContextMenu
|
id: processContextMenu
|
||||||
|
|
||||||
property var processData: null
|
property var processData: null
|
||||||
|
property int selectedIndex: -1
|
||||||
|
property bool keyboardNavigation: false
|
||||||
|
property var parentFocusItem: null
|
||||||
|
|
||||||
function show(x, y) {
|
signal menuClosed
|
||||||
|
signal processKilled
|
||||||
|
|
||||||
|
readonly property var menuItems: [
|
||||||
|
{
|
||||||
|
text: I18n.tr("Copy PID"),
|
||||||
|
icon: "tag",
|
||||||
|
action: copyPid,
|
||||||
|
enabled: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: I18n.tr("Copy Name"),
|
||||||
|
icon: "content_copy",
|
||||||
|
action: copyName,
|
||||||
|
enabled: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: I18n.tr("Copy Full Command"),
|
||||||
|
icon: "code",
|
||||||
|
action: copyFullCommand,
|
||||||
|
enabled: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "separator"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: I18n.tr("Kill Process"),
|
||||||
|
icon: "close",
|
||||||
|
action: killProcess,
|
||||||
|
enabled: true,
|
||||||
|
dangerous: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: I18n.tr("Force Kill (SIGKILL)"),
|
||||||
|
icon: "dangerous",
|
||||||
|
action: forceKillProcess,
|
||||||
|
enabled: processData && processData.pid > 1000,
|
||||||
|
dangerous: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
readonly property int visibleItemCount: {
|
||||||
|
let count = 0;
|
||||||
|
for (let i = 0; i < menuItems.length; i++) {
|
||||||
|
if (menuItems[i].type !== "separator")
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
function show(x, y, fromKeyboard) {
|
||||||
let finalX = x;
|
let finalX = x;
|
||||||
let finalY = y;
|
let finalY = y;
|
||||||
|
|
||||||
@@ -27,17 +80,98 @@ Popup {
|
|||||||
|
|
||||||
processContextMenu.x = finalX;
|
processContextMenu.x = finalX;
|
||||||
processContextMenu.y = finalY;
|
processContextMenu.y = finalY;
|
||||||
|
keyboardNavigation = fromKeyboard || false;
|
||||||
|
selectedIndex = fromKeyboard ? 0 : -1;
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectNext() {
|
||||||
|
if (visibleItemCount === 0)
|
||||||
|
return;
|
||||||
|
let current = selectedIndex;
|
||||||
|
let next = current;
|
||||||
|
do {
|
||||||
|
next = (next + 1) % menuItems.length;
|
||||||
|
} while (menuItems[next].type === "separator" && next !== current)
|
||||||
|
selectedIndex = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectPrevious() {
|
||||||
|
if (visibleItemCount === 0)
|
||||||
|
return;
|
||||||
|
let current = selectedIndex;
|
||||||
|
let prev = current;
|
||||||
|
do {
|
||||||
|
prev = (prev - 1 + menuItems.length) % menuItems.length;
|
||||||
|
} while (menuItems[prev].type === "separator" && prev !== current)
|
||||||
|
selectedIndex = prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
function activateSelected() {
|
||||||
|
if (selectedIndex < 0 || selectedIndex >= menuItems.length)
|
||||||
|
return;
|
||||||
|
const item = menuItems[selectedIndex];
|
||||||
|
if (item.type === "separator" || !item.enabled)
|
||||||
|
return;
|
||||||
|
item.action();
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyPid() {
|
||||||
|
if (processData)
|
||||||
|
Quickshell.execDetached(["dms", "cl", "copy", processData.pid.toString()]);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyName() {
|
||||||
|
if (processData) {
|
||||||
|
const name = processData.command || "";
|
||||||
|
Quickshell.execDetached(["dms", "cl", "copy", name]);
|
||||||
|
}
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyFullCommand() {
|
||||||
|
if (processData) {
|
||||||
|
const fullCmd = processData.fullCommand || processData.command || "";
|
||||||
|
Quickshell.execDetached(["dms", "cl", "copy", fullCmd]);
|
||||||
|
}
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function killProcess() {
|
||||||
|
if (processData)
|
||||||
|
Quickshell.execDetached(["kill", processData.pid.toString()]);
|
||||||
|
processKilled();
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function forceKillProcess() {
|
||||||
|
if (processData)
|
||||||
|
Quickshell.execDetached(["kill", "-9", processData.pid.toString()]);
|
||||||
|
processKilled();
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
width: 200
|
width: 200
|
||||||
height: menuColumn.implicitHeight + Theme.spacingS * 2
|
height: menuColumn.implicitHeight + Theme.spacingS * 2
|
||||||
padding: 0
|
padding: 0
|
||||||
modal: false
|
modal: false
|
||||||
closePolicy: Popup.CloseOnEscape
|
closePolicy: Popup.CloseOnEscape
|
||||||
|
|
||||||
onClosed: closePolicy = Popup.CloseOnEscape
|
onClosed: {
|
||||||
onOpened: outsideClickTimer.start()
|
closePolicy = Popup.CloseOnEscape;
|
||||||
|
keyboardNavigation = false;
|
||||||
|
selectedIndex = -1;
|
||||||
|
menuClosed();
|
||||||
|
if (parentFocusItem)
|
||||||
|
Qt.callLater(() => parentFocusItem.forceActiveFocus());
|
||||||
|
}
|
||||||
|
|
||||||
|
onOpened: {
|
||||||
|
outsideClickTimer.start();
|
||||||
|
if (keyboardNavigation)
|
||||||
|
Qt.callLater(() => keyboardHandler.forceActiveFocus());
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: outsideClickTimer
|
id: outsideClickTimer
|
||||||
@@ -55,142 +189,145 @@ Popup {
|
|||||||
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
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: keyboardHandler
|
||||||
|
anchors.fill: parent
|
||||||
|
focus: keyboardNavigation
|
||||||
|
|
||||||
|
Keys.onPressed: event => {
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_Down:
|
||||||
|
case Qt.Key_J:
|
||||||
|
keyboardNavigation = true;
|
||||||
|
selectNext();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Up:
|
||||||
|
case Qt.Key_K:
|
||||||
|
keyboardNavigation = true;
|
||||||
|
selectPrevious();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Return:
|
||||||
|
case Qt.Key_Enter:
|
||||||
|
case Qt.Key_Space:
|
||||||
|
activateSelected();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Escape:
|
||||||
|
case Qt.Key_Left:
|
||||||
|
case Qt.Key_H:
|
||||||
|
close();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: menuColumn
|
id: menuColumn
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingS
|
anchors.margins: Theme.spacingS
|
||||||
spacing: 1
|
spacing: 1
|
||||||
|
|
||||||
MenuItem {
|
Repeater {
|
||||||
text: I18n.tr("Copy PID")
|
model: menuItems
|
||||||
iconName: "tag"
|
|
||||||
onClicked: {
|
|
||||||
if (processContextMenu.processData)
|
|
||||||
Quickshell.execDetached(["dms", "cl", "copy", processContextMenu.processData.pid.toString()]);
|
|
||||||
processContextMenu.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItem {
|
Item {
|
||||||
text: I18n.tr("Copy Name")
|
width: parent.width
|
||||||
iconName: "content_copy"
|
height: modelData.type === "separator" ? 5 : 32
|
||||||
onClicked: {
|
visible: modelData.type !== "separator" || index > 0
|
||||||
if (processContextMenu.processData) {
|
|
||||||
const name = processContextMenu.processData.command || "";
|
property int itemVisibleIndex: {
|
||||||
Quickshell.execDetached(["dms", "cl", "copy", name]);
|
let count = 0;
|
||||||
|
for (let i = 0; i < index; i++) {
|
||||||
|
if (menuItems[i].type !== "separator")
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
processContextMenu.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItem {
|
Rectangle {
|
||||||
text: I18n.tr("Copy Full Command")
|
visible: modelData.type === "separator"
|
||||||
iconName: "code"
|
width: parent.width - Theme.spacingS * 2
|
||||||
onClicked: {
|
height: 1
|
||||||
if (processContextMenu.processData) {
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
const fullCmd = processContextMenu.processData.fullCommand || processContextMenu.processData.command || "";
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
Quickshell.execDetached(["dms", "cl", "copy", fullCmd]);
|
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.15)
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: menuItem
|
||||||
|
visible: modelData.type !== "separator"
|
||||||
|
width: parent.width
|
||||||
|
height: 32
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: {
|
||||||
|
if (!modelData.enabled)
|
||||||
|
return "transparent";
|
||||||
|
const isSelected = keyboardNavigation && selectedIndex === index;
|
||||||
|
if (modelData.dangerous) {
|
||||||
|
if (isSelected)
|
||||||
|
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.2);
|
||||||
|
return menuItemArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) : "transparent";
|
||||||
|
}
|
||||||
|
if (isSelected)
|
||||||
|
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2);
|
||||||
|
return menuItemArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent";
|
||||||
|
}
|
||||||
|
opacity: modelData.enabled ? 1 : 0.5
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: modelData.icon || ""
|
||||||
|
size: 16
|
||||||
|
color: {
|
||||||
|
if (!modelData.enabled)
|
||||||
|
return Theme.surfaceVariantText;
|
||||||
|
const isSelected = keyboardNavigation && selectedIndex === index;
|
||||||
|
if (modelData.dangerous && (menuItemArea.containsMouse || isSelected))
|
||||||
|
return Theme.error;
|
||||||
|
return Theme.surfaceText;
|
||||||
|
}
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData.text || ""
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Normal
|
||||||
|
color: {
|
||||||
|
if (!modelData.enabled)
|
||||||
|
return Theme.surfaceVariantText;
|
||||||
|
const isSelected = keyboardNavigation && selectedIndex === index;
|
||||||
|
if (modelData.dangerous && (menuItemArea.containsMouse || isSelected))
|
||||||
|
return Theme.error;
|
||||||
|
return Theme.surfaceText;
|
||||||
|
}
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: menuItemArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: modelData.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
|
enabled: modelData.enabled
|
||||||
|
onEntered: {
|
||||||
|
keyboardNavigation = false;
|
||||||
|
selectedIndex = index;
|
||||||
|
}
|
||||||
|
onClicked: modelData.action()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
processContextMenu.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width - Theme.spacingS * 2
|
|
||||||
height: 1
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.15)
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItem {
|
|
||||||
text: I18n.tr("Kill Process")
|
|
||||||
iconName: "close"
|
|
||||||
dangerous: true
|
|
||||||
enabled: processContextMenu.processData
|
|
||||||
onClicked: {
|
|
||||||
if (processContextMenu.processData)
|
|
||||||
Quickshell.execDetached(["kill", processContextMenu.processData.pid.toString()]);
|
|
||||||
processContextMenu.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItem {
|
|
||||||
text: I18n.tr("Force Kill (SIGKILL)")
|
|
||||||
iconName: "dangerous"
|
|
||||||
dangerous: true
|
|
||||||
enabled: processContextMenu.processData && processContextMenu.processData.pid > 1000
|
|
||||||
onClicked: {
|
|
||||||
if (processContextMenu.processData)
|
|
||||||
Quickshell.execDetached(["kill", "-9", processContextMenu.processData.pid.toString()]);
|
|
||||||
processContextMenu.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component MenuItem: Rectangle {
|
|
||||||
id: menuItem
|
|
||||||
|
|
||||||
property string text: ""
|
|
||||||
property string iconName: ""
|
|
||||||
property bool dangerous: false
|
|
||||||
property bool enabled: true
|
|
||||||
|
|
||||||
signal clicked
|
|
||||||
|
|
||||||
width: parent.width
|
|
||||||
height: 32
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: {
|
|
||||||
if (!enabled)
|
|
||||||
return "transparent";
|
|
||||||
if (dangerous)
|
|
||||||
return menuItemArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) : "transparent";
|
|
||||||
return menuItemArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent";
|
|
||||||
}
|
|
||||||
opacity: enabled ? 1 : 0.5
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.spacingS
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: menuItem.iconName
|
|
||||||
size: 16
|
|
||||||
color: {
|
|
||||||
if (!menuItem.enabled)
|
|
||||||
return Theme.surfaceVariantText;
|
|
||||||
if (menuItem.dangerous && menuItemArea.containsMouse)
|
|
||||||
return Theme.error;
|
|
||||||
return Theme.surfaceText;
|
|
||||||
}
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: menuItem.text
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
font.weight: Font.Normal
|
|
||||||
color: {
|
|
||||||
if (!menuItem.enabled)
|
|
||||||
return Theme.surfaceVariantText;
|
|
||||||
if (menuItem.dangerous && menuItemArea.containsMouse)
|
|
||||||
return Theme.error;
|
|
||||||
return Theme.surfaceText;
|
|
||||||
}
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: menuItemArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: menuItem.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
||||||
enabled: menuItem.enabled
|
|
||||||
onClicked: menuItem.clicked()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ DankPopout {
|
|||||||
if (!shouldBeVisible) {
|
if (!shouldBeVisible) {
|
||||||
searchText = "";
|
searchText = "";
|
||||||
expandedPid = "";
|
expandedPid = "";
|
||||||
|
if (processesView)
|
||||||
|
processesView.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,9 +71,13 @@ DankPopout {
|
|||||||
if (processListPopout.shouldBeVisible)
|
if (processListPopout.shouldBeVisible)
|
||||||
forceActiveFocus();
|
forceActiveFocus();
|
||||||
processContextMenu.parent = processListContent;
|
processContextMenu.parent = processListContent;
|
||||||
|
processContextMenu.parentFocusItem = processListContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
|
if (processContextMenu.visible)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case Qt.Key_Escape:
|
case Qt.Key_Escape:
|
||||||
if (processListPopout.searchText.length > 0) {
|
if (processListPopout.searchText.length > 0) {
|
||||||
@@ -79,6 +85,11 @@ DankPopout {
|
|||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (processesView.keyboardNavigationActive) {
|
||||||
|
processesView.reset();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
processListPopout.close();
|
processListPopout.close();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
return;
|
return;
|
||||||
@@ -90,14 +101,15 @@ DankPopout {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processesView.handleKey(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: processListPopout
|
target: processListPopout
|
||||||
function onShouldBeVisibleChanged() {
|
function onShouldBeVisibleChanged() {
|
||||||
if (processListPopout.shouldBeVisible) {
|
if (processListPopout.shouldBeVisible)
|
||||||
Qt.callLater(() => processListContent.forceActiveFocus());
|
Qt.callLater(() => processListContent.forceActiveFocus());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,6 +154,8 @@ DankPopout {
|
|||||||
showClearButton: true
|
showClearButton: true
|
||||||
text: processListPopout.searchText
|
text: processListPopout.searchText
|
||||||
onTextChanged: processListPopout.searchText = text
|
onTextChanged: processListPopout.searchText = text
|
||||||
|
ignoreUpDownKeys: true
|
||||||
|
keyForwardTargets: [processListContent]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,6 +328,7 @@ DankPopout {
|
|||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
ProcessesView {
|
ProcessesView {
|
||||||
|
id: processesView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingS
|
anchors.margins: Theme.spacingS
|
||||||
searchText: processListPopout.searchText
|
searchText: processListPopout.searchText
|
||||||
|
|||||||
@@ -11,18 +11,27 @@ Item {
|
|||||||
property string searchText: ""
|
property string searchText: ""
|
||||||
property string expandedPid: ""
|
property string expandedPid: ""
|
||||||
property var contextMenu: null
|
property var contextMenu: null
|
||||||
property bool hoveringExpandedItem: false
|
|
||||||
|
|
||||||
readonly property bool pauseUpdates: hoveringExpandedItem || (contextMenu?.visible ?? false)
|
property int selectedIndex: -1
|
||||||
|
property bool keyboardNavigationActive: false
|
||||||
|
property int forceRefreshCount: 0
|
||||||
|
|
||||||
|
readonly property bool pauseUpdates: (contextMenu?.visible ?? false) || expandedPid.length > 0
|
||||||
|
readonly property bool shouldUpdate: !pauseUpdates || forceRefreshCount > 0
|
||||||
property var cachedProcesses: []
|
property var cachedProcesses: []
|
||||||
|
|
||||||
|
signal openContextMenuRequested(int index, real x, real y, bool fromKeyboard)
|
||||||
|
|
||||||
onFilteredProcessesChanged: {
|
onFilteredProcessesChanged: {
|
||||||
if (!pauseUpdates)
|
if (!shouldUpdate)
|
||||||
cachedProcesses = filteredProcesses;
|
return;
|
||||||
|
cachedProcesses = filteredProcesses;
|
||||||
|
if (forceRefreshCount > 0)
|
||||||
|
forceRefreshCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
onPauseUpdatesChanged: {
|
onShouldUpdateChanged: {
|
||||||
if (!pauseUpdates)
|
if (shouldUpdate)
|
||||||
cachedProcesses = filteredProcesses;
|
cachedProcesses = filteredProcesses;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,6 +84,135 @@ Item {
|
|||||||
return procs;
|
return procs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectNext() {
|
||||||
|
if (cachedProcesses.length === 0)
|
||||||
|
return;
|
||||||
|
keyboardNavigationActive = true;
|
||||||
|
selectedIndex = Math.min(selectedIndex + 1, cachedProcesses.length - 1);
|
||||||
|
ensureVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectPrevious() {
|
||||||
|
if (cachedProcesses.length === 0)
|
||||||
|
return;
|
||||||
|
keyboardNavigationActive = true;
|
||||||
|
if (selectedIndex <= 0) {
|
||||||
|
selectedIndex = -1;
|
||||||
|
keyboardNavigationActive = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
selectedIndex = selectedIndex - 1;
|
||||||
|
ensureVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectFirst() {
|
||||||
|
if (cachedProcesses.length === 0)
|
||||||
|
return;
|
||||||
|
keyboardNavigationActive = true;
|
||||||
|
selectedIndex = 0;
|
||||||
|
ensureVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectLast() {
|
||||||
|
if (cachedProcesses.length === 0)
|
||||||
|
return;
|
||||||
|
keyboardNavigationActive = true;
|
||||||
|
selectedIndex = cachedProcesses.length - 1;
|
||||||
|
ensureVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleExpand() {
|
||||||
|
if (selectedIndex < 0 || selectedIndex >= cachedProcesses.length)
|
||||||
|
return;
|
||||||
|
const process = cachedProcesses[selectedIndex];
|
||||||
|
const pidStr = (process?.pid ?? -1).toString();
|
||||||
|
expandedPid = (expandedPid === pidStr) ? "" : pidStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
function openContextMenu() {
|
||||||
|
if (selectedIndex < 0 || selectedIndex >= cachedProcesses.length)
|
||||||
|
return;
|
||||||
|
const delegate = processListView.itemAtIndex(selectedIndex);
|
||||||
|
if (!delegate)
|
||||||
|
return;
|
||||||
|
const process = cachedProcesses[selectedIndex];
|
||||||
|
if (!process || !contextMenu)
|
||||||
|
return;
|
||||||
|
contextMenu.processData = process;
|
||||||
|
const itemPos = delegate.mapToItem(contextMenu.parent, delegate.width / 2, delegate.height / 2);
|
||||||
|
contextMenu.parentFocusItem = root;
|
||||||
|
contextMenu.show(itemPos.x, itemPos.y, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
selectedIndex = -1;
|
||||||
|
keyboardNavigationActive = false;
|
||||||
|
expandedPid = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function forceRefresh(count) {
|
||||||
|
forceRefreshCount = count || 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureVisible() {
|
||||||
|
if (selectedIndex < 0)
|
||||||
|
return;
|
||||||
|
processListView.positionViewAtIndex(selectedIndex, ListView.Contain);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleKey(event) {
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_Down:
|
||||||
|
selectNext();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Up:
|
||||||
|
selectPrevious();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_J:
|
||||||
|
if (event.modifiers & Qt.ControlModifier) {
|
||||||
|
selectNext();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
case Qt.Key_K:
|
||||||
|
if (event.modifiers & Qt.ControlModifier) {
|
||||||
|
selectPrevious();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
case Qt.Key_Home:
|
||||||
|
selectFirst();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_End:
|
||||||
|
selectLast();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Space:
|
||||||
|
if (keyboardNavigationActive) {
|
||||||
|
toggleExpand();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
case Qt.Key_Return:
|
||||||
|
case Qt.Key_Enter:
|
||||||
|
if (keyboardNavigationActive) {
|
||||||
|
toggleExpand();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
case Qt.Key_Menu:
|
||||||
|
case Qt.Key_F10:
|
||||||
|
if (keyboardNavigationActive && selectedIndex >= 0) {
|
||||||
|
openContextMenu();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
DgopService.addRef(["processes", "cpu", "memory", "system"]);
|
DgopService.addRef(["processes", "cpu", "memory", "system"]);
|
||||||
cachedProcesses = filteredProcesses;
|
cachedProcesses = filteredProcesses;
|
||||||
@@ -163,22 +301,28 @@ Item {
|
|||||||
|
|
||||||
delegate: ProcessItem {
|
delegate: ProcessItem {
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
required property int index
|
||||||
|
|
||||||
width: processListView.width
|
width: processListView.width
|
||||||
process: modelData
|
process: modelData
|
||||||
isExpanded: root.expandedPid === (modelData?.pid ?? -1).toString()
|
isExpanded: root.expandedPid === (modelData?.pid ?? -1).toString()
|
||||||
|
isSelected: root.keyboardNavigationActive && root.selectedIndex === index
|
||||||
contextMenu: root.contextMenu
|
contextMenu: root.contextMenu
|
||||||
onToggleExpand: {
|
onToggleExpand: {
|
||||||
const pidStr = (modelData?.pid ?? -1).toString();
|
const pidStr = (modelData?.pid ?? -1).toString();
|
||||||
root.expandedPid = (root.expandedPid === pidStr) ? "" : pidStr;
|
root.expandedPid = (root.expandedPid === pidStr) ? "" : pidStr;
|
||||||
}
|
}
|
||||||
onHoveringExpandedChanged: {
|
onClicked: {
|
||||||
if (hoveringExpanded)
|
root.keyboardNavigationActive = true;
|
||||||
root.hoveringExpandedItem = true;
|
root.selectedIndex = index;
|
||||||
else
|
}
|
||||||
Qt.callLater(() => {
|
onContextMenuRequested: (mouseX, mouseY) => {
|
||||||
root.hoveringExpandedItem = false;
|
if (root.contextMenu) {
|
||||||
});
|
root.contextMenu.processData = modelData;
|
||||||
|
root.contextMenu.parentFocusItem = root;
|
||||||
|
const globalPos = mapToItem(root.contextMenu.parent, mouseX, mouseY);
|
||||||
|
root.contextMenu.show(globalPos.x, globalPos.y, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,10 +432,12 @@ Item {
|
|||||||
|
|
||||||
property var process: null
|
property var process: null
|
||||||
property bool isExpanded: false
|
property bool isExpanded: false
|
||||||
|
property bool isSelected: false
|
||||||
property var contextMenu: null
|
property var contextMenu: null
|
||||||
readonly property bool hoveringExpanded: (isExpanded && processMouseArea.containsMouse) || copyMouseArea.containsMouse
|
|
||||||
|
|
||||||
signal toggleExpand
|
signal toggleExpand
|
||||||
|
signal clicked
|
||||||
|
signal contextMenuRequested(real mouseX, real mouseY)
|
||||||
|
|
||||||
readonly property int processPid: process?.pid ?? 0
|
readonly property int processPid: process?.pid ?? 0
|
||||||
readonly property real processCpu: process?.cpu ?? 0
|
readonly property real processCpu: process?.cpu ?? 0
|
||||||
@@ -301,8 +447,16 @@ Item {
|
|||||||
|
|
||||||
height: isExpanded ? (44 + expandedRect.height + Theme.spacingXS) : 44
|
height: isExpanded ? (44 + expandedRect.height + Theme.spacingXS) : 44
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: processMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.06) : "transparent"
|
color: {
|
||||||
border.color: processMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
if (isSelected)
|
||||||
|
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.15);
|
||||||
|
return processMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.06) : "transparent";
|
||||||
|
}
|
||||||
|
border.color: {
|
||||||
|
if (isSelected)
|
||||||
|
return Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.3);
|
||||||
|
return processMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent";
|
||||||
|
}
|
||||||
border.width: 1
|
border.width: 1
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
@@ -327,14 +481,10 @@ Item {
|
|||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onClicked: mouse => {
|
onClicked: mouse => {
|
||||||
if (mouse.button === Qt.RightButton) {
|
if (mouse.button === Qt.RightButton) {
|
||||||
if (processItemRoot.processPid > 0 && processItemRoot.contextMenu) {
|
processItemRoot.contextMenuRequested(mouse.x, mouse.y);
|
||||||
processItemRoot.contextMenu.processData = processItemRoot.process;
|
|
||||||
const globalPos = processMouseArea.mapToGlobal(mouse.x, mouse.y);
|
|
||||||
const localPos = processItemRoot.contextMenu.parent ? processItemRoot.contextMenu.parent.mapFromGlobal(globalPos.x, globalPos.y) : globalPos;
|
|
||||||
processItemRoot.contextMenu.show(localPos.x, localPos.y);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
processItemRoot.clicked();
|
||||||
processItemRoot.toggleExpand();
|
processItemRoot.toggleExpand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -462,6 +462,250 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingsCard {
|
||||||
|
width: parent.width
|
||||||
|
iconName: "search"
|
||||||
|
title: I18n.tr("Search Options")
|
||||||
|
settingKey: "searchOptions"
|
||||||
|
|
||||||
|
SettingsToggleRow {
|
||||||
|
settingKey: "searchAppActions"
|
||||||
|
tags: ["launcher", "search", "actions", "shortcuts"]
|
||||||
|
text: I18n.tr("Search App Actions")
|
||||||
|
description: I18n.tr("Include desktop actions (shortcuts) in search results.")
|
||||||
|
checked: SessionData.searchAppActions
|
||||||
|
onToggled: checked => SessionData.setSearchAppActions(checked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsCard {
|
||||||
|
id: hiddenAppsCard
|
||||||
|
width: parent.width
|
||||||
|
iconName: "visibility_off"
|
||||||
|
title: I18n.tr("Hidden Apps")
|
||||||
|
settingKey: "hiddenApps"
|
||||||
|
|
||||||
|
property var hiddenAppsModel: {
|
||||||
|
SessionData.hiddenApps;
|
||||||
|
const apps = [];
|
||||||
|
const allApps = AppSearchService.applications || [];
|
||||||
|
for (const hiddenId of SessionData.hiddenApps) {
|
||||||
|
const app = allApps.find(a => (a.id || a.execString || a.exec) === hiddenId);
|
||||||
|
if (app) {
|
||||||
|
apps.push({
|
||||||
|
id: hiddenId,
|
||||||
|
name: app.name || hiddenId,
|
||||||
|
icon: app.icon || "",
|
||||||
|
comment: app.comment || ""
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
apps.push({
|
||||||
|
id: hiddenId,
|
||||||
|
name: hiddenId,
|
||||||
|
icon: "",
|
||||||
|
comment: ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return apps.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
text: I18n.tr("Hidden apps won't appear in the launcher. Right-click an app and select 'Hide App' to hide it.")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: hiddenAppsList
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: hiddenAppsCard.hiddenAppsModel
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
width: hiddenAppsList.width
|
||||||
|
height: 48
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3)
|
||||||
|
border.width: 0
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingM
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Image {
|
||||||
|
width: 24
|
||||||
|
height: 24
|
||||||
|
source: modelData.icon ? "image://icon/" + modelData.icon : "image://icon/application-x-executable"
|
||||||
|
sourceSize.width: 24
|
||||||
|
sourceSize.height: 24
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onStatusChanged: {
|
||||||
|
if (status === Image.Error)
|
||||||
|
source = "image://icon/application-x-executable";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData.name
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData.comment || modelData.id
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
visible: text.length > 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Theme.spacingM
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
iconName: "visibility"
|
||||||
|
iconSize: 18
|
||||||
|
iconColor: Theme.primary
|
||||||
|
onClicked: SessionData.showApp(modelData.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
text: I18n.tr("No hidden apps.")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
visible: hiddenAppsCard.hiddenAppsModel.length === 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsCard {
|
||||||
|
id: appOverridesCard
|
||||||
|
width: parent.width
|
||||||
|
iconName: "edit"
|
||||||
|
title: I18n.tr("App Customizations")
|
||||||
|
settingKey: "appOverrides"
|
||||||
|
|
||||||
|
property var overridesModel: {
|
||||||
|
SessionData.appOverrides;
|
||||||
|
const items = [];
|
||||||
|
const allApps = AppSearchService.applications || [];
|
||||||
|
for (const appId in SessionData.appOverrides) {
|
||||||
|
const override = SessionData.appOverrides[appId];
|
||||||
|
const app = allApps.find(a => (a.id || a.execString || a.exec) === appId);
|
||||||
|
items.push({
|
||||||
|
id: appId,
|
||||||
|
name: override.name || app?.name || appId,
|
||||||
|
originalName: app?.name || appId,
|
||||||
|
icon: override.icon || app?.icon || "",
|
||||||
|
hasOverride: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return items.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
text: I18n.tr("Apps with custom display name, icon, or launch options. Right-click an app and select 'Edit App' to customize.")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: overridesList
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: appOverridesCard.overridesModel
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
width: overridesList.width
|
||||||
|
height: 48
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3)
|
||||||
|
border.width: 0
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingM
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
Image {
|
||||||
|
width: 24
|
||||||
|
height: 24
|
||||||
|
source: modelData.icon ? "image://icon/" + modelData.icon : "image://icon/application-x-executable"
|
||||||
|
sourceSize.width: 24
|
||||||
|
sourceSize.height: 24
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onStatusChanged: {
|
||||||
|
if (status === Image.Error)
|
||||||
|
source = "image://icon/application-x-executable";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData.name
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData.originalName !== modelData.name ? modelData.originalName : modelData.id
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Theme.spacingM
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
iconName: "delete"
|
||||||
|
iconSize: 18
|
||||||
|
iconColor: Theme.error
|
||||||
|
onClicked: SessionData.clearAppOverride(modelData.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
text: I18n.tr("No app customizations.")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
visible: appOverridesCard.overridesModel.length === 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
id: recentAppsCard
|
id: recentAppsCard
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ Item {
|
|||||||
|
|
||||||
SettingsButtonGroupRow {
|
SettingsButtonGroupRow {
|
||||||
text: I18n.tr("Occupied Color")
|
text: I18n.tr("Occupied Color")
|
||||||
model: ["sec", "s", "sc", "sch", "none"]
|
model: ["none", "sec", "s", "sc", "sch", "schh"]
|
||||||
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl
|
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl
|
||||||
buttonHeight: 22
|
buttonHeight: 22
|
||||||
minButtonWidth: 36
|
minButtonWidth: 36
|
||||||
@@ -210,15 +210,17 @@ Item {
|
|||||||
textSize: Theme.fontSizeSmall - 1
|
textSize: Theme.fontSizeSmall - 1
|
||||||
spacing: 1
|
spacing: 1
|
||||||
currentIndex: {
|
currentIndex: {
|
||||||
switch (SettingsData.wokspaceColorMode) {
|
switch (SettingsData.workspaceOccupiedColorMode) {
|
||||||
case "s":
|
case "sec":
|
||||||
return 1;
|
return 1;
|
||||||
case "sc":
|
case "s":
|
||||||
return 2;
|
return 2;
|
||||||
case "sch":
|
case "sc":
|
||||||
return 3;
|
return 3;
|
||||||
case "none":
|
case "sch":
|
||||||
return 4;
|
return 4;
|
||||||
|
case "schh":
|
||||||
|
return 5;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -226,7 +228,7 @@ Item {
|
|||||||
onSelectionChanged: (index, selected) => {
|
onSelectionChanged: (index, selected) => {
|
||||||
if (!selected)
|
if (!selected)
|
||||||
return;
|
return;
|
||||||
const modes = ["default", "s", "sc", "sch", "none"];
|
const modes = ["none", "sec", "s", "sc", "sch", "schh"];
|
||||||
SettingsData.set("workspaceOccupiedColorMode", modes[index]);
|
SettingsData.set("workspaceOccupiedColorMode", modes[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ Singleton {
|
|||||||
|
|
||||||
property var applications: []
|
property var applications: []
|
||||||
property var _cachedCategories: null
|
property var _cachedCategories: null
|
||||||
|
property var _cachedVisibleApps: null
|
||||||
|
property var _hiddenAppsSet: new Set()
|
||||||
|
|
||||||
readonly property int maxResults: 10
|
readonly property int maxResults: 10
|
||||||
readonly property int frecencySampleSize: 10
|
readonly property int frecencySampleSize: 10
|
||||||
@@ -40,6 +42,51 @@ Singleton {
|
|||||||
function refreshApplications() {
|
function refreshApplications() {
|
||||||
applications = DesktopEntries.applications.values;
|
applications = DesktopEntries.applications.values;
|
||||||
_cachedCategories = null;
|
_cachedCategories = null;
|
||||||
|
_cachedVisibleApps = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _rebuildHiddenSet() {
|
||||||
|
_hiddenAppsSet = new Set(SessionData.hiddenApps || []);
|
||||||
|
_cachedVisibleApps = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isAppHidden(app) {
|
||||||
|
if (!app)
|
||||||
|
return false;
|
||||||
|
const appId = app.id || app.execString || app.exec || "";
|
||||||
|
return _hiddenAppsSet.has(appId);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVisibleApplications() {
|
||||||
|
if (_cachedVisibleApps === null) {
|
||||||
|
_cachedVisibleApps = applications.filter(app => !isAppHidden(app));
|
||||||
|
}
|
||||||
|
return _cachedVisibleApps.map(app => applyAppOverride(app));
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: SessionData
|
||||||
|
function onHiddenAppsChanged() {
|
||||||
|
root._rebuildHiddenSet();
|
||||||
|
}
|
||||||
|
function onAppOverridesChanged() {
|
||||||
|
root._cachedVisibleApps = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyAppOverride(app) {
|
||||||
|
if (!app)
|
||||||
|
return app;
|
||||||
|
const appId = app.id || app.execString || app.exec || "";
|
||||||
|
const override = SessionData.getAppOverride(appId);
|
||||||
|
if (!override)
|
||||||
|
return app;
|
||||||
|
return Object.assign({}, app, {
|
||||||
|
name: override.name || app.name,
|
||||||
|
icon: override.icon || app.icon,
|
||||||
|
comment: override.comment || app.comment,
|
||||||
|
_override: override
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property string dmsLogoPath: Qt.resolvedUrl("../assets/danklogo2.svg")
|
readonly property string dmsLogoPath: Qt.resolvedUrl("../assets/danklogo2.svg")
|
||||||
@@ -226,7 +273,10 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: refreshApplications()
|
Component.onCompleted: {
|
||||||
|
_rebuildHiddenSet();
|
||||||
|
refreshApplications();
|
||||||
|
}
|
||||||
|
|
||||||
function tokenize(text) {
|
function tokenize(text) {
|
||||||
return text.toLowerCase().trim().split(/[\s\-_]+/).filter(w => w.length > 0);
|
return text.toLowerCase().trim().split(/[\s\-_]+/).filter(w => w.length > 0);
|
||||||
@@ -345,17 +395,17 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchApplications(query) {
|
function searchApplications(query) {
|
||||||
if (!query || query.length === 0) {
|
if (!query || query.length === 0)
|
||||||
return applications;
|
return getVisibleApplications();
|
||||||
}
|
|
||||||
if (applications.length === 0)
|
if (applications.length === 0)
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
const queryLower = query.toLowerCase().trim();
|
const queryLower = query.toLowerCase().trim();
|
||||||
const scoredApps = [];
|
const scoredApps = [];
|
||||||
const results = [];
|
const results = [];
|
||||||
|
const visibleApps = getVisibleApplications();
|
||||||
|
|
||||||
for (const app of applications) {
|
for (const app of visibleApps) {
|
||||||
const name = (app.name || "").toLowerCase();
|
const name = (app.name || "").toLowerCase();
|
||||||
const genericName = (app.genericName || "").toLowerCase();
|
const genericName = (app.genericName || "").toLowerCase();
|
||||||
const comment = (app.comment || "").toLowerCase();
|
const comment = (app.comment || "").toLowerCase();
|
||||||
@@ -440,10 +490,58 @@ Singleton {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SessionData.searchAppActions) {
|
||||||
|
const actionResults = searchAppActions(queryLower, visibleApps);
|
||||||
|
for (const actionResult of actionResults) {
|
||||||
|
scoredApps.push({
|
||||||
|
app: actionResult.app,
|
||||||
|
score: actionResult.score
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scoredApps.sort((a, b) => b.score - a.score);
|
scoredApps.sort((a, b) => b.score - a.score);
|
||||||
return scoredApps.slice(0, maxResults).map(item => item.app);
|
return scoredApps.slice(0, maxResults).map(item => item.app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function searchAppActions(query, apps) {
|
||||||
|
const results = [];
|
||||||
|
for (const app of apps) {
|
||||||
|
if (!app.actions || app.actions.length === 0)
|
||||||
|
continue;
|
||||||
|
for (const action of app.actions) {
|
||||||
|
const actionName = (action.name || "").toLowerCase();
|
||||||
|
if (!actionName)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
let score = 0;
|
||||||
|
if (actionName === query) {
|
||||||
|
score = 8000;
|
||||||
|
} else if (actionName.startsWith(query)) {
|
||||||
|
score = 4000;
|
||||||
|
} else if (actionName.includes(query)) {
|
||||||
|
score = 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (score > 0) {
|
||||||
|
results.push({
|
||||||
|
app: {
|
||||||
|
name: action.name,
|
||||||
|
icon: action.icon || app.icon,
|
||||||
|
comment: app.name,
|
||||||
|
categories: app.categories || [],
|
||||||
|
isAction: true,
|
||||||
|
parentApp: app,
|
||||||
|
actionData: action
|
||||||
|
},
|
||||||
|
score: score
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
function getCategoriesForApp(app) {
|
function getCategoriesForApp(app) {
|
||||||
if (!app?.categories)
|
if (!app?.categories)
|
||||||
return [];
|
return [];
|
||||||
@@ -525,17 +623,15 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAppsInCategory(category) {
|
function getAppsInCategory(category) {
|
||||||
if (category === I18n.tr("All")) {
|
const visibleApps = getVisibleApplications();
|
||||||
return applications;
|
if (category === I18n.tr("All"))
|
||||||
}
|
return visibleApps;
|
||||||
|
|
||||||
// Check if it's a plugin category
|
|
||||||
const pluginItems = getPluginItems(category, "");
|
const pluginItems = getPluginItems(category, "");
|
||||||
if (pluginItems.length > 0) {
|
if (pluginItems.length > 0)
|
||||||
return pluginItems;
|
return pluginItems;
|
||||||
}
|
|
||||||
|
|
||||||
return applications.filter(app => {
|
return visibleApps.filter(app => {
|
||||||
const appCategories = getCategoriesForApp(app);
|
const appCategories = getCategoriesForApp(app);
|
||||||
return appCategories.includes(category);
|
return appCategories.includes(category);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -182,17 +182,44 @@ Singleton {
|
|||||||
return /[;&|<>()$`\\"']/.test(prefix);
|
return /[;&|<>()$`\\"']/.test(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseEnvVars(envVarsStr) {
|
||||||
|
if (!envVarsStr || envVarsStr.trim().length === 0)
|
||||||
|
return {};
|
||||||
|
const envObj = {};
|
||||||
|
const pairs = envVarsStr.trim().split(/\s+/);
|
||||||
|
for (const pair of pairs) {
|
||||||
|
const eqIndex = pair.indexOf("=");
|
||||||
|
if (eqIndex > 0) {
|
||||||
|
const key = pair.substring(0, eqIndex);
|
||||||
|
const value = pair.substring(eqIndex + 1);
|
||||||
|
envObj[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return envObj;
|
||||||
|
}
|
||||||
|
|
||||||
function launchDesktopEntry(desktopEntry, useNvidia) {
|
function launchDesktopEntry(desktopEntry, useNvidia) {
|
||||||
let cmd = desktopEntry.command;
|
let cmd = desktopEntry.command;
|
||||||
if (useNvidia && nvidiaCommand)
|
if (useNvidia && nvidiaCommand)
|
||||||
cmd = [nvidiaCommand].concat(cmd);
|
cmd = [nvidiaCommand].concat(cmd);
|
||||||
|
|
||||||
|
const appId = desktopEntry.id || desktopEntry.execString || desktopEntry.exec || "";
|
||||||
|
const override = SessionData.getAppOverride(appId);
|
||||||
|
|
||||||
|
if (override?.extraFlags) {
|
||||||
|
const extraArgs = override.extraFlags.trim().split(/\s+/).filter(arg => arg.length > 0);
|
||||||
|
cmd = cmd.concat(extraArgs);
|
||||||
|
}
|
||||||
|
|
||||||
const userPrefix = SettingsData.launchPrefix?.trim() || "";
|
const userPrefix = SettingsData.launchPrefix?.trim() || "";
|
||||||
const defaultPrefix = Quickshell.env("DMS_DEFAULT_LAUNCH_PREFIX") || "";
|
const defaultPrefix = Quickshell.env("DMS_DEFAULT_LAUNCH_PREFIX") || "";
|
||||||
const prefix = userPrefix.length > 0 ? userPrefix : defaultPrefix;
|
const prefix = userPrefix.length > 0 ? userPrefix : defaultPrefix;
|
||||||
const workDir = desktopEntry.workingDirectory || Quickshell.env("HOME");
|
const workDir = desktopEntry.workingDirectory || Quickshell.env("HOME");
|
||||||
const cursorEnv = typeof SettingsData.getCursorEnvironment === "function" ? SettingsData.getCursorEnvironment() : {};
|
const cursorEnv = typeof SettingsData.getCursorEnvironment === "function" ? SettingsData.getCursorEnvironment() : {};
|
||||||
|
|
||||||
|
const overrideEnv = override?.envVars ? parseEnvVars(override.envVars) : {};
|
||||||
|
const finalEnv = Object.assign({}, cursorEnv, overrideEnv);
|
||||||
|
|
||||||
if (desktopEntry.runInTerminal) {
|
if (desktopEntry.runInTerminal) {
|
||||||
const terminal = Quickshell.env("TERMINAL") || "xterm";
|
const terminal = Quickshell.env("TERMINAL") || "xterm";
|
||||||
const escapedCmd = cmd.map(arg => escapeShellArg(arg)).join(" ");
|
const escapedCmd = cmd.map(arg => escapeShellArg(arg)).join(" ");
|
||||||
@@ -200,7 +227,7 @@ Singleton {
|
|||||||
Quickshell.execDetached({
|
Quickshell.execDetached({
|
||||||
command: [terminal, "-e", "sh", "-c", shellCmd],
|
command: [terminal, "-e", "sh", "-c", shellCmd],
|
||||||
workingDirectory: workDir,
|
workingDirectory: workDir,
|
||||||
environment: cursorEnv
|
environment: finalEnv
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -210,7 +237,7 @@ Singleton {
|
|||||||
Quickshell.execDetached({
|
Quickshell.execDetached({
|
||||||
command: ["sh", "-c", `${prefix} ${escapedCmd}`],
|
command: ["sh", "-c", `${prefix} ${escapedCmd}`],
|
||||||
workingDirectory: workDir,
|
workingDirectory: workDir,
|
||||||
environment: cursorEnv
|
environment: finalEnv
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -221,7 +248,7 @@ Singleton {
|
|||||||
Quickshell.execDetached({
|
Quickshell.execDetached({
|
||||||
command: cmd,
|
command: cmd,
|
||||||
workingDirectory: workDir,
|
workingDirectory: workDir,
|
||||||
environment: cursorEnv
|
environment: finalEnv
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ Item {
|
|||||||
property bool shouldBeVisible: false
|
property bool shouldBeVisible: false
|
||||||
property var customKeyboardFocus: null
|
property var customKeyboardFocus: null
|
||||||
property bool backgroundInteractive: true
|
property bool backgroundInteractive: true
|
||||||
|
property bool contentHandlesKeys: false
|
||||||
|
|
||||||
property real storedBarThickness: Theme.barHeight - 4
|
property real storedBarThickness: Theme.barHeight - 4
|
||||||
property real storedBarSpacing: 4
|
property real storedBarSpacing: 4
|
||||||
@@ -461,8 +462,12 @@ Item {
|
|||||||
id: focusHelper
|
id: focusHelper
|
||||||
parent: contentContainer
|
parent: contentContainer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
focus: true
|
visible: !root.contentHandlesKeys
|
||||||
|
enabled: !root.contentHandlesKeys
|
||||||
|
focus: !root.contentHandlesKeys
|
||||||
Keys.onPressed: event => {
|
Keys.onPressed: event => {
|
||||||
|
if (root.contentHandlesKeys)
|
||||||
|
return;
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
close();
|
close();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ StyledRect {
|
|||||||
property real topPadding: Theme.spacingM
|
property real topPadding: Theme.spacingM
|
||||||
property real bottomPadding: Theme.spacingM
|
property real bottomPadding: Theme.spacingM
|
||||||
property bool ignoreLeftRightKeys: false
|
property bool ignoreLeftRightKeys: false
|
||||||
|
property bool ignoreUpDownKeys: false
|
||||||
property bool ignoreTabKeys: false
|
property bool ignoreTabKeys: false
|
||||||
property var keyForwardTargets: []
|
property var keyForwardTargets: []
|
||||||
property Item keyNavigationTab: null
|
property Item keyNavigationTab: null
|
||||||
@@ -145,9 +146,16 @@ StyledRect {
|
|||||||
if (root.ignoreTabKeys && (event.key === Qt.Key_Tab || event.key === Qt.Key_Backtab)) {
|
if (root.ignoreTabKeys && (event.key === Qt.Key_Tab || event.key === Qt.Key_Backtab)) {
|
||||||
event.accepted = false;
|
event.accepted = false;
|
||||||
for (var i = 0; i < root.keyForwardTargets.length; i++) {
|
for (var i = 0; i < root.keyForwardTargets.length; i++) {
|
||||||
if (root.keyForwardTargets[i]) {
|
if (root.keyForwardTargets[i])
|
||||||
|
root.keyForwardTargets[i].Keys.pressed(event);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (root.ignoreUpDownKeys && (event.key === Qt.Key_Up || event.key === Qt.Key_Down)) {
|
||||||
|
event.accepted = false;
|
||||||
|
for (var i = 0; i < root.keyForwardTargets.length; i++) {
|
||||||
|
if (root.keyForwardTargets[i])
|
||||||
root.keyForwardTargets[i].Keys.pressed(event);
|
root.keyForwardTargets[i].Keys.pressed(event);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user