feat(power): only ask for user confirmation on destructive actions
This commit is contained in:
parent
257250eb62
commit
d097cb1c94
1 changed files with 16 additions and 11 deletions
|
|
@ -164,6 +164,10 @@ impl cosmic::Application for Power {
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
Message::Action(action) => {
|
Message::Action(action) => {
|
||||||
|
// Ask for user confirmation of non-destructive actions only
|
||||||
|
if matches!(action, PowerAction::Lock | PowerAction::Suspend) {
|
||||||
|
action.perform()
|
||||||
|
} else {
|
||||||
let id = window::Id::unique();
|
let id = window::Id::unique();
|
||||||
self.action_to_confirm = Some((id, action, COUNTDOWN_LENGTH));
|
self.action_to_confirm = Some((id, action, COUNTDOWN_LENGTH));
|
||||||
get_layer_surface(SctkLayerSurfaceSettings {
|
get_layer_surface(SctkLayerSurfaceSettings {
|
||||||
|
|
@ -176,6 +180,7 @@ impl cosmic::Application for Power {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Message::Zbus(result) => {
|
Message::Zbus(result) => {
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
eprintln!("cosmic-applet-power ERROR: '{}'", e);
|
eprintln!("cosmic-applet-power ERROR: '{}'", e);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue