Skip to content

Commit 8a3436e

Browse files
wash2Drakulix
authored andcommitted
Revert "feat: power button handling"
This reverts commit 534584b.
1 parent 8e3590f commit 8a3436e

File tree

3 files changed

+10
-31
lines changed

3 files changed

+10
-31
lines changed

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ use cosmic_comp_config::{
4949
XkbConfig, XwaylandDescaling, XwaylandEavesdropping, ZoomConfig,
5050
};
5151

52-
/// Offset used to convert Linux scancode to X11 keycode.
53-
pub(crate) const X11_KEYCODE_OFFSET: u32 = 8;
54-
5552
#[derive(Debug)]
5653
pub struct Config {
5754
pub dynamic_conf: DynamicConfig,
@@ -779,6 +776,9 @@ pub fn change_modifier_state(
779776
scan_code: u32,
780777
state: &mut State,
781778
) {
779+
/// Offset used to convert Linux scancode to X11 keycode.
780+
const X11_KEYCODE_OFFSET: u32 = 8;
781+
782782
let mut input = |key_state, scan_code| {
783783
let time = state.common.clock.now().as_millis();
784784
let _ = keyboard.input(

src/input/mod.rs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
cosmic_keystate_from_smithay, cosmic_modifiers_eq_smithay,
88
cosmic_modifiers_from_smithay,
99
},
10-
Action, Config, PrivateAction, X11_KEYCODE_OFFSET,
10+
Action, Config, PrivateAction,
1111
},
1212
input::gestures::{GestureState, SwipeAction},
1313
shell::{
@@ -35,8 +35,8 @@ use calloop::{
3535
RegistrationToken,
3636
};
3737
use cosmic_comp_config::{workspace::WorkspaceLayout, NumlockState};
38+
use cosmic_settings_config::shortcuts;
3839
use cosmic_settings_config::shortcuts::action::{Direction, ResizeDirection};
39-
use cosmic_settings_config::{shortcuts, Binding};
4040
use smithay::{
4141
backend::input::{
4242
AbsolutePositionEvent, Axis, AxisSource, Device, DeviceCapability, GestureBeginEvent,
@@ -213,32 +213,11 @@ impl State {
213213
self.common.idle_notifier_state.notify_activity(&seat);
214214

215215
let keycode = event.key_code();
216-
217216
let state = event.state();
218217
trace!(?keycode, ?state, "key");
219218

220219
let serial = SERIAL_COUNTER.next_serial();
221220
let time = Event::time_msec(&event);
222-
223-
const POWER_OFF: u32 = 116;
224-
// if power key is pressed, just use the system action for power off
225-
// this is a workaround for the fact that the power key is not
226-
// available in the keymap, so we cannot use the keymap to determine
227-
// if the key is pressed
228-
if keycode.raw() == POWER_OFF + X11_KEYCODE_OFFSET && state == KeyState::Pressed
229-
{
230-
self.handle_action(
231-
Action::Shortcut(shortcuts::Action::System(
232-
shortcuts::action::System::PowerOff,
233-
)),
234-
&seat,
235-
serial,
236-
time,
237-
Binding::default(),
238-
None,
239-
);
240-
}
241-
242221
let keyboard = seat.get_keyboard().unwrap();
243222
let previous_modifiers = keyboard.modifier_state();
244223
if let Some((action, pattern)) = keyboard

0 commit comments

Comments
 (0)