-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save/Restore tabs #6
Comments
Note that Sesh uses Chrome's 'Other Bookmarks' folder as the default root/parent to save its sessions in. According to the extension code, there is no simple way to get the ID of this folder except by looking it up by name, which will differ depending on the browser's language settings. The extension therefore includes a bunch of unicode escaped translations by default: https://github.com/yujiberra/sesh/blob/7c0ab6a9ff07df40fc3af2a64d0c97593f9b4530/sesh.js#L127-L185 A little google-fu lead to me finding the 'Other Bookmarks' entry in the Chromium translation files: <translation id="883848425547221593">Other Bookmarks</translation> Which can also be found in the GitHub mirror of the Chromium source code: We can see all of the translated resource files here, in the Currently, by rough manual count, there seem to be ~81 different translation files (each of which will presumably have their own variation of how 'Other Bookmarks' is shown in the UI.. though there may be duplicates) Googling for the translation id (
Googling for this new translation id (
Which still seem to be present in the latest source:
And can be found on the GitHub mirror of the repo in the
We can
Doing a ⇒ git clone --depth 1 https://github.com/chromium/chromium
Cloning into 'chromium'...
remote: Enumerating objects: 403624, done.
remote: Counting objects: 100% (403624/403624), done.
remote: Compressing objects: 100% (283941/283941), done.
remote: Total 403624 (delta 110999), reused 283472 (delta 98263), pack-reused 0
Receiving objects: 100% (403624/403624), 1.33 GiB | 12.27 MiB/s, done.
Resolving deltas: 100% (110999/110999), done.
Checking connectivity: 403624, done.
Updating files: 100% (400650/400650), done.
⇒ du -sh chromium
5.8G chromium Using the 'partial clone' hack from above... ⇒ git clone --depth 1 --filter=blob:none --sparse https://github.com/chromium/chromium
Cloning into 'chromium'...
remote: Enumerating objects: 34624, done.
remote: Counting objects: 100% (34624/34624), done.
remote: Compressing objects: 100% (25767/25767), done.
remote: Total 34624 (delta 1785), reused 21959 (delta 1265), pack-reused 0
Receiving objects: 100% (34624/34624), 12.97 MiB | 11.89 MiB/s, done.
Resolving deltas: 100% (1785/1785), done.
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (27/27), done.
remote: Total 27 (delta 2), reused 6 (delta 0), pack-reused 0
Receiving objects: 100% (27/27), 191.39 KiB | 7.97 MiB/s, done.
Resolving deltas: 100% (2/2), done.
⇒ du -sh chromium
72M chromium
⇒ cd chromium
⇒ git sparse-checkout set components/strings
remote: Enumerating objects: 299, done.
remote: Counting objects: 100% (299/299), done.
remote: Compressing objects: 100% (170/170), done.
remote: Total 299 (delta 166), reused 156 (delta 128), pack-reused 0
Receiving objects: 100% (299/299), 6.22 MiB | 6.25 MiB/s, done.
Resolving deltas: 100% (166/166), done.
Updating files: 100% (326/326), done.
⇒ du -sh ../chromium
106M ../chromium
⇒ du -sh components/strings/
29M components/strings/
⇒ du -shc components/strings/components_strings_*.xtb
280K components/strings/components_strings_af.xtb
..snip..
296K components/strings/components_strings_zu.xtb
28M total
⇒ grep -r -E '2354001756790975382|883848425547221593' components/strings
components/strings/components_strings_fr.xtb:<translation id="2354001756790975382">Autres favoris</translation>
components/strings/components_strings_fr.xtb:<translation id="883848425547221593">Autres favoris</translation>
..snip..
components/strings/components_strings_si.xtb:<translation id="2354001756790975382">වෙනත් පිටු සලකුණු</translation>
components/strings/components_strings_si.xtb:<translation id="883848425547221593">වෙනත් පිටු සලකුණු</translation>
⇒ grep -r -E '2354001756790975382|883848425547221593' components/strings | wc -l
162 But since both translation IDs seem to result to the same string, we can probably just pick one of them: ⇒ grep -r '883848425547221593' components/strings | wc -l
81
⇒ grep -r '2354001756790975382' components/strings | wc -l
81
⇒ grep -r '2354001756790975382' components/strings
components/strings/components_strings_fr.xtb:<translation id="2354001756790975382">Autres favoris</translation>
..snip..
components/strings/components_strings_si.xtb:<translation id="2354001756790975382">වෙනත් පිටු සලකුණු</translation> We could also use ⇒ time xpath -q -e '//translation[@id='2354001756790975382']/text()' components/strings/components_strings_*.xtb | wc -l
81
xpath -q -e '//translation[@id='2354001756790975382']/text()' 40.75s user 0.38s system 94% cpu 43.389 total
wc -l 0.00s user 0.00s system 0% cpu 43.387 total
⇒ time grep -r '2354001756790975382' components/strings | wc -l
81
grep --color -r '2354001756790975382' components/strings 0.47s user 0.04s system 93% cpu 0.539 total
wc -l 0.00s user 0.00s system 0% cpu 0.538 total But using a little shell magic, we can combine the two and get pretty instant results: ⇒ TRANSLATIONS=`grep --no-filename -r '2354001756790975382' components/strings` && echo -e "<translations>\n$TRANSLATIONS\n</translations>" | xpath -q -e '//translation/text()' | wc -l
81
⇒ TRANSLATIONS=`grep --no-filename -r '2354001756790975382' components/strings` && echo -e "<translations>\n$TRANSLATIONS\n</translations>" | xpath -q -e '//translation/text()'
Autres favoris
..snip..
වෙනත් පිටු සලකුණු |
We could also achieve the same sort of thing as #6 (comment) by using the GitHub API rather than cloning the git repo directly:
The following command uses the ⇒ gh api /repos/chromium/chromium/contents/components/strings --jq 'map(select(.type == "file" and (.name | test("components_strings_.+\\.xtb"; "i")))) | map(.download_url) | .[]' | wc -l
81
⇒ gh api /repos/chromium/chromium/contents/components/strings --jq 'map(select(.type == "file" and (.name | test("components_strings_.+\\.xtb"; "i")))) | map(.download_url) | .[]' | cat
https://raw.githubusercontent.com/chromium/chromium/main/components/strings/components_strings_af.xtb
..snip..
https://raw.githubusercontent.com/chromium/chromium/main/components/strings/components_strings_zu.xtb We could then extend this by piping the output to ⇒ gh api /repos/chromium/chromium/contents/components/strings --jq 'map(select(.type == "file" and (.name | test("components_strings_.+\\.xtb"; "i")))) | map(.download_url) | .[]' | (while read url; do curl --silent --remote-name "$url"; done)
⇒ ls
components_strings_af.xtb components_strings_be.xtb components_strings_cs.xtb components_strings_en-GB.xtb components_strings_fa.xtb components_strings_gl.xtb components_strings_hy.xtb components_strings_ja.xtb components_strings_ko.xtb components_strings_mk.xtb components_strings_my.xtb components_strings_pa.xtb components_strings_ru.xtb components_strings_sr-Latn.xtb components_strings_te.xtb components_strings_uz.xtb components_strings_zu.xtb
components_strings_am.xtb components_strings_bg.xtb components_strings_cy.xtb components_strings_es-419.xtb components_strings_fi.xtb components_strings_gu.xtb components_strings_id.xtb components_strings_ka.xtb components_strings_ky.xtb components_strings_ml.xtb components_strings_ne.xtb components_strings_pl.xtb components_strings_si.xtb components_strings_sr.xtb components_strings_th.xtb components_strings_vi.xtb
components_strings_ar.xtb components_strings_bn.xtb components_strings_da.xtb components_strings_es.xtb components_strings_fil.xtb components_strings_hi.xtb components_strings_is.xtb components_strings_kk.xtb components_strings_lo.xtb components_strings_mn.xtb components_strings_nl.xtb components_strings_pt-BR.xtb components_strings_sk.xtb components_strings_sv.xtb components_strings_tr.xtb components_strings_zh-CN.xtb
components_strings_as.xtb components_strings_bs.xtb components_strings_de.xtb components_strings_et.xtb components_strings_fr-CA.xtb components_strings_hr.xtb components_strings_it.xtb components_strings_km.xtb components_strings_lt.xtb components_strings_mr.xtb components_strings_no.xtb components_strings_pt-PT.xtb components_strings_sl.xtb components_strings_sw.xtb components_strings_uk.xtb components_strings_zh-HK.xtb
components_strings_az.xtb components_strings_ca.xtb components_strings_el.xtb components_strings_eu.xtb components_strings_fr.xtb components_strings_hu.xtb components_strings_iw.xtb components_strings_kn.xtb components_strings_lv.xtb components_strings_ms.xtb components_strings_or.xtb components_strings_ro.xtb components_strings_sq.xtb components_strings_ta.xtb components_strings_ur.xtb components_strings_zh-TW.xtb Once we have the files locally, we can use the same ⇒ TRANSLATIONS=`grep --no-filename -r '2354001756790975382' *.xtb` && echo -e "<translations>\n$TRANSLATIONS\n</translations>" | xpath -q -e '//translation/text()' | wc -l
81
⇒ TRANSLATIONS=`grep --no-filename -r '2354001756790975382' *.xtb` && echo -e "<translations>\n$TRANSLATIONS\n</translations>" | xpath -q -e '//translation/text()' | sort
Alamisho zingine
..snip..
บุ๊กมาร์กอื่นๆ To save having to download the files again if they haven't changed, we could look at the |
We could also add a feature for seeing/restoring recently closed tabs/windows:
See also: |
As I tab junkie I tend to end up with a lot of tabs related to certain 'contexts', and this extension was born out of helping me to 'slice off' those contexts, so that I could then save them for future using something like Sesh (Chrome Store, GitHub)
I'm not sure if this would necessarily make sense to include in this extension.. sort of torn between 'keep it simple' and 'integrate the features I need so I don't require multiple extensions'. Described here for future pondering.
One potential options is to have some features that 'play nice' with Sesh's features, so that by using both you get a 'synergistic effect'. This concept could potentially be extended to other extensions as well, which would reduce the need to 'reimplement features', and help support others work (eg. This features requires you to also have X extension installed: (link to chrome store))
API's
The text was updated successfully, but these errors were encountered: