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
--name also handles specifying a WM_CLASS property, is this also expected behavior?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):
termite --name=termite_name --title=temite_title --class=temite_class
swaymsg -t get_tree > ~/sway_termite.jsonst -c st_class -n st_name -t st_title
swaymsg -t get_tree > ~/sway_st.jsontermite 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:
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
Most helpful comment
Ah, I didn't realize
app_idcould 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: