Solved Exporting & Importing Sessions
-
@mallen
Hi, I tried to check where the workspace information is in the Preference file but could not find it.
If you change to a new system or something it is OK to copy the file but if you have a broken profile and have to reset it is not good to copy the whole file over.
Do you know in which section of the Preference file the workspace naming information is?Cheers, mib
-
@mib2berlin said in Exporting & Importing Sessions:
Do you know in which section of the Preference file the workspace naming information is?
No idea. I just found it was the key file that was needed. For my mate who is having problems getting his preferences into a new install is useful to him.
Some Decoding of Preferences
Looking at the raw text in that file now I see "Workspaces" appear once. I get some of the wall of numbers that follows makes it work. As I read onwards from that word I see the titles of my sessions.
"workspaces":{"button":{"show_name":true},"link_routes":[],"list":[{"icon":"\u003Csvg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n \u003Cpath d=\"M11.5 10.75C11.5 10.75 15.5 8.00001 15.5 5.75001C15.5024 5.28342 15.3591 4.82771 15.0901 4.44646C14.8211 4.06522 14.4398 3.77745 13.9994 3.62331C13.559 3.46917 13.0814 3.45634 12.6334 3.58661C12.1853 3.71688 11.7891 3.98376 11.5 4.35001C11.2109 3.98376 10.8147 3.71688 10.3667 3.58661C9.91863 3.45634 9.44109 3.46917 9.00068 3.62331C8.56028 3.77745 8.17897 4.06522 7.90995 4.44646C7.64094 4.82771 7.49763 5.28342 7.50003 5.75001C7.50003 8.00001 11.5 10.75 11.5 10.75Z\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n \u003Cpath d=\"M11.5 10.753C11.0645 11.1891 10.8199 11.7802 10.8199 12.3965C10.8199 13.0128 11.0645 13.6039 11.5 14.04C11.8899 14.4307 12.1253 14.9493 12.163 15.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n \u003Cpath d=\"M5.85599 15.5C6.01057 15.0489 6.03574 14.5636 5.92863 14.0989C5.82153 13.6343 5.58644 13.2089 5.24999 12.871C5.01218 12.6333 4.82354 12.351 4.69483 12.0404C4.56612 11.7297 4.49988 11.3968 4.49988 11.0605C4.49988 10.7242 4.56612 10.3913 4.69483 10.0806C4.82354 9.76998 5.01218 9.48773 5.24999 9.25\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n \u003Cpath d=\"M9.385 1.51802C9.13837 1.21327 8.82932 0.964891 8.47866 0.789589C8.12799 0.614287 7.74384 0.516132 7.35207 0.501731C6.96029 0.487329 6.56997 0.557015 6.20738 0.706098C5.84479 0.855181 5.51834 1.0802 5.25 1.36602C4.87267 0.964714 4.38343 0.686071 3.84578 0.566244C3.30813 0.446417 2.74688 0.490937 2.23484 0.694027C1.7228 0.897117 1.28362 1.2494 0.974269 1.70518C0.664919 2.16095 0.499683 2.69918 0.5 3.25002C0.5 6.00002 5.25 9.25002 5.25 9.25002C5.25 9.25002 5.714 8.93202 6.35 8.41102\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n\u003C/svg>\n","id":1.701772910721e+12,"name":"My First Workspace"},{"icon":"\u003Csvg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n \u003Cpath d=\"M9.5 0.5H6.5V15.5H9.5V0.5Z\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n \u003Cpath d=\"M3.5 10.5H0.5V15.5H3.5V10.5Z\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n \u003Cpath d=\"M15.5 5.5H12.5V15.5H15.5V5.5Z\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n\u003C/svg>\n","id":1.692203254698e+12,"name":"My Second Workspace"},{"icon":"\u003Csvg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n \u003Cpath d=\"M13.5 3.5H15.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n \u003Cpath d=\"M10.5 6.5H2C1.60218 6.5 1.22064 6.34196 0.93934 6.06066C0.658035 5.77936 0.5 5.39782 0.5 5V2C0.5 1.60218 0.658035 1.22064 0.93934 0.93934C1.22064 0.658035 1.60218 0.5 2 0.5H10.5L13.5 1.5V5.5L10.5 6.5Z\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n \u003Cpath d=\"M7.5 6.5L6.687 10.565C6.63667 10.8169 6.68525 11.0786 6.82266 11.2957C6.96006 11.5128 7.17575 11.6687 7.425 11.731L9.364 12.216C9.68846 12.2972 9.97649 12.4844 10.1823 12.7481C10.3881 13.0117 10.5 13.3365 10.5 13.671V15.5H0.5V13.427C0.499917 13.1484 0.57743 12.8753 0.723853 12.6382C0.870276 12.4012 1.07982 12.2096 1.329 12.085L2.063 11.719C2.19933 11.6507 2.31824 11.5521 2.41062 11.4308C2.503 11.3094 2.56641 11.1686 2.596 11.019L3.5 6.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n \u003Cpath d=\"M10.5 0.5V6.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n \u003Cpath d=\"M2.5 4.5H5.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n \u003Cpath d=\"M2.5 2.5H5.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n\u003C/svg>\n","id":1.691848707565e+12,"name":"My Third Workspace"},{"icon":"\u003Csvg ..... and so on until.... ,"id":1.714050266767e+12,"name":"My Last Workspace"}]}},
Above is a snippet of that text. I chopped it after the third Workspace. I renamed the Workspaces to "My First Workspace", etc so it is easier to follow.
In my preferences file I think it ends when "web_apps" appears. No doubt that will be different in every file and looking for the closing } will be the key. (It is actually "name":"My Last Workspace"}]}}, that is the end point... and I have now seen "web_apps" in multiple examples as the item that comes next)
Not used to modern syntax, so no idea what that is. But a bit of careful reading at it is clear this is a list of my workspaces. Each workspace starts with {"icon": and ends with "id":1.714050266767e+12,"name":"My Last Workspace"} so is pretty easy to decode. Or would be if not all in one unreadable line.
Some of the important points here are the values like "id":1.691848707565e+12" as this will line up with the saved sessions. I have seen that number in the session files.
My fairly safe bet is that we could lift that whole chunk starting from "workspaces":{"list" and ending at }]}}, and drop it into another preferences file and it should work.
Further research shows may also need to lift out the item called "sessions" (NOPE - not needed.
See next post)"sessions":{"event_log":[{"did_schedule_command":true,"first_session_service":true,"tab_count":676,"time":"13358983330617417","type":2,"window_count":1},{"crashed":false,"time":"13358987289117184","type":0},{"restore_browser":true,"synchronous":true,"time":"13358987289189201","type":5},{"errored_reading":false,"tab_count":676,"time":"13358987290032595","type":1,"window_count":1},{"did_schedule_command":true,"first_session_service":true,"tab_count":678,"time":"13358987642813894","type":2,"window_count":1},{"crashed":false,"time":"13359121294720377","type":0},{"restore_browser":true,"synchronous":false,"time":"13359121848355592","type":5},{"errored_reading":false,"tab_count":678,"time":"13359121850469579","type":1,"window_count":1},{"restore_browser":true,"synchronous":false,"time":"13359128141686867","type":5},{"errored_reading":false,"tab_count":676,"time":"13359128143797713","type":1,"window_count":1},{"did_schedule_command":true,"first_session_service":true,"tab_count":676,"time":"13359203951132302","type":2,"window_count":1},{"crashed":true,"time":"13360252129230034","type":0},{"restore_browser":true,"synchronous":true,"time":"13360252129525970","type":5},{"errored_reading":false,"tab_count":676,"time":"13360252131993744","type":1,"window_count":1},{"did_schedule_command":true,"first_session_service":true,"tab_count":676,"time":"13360254668023026","type":2,"window_count":1},{"crashed":false,"time":"13360254816185268","type":0},{"restore_browser":true,"synchronous":true,"time":"13360254816273907","type":5},{"errored_reading":false,"tab_count":676,"time":"13360254817067764","type":1,"window_count":1},{"did_schedule_command":true,"first_session_service":true,"tab_count":676,"time":"13360256974796039","type":2,"window_count":1}],"session_data_status":3},
Some experimenting may tell if that is important to transfer with "workspaces" or can just rebuild itself.
Edited to add: It is when reading a mess of text like Preferences you realise how darn good Notepad++ is. Just the simple thing like clicking on an open bracket and seeing the close bracket lit up in pink makes it so much quicker to manually parse the file... Jumping to that bracket with CTRL+B...
Reading the whole of the Preferences file line by line I can see that it should not really be copied over "as is" to a new machine. For example needs paths updated (i.e. downloads), but has not broken my test machine doing this. Extensions just cleanly reset themselves we the Extension folders not found. Certainly works as a quick hack for someone not fussy who is testing or disaster recovery.
-
To better help the OP - here is a big clue I believe to restore Workplace titles along with the sessions files.
Refining my posts above....
Open the Preferences file and go look for
"workspaces":{"button":{"show_name":true},"link_routes":[],"list":[ {"icon":"\u003Csvg
Open the Sessions.json file and scroll to the bottom for the last "Autosaved Sessions"
"guid": "00000000-0000-5000-a000-000000000004", "modifytime": 1.717069997887928e+12, "quarantinecount": 0, "tabscount": 678, "title": "Autosaved Sessions", "type": 0, "windowscount": 1, "workspaces": [ { "active": true, "icon": "\u003Csvg
There is a HUGE similarity here when you look at what is between the square brackets!
A
theorytested fact... lift everything between the square brackets from the sessions.json and paste into the preferences... Strip out those "active": true, extra lines and this works! Workspace names can be manually restored from a sessions.json file.Note as long as you just copy between the square brackets you don't even need to clean up all the extra white space. Preferences file is happy with that.
Just have to understand how the TABS_nnnnn and SESSIONS_nnnnn files match up. If I keep fiddling with this I'll post back anything I work out.
Note: I did this test by pulling a complex set of pages from my PC and pasting into the test PC. Also transferring the Sessions and Sessions Store folders, but instead of moving the whole Preferences file I used the Workspaces from the Sessions.json.
That should answer @mib2berlin question about what to change in the preferences file.
Hope that helps someone else.
DISCLAIMER: obviously don't try this at home without backups... I have no idea what I am doing here...
Just following the patterns
-
@mallen Dealing with JSON files without proper tools is bound to you stranded up s**it creek without a paddle.
https://tomeko.net/software/JSONedit/
https://www.mitec.cz/jsonv.html
https://jqlang.github.io/jq/
JSON plugin for Notepad++ - or whatever editor you prefer to unpack/pack JSON files.
Most professional IDEs have JSON modules already.As for the tabs and session files, these are Chromium SNSS files, basically a black box, far as I know there are no good tools to do anything with these, unless you're a developer and willing to parse Chromium's source.
https://digitalinvestigation.wordpress.com/tag/snss/ -
@Pathduck said in Exporting & Importing Sessions:
JSON plugin for Notepad++ - or whatever editor you prefer to unpack/pack JSON files.
The JSON files coloured up quite nice in the default notepad++ but will look at your recommended plugin.
Notepad++ is the best tool for any coding
I am guessing the preferences file is not full json? I changed the file extension to see if the colours would update, but no change. It seemed to gobble up the JSON snippet I handed it so clearly following some of the same syntax.
I ain't gonna go digging into the Chrome source. This old coders head is used to reading \ decoding the syntax of various languages so could hack around the json fine (i.e. just follow the brackets) but don't fancy trying to make sense of chrome!
The above was really a case of curiosity leading me to pulling things apart and seeing if I could stick 'em back together again.
A puzzle I may look at next is an easier way of restoring an old backup session instead of it just merging into the current session. Something I think I may be able to manage with some hacking around of the preferences \ workspaces item.
-
@mib2berlin said in Exporting & Importing Sessions:
@ShadesOfGrey
Hi, sessions are not synced only tabs, so you can see all open tabs on other devices.
Sync is additive, a new clean device get only data from Profile 1.
If Profile 1 have 100 bookmarks and Profile 2 50 you will get 150 on both after sync.Cheers, mib
Aren't Profiles independent? Independent to a such degree, that they require different email / sync account?
What are you talking about here mentioning new device being built up via syncing from two profiles? -
@RadekPilich
Profiles are independent, except one use the same account for syncing.
I have 3 accounts to manage this.
May some users use one account for 2 profiles but sync only bookmarks or something. -
@mib2berlin Oh, great, that's what I was hoping to get. So I just enter the same account to the second profile and then I can get all bookmarks, passwords, extensions etc synced? While at the same time having a different set of workspaces and tabs in each profile?
-
@RadekPilich
Yep. -
PPathduck has marked this topic as solved on
-
Unfortunately, not possible to export import settings and drag and drop tabs between profiles.
EDIT: At least the workspace contents can be transferred nicely between profiles via cloud sync.