hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
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
From 8aff1aacfc9217127151aa38133c9a20e7fce036 Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Fri, 10 Jun 2022 11:44:04 +0800
Subject: [PATCH 4/8] Add hooks for term switching
 
term foreground: /etc/frecon/term-switch on
term background: /etc/frecon/term-switch off
 
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
 term.c | 7 +++++++
 1 file changed, 7 insertions(+)
 
diff --git a/term.c b/term.c
index 1f69c47..95ffc9a 100644
--- a/term.c
+++ b/term.c
@@ -983,6 +983,10 @@ void term_background(bool onetry)
     if (in_background)
         return;
     in_background = true;
+
+    if (system("/etc/frecon/term-switch off") < 0)
+        LOG(DEBUG, "Failed to exec hook script.");
+
     drm_dropmaster(NULL);
     while (!dbus_take_display_ownership() && retry--) {
         if (onetry)
@@ -1003,6 +1007,9 @@ void term_foreground(void)
         return;
     in_background = false;
 
+    if (system("/etc/frecon/term-switch on") < 0)
+        LOG(DEBUG, "Failed to exec hook script.");
+
     /* LOG(INFO, "TIMING: Console switch time start."); */ /* Keep around for timing it in the future. */
     while (!dbus_release_display_ownership() && retry--) {
         LOG(ERROR, "Chrome did not release master. %s",
-- 
2.20.1