Reputation: 75
I'm trying to use the layout saving feature in i3. I've created a .json file for workspace 1 (pasted below) but can't figure out how to execute the programs in my config or shell script file so that the placeholders 'swallow' the programs. I'm not sure if I need to customize/edit the details in my .json files (e.g., the names of the instances) or add some arguments to my exec commands, or both.
Here is my .json file for the workspace:
{
"border": "normal",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 1028,
"width": 1916,
"x": 1932,
"y": 34
},
"marks": [],
"name": "New Tab - Google Chrome",
"percent": 0.6,
"swallows": [
{
"class": "^Google\\-chrome$",
"instance": "^google\\-chrome$",
"machine": "^drewbear\\-GS65\\-Stealth\\-Thin\\-8RF$",
"title": "^New\\ Tab\\ \\-\\ Google\\ Chrome$",
"window_role": "^browser$"
}
],
"type": "con"
}
{
"border": "normal",
"floating": "auto_off",
"layout": "splitv",
"marks": [],
"percent": 0.4,
"type": "con",
"nodes": [
{
"border": "normal",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 501,
"width": 956,
"x": 0,
"y": 0
},
"marks": [],
"name": "drewbear@drewbear-GS65-Stealth-Thin-8RF: ~",
"percent": 0.5,
"swallows": [
{
"class": "^kitty$",
"instance": "^kitty$",
"machine": "^drewbear\\-GS65\\-Stealth\\-Thin\\-8RF$",
"title": "^drewbear\\@drewbear\\-GS65\\-Stealth\\-Thin\\-8RF\\:\\ \\~$"
}
],
"type": "con"
},
{
"border": "normal",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 501,
"width": 956,
"x": 0,
"y": 0
},
"marks": [],
"name": "drewbear@drewbear-GS65-Stealth-Thin-8RF: ~",
"percent": 0.5,
"swallows": [
{
"class": "^kitty$",
"instance": "^kitty$",
"machine": "^drewbear\\-GS65\\-Stealth\\-Thin\\-8RF$",
"title": "^drewbear\\@drewbear\\-GS65\\-Stealth\\-Thin\\-8RF\\:\\ \\~$"
}
],
"type": "con"
}
]
}
Upvotes: 0
Views: 136
Reputation: 1
Your config looks about right, you just have to correct the expressions in the fields "class", "instance" and "machine" by uncommenting the respective strings.
In your current configuration, you have used the following expressions:
"^Google\\-chrome$",
"^google\\-chrome$",
"^drewbear\\-GS65\\-Stealth\\-Thin\\-8RF$"
The double backslash is used in regular expressions to escape special characters. However, in your case, you want the expressions to match the exact characters "Google-chrome", "google-chrome" and "drewbear-GS65-Stealth-Thin-8RF".
To achieve this, you should match the expressions as follows:
"class": "^Google-chrome$",
"instance": "^google-chrome$",
"machine": "^drewbear-GS65-Stealth-Thin-8RF$"
By removing the double backslashes, the expressions are interpreted correctly and should work as intended to match the corresponding window classes and instances in i3wm.
It is important to ensure that the file is correctly formatted and syntactically correct. If you have made changes to your configuration file and are unsure, you can check it with a JSON validator like jsonformatter.org to ensure that it is valid.
Good luck!
Upvotes: 0