Skip to content

kcmodule: Switch to comboboxes for selecting idle timeout values

Jakob Petsovits requested to merge work/jpetso/kcm-combobox-timeouts into master

Original commit message

This follows the direction spearheaded by kcm_screenlocker, in kscreenlocker@311db2a9. In addition to a few select preset options, the user can also select a "Custom…" option which presents a duration prompt dialog.

Using comboboxes has a few nice UX characteristics:

  • It allows us to replace the checkbox of some timeout settings with a textual option called "Never", which is easier to grasp. Likewise, "Immediately" is more obvious than "0 sec".

  • It increases the mouse area available for clicking, which makes the control easier to hit for users with low-precision pointer input devices.

  • It sidesteps the problem of SpinBox ignoring the defined step size when scrolling with a high-resolution scroll wheel.

  • By putting the SpinBox into a custom duration prompt dialog, it's more obvious that both seconds and minutes are supported for each setting. Some options also provide second-level presets.

The downside is that it now takes three extra clicks to enter and confirm a custom timeout duration. Hopefully our users are comfortable with that trade-off.

In order to implement this, the latest versions of the ComboBoxWithCustomValue and DurationPromptDialog components are copied from kcm_screenlocker. Several improvements to these components will be fed back to kcm_screenlocker and hopefully upstreamed to Kirigami (or Kirigami Addons) in time.

In addition, this commit introduces TimeDelayComboBox, a glue code component combining two aforementioned components, to further. reduce the amount of boilerplate required in ProfileConfig.qml.

Test plan

Exercise all five controls that replaced the previous ones. Double-check that preset options for each are sane. Try switching between preset and custom timeout values. Make sure that values written to .config/powerdevilrc match expectations and result in the desired idle timeout behavior.

Bugs fixed

BUG: 482428 CCBUG: 482853

Screenshots or screen recordings

Before After
2024-05-15.kcm-power-combobox-timeouts-before 2024-05-15.kcm-power-combobox-timeouts
2024-05-15.kcm-power-combobox-timeouts-locked

Notes for reviewers

The main uncertainty I have about this is how to deal with the timeout previously known as "When locked, turn off screen: [after X seconds]". Would appreciate input from @teams/vdg. The additional expressiveness of combobox option texts, combined with the gained space from not having a checkbox, makes it theoretically possible to combine unlocked and locked timeout settings into a single line (as shown in the screenshot). It's also nice visually to not have tons of full-width comboboxes everywhere.

But I had to tweak the option texts carefully to avoid the line getting too long, and I'm not sure if other languages can do the same. Perhaps you'd also prefer different option text phrasing, and/or you don't like having "When locked:" in the option text in the first place. Discuss.

Wondering if I should rename TimeDelayComboBox to DurationComboBox, because it could well support non-delay durations and that would bring it in line with DurationPromptDialog, although months and years aren't supported as time units in this glue-code component so maybe that's unexpected when using the same name. [Edit: renamed it to TimeDurationComboBox for the time being.]

Edited by Jakob Petsovits

Merge request reports

Loading