You are not logged in.
Pages: 1
I followed Arch Wiki
https://wiki.archlinux.org/index.php/I3
I can create workspace-1.json however when I run the next command
tail -n +2 ~/.config/i3/workspace_N.json | fgrep -v '// split' | sed 's|//||g' > ~/.config/i3/workspace_N.jsonit deletes all the code inside this .json
Is that command incorrect or my mistakes somewhere?
// vim:ts=4:sw=4:et
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 1393,
"width": 1515,
"x": 0,
"y": 0
},
"marks": [],
"name": "i3: Layout saving in i3 — Mozilla Firefox",
"percent": 0.6,
"swallows": [
{
// "class": "^firefox$",
// "instance": "^Navigator$",
// "title": "^i3\\:\\ Layout\\ saving\\ in\\ i3\\ \\—\\ Mozilla\\ Firefox$",
// "window_role": "^browser$"
}
],
"type": "con"
}
{
// splitv split container with 2 children
"border": "pixel",
"floating": "auto_off",
"layout": "splitv",
"marks": [],
"percent": 0.4,
"type": "con",
"nodes": [
{
// splith split container with 2 children
"border": "pixel",
"floating": "auto_off",
"layout": "splith",
"marks": [],
"percent": 0.3,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.5,
"swallows": [
{
// "class": "^URxvt$",
// "instance": "^urxvt$",
// "title": "^urxvt$"
}
],
"type": "con"
},
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.5,
"swallows": [
{
// "class": "^URxvt$",
// "instance": "^urxvt$",
// "title": "^urxvt$"
}
],
"type": "con"
}
]
},
{
// splitv split container with 2 children
"border": "pixel",
"floating": "auto_off",
"layout": "splitv",
"marks": [],
"percent": 0.7,
"type": "con",
"nodes": [
{
// splith split container with 2 children
"border": "pixel",
"floating": "auto_off",
"layout": "splith",
"marks": [],
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.675510204081633,
"swallows": [
{
// "class": "^URxvt$",
// "instance": "^urxvt$",
// "title": "^urxvt$"
}
],
"type": "con"
},
{
// splitv split container with 2 children
"border": "pixel",
"floating": "auto_off",
"layout": "splitv",
"marks": [],
"percent": 0.324489795918367,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.5,
"swallows": [
{
// "class": "^URxvt$",
// "instance": "^urxvt$",
// "title": "^urxvt$"
}
],
"type": "con"
},
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.5,
"swallows": [
{
// "class": "^URxvt$",
// "instance": "^urxvt$",
// "title": "^urxvt$"
}
],
"type": "con"
}
]
}
]
},
{
// splith split container with 2 children
"border": "pixel",
"floating": "auto_off",
"layout": "splith",
"marks": [],
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.6,
"swallows": [
{
// "class": "^URxvt$",
// "instance": "^urxvt$",
// "title": "^urxvt$"
}
],
"type": "con"
},
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"fullscreen_mode": 1,
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.4,
"swallows": [
{
// "class": "^URxvt$",
// "instance": "^urxvt$",
// "title": "^urxvt$"
}
],
"type": "con"
}
]
}
]
}
]
} Last edited by VoDo (2021-01-11 08:10:43)
Archi3
Offline
type tail
type fgrep
type sedWhat's the output for
tail -n +2 ~/.config/i3/workspace_N.json | fgrep -v '// split' | sed 's|//||g'?
The command redirects its output into ~/.config/i3/workspace_N.json and overwrites that file, however the output should™ not be empty.
Online
Yeah in my limited understanding it should just overwrite the file, I do not know if it just should uncommend or add something else.
~ >>> type tail
tail is /usr/bin/tail
~ >>> type fgrep
fgrep is /usr/bin/fgrep
~ >>> type sed
sed is /usr/bin/sed~ >>> tail -n +2 ~/.config/i3/workspace-1.json | fgrep -v '// split' | sed 's|//||g'
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 1393,
"width": 1515,
"x": 0,
"y": 0
},
"marks": [],
"name": "i3: Layout saving in i3 — Mozilla Firefox",
"percent": 0.6,
"swallows": [
{
"class": "^firefox$",
"instance": "^Navigator$",
"title": "^i3\\:\\ Layout\\ saving\\ in\\ i3\\ \\—\\ Mozilla\\ Firefox$",
"window_role": "^browser$"
}
],
"type": "con"
}
{
"border": "pixel",
"floating": "auto_off",
"layout": "splitv",
"marks": [],
"percent": 0.4,
"type": "con",
"nodes": [
{
"border": "pixel",
"floating": "auto_off",
"layout": "splith",
"marks": [],
"percent": 0.3,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.5,
"swallows": [
{
"class": "^URxvt$",
"instance": "^urxvt$",
"title": "^urxvt$"
}
],
"type": "con"
},
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.5,
"swallows": [
{
"class": "^URxvt$",
"instance": "^urxvt$",
"title": "^urxvt$"
}
],
"type": "con"
}
]
},
{
"border": "pixel",
"floating": "auto_off",
"layout": "splitv",
"marks": [],
"percent": 0.7,
"type": "con",
"nodes": [
{
"border": "pixel",
"floating": "auto_off",
"layout": "splith",
"marks": [],
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.675510204081633,
"swallows": [
{
"class": "^URxvt$",
"instance": "^urxvt$",
"title": "^urxvt$"
}
],
"type": "con"
},
{
"border": "pixel",
"floating": "auto_off",
"layout": "splitv",
"marks": [],
"percent": 0.324489795918367,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.5,
"swallows": [
{
"class": "^URxvt$",
"instance": "^urxvt$",
"title": "^urxvt$"
}
],
"type": "con"
},
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.5,
"swallows": [
{
"class": "^URxvt$",
"instance": "^urxvt$",
"title": "^urxvt$"
}
],
"type": "con"
}
]
}
]
},
{
"border": "pixel",
"floating": "auto_off",
"layout": "splith",
"marks": [],
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.6,
"swallows": [
{
"class": "^URxvt$",
"instance": "^urxvt$",
"title": "^urxvt$"
}
],
"type": "con"
},
{
"border": "pixel",
"current_border_width": 1,
"floating": "auto_off",
"fullscreen_mode": 1,
"geometry": {
"height": 412,
"width": 644,
"x": 0,
"y": 0
},
"marks": [],
"name": "urxvt",
"percent": 0.4,
"swallows": [
{
"class": "^URxvt$",
"instance": "^urxvt$",
"title": "^urxvt$"
}
],
"type": "con"
}
]
}
]
}
]
}If I create a new file ie > new file after that tail command it creates file with code but when I run it it shows black screen with
[class=^URxvt$"instance.....]Last edited by VoDo (2021-01-10 16:05:12)
Archi3
Offline
That's the expectable output.
What's
echo $SHELLOnline
I use zsh
/bin/zshArchi3
Offline
Also OMZ?
Online
Could it be that I use i3-gaps instead of i3-wm?
I did not install OMZ but have some .zsrhc config for a long time
I switched to bash in terminal a run it again same output black window with that message
Last edited by VoDo (2021-01-10 16:12:33)
Archi3
Offline
It is not critical issue I update every Sunday, just. I can live with reorganizing my windows every Sunday ![]()
Archi3
Offline
I switched to bash in terminal a run it again same output black window with that message
Wait a second: your OP suggests that
tail -n +2 ~/.config/i3/workspace_N.json | fgrep -v '// split' | sed 's|//||g' > ~/.config/i3/workspace_N.json results in a blank ~/.config/i3/workspace_N.json
Is that the case? If not, please describe the actual issue at hand, symptoms, error messages etc.
Online
OK sorry, it was empty then I used the tail command to create a NEW file not overwrite the old, it worked. Hovewer when I run restoring command
i3-msg "workspace 2; append_layout /home/arch/.config/i3/workspace-1.json"it does not restore the session it just opens new workspace (I use workspace2) with black fullscreen window where this is written
[class=^URxvt$"instance.....]I tried to remove those // manually in copied json code with the same result so problem is in my i3 I thinks i3-gaps?
Last edited by VoDo (2021-01-10 17:42:21)
Archi3
Offline
I'm not going into everything said here besides, input can't be output without a step in between..
it does not restore the session it just opens new workspace (I use workspace2) with black fullscreen window where this is written
[class=^URxvt$"instance.....]I tried to remove those // manually in copied json code with the same result so problem is in my i3 I thinks i3-gaps?
You seem to not fully get what it is that's happening here for what you see is actually correct..
The restore sessions is just a place holder.
So, instead of the program you think should be executed, you create a place holder for it, it doesn't actually open the program it just reserves a place for that program if executed.
Lets say you created a placeholder for firefox and 2 terminals, if you would add these to your config also the place holders would be filled right away F.I.
exec --no-startup-id "i3-msg 'workspace 1mon1; append_layout $HOME/.config/i3/workspace-1.json'"
exec --no-startup-id firefox
exec --no-startup-id xterm
exec --no-startup-id xtermOffline
input can't be output without a step in between
The relevant step here are the two pipes which should™ generate a 4k blockbuffer that should™ successfully cache the file before writing it.
(Try and then try "stdbuf -oL tail -n +2 | …" which will limit the buffer to a line, you should™ now get an empty result)
The command as is, is stupid but should™n't cause an empty file… *shrug*
More reliable:
sed -i '1,2d; /\/\/ split/d; s|//||g' $HOME/.config/i3/workspace-1.jsonOnline
Using temp files or dual pipes ads just unnecessary layers and I wouldn't use that command either but something like that sed command you pasted.
On the other hand I don't get why he's trying to remove perfectly fine notes, there's no need to do that at all;)
edit: I see looking at OP's file I need clarify: don't do that, removing all '//' with a command, some are meant to be a comment even though json uses a different way to comment like "comment": "a comment", the line lines with '//' are disregarded in json but not proper comment far as I know/understand
If you use that command also ' // vim:ts=4:sw=4:et' & '// splitv split container with 2 children' the '//' are removed which makes no sense, well the vim one may..
Best remove the ones to enable by hand or use different files for different purposes.
Last edited by qinohe (2021-01-11 00:27:16)
Offline
Thank you both I will try what is suggested in #11 and yes you are right I did not fully understand what was needed I missed the part of starting those programs too.
Archi3
Offline
Pages: 1