Sway: Window properties not specified for native Wayland applications

Created on 13 Nov 2018  路  2Comments  路  Source: swaywm/sway

Note

This may be a termite issue, or a non-issue, but I thought I would report in full here for clarification since I suspect others are likely to run into the same issue.

Overview

When attempting to configure sway to silently create a couple terminal scratchpad instances at launch (separate issue, but also happy to hear any suggestions about plausibility / implementation), I was unable to get any rules relating to application instance or class to apply properly to the terminal application termite.

Upon closer inspection, it appears that the window field is set to null and window_properties is not specified at all.

For comparison, the same procedure was run with a second X-based terminal application, st, and both window and window_properties were found to be specified as expected.

Termite's lack of support for handling window class in wayland has been previously reported (1 and 2), and appears to be expected for behavior for native wayland apps.

Questions

  1. Since --name also handles specifying a WM_CLASS property, is this also expected behavior?
  2. Is there anything similar to WM_CLASS for native wayland apps? The fact that window_properties is handled for the non-native applications, but not native ones seems counter-intuitive and has the result that controlling the behavior of X apps is easier than controlling the behavior of wayland apps.

Steps to reproduce

Starting with a clean config file (only specified terminal):

  1. Launch sway
  2. Open a terminal instance
  3. Run termite with flags specifying window name, title and class:
termite --name=termite_name --title=temite_title --class=temite_class
  1. swaymsg -t get_tree > ~/sway_termite.json
  2. Close second termite instance
  3. Run st with similar parameters:
st -c st_class -n st_name -t st_title
  1. swaymsg -t get_tree > ~/sway_st.json

termite window entry:

{
"id": 7,
"name": "termite_title",
"rect": {
    "x": 2880,
    "y": 23,
    "width": 960,
    "height": 1057
},
"focused": true,
"focus": [
],
"border": "normal",
"current_border_width": 2,
"layout": "none",
"orientation": "none",
"percent": 0.5,
"window_rect": {
    "x": 2,
    "y": 0,
    "width": 956,
    "height": 1030
},
"deco_rect": {
    "x": 0,
    "y": 0,
    "width": 960,
    "height": 25
},
"geometry": {
    "x": 0,
    "y": 0,
    "width": 814,
    "height": 458
},
"window": null,
"urgent": false,
"floating_nodes": [
],
"sticky": false,
"type": "con",
"pid": 30841,
"app_id": "termite_name",
"marks": [
],
"nodes": [
]
}

st window entry

{
"id": 8,
"name": "swaymsg",
"rect": {
    "x": 2880,
    "y": 23,
    "width": 960,
    "height": 1057
},
"focused": true,
"focus": [
],
"border": "normal",
"current_border_width": 2,
"layout": "none",
"orientation": "none",
"percent": 0.5,
"window_rect": {
    "x": 2,
    "y": 0,
    "width": 956,
    "height": 1030
},
"deco_rect": {
    "x": 0,
    "y": 0,
    "width": 960,
    "height": 25
},
"geometry": {
    "x": 0,
    "y": 0,
    "width": 564,
    "height": 340
},
"window": 6291461,
"urgent": false,
"floating_nodes": [
],
"sticky": false,
"type": "con",
"pid": 31082,
"app_id": null,
"marks": [
],
"window_properties": {
    "class": "st_class",
    "instance": "st_name",
    "title": "swaymsg",
    "transient_for": null
},
"nodes": [
]
}

Debug log: https://gist.github.com/khughitt/361c7bade4d06e25bca5869d42a0a890

System info:

  • Arch Linux 4.18.16 64-bit
  • Sway Version 1.0-beta.1-184-g27b930df (Nov 13 2018, branch 'master')
  • Termite v14
  • st 0.8.1

Most helpful comment

Ah, I didn't realize app_id could also be used for matches. That did the trick! Thanks for the quick response.

In case it helps anyone else, here is an example of setting up two separate scratchpad, each with their own shortcuts, using app_id:

# console terminal (alt + enter)
exec termite --name=terminal_scratchpad

# R terminal (alt + space)
exec termite --name=r_scratchpad -e R

for_window [app_id="terminal_scratchpad"] move scratchpad, resize set 1440 810
for_window [app_id="r_scratchpad"] move scratchpad, resize set 1440 810

bindsym Mod1+Return [app_id="terminal_scratchpad"] scratchpad show
bindsym Mod1+space [app_id="r_scratchpad"] scratchpad show

All 2 comments

You can use app_id or title to match on wayland windows. This is the expected behavior.

Ah, I didn't realize app_id could also be used for matches. That did the trick! Thanks for the quick response.

In case it helps anyone else, here is an example of setting up two separate scratchpad, each with their own shortcuts, using app_id:

# console terminal (alt + enter)
exec termite --name=terminal_scratchpad

# R terminal (alt + space)
exec termite --name=r_scratchpad -e R

for_window [app_id="terminal_scratchpad"] move scratchpad, resize set 1440 810
for_window [app_id="r_scratchpad"] move scratchpad, resize set 1440 810

bindsym Mod1+Return [app_id="terminal_scratchpad"] scratchpad show
bindsym Mod1+space [app_id="r_scratchpad"] scratchpad show
Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcoms picture marcoms  路  3Comments

RyanDwyer picture RyanDwyer  路  3Comments

cauebs picture cauebs  路  3Comments

mcmfb picture mcmfb  路  3Comments

Alphare picture Alphare  路  3Comments