Skip to content

Commit

Permalink
keyd-application-mapper: Add support for the pop-os cosmic desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelSlepushkin authored and rvaiya committed Dec 18, 2024
1 parent 8cc5120 commit 886b603
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scripts/keyd-application-mapper
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -413,6 +435,7 @@ def get_monitor(on_window_change):
monitors = [
('kde', KDE),
('wlroots', Wlroots),
('cosmic', Cosmic),
('Gnome', GnomeMonitor),
('X', XMonitor),
]
Expand Down

0 comments on commit 886b603

Please sign in to comment.