-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgsd-media-keys-manager.c.patch
71 lines (71 loc) · 2.83 KB
/
gsd-media-keys-manager.c.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
*** plugins/media-keys/gsd-media-keys-manager.c_org 2020-12-08 00:33:34.316300050 +0100
--- plugins/media-keys/gsd-media-keys-manager.c 2020-12-08 10:44:30.399156924 +0100
***************
*** 2188,2196 ****
GsdPowerActionType action_type,
gboolean in_lock_screen)
{
switch (action_type) {
case GSD_POWER_ACTION_SUSPEND:
! power_action (manager, "Suspend", !in_lock_screen);
break;
case GSD_POWER_ACTION_INTERACTIVE:
if (!in_lock_screen)
--- 2188,2217 ----
GsdPowerActionType action_type,
gboolean in_lock_screen)
{
+
+ #ifdef __aarch64__
+ int status = 0;
+ #endif
switch (action_type) {
case GSD_POWER_ACTION_SUSPEND:
! #ifdef __aarch64__
! // only use it on devices that have a mobile-greeter like pinephones
! if( access( "/usr/bin/lightdm-mobile-greeter", F_OK ) == 0 ) {
! status = system("/usr/bin/dm-tool lock");
! if ( status == 0 ) {
! power_action (manager, "Suspend", !in_lock_screen);
! } else {
! g_debug ("Execution of LightDM-Lock failed for suspend!");
! // done by Marius Schwarz <[email protected]>
! // TODO: Escalate to OSD, because this is a security problem
! // Suspending a device if an intended security feature failes, is out of the question, so we deny it.
! }
! } else {
! power_action (manager, "Suspend", !in_lock_screen);
! }
! #else
! power_action (manager, "Suspend", !in_lock_screen);
! #endif
break;
case GSD_POWER_ACTION_INTERACTIVE:
if (!in_lock_screen)
***************
*** 2200,2206 ****
--- 2221,2244 ----
power_action (manager, "PowerOff", !in_lock_screen);
break;
case GSD_POWER_ACTION_HIBERNATE:
+ #ifdef __aarch64__
+ // only use it on devices that have a mobile-greeter like pinephones
+ if( access( "/usr/bin/lightdm-mobile-greeter", F_OK ) == 0 ) {
+ status = system("/usr/bin/dm-tool lock");
+ if ( status == 0 ) {
+ power_action (manager, "Hibernate", !in_lock_screen);
+ } else {
+ g_debug ("Execution of LightDM-Lock failed for hibernate!");
+ // done by Marius Schwarz <[email protected]>
+ // TODO: Escalate to OSD, because this is a security problem
+ // Suspending a device if an intended security feature failes, is out of the question, so we deny it.
+ }
+ } else {
+ power_action (manager, "Hibernate", !in_lock_screen);
+ }
+ #else
power_action (manager, "Hibernate", !in_lock_screen);
+ #endif
break;
case GSD_POWER_ACTION_BLANK:
case GSD_POWER_ACTION_LOGOUT: