1From a53f23b63f94f32a55483ba49e23e06726d38e1f Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Fri, 10 Jun 2022 11:44:04 +0800 4Subject: [PATCH 4/9] Add hooks for term switching 5 6term foreground: /etc/frecon/term-switch on 7term background: /etc/frecon/term-switch off 8 9Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 10--- 11 term.c | 7 +++++++ 12 1 file changed, 7 insertions(+) 13 14diff --git a/term.c b/term.c 15index 7b6383a..8f391ef 100644 16--- a/term.c 17+++ b/term.c 18@@ -1013,6 +1013,10 @@ void term_background(bool onetry) 19 if (in_background) 20 return; 21 in_background = true; 22+ 23+ if (system("/etc/frecon/term-switch off") < 0) 24+ LOG(DEBUG, "Failed to exec hook script."); 25+ 26 drm_dropmaster(NULL); 27 while (!dbus_take_display_ownership() && retry--) { 28 if (onetry) 29@@ -1033,6 +1037,9 @@ void term_foreground(void) 30 return; 31 in_background = false; 32 33+ if (system("/etc/frecon/term-switch on") < 0) 34+ LOG(DEBUG, "Failed to exec hook script."); 35+ 36 /* LOG(INFO, "TIMING: Console switch time start."); */ /* Keep around for timing it in the future. */ 37 while (!dbus_release_display_ownership() && retry--) { 38 LOG(ERROR, "Chrome did not release master. %s", 39-- 402.20.1 41 42