Revert "feat: power button handling"
This reverts commit 534584b9e48fcae406094367bdcb911f8957a523.
This commit is contained in:
parent
8e3590fb4d
commit
8a3436edb2
3 changed files with 10 additions and 31 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
|
@ -888,7 +888,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/#12317d8103c34d66f005ee868df578abe693c84a"
|
||||
source = "git+https://github.com/pop-os/libcosmic/#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
dependencies = [
|
||||
"atomicwrites",
|
||||
"calloop 0.14.2",
|
||||
|
|
@ -907,7 +907,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config-derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic/#12317d8103c34d66f005ee868df578abe693c84a"
|
||||
source = "git+https://github.com/pop-os/libcosmic/#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
|
|
@ -943,7 +943,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-settings-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-settings-daemon#243c36e9e66dcbec83fa63cb3adaceb3bea166a4"
|
||||
source = "git+https://github.com/pop-os/cosmic-settings-daemon#ed1bc9e39e0380ea7e40233bb63960eeb674be34"
|
||||
dependencies = [
|
||||
"cosmic-config",
|
||||
"ron",
|
||||
|
|
@ -2279,7 +2279,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_core"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic/#12317d8103c34d66f005ee868df578abe693c84a"
|
||||
source = "git+https://github.com/pop-os/libcosmic/#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bytes",
|
||||
|
|
@ -2302,7 +2302,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_futures"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic/#12317d8103c34d66f005ee868df578abe693c84a"
|
||||
source = "git+https://github.com/pop-os/libcosmic/#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"iced_core",
|
||||
|
|
|
|||
|
|
@ -49,9 +49,6 @@ use cosmic_comp_config::{
|
|||
XkbConfig, XwaylandDescaling, XwaylandEavesdropping, ZoomConfig,
|
||||
};
|
||||
|
||||
/// Offset used to convert Linux scancode to X11 keycode.
|
||||
pub(crate) const X11_KEYCODE_OFFSET: u32 = 8;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Config {
|
||||
pub dynamic_conf: DynamicConfig,
|
||||
|
|
@ -779,6 +776,9 @@ pub fn change_modifier_state(
|
|||
scan_code: u32,
|
||||
state: &mut State,
|
||||
) {
|
||||
/// Offset used to convert Linux scancode to X11 keycode.
|
||||
const X11_KEYCODE_OFFSET: u32 = 8;
|
||||
|
||||
let mut input = |key_state, scan_code| {
|
||||
let time = state.common.clock.now().as_millis();
|
||||
let _ = keyboard.input(
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use crate::{
|
|||
cosmic_keystate_from_smithay, cosmic_modifiers_eq_smithay,
|
||||
cosmic_modifiers_from_smithay,
|
||||
},
|
||||
Action, Config, PrivateAction, X11_KEYCODE_OFFSET,
|
||||
Action, Config, PrivateAction,
|
||||
},
|
||||
input::gestures::{GestureState, SwipeAction},
|
||||
shell::{
|
||||
|
|
@ -35,8 +35,8 @@ use calloop::{
|
|||
RegistrationToken,
|
||||
};
|
||||
use cosmic_comp_config::{workspace::WorkspaceLayout, NumlockState};
|
||||
use cosmic_settings_config::shortcuts;
|
||||
use cosmic_settings_config::shortcuts::action::{Direction, ResizeDirection};
|
||||
use cosmic_settings_config::{shortcuts, Binding};
|
||||
use smithay::{
|
||||
backend::input::{
|
||||
AbsolutePositionEvent, Axis, AxisSource, Device, DeviceCapability, GestureBeginEvent,
|
||||
|
|
@ -213,32 +213,11 @@ impl State {
|
|||
self.common.idle_notifier_state.notify_activity(&seat);
|
||||
|
||||
let keycode = event.key_code();
|
||||
|
||||
let state = event.state();
|
||||
trace!(?keycode, ?state, "key");
|
||||
|
||||
let serial = SERIAL_COUNTER.next_serial();
|
||||
let time = Event::time_msec(&event);
|
||||
|
||||
const POWER_OFF: u32 = 116;
|
||||
// if power key is pressed, just use the system action for power off
|
||||
// this is a workaround for the fact that the power key is not
|
||||
// available in the keymap, so we cannot use the keymap to determine
|
||||
// if the key is pressed
|
||||
if keycode.raw() == POWER_OFF + X11_KEYCODE_OFFSET && state == KeyState::Pressed
|
||||
{
|
||||
self.handle_action(
|
||||
Action::Shortcut(shortcuts::Action::System(
|
||||
shortcuts::action::System::PowerOff,
|
||||
)),
|
||||
&seat,
|
||||
serial,
|
||||
time,
|
||||
Binding::default(),
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
let keyboard = seat.get_keyboard().unwrap();
|
||||
let previous_modifiers = keyboard.modifier_state();
|
||||
if let Some((action, pattern)) = keyboard
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue