From 8aff1aacfc9217127151aa38133c9a20e7fce036 Mon Sep 17 00:00:00 2001 From: Jeffy Chen 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 --- 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