1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-12 16:52:10 -04:00

clipboard: option to paste on enter

fixes #1686
This commit is contained in:
bbedward
2026-02-15 13:36:19 -05:00
parent 13ef1efa7b
commit e5cdbf4cf5
6 changed files with 41 additions and 6 deletions

View File

@@ -79,6 +79,8 @@ Singleton {
saveSettings(); saveSettings();
} }
property bool clipboardEnterToPaste: false
property var launcherPluginVisibility: ({}) property var launcherPluginVisibility: ({})
function getPluginAllowWithoutTrigger(pluginId) { function getPluginAllowWithoutTrigger(pluginId) {
@@ -2233,10 +2235,16 @@ Singleton {
if ((existing.dark && typeof existing.dark === "object") || (existing.light && typeof existing.light === "object")) { if ((existing.dark && typeof existing.dark === "object") || (existing.light && typeof existing.light === "object")) {
perMode = existing; perMode = existing;
} else if (typeof existing.flavor === "string") { } else if (typeof existing.flavor === "string") {
perMode.dark = {flavor: existing.flavor, accent: existing.accent || ""}; perMode.dark = {
flavor: existing.flavor,
accent: existing.accent || ""
};
} }
} }
perMode[mode || "dark"] = {flavor: flavor, accent: accent}; perMode[mode || "dark"] = {
flavor: flavor,
accent: accent
};
variants[themeId] = perMode; variants[themeId] = perMode;
registryThemeVariants = variants; registryThemeVariants = variants;
saveSettings(); saveSettings();

View File

@@ -469,6 +469,8 @@ var SPEC = {
desktopWidgetGroups: { def: [] }, desktopWidgetGroups: { def: [] },
builtInPluginSettings: { def: {} }, builtInPluginSettings: { def: {} },
clipboardEnterToPaste: { def: false },
launcherPluginVisibility: { def: {} }, launcherPluginVisibility: { def: {} },
launcherPluginOrder: { def: [] } launcherPluginOrder: { def: [] }
}; };

View File

@@ -268,6 +268,7 @@ Item {
sourceComponent: ClipboardKeyboardHints { sourceComponent: ClipboardKeyboardHints {
wtypeAvailable: modal.wtypeAvailable wtypeAvailable: modal.wtypeAvailable
enterToPaste: SettingsData.clipboardEnterToPaste
} }
} }
} }

View File

@@ -1,4 +1,5 @@
import QtQuick import QtQuick
import qs.Common
import qs.Services import qs.Services
QtObject { QtObject {
@@ -133,7 +134,11 @@ QtObject {
case Qt.Key_Return: case Qt.Key_Return:
case Qt.Key_Enter: case Qt.Key_Enter:
if (ClipboardService.keyboardNavigationActive) { if (ClipboardService.keyboardNavigationActive) {
modal.pasteSelected(); if (SettingsData.clipboardEnterToPaste) {
copySelected();
} else {
modal.pasteSelected();
}
event.accepted = true; event.accepted = true;
} }
return; return;
@@ -144,7 +149,11 @@ QtObject {
switch (event.key) { switch (event.key) {
case Qt.Key_Return: case Qt.Key_Return:
case Qt.Key_Enter: case Qt.Key_Enter:
copySelected(); if (SettingsData.clipboardEnterToPaste) {
modal.pasteSelected();
} else {
copySelected();
}
event.accepted = true; event.accepted = true;
return; return;
case Qt.Key_Delete: case Qt.Key_Delete:

View File

@@ -6,7 +6,12 @@ Rectangle {
id: keyboardHints id: keyboardHints
property bool wtypeAvailable: false property bool wtypeAvailable: false
readonly property string hintsText: wtypeAvailable ? I18n.tr("Shift+Enter: Paste • Shift+Del: Clear All • Esc: Close") : I18n.tr("Shift+Del: Clear All • Esc: Close") property bool enterToPaste: false
readonly property string hintsText: {
if (!wtypeAvailable)
return I18n.tr("Shift+Del: Clear All • Esc: Close");
return enterToPaste ? I18n.tr("Shift+Enter: Copy • Shift+Del: Clear All • Esc: Close", "Keyboard hints when enter-to-paste is enabled") : I18n.tr("Shift+Enter: Paste • Shift+Del: Clear All • Esc: Close");
}
height: ClipboardConstants.keyboardHintsHeight height: ClipboardConstants.keyboardHintsHeight
radius: Theme.cornerRadius radius: Theme.cornerRadius
@@ -21,7 +26,7 @@ Rectangle {
spacing: 2 spacing: 2
StyledText { StyledText {
text: "↑/↓: Navigate • Enter/Ctrl+C: Copy • Del: Delete • F10: Help" text: keyboardHints.enterToPaste ? I18n.tr("↑/↓: Navigate • Enter: Paste • Del: Delete • F10: Help", "Keyboard hints when enter-to-paste is enabled") : "↑/↓: Navigate • Enter/Ctrl+C: Copy • Del: Delete • F10: Help"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText color: Theme.surfaceText
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter

View File

@@ -427,6 +427,16 @@ Item {
checked: root.config.clearAtStartup ?? false checked: root.config.clearAtStartup ?? false
onToggled: checked => root.saveConfig("clearAtStartup", checked) onToggled: checked => root.saveConfig("clearAtStartup", checked)
} }
SettingsToggleRow {
tab: "clipboard"
tags: ["clipboard", "enter", "paste", "behavior"]
settingKey: "clipboardEnterToPaste"
text: I18n.tr("Enter to Paste")
description: I18n.tr("Press Enter to paste, Shift+Enter to copy", "Clipboard behavior setting description")
checked: SettingsData.clipboardEnterToPaste
onToggled: checked => SettingsData.set("clipboardEnterToPaste", checked)
}
} }
SettingsCard { SettingsCard {