From ebb016bfa28ffbd007a1fb742e4e3f658b2f5aa4 Mon Sep 17 00:00:00 2001 From: Heddxh Date: Mon, 15 Jan 2024 23:38:54 +0800 Subject: [PATCH] Basic fallback method for konsole profile switch --- yin_yang/plugins/konsole.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/yin_yang/plugins/konsole.py b/yin_yang/plugins/konsole.py index a1e45a2..ebe8a56 100644 --- a/yin_yang/plugins/konsole.py +++ b/yin_yang/plugins/konsole.py @@ -242,9 +242,16 @@ def set_profile(service: str, profile: str): try: sessions = subprocess.check_output(f'qdbus {service} | grep "Sessions/"', shell=True) except subprocess.CalledProcessError: - # happens when dolphins konsole is not opened - logger.debug(f'No Konsole sessions available in service {service}, skipping') - return + try: + sessions = subprocess.check_output( + f'qdbus org.kde.konsole | grep "Sessions/"', shell=True + ) + logger.debug(f'Found org.kde.konsole, use that instead') + service = "org.kde.konsole" + except subprocess.CalledProcessError: + # happens when dolphins konsole is not opened + logger.debug(f'No Konsole sessions available in service {service}, skipping') + return sessions = sessions.decode('utf-8').removesuffix('\n').split('\n') # loop: process sessions