diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index 3935c360..517d1efc 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -79,6 +79,8 @@ Singleton { saveSettings(); } + property bool clipboardEnterToPaste: false + property var launcherPluginVisibility: ({}) function getPluginAllowWithoutTrigger(pluginId) { @@ -2233,10 +2235,16 @@ Singleton { if ((existing.dark && typeof existing.dark === "object") || (existing.light && typeof existing.light === "object")) { perMode = existing; } 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; registryThemeVariants = variants; saveSettings(); diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index af7dd0a7..aa347353 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -469,6 +469,8 @@ var SPEC = { desktopWidgetGroups: { def: [] }, builtInPluginSettings: { def: {} }, + clipboardEnterToPaste: { def: false }, + launcherPluginVisibility: { def: {} }, launcherPluginOrder: { def: [] } }; diff --git a/quickshell/Modals/Clipboard/ClipboardContent.qml b/quickshell/Modals/Clipboard/ClipboardContent.qml index 8a4cfafd..12eadc0a 100644 --- a/quickshell/Modals/Clipboard/ClipboardContent.qml +++ b/quickshell/Modals/Clipboard/ClipboardContent.qml @@ -268,6 +268,7 @@ Item { sourceComponent: ClipboardKeyboardHints { wtypeAvailable: modal.wtypeAvailable + enterToPaste: SettingsData.clipboardEnterToPaste } } } diff --git a/quickshell/Modals/Clipboard/ClipboardKeyboardController.qml b/quickshell/Modals/Clipboard/ClipboardKeyboardController.qml index da3addaf..f2a457ee 100644 --- a/quickshell/Modals/Clipboard/ClipboardKeyboardController.qml +++ b/quickshell/Modals/Clipboard/ClipboardKeyboardController.qml @@ -1,4 +1,5 @@ import QtQuick +import qs.Common import qs.Services QtObject { @@ -133,7 +134,11 @@ QtObject { case Qt.Key_Return: case Qt.Key_Enter: if (ClipboardService.keyboardNavigationActive) { - modal.pasteSelected(); + if (SettingsData.clipboardEnterToPaste) { + copySelected(); + } else { + modal.pasteSelected(); + } event.accepted = true; } return; @@ -144,7 +149,11 @@ QtObject { switch (event.key) { case Qt.Key_Return: case Qt.Key_Enter: - copySelected(); + if (SettingsData.clipboardEnterToPaste) { + modal.pasteSelected(); + } else { + copySelected(); + } event.accepted = true; return; case Qt.Key_Delete: diff --git a/quickshell/Modals/Clipboard/ClipboardKeyboardHints.qml b/quickshell/Modals/Clipboard/ClipboardKeyboardHints.qml index 6989a91c..edfb9cb6 100644 --- a/quickshell/Modals/Clipboard/ClipboardKeyboardHints.qml +++ b/quickshell/Modals/Clipboard/ClipboardKeyboardHints.qml @@ -6,7 +6,12 @@ Rectangle { id: keyboardHints 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 radius: Theme.cornerRadius @@ -21,7 +26,7 @@ Rectangle { spacing: 2 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 color: Theme.surfaceText anchors.horizontalCenter: parent.horizontalCenter diff --git a/quickshell/Modules/Settings/ClipboardTab.qml b/quickshell/Modules/Settings/ClipboardTab.qml index 73b41e95..d477bb9c 100644 --- a/quickshell/Modules/Settings/ClipboardTab.qml +++ b/quickshell/Modules/Settings/ClipboardTab.qml @@ -427,6 +427,16 @@ Item { checked: root.config.clearAtStartup ?? false 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 {