Original commit message
This follows the direction spearheaded by kcm_screenlocker,in kscreenlocker@311db2a9. In addition to a fewselect 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 settingswith 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 makesthe control easier to hit for users with low-precision pointerinput devices.
It sidesteps the problem of
SpinBox
ignoring the definedstep 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 supportedfor each setting. Some options also provide second-level presets.
The downside is that it now takes three extra clicks to enterand confirm a custom timeout duration. Hopefully our users arecomfortable with that trade-off.
In order to implement this, the latest versions of theComboBoxWithCustomValue
and DurationPromptDialog
componentsare copied from kcm_screenlocker. Several improvements to thesecomponents will be fed back to kcm_screenlocker and hopefullyupstreamed to Kirigami (or Kirigami Addons) in time.
In addition, this commit introduces TimeDelayComboBox
, a glue codecomponent 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
Screenshots or screen recordings
Before | After |
---|---|
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.]