1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

Compare commits

...

5 Commits

Author SHA1 Message Date
purian23
f2be6cfeb1 notepad: Update cursor color & activity 2026-01-19 00:34:10 -05:00
purian23
65486ed3cf notepad: QOL updates 2026-01-18 23:49:38 -05:00
bbedward
cc30e2a9e4 workspaces: fix occupied color overridworkspacs: fix occupied color
overridee
2026-01-18 22:44:54 -05:00
bbedward
ac68451cdf processlist: add full keyboard navigation 2026-01-18 21:03:34 -05:00
bbedward
0f6ae11c3d launcher: add name, icon, description overrides + hide/unhide options
- convenient helpers without needing to make .desktop overrides
fixes #1329
2026-01-18 20:30:50 -05:00
26 changed files with 1938 additions and 599 deletions

View File

@@ -1,5 +1,12 @@
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
- Added clipboard and clipboard history integration

View File

@@ -21,6 +21,7 @@ Singleton {
property bool _isReadOnly: false
property bool _hasUnsavedChanges: false
property var _loadedSessionSnapshot: null
readonly property var _hooks: ({})
readonly property string _stateUrl: StandardPaths.writableLocation(StandardPaths.GenericStateLocation)
readonly property string _stateDir: Paths.strip(_stateUrl)
@@ -102,6 +103,10 @@ Singleton {
property string weatherLocation: "New York, NY"
property string weatherCoordinates: "40.7128,-74.0060"
property var hiddenApps: []
property var appOverrides: ({})
property bool searchAppActions: true
Component.onCompleted: {
if (!isGreeterMode) {
loadSettings();
@@ -261,6 +266,10 @@ Singleton {
_checkSessionWritable();
}
function set(key, value) {
Spec.set(root, key, value, saveSettings, _hooks);
}
function migrateFromUndefinedToV1(settings) {
console.info("SessionData: Migrating configuration from undefined to version 1");
if (typeof SettingsData !== "undefined") {
@@ -906,6 +915,61 @@ Singleton {
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() {
if (!perModeWallpaper)
return;

View File

@@ -206,7 +206,7 @@ Singleton {
property bool reverseScrolling: false
property bool dwlShowAllTags: false
property string workspaceColorMode: "default"
property string workspaceOccupiedColorMode: "default"
property string workspaceOccupiedColorMode: "none"
property string workspaceUnfocusedColorMode: "default"
property string workspaceUrgentColorMode: "default"
property bool workspaceFocusedBorderEnabled: false

View File

@@ -55,9 +55,23 @@ var SPEC = {
enabledGpuPciIds: { def: [] },
wifiDeviceOverride: { def: "" },
weatherHourlyDetailed: { def: true }
weatherHourlyDetailed: { def: true },
hiddenApps: { def: [] },
appOverrides: { def: {} },
searchAppActions: { def: true }
};
function getValidKeys() {
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();
}

View File

@@ -100,7 +100,7 @@ var SPEC = {
reverseScrolling: { def: false },
dwlShowAllTags: { def: false },
workspaceColorMode: { def: "default" },
workspaceOccupiedColorMode: { def: "default" },
workspaceOccupiedColorMode: { def: "none" },
workspaceUnfocusedColorMode: { def: "default" },
workspaceUrgentColorMode: { def: "default" },
workspaceFocusedBorderEnabled: { def: false },

View File

@@ -71,6 +71,14 @@ FloatingWindow {
return (bytes / (1024 * 1024 * 1024)).toFixed(2) + " GB/s";
}
function nextTab() {
currentTab = (currentTab + 1) % 4;
}
function previousTab() {
currentTab = (currentTab - 1 + 4) % 4;
}
objectName: "processListModal"
title: I18n.tr("System Monitor", "sysmon window title")
minimumSize: Qt.size(750, 550)
@@ -79,16 +87,25 @@ FloatingWindow {
color: Theme.surfaceContainer
visible: false
onCurrentTabChanged: {
if (visible && currentTab === 0 && searchField.visible)
searchField.forceActiveFocus();
}
onVisibleChanged: {
if (!visible) {
closingModal();
searchText = "";
expandedPid = "";
if (processesTabLoader.item)
processesTabLoader.item.reset();
DgopService.removeRef(["cpu", "memory", "network", "disk", "system"]);
} else {
DgopService.addRef(["cpu", "memory", "network", "disk", "system"]);
Qt.callLater(() => {
if (contentFocusScope)
if (currentTab === 0 && searchField.visible)
searchField.forceActiveFocus();
else if (contentFocusScope)
contentFocusScope.forceActiveFocus();
});
}
@@ -96,6 +113,11 @@ FloatingWindow {
ProcessContextMenu {
id: processContextMenu
parentFocusItem: contentFocusScope
onProcessKilled: {
if (processesTabLoader.item)
processesTabLoader.item.forceRefresh(3);
}
}
FocusScope {
@@ -108,6 +130,9 @@ FloatingWindow {
focus: true
Keys.onPressed: event => {
if (processContextMenu.visible)
return;
switch (event.key) {
case Qt.Key_1:
currentTab = 0;
@@ -125,12 +150,25 @@ FloatingWindow {
currentTab = 3;
event.accepted = true;
return;
case Qt.Key_Tab:
nextTab();
event.accepted = true;
return;
case Qt.Key_Backtab:
previousTab();
event.accepted = true;
return;
case Qt.Key_Escape:
if (searchText.length > 0) {
searchText = "";
event.accepted = true;
return;
}
if (currentTab === 0 && processesTabLoader.item?.keyboardNavigationActive) {
processesTabLoader.item.reset();
event.accepted = true;
return;
}
hide();
event.accepted = true;
return;
@@ -142,6 +180,9 @@ FloatingWindow {
}
break;
}
if (currentTab === 0 && processesTabLoader.item)
processesTabLoader.item.handleKey(event);
}
Rectangle {
@@ -336,6 +377,8 @@ FloatingWindow {
text: searchText
visible: currentTab === 0
onTextChanged: searchText = text
ignoreUpDownKeys: true
keyForwardTargets: [contentFocusScope]
}
}

View File

@@ -1,3 +1,4 @@
pragma ComponentBehavior: Bound
import QtQuick
import qs.Common
import qs.Modals.Spotlight
@@ -19,6 +20,10 @@ Item {
property string searchMode: "apps"
property bool usePopupContextMenu: false
property bool editMode: false
property var editingApp: null
property string editAppId: ""
function resetScroll() {
if (searchMode === "apps") {
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: {
if (searchMode === "files") {
appLauncher.keyboardNavigationActive = false;
@@ -55,10 +103,16 @@ Item {
focus: true
clip: false
Keys.onPressed: event => {
if (editMode) {
if (event.key === Qt.Key_Escape) {
closeEditMode();
event.accepted = true;
}
return;
}
if (event.key === Qt.Key_Escape) {
if (parentModal)
parentModal.hide();
event.accepted = true;
} else if (event.key === Qt.Key_Down) {
if (searchMode === "apps") {
@@ -155,7 +209,6 @@ Item {
if (searchMode === "apps" && appLauncher.model.count > 0) {
const selectedApp = appLauncher.model.get(appLauncher.selectedIndex);
const menu = usePopupContextMenu ? popupContextMenu : layerContextMenuLoader.item;
if (selectedApp && menu && resultsView) {
const itemPos = resultsView.getSelectedItemPosition();
const contentPos = resultsView.mapToItem(spotlightKeyHandler, itemPos.x, itemPos.y);
@@ -168,7 +221,6 @@ Item {
AppLauncher {
id: appLauncher
viewMode: SettingsData.spotlightModalViewMode
gridColumns: SettingsData.appLauncherGridColumns
onAppLaunched: () => {
@@ -185,7 +237,6 @@ Item {
FileSearchController {
id: fileSearchController
onFileOpened: () => {
if (parentModal)
parentModal.hide();
@@ -197,7 +248,6 @@ Item {
SpotlightContextMenuPopup {
id: popupContextMenu
parent: spotlightKeyHandler
appLauncher: spotlightKeyHandler.appLauncher
parentHandler: spotlightKeyHandler
@@ -231,20 +281,37 @@ Item {
target: parentModal
function onSpotlightOpenChanged() {
if (parentModal && !parentModal.spotlightOpen) {
if (layerContextMenuLoader.item) {
if (layerContextMenuLoader.item)
layerContextMenuLoader.item.hide();
}
popupContextMenu.hide();
if (editMode)
closeEditMode();
}
}
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 {
anchors.fill: parent
anchors.margins: Theme.spacingM
spacing: Theme.spacingM
clip: false
visible: !editMode
Item {
id: searchRow
@@ -275,18 +342,14 @@ Item {
ignoreTabKeys: true
keyForwardTargets: [spotlightKeyHandler]
onTextChanged: {
if (searchMode === "apps") {
if (searchMode === "apps")
appLauncher.searchQuery = text;
}
}
onTextEdited: {
updateSearchMode();
}
onTextEdited: updateSearchMode()
Keys.onPressed: event => {
if (event.key === Qt.Key_Escape) {
if (parentModal)
parentModal.hide();
event.accepted = true;
} else if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length > 0) {
if (searchMode === "apps") {
@@ -334,13 +397,10 @@ Item {
MouseArea {
id: listViewArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: () => {
appLauncher.setViewMode("list");
}
onClicked: appLauncher.setViewMode("list")
}
}
@@ -359,13 +419,10 @@ Item {
MouseArea {
id: gridViewArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: () => {
appLauncher.setViewMode("grid");
}
onClicked: appLauncher.setViewMode("grid")
}
}
}
@@ -379,7 +436,6 @@ Item {
Rectangle {
id: filenameFilterButton
width: 36
height: 36
radius: Theme.cornerRadius
@@ -394,13 +450,10 @@ Item {
MouseArea {
id: filenameFilterArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: () => {
fileSearchController.searchField = "filename";
}
onClicked: fileSearchController.searchField = "filename"
onEntered: {
filenameTooltipLoader.active = true;
Qt.callLater(() => {
@@ -413,7 +466,6 @@ Item {
onExited: {
if (filenameTooltipLoader.item)
filenameTooltipLoader.item.hide();
filenameTooltipLoader.active = false;
}
}
@@ -421,7 +473,6 @@ Item {
Rectangle {
id: contentFilterButton
width: 36
height: 36
radius: Theme.cornerRadius
@@ -436,13 +487,10 @@ Item {
MouseArea {
id: contentFilterArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: () => {
fileSearchController.searchField = "body";
}
onClicked: fileSearchController.searchField = "body"
onEntered: {
contentTooltipLoader.active = true;
Qt.callLater(() => {
@@ -455,7 +503,6 @@ Item {
onExited: {
if (contentTooltipLoader.item)
contentTooltipLoader.item.hide();
contentTooltipLoader.active = false;
}
}
@@ -474,13 +521,10 @@ Item {
anchors.fill: parent
appLauncher: spotlightKeyHandler.appLauncher
visible: searchMode === "apps"
onItemRightClicked: (index, modelData, mouseX, mouseY) => {
const menu = usePopupContextMenu ? popupContextMenu : layerContextMenuLoader.item;
if (menu?.show) {
const isPopup = menu.contentItem !== undefined;
if (isPopup) {
const localPos = popupContextMenu.parent.mapFromItem(null, mouseX, mouseY);
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 {
id: filenameTooltipLoader
active: false
sourceComponent: DankTooltip {}
}
Loader {
id: contentTooltipLoader
active: false
sourceComponent: DankTooltip {}
}

View File

@@ -1,7 +1,6 @@
import QtQuick
import Quickshell
import Quickshell.Wayland
import Quickshell.Widgets
import qs.Common
import qs.Modals.Spotlight
@@ -19,6 +18,8 @@ PanelWindow {
property real menuPositionX: 0
property real menuPositionY: 0
signal editAppRequested(var app)
readonly property real shadowBuffer: 5
screen: parentModal?.effectiveScreen
@@ -106,6 +107,7 @@ PanelWindow {
}
onHideRequested: root.hide()
onEditAppRequested: app => root.editAppRequested(app)
}
MouseArea {

View File

@@ -68,6 +68,27 @@ Item {
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: {
const items = [];
@@ -103,6 +124,21 @@ Item {
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) {
items.push({
type: "separator"

View File

@@ -1,6 +1,5 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import qs.Common
import qs.Modals.Spotlight
@@ -11,6 +10,8 @@ Popup {
property var parentHandler: null
property var searchField: null
signal editAppRequested(var app)
function show(x, y, app, fromKeyboard) {
fromKeyboard = fromKeyboard || false;
menuContent.currentApp = app;
@@ -53,7 +54,7 @@ Popup {
if (parentHandler) {
parentHandler.enabled = true;
}
if (searchField) {
if (searchField?.visible) {
Qt.callLater(() => {
searchField.forceActiveFocus();
});
@@ -84,5 +85,6 @@ Popup {
id: menuContent
appLauncher: root.appLauncher
onHideRequested: root.hide()
onEditAppRequested: app => root.editAppRequested(app)
}
}

View File

@@ -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() {
openedFromOverview = false;
isClosing = true;

View File

@@ -1,11 +1,7 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import Quickshell.Widgets
import qs.Common
import qs.Modals.Spotlight
import qs.Modules.AppDrawer
import qs.Services
import qs.Widgets
DankPopout {
@@ -15,6 +11,63 @@ DankPopout {
property string searchMode: "apps"
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) {
if (text.startsWith("/")) {
@@ -42,16 +95,25 @@ DankPopout {
popupHeight: 600
triggerWidth: 40
positioning: ""
contentHandlesKeys: editMode
onBackgroundClicked: {
if (contextMenu.visible) {
contextMenu.close();
return;
}
if (editMode) {
closeEditMode();
return;
}
close();
}
onOpened: {
searchMode = "apps";
editMode = false;
editingApp = null;
editAppId = "";
appLauncher.ensureInitialized();
appLauncher.searchQuery = "";
appLauncher.selectedIndex = 0;
@@ -100,8 +162,45 @@ DankPopout {
LayoutMirroring.childrenInherit: true
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"
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
antialiasing: true
smooth: true
@@ -140,7 +239,7 @@ DankPopout {
id: keyHandler
anchors.fill: parent
focus: true
focus: !appDrawerPopout.editMode
function selectNext() {
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: {
const mappings = {};
mappings[Qt.Key_Escape] = () => appDrawerPopout.close();
@@ -181,6 +303,8 @@ DankPopout {
mappings[Qt.Key_Enter] = () => keyHandler.activateSelected();
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_Menu] = () => keyHandler.openContextMenuForSelected();
mappings[Qt.Key_F10] = () => keyHandler.openContextMenuForSelected();
if (appDrawerPopout.searchMode === "apps" && appLauncher.viewMode === "grid") {
mappings[Qt.Key_Right] = () => I18n.isRtl ? appLauncher.selectPreviousInRow() : appLauncher.selectNextInRow();
@@ -191,6 +315,9 @@ DankPopout {
}
Keys.onPressed: function (event) {
if (appDrawerPopout.editMode)
return;
if (keyMappings[event.key]) {
keyMappings[event.key]();
event.accepted = true;
@@ -198,9 +325,8 @@ DankPopout {
}
const hasCtrl = event.modifiers & Qt.ControlModifier;
if (!hasCtrl) {
if (!hasCtrl)
return;
}
switch (event.key) {
case Qt.Key_N:
@@ -234,6 +360,7 @@ DankPopout {
x: Theme.spacingS
y: Theme.spacingS
spacing: Theme.spacingS
visible: !appDrawerPopout.editMode
Item {
width: parent.width
@@ -487,7 +614,7 @@ DankPopout {
appLauncher.launchApp(modelData);
}
onItemRightClicked: function (index, modelData, mouseX, mouseY) {
contextMenu.show(mouseX, mouseY, modelData);
contextMenu.show(mouseX, mouseY, modelData, false);
}
onKeyboardNavigationReset: {
appLauncher.keyboardNavigationActive = false;
@@ -574,7 +701,7 @@ DankPopout {
appLauncher.launchApp(modelData);
}
onItemRightClicked: function (index, modelData, mouseX, mouseY) {
contextMenu.show(mouseX, mouseY, modelData);
contextMenu.show(mouseX, mouseY, modelData, false);
}
onKeyboardNavigationReset: {
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 {
anchors.fill: parent
visible: contextMenu.visible
@@ -624,338 +1026,21 @@ DankPopout {
}
}
Popup {
SpotlightContextMenuPopup {
id: contextMenu
property var currentApp: null
readonly property var desktopEntry: (currentApp && !currentApp.isPlugin && appLauncher && appLauncher._uniqueApps && currentApp.appIndex >= 0 && currentApp.appIndex < appLauncher._uniqueApps.length) ? appLauncher._uniqueApps[currentApp.appIndex] : null
readonly property string appId: desktopEntry ? (desktopEntry.id || desktopEntry.execString || "") : ""
readonly property bool isPinned: appId && SessionData.isPinnedApp(appId)
parent: contentLoader.item
appLauncher: appLauncher
parentHandler: contentLoader.item?.keyHandler ?? null
searchField: contentLoader.item?.searchField ?? null
visible: false
z: 1000
}
function show(x, y, app) {
currentApp = app;
let finalX = x + 4;
let finalY = y + 4;
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();
}
}
}
Connections {
target: contextMenu
function onEditAppRequested(app) {
appDrawerPopout.openEditMode(app);
}
}
}

View File

@@ -72,6 +72,16 @@ Item {
}
}
Connections {
target: SessionData
function onHiddenAppsChanged() {
updateFilteredModel();
}
function onAppOverridesChanged() {
updateFilteredModel();
}
}
function updateFilteredModel() {
if (suppressUpdatesWhileLaunching) {
suppressUpdatesWhileLaunching = false;
@@ -124,7 +134,7 @@ Item {
emptyTriggerItems = emptyTriggerItems.concat(items);
});
const coreItems = AppSearchService.getCoreApps("");
apps = AppSearchService.applications.concat(emptyTriggerItems).concat(coreItems);
apps = AppSearchService.getVisibleApplications().concat(emptyTriggerItems).concat(coreItems);
} else {
apps = AppSearchService.getAppsInCategory(selectedCategory).slice(0, maxResults);
const coreItems = AppSearchService.getCoreApps("").filter(app => app.categories.includes(selectedCategory));
@@ -205,6 +215,7 @@ Item {
"isPlugin": isPluginItem,
"isCore": app.isCore === true,
"isBuiltInLauncher": app.isBuiltInLauncher === true,
"isAction": app.isAction === true,
"appIndex": uniqueApps.length - 1,
"pinned": app._pinned === true
});
@@ -283,6 +294,13 @@ Item {
return;
}
if (appData.isAction && actualApp.parentApp && actualApp.actionData) {
SessionService.launchDesktopAction(actualApp.parentApp, actualApp.actionData);
appLaunched(appData);
AppUsageHistoryData.addAppUsage(actualApp.parentApp);
return;
}
SessionService.launchDesktopEntry(actualApp);
appLaunched(appData);
AppUsageHistoryData.addAppUsage(actualApp);

View File

@@ -757,12 +757,13 @@ Item {
}
property bool isOccupied: {
if (CompositorService.isHyprland)
return Array.from(Hyprland.toplevels?.values || [])
.some(tl => tl.workspace?.id === modelData?.id);
return Array.from(Hyprland.toplevels?.values || []).some(tl => tl.workspace?.id === modelData?.id);
if (CompositorService.isDwl)
return modelData.clients > 0;
if (CompositorService.isNiri)
return NiriService.windows?.some(win => win.workspace_id === modelData?.id) ?? false;
if (CompositorService.isNiri) {
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;
}
property bool isPlaceholder: {
@@ -848,16 +849,18 @@ Item {
readonly property color occupiedColor: {
switch (SettingsData.workspaceOccupiedColorMode) {
case "sec":
return Theme.secondary;
case "s":
return Theme.surface;
case "sc":
return Theme.surfaceContainer;
case "sch":
return Theme.surfaceContainerHigh;
case "none":
return unfocusedColor;
case "schh":
return Theme.surfaceContainerHighest;
default:
return Theme.secondary;
return unfocusedColor;
}
}

View File

@@ -182,30 +182,20 @@ Item {
}
onOpenRequested: {
if (hasUnsavedChanges()) {
root.pendingAction = "open";
root.confirmationDialogOpen = true;
confirmationDialogLoader.active = true;
if (confirmationDialogLoader.item)
confirmationDialogLoader.item.open();
} else {
root.fileDialogOpen = true;
loadBrowserLoader.active = true;
if (loadBrowserLoader.item)
loadBrowserLoader.item.open();
textEditor.autoSaveToSession();
if (textEditor.text.length > 0) {
createNewTab();
}
root.fileDialogOpen = true;
loadBrowserLoader.active = true;
if (loadBrowserLoader.item)
loadBrowserLoader.item.open();
}
onNewRequested: {
if (hasUnsavedChanges()) {
root.pendingAction = "new";
root.confirmationDialogOpen = true;
confirmationDialogLoader.active = true;
if (confirmationDialogLoader.item)
confirmationDialogLoader.item.open();
} else {
createNewTab();
}
textEditor.autoSaveToSession();
createNewTab();
}
onEscapePressed: {
@@ -266,7 +256,7 @@ Item {
id: saveBrowserLoader
active: false
FileBrowserModal {
FileBrowserSurfaceModal {
id: saveBrowser
browserTitle: I18n.tr("Save Notepad File")
@@ -332,7 +322,7 @@ Item {
id: loadBrowserLoader
active: false
FileBrowserModal {
FileBrowserSurfaceModal {
id: loadBrowser
browserTitle: I18n.tr("Open Notepad File")

View File

@@ -52,20 +52,15 @@ Column {
readonly property bool isActive: NotepadStorageService.currentTabIndex === index
readonly property bool isHovered: tabMouseArea.containsMouse && !closeMouseArea.containsMouse
readonly property real calculatedWidth: {
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));
}
readonly property real tabWidth: 128
width: calculatedWidth
width: tabWidth
height: 32
radius: Theme.cornerRadius
color: isActive ? Theme.primaryPressed : isHovered ? Theme.primaryHoverLight : Theme.withAlpha(Theme.primaryPressed, 0)
border.width: isActive ? 0 : 1
border.color: Theme.outlineMedium
clip: true
MouseArea {
id: tabMouseArea
@@ -79,11 +74,14 @@ Column {
Row {
id: tabContent
anchors.centerIn: parent
anchors.fill: parent
anchors.leftMargin: Theme.spacingM
anchors.rightMargin: Theme.spacingM
spacing: Theme.spacingXS
StyledText {
id: tabText
width: parent.width - (tabCloseButton.visible ? tabCloseButton.width + Theme.spacingXS : 0)
text: {
var prefix = "";
if (hasUnsavedChangesForTab(modelData)) {
@@ -96,6 +94,7 @@ Column {
font.weight: isActive ? Font.Medium : Font.Normal
elide: Text.ElideMiddle
maximumLineCount: 1
wrapMode: Text.NoWrap
anchors.verticalCenter: parent.verticalCenter
}

View File

@@ -383,7 +383,7 @@ Column {
TextArea.flickable: 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)
font.family: SettingsData.notepadUseMonospace ? SettingsData.monoFontFamily : (SettingsData.notepadFontFamily || SettingsData.fontFamily)
font.pixelSize: SettingsData.notepadFontSize * SettingsData.fontScale
@@ -404,6 +404,22 @@ Column {
topPadding: Theme.spacingM
rightPadding: 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: {
loadCurrentTabContent()
@@ -480,6 +496,20 @@ Column {
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
}
}
}

View File

@@ -8,8 +8,61 @@ Popup {
id: processContextMenu
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 finalY = y;
@@ -27,17 +80,98 @@ Popup {
processContextMenu.x = finalX;
processContextMenu.y = finalY;
keyboardNavigation = fromKeyboard || false;
selectedIndex = fromKeyboard ? 0 : -1;
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
height: menuColumn.implicitHeight + Theme.spacingS * 2
padding: 0
modal: false
closePolicy: Popup.CloseOnEscape
onClosed: closePolicy = Popup.CloseOnEscape
onOpened: outsideClickTimer.start()
onClosed: {
closePolicy = Popup.CloseOnEscape;
keyboardNavigation = false;
selectedIndex = -1;
menuClosed();
if (parentFocusItem)
Qt.callLater(() => parentFocusItem.forceActiveFocus());
}
onOpened: {
outsideClickTimer.start();
if (keyboardNavigation)
Qt.callLater(() => keyboardHandler.forceActiveFocus());
}
Timer {
id: outsideClickTimer
@@ -55,142 +189,145 @@ Popup {
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
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 {
id: menuColumn
anchors.fill: parent
anchors.margins: Theme.spacingS
spacing: 1
MenuItem {
text: I18n.tr("Copy PID")
iconName: "tag"
onClicked: {
if (processContextMenu.processData)
Quickshell.execDetached(["dms", "cl", "copy", processContextMenu.processData.pid.toString()]);
processContextMenu.close();
}
}
Repeater {
model: menuItems
MenuItem {
text: I18n.tr("Copy Name")
iconName: "content_copy"
onClicked: {
if (processContextMenu.processData) {
const name = processContextMenu.processData.command || "";
Quickshell.execDetached(["dms", "cl", "copy", name]);
Item {
width: parent.width
height: modelData.type === "separator" ? 5 : 32
visible: modelData.type !== "separator" || index > 0
property int itemVisibleIndex: {
let count = 0;
for (let i = 0; i < index; i++) {
if (menuItems[i].type !== "separator")
count++;
}
return count;
}
processContextMenu.close();
}
}
MenuItem {
text: I18n.tr("Copy Full Command")
iconName: "code"
onClicked: {
if (processContextMenu.processData) {
const fullCmd = processContextMenu.processData.fullCommand || processContextMenu.processData.command || "";
Quickshell.execDetached(["dms", "cl", "copy", fullCmd]);
Rectangle {
visible: modelData.type === "separator"
width: parent.width - Theme.spacingS * 2
height: 1
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
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()
}
}
}

View File

@@ -42,6 +42,8 @@ DankPopout {
if (!shouldBeVisible) {
searchText = "";
expandedPid = "";
if (processesView)
processesView.reset();
}
}
@@ -69,9 +71,13 @@ DankPopout {
if (processListPopout.shouldBeVisible)
forceActiveFocus();
processContextMenu.parent = processListContent;
processContextMenu.parentFocusItem = processListContent;
}
Keys.onPressed: event => {
if (processContextMenu.visible)
return;
switch (event.key) {
case Qt.Key_Escape:
if (processListPopout.searchText.length > 0) {
@@ -79,6 +85,11 @@ DankPopout {
event.accepted = true;
return;
}
if (processesView.keyboardNavigationActive) {
processesView.reset();
event.accepted = true;
return;
}
processListPopout.close();
event.accepted = true;
return;
@@ -90,14 +101,15 @@ DankPopout {
}
break;
}
processesView.handleKey(event);
}
Connections {
target: processListPopout
function onShouldBeVisibleChanged() {
if (processListPopout.shouldBeVisible) {
if (processListPopout.shouldBeVisible)
Qt.callLater(() => processListContent.forceActiveFocus());
}
}
}
@@ -142,6 +154,8 @@ DankPopout {
showClearButton: true
text: processListPopout.searchText
onTextChanged: processListPopout.searchText = text
ignoreUpDownKeys: true
keyForwardTargets: [processListContent]
}
}
@@ -314,6 +328,7 @@ DankPopout {
clip: true
ProcessesView {
id: processesView
anchors.fill: parent
anchors.margins: Theme.spacingS
searchText: processListPopout.searchText

View File

@@ -11,18 +11,27 @@ Item {
property string searchText: ""
property string expandedPid: ""
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: []
signal openContextMenuRequested(int index, real x, real y, bool fromKeyboard)
onFilteredProcessesChanged: {
if (!pauseUpdates)
cachedProcesses = filteredProcesses;
if (!shouldUpdate)
return;
cachedProcesses = filteredProcesses;
if (forceRefreshCount > 0)
forceRefreshCount--;
}
onPauseUpdatesChanged: {
if (!pauseUpdates)
onShouldUpdateChanged: {
if (shouldUpdate)
cachedProcesses = filteredProcesses;
}
@@ -75,6 +84,135 @@ Item {
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: {
DgopService.addRef(["processes", "cpu", "memory", "system"]);
cachedProcesses = filteredProcesses;
@@ -163,22 +301,28 @@ Item {
delegate: ProcessItem {
required property var modelData
required property int index
width: processListView.width
process: modelData
isExpanded: root.expandedPid === (modelData?.pid ?? -1).toString()
isSelected: root.keyboardNavigationActive && root.selectedIndex === index
contextMenu: root.contextMenu
onToggleExpand: {
const pidStr = (modelData?.pid ?? -1).toString();
root.expandedPid = (root.expandedPid === pidStr) ? "" : pidStr;
}
onHoveringExpandedChanged: {
if (hoveringExpanded)
root.hoveringExpandedItem = true;
else
Qt.callLater(() => {
root.hoveringExpandedItem = false;
});
onClicked: {
root.keyboardNavigationActive = true;
root.selectedIndex = index;
}
onContextMenuRequested: (mouseX, mouseY) => {
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 bool isExpanded: false
property bool isSelected: false
property var contextMenu: null
readonly property bool hoveringExpanded: (isExpanded && processMouseArea.containsMouse) || copyMouseArea.containsMouse
signal toggleExpand
signal clicked
signal contextMenuRequested(real mouseX, real mouseY)
readonly property int processPid: process?.pid ?? 0
readonly property real processCpu: process?.cpu ?? 0
@@ -301,8 +447,16 @@ Item {
height: isExpanded ? (44 + expandedRect.height + Theme.spacingXS) : 44
radius: Theme.cornerRadius
color: processMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.06) : "transparent"
border.color: processMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
color: {
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
clip: true
@@ -327,14 +481,10 @@ Item {
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: mouse => {
if (mouse.button === Qt.RightButton) {
if (processItemRoot.processPid > 0 && processItemRoot.contextMenu) {
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);
}
processItemRoot.contextMenuRequested(mouse.x, mouse.y);
return;
}
processItemRoot.clicked();
processItemRoot.toggleExpand();
}
}

View File

@@ -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 {
id: recentAppsCard
width: parent.width

View File

@@ -201,7 +201,7 @@ Item {
SettingsButtonGroupRow {
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
buttonHeight: 22
minButtonWidth: 36
@@ -210,15 +210,17 @@ Item {
textSize: Theme.fontSizeSmall - 1
spacing: 1
currentIndex: {
switch (SettingsData.wokspaceColorMode) {
case "s":
switch (SettingsData.workspaceOccupiedColorMode) {
case "sec":
return 1;
case "sc":
case "s":
return 2;
case "sch":
case "sc":
return 3;
case "none":
case "sch":
return 4;
case "schh":
return 5;
default:
return 0;
}
@@ -226,7 +228,7 @@ Item {
onSelectionChanged: (index, selected) => {
if (!selected)
return;
const modes = ["default", "s", "sc", "sch", "none"];
const modes = ["none", "sec", "s", "sc", "sch", "schh"];
SettingsData.set("workspaceOccupiedColorMode", modes[index]);
}
}

View File

@@ -10,6 +10,8 @@ Singleton {
property var applications: []
property var _cachedCategories: null
property var _cachedVisibleApps: null
property var _hiddenAppsSet: new Set()
readonly property int maxResults: 10
readonly property int frecencySampleSize: 10
@@ -40,6 +42,51 @@ Singleton {
function refreshApplications() {
applications = DesktopEntries.applications.values;
_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")
@@ -226,7 +273,10 @@ Singleton {
}
}
Component.onCompleted: refreshApplications()
Component.onCompleted: {
_rebuildHiddenSet();
refreshApplications();
}
function tokenize(text) {
return text.toLowerCase().trim().split(/[\s\-_]+/).filter(w => w.length > 0);
@@ -345,17 +395,17 @@ Singleton {
}
function searchApplications(query) {
if (!query || query.length === 0) {
return applications;
}
if (!query || query.length === 0)
return getVisibleApplications();
if (applications.length === 0)
return [];
const queryLower = query.toLowerCase().trim();
const scoredApps = [];
const results = [];
const visibleApps = getVisibleApplications();
for (const app of applications) {
for (const app of visibleApps) {
const name = (app.name || "").toLowerCase();
const genericName = (app.genericName || "").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);
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) {
if (!app?.categories)
return [];
@@ -525,17 +623,15 @@ Singleton {
}
function getAppsInCategory(category) {
if (category === I18n.tr("All")) {
return applications;
}
const visibleApps = getVisibleApplications();
if (category === I18n.tr("All"))
return visibleApps;
// Check if it's a plugin category
const pluginItems = getPluginItems(category, "");
if (pluginItems.length > 0) {
if (pluginItems.length > 0)
return pluginItems;
}
return applications.filter(app => {
return visibleApps.filter(app => {
const appCategories = getCategoriesForApp(app);
return appCategories.includes(category);
});

View File

@@ -182,17 +182,44 @@ Singleton {
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) {
let cmd = desktopEntry.command;
if (useNvidia && nvidiaCommand)
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 defaultPrefix = Quickshell.env("DMS_DEFAULT_LAUNCH_PREFIX") || "";
const prefix = userPrefix.length > 0 ? userPrefix : defaultPrefix;
const workDir = desktopEntry.workingDirectory || Quickshell.env("HOME");
const cursorEnv = typeof SettingsData.getCursorEnvironment === "function" ? SettingsData.getCursorEnvironment() : {};
const overrideEnv = override?.envVars ? parseEnvVars(override.envVars) : {};
const finalEnv = Object.assign({}, cursorEnv, overrideEnv);
if (desktopEntry.runInTerminal) {
const terminal = Quickshell.env("TERMINAL") || "xterm";
const escapedCmd = cmd.map(arg => escapeShellArg(arg)).join(" ");
@@ -200,7 +227,7 @@ Singleton {
Quickshell.execDetached({
command: [terminal, "-e", "sh", "-c", shellCmd],
workingDirectory: workDir,
environment: cursorEnv
environment: finalEnv
});
return;
}
@@ -210,7 +237,7 @@ Singleton {
Quickshell.execDetached({
command: ["sh", "-c", `${prefix} ${escapedCmd}`],
workingDirectory: workDir,
environment: cursorEnv
environment: finalEnv
});
return;
}
@@ -221,7 +248,7 @@ Singleton {
Quickshell.execDetached({
command: cmd,
workingDirectory: workDir,
environment: cursorEnv
environment: finalEnv
});
}

View File

@@ -29,6 +29,7 @@ Item {
property bool shouldBeVisible: false
property var customKeyboardFocus: null
property bool backgroundInteractive: true
property bool contentHandlesKeys: false
property real storedBarThickness: Theme.barHeight - 4
property real storedBarSpacing: 4
@@ -461,8 +462,12 @@ Item {
id: focusHelper
parent: contentContainer
anchors.fill: parent
focus: true
visible: !root.contentHandlesKeys
enabled: !root.contentHandlesKeys
focus: !root.contentHandlesKeys
Keys.onPressed: event => {
if (root.contentHandlesKeys)
return;
if (event.key === Qt.Key_Escape) {
close();
event.accepted = true;

View File

@@ -53,6 +53,7 @@ StyledRect {
property real topPadding: Theme.spacingM
property real bottomPadding: Theme.spacingM
property bool ignoreLeftRightKeys: false
property bool ignoreUpDownKeys: false
property bool ignoreTabKeys: false
property var keyForwardTargets: []
property Item keyNavigationTab: null
@@ -145,9 +146,16 @@ StyledRect {
if (root.ignoreTabKeys && (event.key === Qt.Key_Tab || event.key === Qt.Key_Backtab)) {
event.accepted = false;
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);
}
}
}
}