From 886b6035deea20cfff7c18a314254456e9936294 Mon Sep 17 00:00:00 2001 From: Pavel Slepushkin Date: Thu, 15 Aug 2024 18:23:36 +0200 Subject: [PATCH] keyd-application-mapper: Add support for the pop-os cosmic desktop --- scripts/keyd-application-mapper | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/keyd-application-mapper b/scripts/keyd-application-mapper index 6973e3e..f55e1e5 100755 --- a/scripts/keyd-application-mapper +++ b/scripts/keyd-application-mapper @@ -251,6 +251,28 @@ class Wlroots(): if event == 4 and payload[0] > 0 and payload[4] == 2: self.on_window_change(windows[obj].get('appid', ''), windows[obj].get('title', '')) +class Cosmic(): + def __init__(self, on_window_change): + self.wl = Wayland('zcosmic_toplevel_info_v1') + self.on_window_change = on_window_change + + def init(self): + pass + + def run(self): + windows = {} + while True: + (obj, event, payload) = self.wl.recv_msg() + if obj not in windows: + windows[obj]={} + + if event == 2: + windows[obj]['title'] = self.wl.read_string(payload) + if event == 3: + windows[obj]['appid'] = self.wl.read_string(payload) + if event == 8 and payload[0] > 0 and payload[4] == 2: + self.on_window_change(windows[obj].get('appid', ''), windows[obj].get('title', '')) + class XMonitor(): def __init__(self, on_window_change): assert_env('DISPLAY') @@ -413,6 +435,7 @@ def get_monitor(on_window_change): monitors = [ ('kde', KDE), ('wlroots', Wlroots), + ('cosmic', Cosmic), ('Gnome', GnomeMonitor), ('X', XMonitor), ]