keyd-application-mapper is broken on modern Cosmic DE due to Wayland protocol changes
Hello,
The keyd-application-mapper script is currently not working on up-to-date Arch Linux systems running the Cosmic Desktop Environment.
Problem Description:
When running keyd-application-mapper -v, the script's Cosmic class fails to get window information. Debugging shows that the payload variable at scripts/keyd-application-mapper#L325 is always empty when switching windows.
Commenting out the Cosmic implementation to fall back to the Wlroots class also does not work; there is no output at all upon window switching.
Root Cause Analysis:
I've used wayland-info to diagnose the supported Wayland protocols on my system. The output reveals two key things:
- The
zwlr_foreign_toplevel_manager_v1protocol (used by theWlrootsclass) is not supported by Cosmic DE. - Cosmic DE now provides the standardized
ext_foreign_toplevel_list_v1protocol for this purpose.
It appears the old zcosmic_toplevel_info_v1 protocol, while still present, has had breaking changes, and the correct way forward is to support the new standardized protocol.
Proposed Solution:
The script needs to be updated to support ext_foreign_toplevel_list_v1. This would likely involve creating a new monitor class that uses this protocol to get window app_id and title information, which would restore functionality on modern Cosmic and potentially other desktops that use this standard.
wayland-info Output:
❯ wayland-info
interface: 'wl_compositor', version: 5, name: 1
interface: 'wl_subcompositor', version: 1, name: 2
interface: 'wl_data_device_manager', version: 3, name: 3
interface: 'wp_fractional_scale_manager_v1', version: 1, name: 4
interface: 'zwp_keyboard_shortcuts_inhibit_manager_v1', version: 1, name: 5
interface: 'zxdg_output_manager_v1', version: 3, name: 6
xdg_output_v1
output: 53
name: 'HDMI-A-2'
description: 'Philips Consumer Electronics Company - PHL 256P1 - HDMI-A-2'
logical_x: 1707, logical_y: 0
logical_width: 2560, logical_height: 1440
interface: 'zwlr_output_manager_v1', version: 4, name: 7
interface: 'zcosmic_output_manager_v1', version: 3, name: 8
interface: 'zwlr_output_power_manager_v1', version: 1, name: 9
interface: 'zcosmic_overlap_notify_v1', version: 1, name: 10
interface: 'wp_presentation', version: 2, name: 11
presentation clock id: 1 (CLOCK_MONOTONIC)
interface: 'zwp_primary_selection_device_manager_v1', version: 1, name: 12
interface: 'ext_output_image_capture_source_manager_v1', version: 1, name: 13
interface: 'zcosmic_workspace_image_capture_source_manager_v1', version: 1, name: 14
interface: 'ext_foreign_toplevel_image_capture_source_manager_v1', version: 1, name: 15
interface: 'ext_image_copy_capture_manager_v1', version: 1, name: 16
interface: 'wl_shm', version: 2, name: 17
formats (fourcc):
0x34324241 = 'AB24'
1 = 'XR24'
0 = 'AR24'
0x34324258 = 'XB24'
interface: 'wp_cursor_shape_manager_v1', version: 2, name: 18
interface: 'wp_viewporter', version: 1, name: 19
interface: 'org_kde_kwin_server_decoration_manager', version: 1, name: 20
interface: 'zxdg_decoration_manager_v1', version: 1, name: 21
interface: 'ext_session_lock_manager_v1', version: 1, name: 22
interface: 'zwp_pointer_constraints_v1', version: 1, name: 25
interface: 'zwp_pointer_gestures_v1', version: 3, name: 26
interface: 'zwp_tablet_manager_v2', version: 1, name: 27
interface: 'wp_security_context_manager_v1', version: 1, name: 28
interface: 'zwp_input_method_manager_v2', version: 1, name: 29
interface: 'zwp_text_input_manager_v3', version: 1, name: 30
interface: 'zwp_virtual_keyboard_manager_v1', version: 1, name: 31
interface: 'wp_alpha_modifier_v1', version: 1, name: 32
interface: 'wp_single_pixel_buffer_manager_v1', version: 1, name: 33
interface: 'ext_idle_notifier_v1', version: 2, name: 34
interface: 'zwp_idle_inhibit_manager_v1', version: 1, name: 35
interface: 'zwlr_layer_shell_v1', version: 4, name: 36
interface: 'xdg_wm_base', version: 6, name: 37
interface: 'xdg_activation_v1', version: 1, name: 38
interface: 'zxdg_exporter_v2', version: 1, name: 39
interface: 'zxdg_importer_v2', version: 1, name: 40
interface: 'zcosmic_toplevel_info_v1', version: 3, name: 41
interface: 'ext_foreign_toplevel_list_v1', version: 1, name: 42
interface: 'zcosmic_toplevel_manager_v1', version: 4, name: 43
interface: 'ext_workspace_manager_v1', version: 1, name: 44
interface: 'zcosmic_workspace_manager_v2', version: 2, name: 45
interface: 'cosmic_a11y_manager_v1', version: 2, name: 46
interface: 'cosmic_atspi_manager_v1', version: 1, name: 47
interface: 'zwp_relative_pointer_manager_v1', version: 1, name: 48
interface: 'zwp_linux_dmabuf_v1', version: 5, name: 49
main device: 0xE280 (/dev/dri/card1 or /dev/dri/renderD128)
tranche
target device: 0xE280 (/dev/dri/card1 or /dev/dri/renderD128)
flags: none
formats (fourcc) and modifiers (names):
0x48344241 = 'AB4H'; 0x0000000000000000 = LINEAR
0x48344241 = 'AB4H'; 0x0100000000000001 = INTEL_X_TILED
0x48344241 = 'AB4H'; 0x0100000000000002 = INTEL_Y_TILED
0x48344241 = 'AB4H'; 0x00ffffffffffffff = INVALID
0x48344258 = 'XB4H'; 0x0000000000000000 = LINEAR
0x48344258 = 'XB4H'; 0x0100000000000001 = INTEL_X_TILED
0x48344258 = 'XB4H'; 0x0100000000000002 = INTEL_Y_TILED
0x48344258 = 'XB4H'; 0x00ffffffffffffff = INVALID
0x30335241 = 'AR30'; 0x0000000000000000 = LINEAR
0x30335241 = 'AR30'; 0x0100000000000001 = INTEL_X_TILED
0x30335241 = 'AR30'; 0x0100000000000002 = INTEL_Y_TILED
0x30335241 = 'AR30'; 0x00ffffffffffffff = INVALID
0x30335258 = 'XR30'; 0x0000000000000000 = LINEAR
0x30335258 = 'XR30'; 0x0100000000000001 = INTEL_X_TILED
0x30335258 = 'XR30'; 0x0100000000000002 = INTEL_Y_TILED
0x30335258 = 'XR30'; 0x00ffffffffffffff = INVALID
0x30334241 = 'AB30'; 0x0000000000000000 = LINEAR
0x30334241 = 'AB30'; 0x0100000000000001 = INTEL_X_TILED
0x30334241 = 'AB30'; 0x0100000000000002 = INTEL_Y_TILED
0x30334241 = 'AB30'; 0x00ffffffffffffff = INVALID
0x34325241 = 'AR24'; 0x0000000000000000 = LINEAR
0x34325241 = 'AR24'; 0x0100000000000001 = INTEL_X_TILED
0x34325241 = 'AR24'; 0x0100000000000002 = INTEL_Y_TILED
0x34325241 = 'AR24'; 0x00ffffffffffffff = INVALID
0x34324241 = 'AB24'; 0x0000000000000000 = LINEAR
0x34324241 = 'AB24'; 0x0100000000000001 = INTEL_X_TILED
0x34324241 = 'AB24'; 0x0100000000000002 = INTEL_Y_TILED
0x34324241 = 'AB24'; 0x00ffffffffffffff = INVALID
0x34325258 = 'XR24'; 0x0000000000000000 = LINEAR
0x34325258 = 'XR24'; 0x0100000000000001 = INTEL_X_TILED
0x34325258 = 'XR24'; 0x0100000000000002 = INTEL_Y_TILED
0x34325258 = 'XR24'; 0x00ffffffffffffff = INVALID
0x34324258 = 'XB24'; 0x0000000000000000 = LINEAR
0x34324258 = 'XB24'; 0x0100000000000001 = INTEL_X_TILED
0x34324258 = 'XB24'; 0x0100000000000002 = INTEL_Y_TILED
0x34324258 = 'XB24'; 0x00ffffffffffffff = INVALID
0x35315241 = 'AR15'; 0x0000000000000000 = LINEAR
0x35315241 = 'AR15'; 0x0100000000000001 = INTEL_X_TILED
0x35315241 = 'AR15'; 0x0100000000000002 = INTEL_Y_TILED
0x35315241 = 'AR15'; 0x00ffffffffffffff = INVALID
0x32315241 = 'AR12'; 0x0000000000000000 = LINEAR
0x32315241 = 'AR12'; 0x0100000000000001 = INTEL_X_TILED
0x32315241 = 'AR12'; 0x0100000000000002 = INTEL_Y_TILED
0x32315241 = 'AR12'; 0x00ffffffffffffff = INVALID
0x36314752 = 'RG16'; 0x0000000000000000 = LINEAR
0x36314752 = 'RG16'; 0x0100000000000001 = INTEL_X_TILED
0x36314752 = 'RG16'; 0x0100000000000002 = INTEL_Y_TILED
0x36314752 = 'RG16'; 0x00ffffffffffffff = INVALID
0x20203852 = 'R8 '; 0x0000000000000000 = LINEAR
0x20203852 = 'R8 '; 0x0100000000000001 = INTEL_X_TILED
0x20203852 = 'R8 '; 0x0100000000000002 = INTEL_Y_TILED
0x20203852 = 'R8 '; 0x00ffffffffffffff = INVALID
0x20363152 = 'R16 '; 0x0000000000000000 = LINEAR
0x20363152 = 'R16 '; 0x0100000000000001 = INTEL_X_TILED
0x20363152 = 'R16 '; 0x0100000000000002 = INTEL_Y_TILED
0x20363152 = 'R16 '; 0x00ffffffffffffff = INVALID
0x38385247 = 'GR88'; 0x0000000000000000 = LINEAR
0x38385247 = 'GR88'; 0x0100000000000001 = INTEL_X_TILED
0x38385247 = 'GR88'; 0x0100000000000002 = INTEL_Y_TILED
0x38385247 = 'GR88'; 0x00ffffffffffffff = INVALID
0x32335247 = 'GR32'; 0x0000000000000000 = LINEAR
0x32335247 = 'GR32'; 0x0100000000000001 = INTEL_X_TILED
0x32335247 = 'GR32'; 0x0100000000000002 = INTEL_Y_TILED
0x32335247 = 'GR32'; 0x00ffffffffffffff = INVALID
0x39565559 = 'YUV9'; 0x00ffffffffffffff = INVALID
0x31315559 = 'YU11'; 0x00ffffffffffffff = INVALID
0x32315559 = 'YU12'; 0x00ffffffffffffff = INVALID
0x36315559 = 'YU16'; 0x00ffffffffffffff = INVALID
0x34325559 = 'YU24'; 0x00ffffffffffffff = INVALID
0x39555659 = 'YVU9'; 0x00ffffffffffffff = INVALID
0x31315659 = 'YV11'; 0x00ffffffffffffff = INVALID
0x32315659 = 'YV12'; 0x00ffffffffffffff = INVALID
0x36315659 = 'YV16'; 0x00ffffffffffffff = INVALID
0x34325659 = 'YV24'; 0x00ffffffffffffff = INVALID
0x3231564e = 'NV12'; 0x00ffffffffffffff = INVALID
0x3132564e = 'NV21'; 0x00ffffffffffffff = INVALID
0x3531564e = 'NV15'; 0x00ffffffffffffff = INVALID
0x30313050 = 'P010'; 0x00ffffffffffffff = INVALID
0x32313050 = 'P012'; 0x00ffffffffffffff = INVALID
0x36313050 = 'P016'; 0x00ffffffffffffff = INVALID
0x3631564e = 'NV16'; 0x00ffffffffffffff = INVALID
0x56555941 = 'AYUV'; 0x00ffffffffffffff = INVALID
0x56555958 = 'XYUV'; 0x00ffffffffffffff = INVALID
0x30313459 = 'Y410'; 0x00ffffffffffffff = INVALID
0x32313459 = 'Y412'; 0x00ffffffffffffff = INVALID
0x36313459 = 'Y416'; 0x00ffffffffffffff = INVALID
0x56595559 = 'YUYV'; 0x00ffffffffffffff = INVALID
0x55595659 = 'YVYU'; 0x00ffffffffffffff = INVALID
0x59565955 = 'UYVY'; 0x00ffffffffffffff = INVALID
0x59555956 = 'VYUY'; 0x00ffffffffffffff = INVALID
0x30313259 = 'Y210'; 0x00ffffffffffffff = INVALID
0x32313259 = 'Y212'; 0x00ffffffffffffff = INVALID
0x36313259 = 'Y216'; 0x00ffffffffffffff = INVALID
0x38305559 = 'YU08'; 0x00ffffffffffffff = INVALID
0x30315559 = 'YU10'; 0x00ffffffffffffff = INVALID
interface: 'wl_drm', version: 2, name: 50
interface: 'wp_drm_lease_device_v1', version: 1, name: 51
path: /dev/dri/card1
interface: 'wp_linux_drm_syncobj_manager_v1', version: 1, name: 52
interface: 'wl_output', version: 4, name: 53
name: HDMI-A-2
description: Philips Consumer Electronics Company - PHL 256P1 - HDMI-A-2
x: 1707, y: 0, scale: 1,
physical_width: 550 mm, physical_height: 310 mm,
make: 'Philips Consumer Electronics Company', model: 'PHL 256P1',
subpixel_orientation: unknown, output_transform: normal,
mode:
width: 2560 px, height: 1440 px, refresh: 59.951 Hz,
flags: current preferred
mode:
width: 2560 px, height: 1440 px, refresh: 74.968 Hz,
flags:
mode:
width: 1920 px, height: 1080 px, refresh: 74.973 Hz,
flags:
mode:
width: 1920 px, height: 1080 px, refresh: 60.000 Hz,
flags:
mode:
width: 1920 px, height: 1080 px, refresh: 59.940 Hz,
flags:
mode:
width: 1920 px, height: 1080 px, refresh: 50.000 Hz,
flags:
mode:
width: 1280 px, height: 1440 px, refresh: 59.913 Hz,
flags:
mode:
width: 1680 px, height: 1050 px, refresh: 59.883 Hz,
flags:
mode:
width: 1280 px, height: 1024 px, refresh: 75.025 Hz,
flags:
mode:
width: 1280 px, height: 1024 px, refresh: 60.020 Hz,
flags:
mode:
width: 1440 px, height: 900 px, refresh: 59.901 Hz,
flags:
mode:
width: 1280 px, height: 960 px, refresh: 60.000 Hz,
flags:
mode:
width: 1280 px, height: 720 px, refresh: 60.000 Hz,
flags:
mode:
width: 1280 px, height: 720 px, refresh: 59.940 Hz,
flags:
mode:
width: 1280 px, height: 720 px, refresh: 50.000 Hz,
flags:
mode:
width: 1024 px, height: 768 px, refresh: 75.029 Hz,
flags:
mode:
width: 1024 px, height: 768 px, refresh: 70.069 Hz,
flags:
mode:
width: 1024 px, height: 768 px, refresh: 60.004 Hz,
flags:
mode:
width: 832 px, height: 624 px, refresh: 74.551 Hz,
flags:
mode:
width: 800 px, height: 600 px, refresh: 75.000 Hz,
flags:
mode:
width: 800 px, height: 600 px, refresh: 72.188 Hz,
flags:
mode:
width: 800 px, height: 600 px, refresh: 60.317 Hz,
flags:
mode:
width: 800 px, height: 600 px, refresh: 56.250 Hz,
flags:
mode:
width: 720 px, height: 576 px, refresh: 50.000 Hz,
flags:
mode:
width: 720 px, height: 480 px, refresh: 60.000 Hz,
flags:
mode:
width: 720 px, height: 480 px, refresh: 59.940 Hz,
flags:
mode:
width: 640 px, height: 480 px, refresh: 75.000 Hz,
flags:
mode:
width: 640 px, height: 480 px, refresh: 72.809 Hz,
flags:
mode:
width: 640 px, height: 480 px, refresh: 66.667 Hz,
flags:
mode:
width: 640 px, height: 480 px, refresh: 60.000 Hz,
flags:
mode:
width: 640 px, height: 480 px, refresh: 59.940 Hz,
flags:
mode:
width: 720 px, height: 400 px, refresh: 70.082 Hz,
flags:
interface: 'wl_seat', version: 9, name: 54
name: seat-0
capabilities: pointer keyboard touch
keyboard repeat rate: 25
keyboard repeat delay: 600
Thank you for maintaining this excellent tool!
so thats why it isnt working for me. thanks for reporting :)