Skip to content

Commit bc603e1

Browse files
committed
ui: expose keystroke delay option
1 parent d592109 commit bc603e1

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

desktop/qml/SettingsAdvancedPage.qml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2024 Michal Kosciesza <michal@mkiol.net>
1+
/* Copyright (C) 2024-2025 Michal Kosciesza <michal@mkiol.net>
22
*
33
* This Source Code Form is subject to the terms of the Mozilla Public
44
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -302,7 +302,7 @@ ColumnLayout {
302302
ComboBoxForm {
303303
visible: _settings.is_xcb()
304304
label.text: qsTranslate("SettingsPage", "Keystroke sending method")
305-
toolTip: qsTranslate("SettingsPage", "Keystroke sending method used in %1.").arg("<i>" + qsTranslate("SettingsPage", "Insert into active window") + "</i>")
305+
toolTip: qsTranslate("SettingsPage", "Simulated keystroke sending method used in %1.").arg("<i>" + qsTranslate("SettingsPage", "Insert into active window") + "</i>")
306306
comboBox {
307307
currentIndex: {
308308
if (_settings.fake_keyboard_type === Settings.FakeKeyboardTypeLegacy) return 0
@@ -323,8 +323,23 @@ ColumnLayout {
323323
}
324324
}
325325

326+
SpinBoxForm {
327+
visible: _settings.is_xcb() && _settings.fake_keyboard_type === Settings.FakeKeyboardTypeLegacy
328+
label.text: qsTranslate("SettingsPage", "Keystroke delay")
329+
toolTip: qsTranslate("SettingsPage", "The delay between simulated keystrokes used in %1.").arg("<i>" + qsTranslate("SettingsPage", "Insert into active window") + "</i>")
330+
spinBox {
331+
from: 1
332+
to: 1000
333+
stepSize: 1
334+
value: _settings.fake_keyboard_delay
335+
onValueChanged: {
336+
_settings.fake_keyboard_delay = spinBox.value;
337+
}
338+
}
339+
}
340+
326341
TextFieldForm {
327-
visible: _settings.is_xcb() && _settings.fake_keyboard_type === Settings.FakeKeyboardTypeNative
342+
visible: _settings.is_xcb() && _settings.fake_keyboard_type === Settings.FakeKeyboardTypeLegacy
328343
label.text: qsTranslate("SettingsPage", "Compose file")
329344
toolTip: qsTranslate("SettingsPage", "X11 compose file used in %1.").arg("<i>" + qsTranslate("SettingsPage", "Insert into active window") + "</i>") + " " +
330345
qsTranslate("SettingsPage", "Leave blank to use the default value.")

src/settings.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2021-2024 Michal Kosciesza <michal@mkiol.net>
1+
/* Copyright (C) 2021-2025 Michal Kosciesza <michal@mkiol.net>
22
*
33
* This Source Code Form is subject to the terms of the Mozilla Public
44
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -2677,7 +2677,8 @@ void settings::set_fake_keyboard_type(fake_keyboard_type_t value) {
26772677
}
26782678

26792679
int settings::fake_keyboard_delay() const {
2680-
return value(QStringLiteral("fake_keyboard_delay"), 10).toInt();
2680+
auto v = value(QStringLiteral("fake_keyboard_delay"), 10).toInt();
2681+
return std::clamp(v, 1, 1000);
26812682
}
26822683

26832684
void settings::set_fake_keyboard_delay(int value) {

0 commit comments

Comments
 (0)