AutoSave Sessions Mod
-
@LonM I'd prefer if it pulled the name of the first tab group. If the user has given a name to the group, that's because this is what they want to see to know what it is about. If the user hasn't given a name to the group, then it will the name of the most recent active tab. Ideally, in my opinion, the mod would skip over loose tabs if groups exist and grab the name of either the first group or largest group. Perhaps, it could even skip over unnamed groups if another group exists and has been named.
I write all this not knowing how or even if we can distinguish between a group that has been given a name and that which is just displaying a tab's title. Though Vivaldi is able to distinguish, it doesn't change the group name when the user has modified it, so there is something there.
-
Once again i'm late to the party... i did not know of this clever mod til some hours ago today, alerted by @BoneTone's https://forum.vivaldi.net/post/400345. The timing is rather exquisite, given my shock discovery this evening that chromium 86 has broken my hitherto successful tabs backups, per my https://forum.vivaldi.net/post/400417.
I've now added this bit of further @LonM genius-work to both Stable's & Snapshot's
custom.js
& verified that in both it's working a treat. I have noticed however one little thing to quibble about.It assigns a timestamp that is UTC, not local time. Inspecting the few other pics of sessions already posted in this thread let me confirm it's not just unique to me -- others' also have what seems to be UTC.
Is there a simple code tweak possible pls to use local rather than UTC for the assigned timestamps?
-
@Steffie one thing to consider, I suspect that a simple change to just pull the local system time for naming the sessions will likely lead to some funky behavior twice a year in most locales. Right around this time of year there can be hiccups as some newer sessions appear to be older than existing sessions after the clocks roll back to Standard Time. UTC isn't affected by Daylight Saving clock changes so it avoids this problem. In the Spring, some sessions will appear older than they actually are, and be deleted too soon.
Addressing these issues takes a lot more code than is required for just using UTC. I can understand the desire to want to see local time, but there should be a warning included next to the option about this possibility.
-
@Steffie That should be doable, but there are some concerns I have which may delay a fix:
- The session name is also the filename, so lots of care needs to be taken that changing the format won't produce filenames that are invalid on certain OSes, or clash with vivaldi's idea of what a valid filename is
- As @BoneTone says, changing how data is stored when dealing with timezones is very tricky. The name and timestamp should be separate, but i will need to investigate further.
Apologies to all people in this thread if my anglo/UTC0-centric development has caused issues, I will try and have a look at how this could be corrected
-
@LonM I don't consider UTC to be anglo-centric, it's right there in the name -- universal. Though it's a bit of a misnomer, global would be more accurate. I doubt the universe runs on Earth time. You include the Z for Zulu in the name, following the standard convention.
-
@BoneTone said in AutoSave Sessions Mod:
hiccups as some newer sessions appear to be older than existing sessions after the clocks roll back to Standard Time
You make an excellent point i'd not considered, however... I entirely blame Cher...
https://www.youtube.com/watch?v=GgD9FyE60hs
@LonM said in AutoSave Sessions Mod:
Apologies to all people in this thread if my anglo/UTC0-centric development has caused issues
OMZ pls, no. The very last thing i wanted to do was to wring some apology from you. It's totally not necessary or warranted. My gosh you do such great stuff for our community, thank you.
-
Alright, so I think I've got part of a solution.
I am very much reminded of a youtube video with Tom Scott where he talks about programming and time zones. His point boils down to "Let someone else handle it".
Having dealt with these bugs, I must say I very much agree with him.
Developments:
- It turns out that there is no date formatter in javascript native to browsers
- Including a full formatting library would take up several kbs, and I'm not doing that
- Vivaldi has some kind of library but it's hidden away inside one of the bundles and I can't access it
- Native JS 4 date formatters and a lot of getters to build custom strings. I've the one that does a decent job
- I've moved the whole thing to a separate method, so if someone wants to build and share their own, they just have to share that method and everyone else can easily drop it in if they want to use it
- Vivaldi's sessions doesn't seem to save daylight savings, just an absolute time, this may be a bug with vivaldi, or may be intended
- If anyone else knows how to handle daylight savings, feel free to hack away at the code to fix it. Any data loss should be limited to, at most, 1 hour on the evening your country changes time zone. I have no idea how to handle daylight savings time, so I've given up even trying! αΰΌΌΰΊΩΝΰΊΰΌ½α
I will test the changes for a bit, and update the main post if I'm happy with it. This also applies to the sessions panel mod, but there's no problem of data loss there. The worst that could happen is the sort order gets a bit funny.
-
@LonM said in AutoSave Sessions Mod:
he talks about programming and time zones. His point boils down to "Let someone else handle it"
That used to be me. I'm a bit of a time nerd, it's fascinating, thus in my various QA roles I was always the one to spot & correct time related issues, including time zones, as well as
daylight savings
There is no s in
daylight saving time
. It's an extremely common error. If your dog has to go to the bathroom, it needs to be walked and it's dog walking time, not dog walkings time. Same thing with daylight saving time.When talking about a location's time zone, it's often best to leave out the standard or daylight. New York is in the Eastern Time zone of the United States, it's only on Eastern Standard Time or Eastern Daylight Time for part of the year.
-
@BoneTone said in AutoSave Sessions Mod:
daylight savings
I have always called it that, with an s. It is the time when you save daylight, i.e. you get daylight savings.
Like my bank account: I save money, I make money savings, so it's a savings account.
And yes, it looks very likely I'll have to just ignore any special time rules because all I have to go on is a timestamp like
1592837180229.7
, so any conversion will need to take place relative to the current timezone. This could pose a problem if you're using a laptop and go on holiday far away. -
@LonM said in AutoSave Sessions Mod:
Like my bank account: I save money, I make money savings, so it's a savings account.
The difference between the two is that your savings account is a nounal adjective, while daylight saving time is a verbal adjective. The account holds your savings (a noun), the time-shift saves (a verb) daylight for the evening after work. Technically it would be better as daylight-saving time, such as a mind-expanding experience. As I said, it's an extremely common error; so common that some references include it as accepted usage. The use of the participle (saving) is the original and more grammatically correct, as well as the official termβ‘, even if it feels funky and has become less common. Locales that use the term Summer Time avoid this confusion all together.
Funnily enough, this page uses the savings account as an example for why people get it wrong. To put it all together, we could say that one of the primary justifications for daylight saving time is the energy savings it creates.
β‘ official - you won't find savings on a website like NIST
-
@LonM said in AutoSave Sessions Mod:
I have no idea how to handle daylight savings time, so I've given up even trying! αΰΌΌΰΊΩΝΰΊΰΌ½α
I am most remorseful that i ever mentioned this. I did not & do not wish to cause grief here. Pls let's do a Cher then pretend my post never happened.
@BoneTone said in AutoSave Sessions Mod:
I'm a ... time nerd
I am thrilled to learn this, & positively quiver with excitement in anticipation of soon enough streaming your impending series, & discovering if your TARDIS rivals Jodie's. Down the track, can we expect spin-offs like
Alien vs Predator
, eg,Time Lord vs Time Nerd
? Has the merch campaign begun yet? -
@BoneTone said in AutoSave Sessions Mod:
Technically it would be better as daylight-saving time, such as a mind-expanding experience
This is a good explanation!
@Steffie said in AutoSave Sessions Mod:
I am most remorseful that i ever mentioned this.
Don't be! It makes me very happy when I see people enjoying and using
thingsβ’
that I've built, and I want them to be as bug free as possible. Now I know that this one rare case is beyond my ability to fix, I can at least give people a warning up front, which I would not have thought to do beforehand. -
Main post has been updated with some changes to timezone, and languages.
-
@LonM Well, firstly... OMZ, more majik from you -- ta muchly!
Secondly, can you pls clarify the following for me? Atm this latest version is confusing me a bit.
- When i first installed this the other day it was at v2, & i merely appended all your code into the end of my existing
custom.js
file. It worked great. - Tonight, having discovered you've now enhanced it to v4, i simply replaced all the v2 text in #1 with your v4 text. As i am currently using Snapshot [eg, for this post], i chose to trial this first in Stable, which was not running at the time.
- With the copy/paste/save done [this time i chose to use your default timers & nos of sessions], i launched Stable, waited, waited, waited ... no sessions were saved.
- Opened Stable's Settings & searched for some new instances of keyword
session
, as i interpreted your v4 explanatory text to imply that we could now control this mod via V's Settings tab. I found nothing new. - Closed V-Stable, re-read your post, rechecked my Stable's
custom.js
... all still seemed ok. Hmmmm, huh? - Relaunched Stable, waited, waited ... oooh, now it has begun saving sessions at 5' intervals as hoped. Why did it not do this the first time? Btw, the new local timestamps are fabbo ta !
- Rechecked Settings ... still can't find anything relevant.
I presume i have misunderstood the intent of v4?
Haha, the funniest things turn up ... once one closes Settings then reopens it:Thank yooooooooooooooooooo !
- When i first installed this the other day it was at v2, & i merely appended all your code into the end of my existing
-
@Steffie For v4, I may have forgotten to update this forum post and just pushed it to my git repo only, and only realised just now. oops
Hacking my way into settings isn't very pleasant, so it can be a bit tempermental, hence why it doesn't always show. Searching won't help, it will only show on the first general page of settings when it is opened. I think other mods have a neater way of sneaking in, but I haven't used that.
I'm not sure why it would fail to save sessions until a restart. That's a concerning bug, and didn't come up in my testing. If it takes a restart to make it work, I guess that's fine... ?
-
@LonM Tis all happy & yummy now also in Snapshot.
Furthermore late arvo i gave in & deployed what i had told myself 24 hours ago that i simply did not need ... alas i am weak-willed & so now both V's also happily have your uber geek-chic sessions panel: https://forum.vivaldi.net/topic/28102/advanced-panels-mod-with-sessions-panel?page=1
This is all rather fun, heehee.
-
Warning! This is a purely Off Topic comment
@BoneTone said in AutoSave Sessions Mod:
There is no s in daylight saving time.
There is no "daylight saving" at all, we get only fractions of milliseconds per solar day added to the arbitrary partition of time we humans do because the rotation of the earth is slowly slowing down until we are tidally locked with the moon (a bit less than 2ms in 100 years).
About UTC: Of course it is Universal (with capital U), the same as are all other time zones. As Einstein showed, time is only "correct" from the vantage point of the beholder, i.e. in the same reference frame which must not be altered, so everyone needs to carry a an atomic clock with an individual time ...
OK, OK - I stop rambling now, but SICNR
-
@QuHno said in AutoSave Sessions Mod:
There is no "daylight saving" at all, we get only fractions of milliseconds per solar day added to the arbitrary partition of time we humans do because the rotation of the earth is slowly slowing down until we are tidally locked with the moon (a bit less than 2ms in 100 years).
Daylight saving isn't a reference to collecting daylight and having it build up, like money in an account. It means that we're saving the daylight for later in the day so that we have more of it at the end of the day after work. Just like you might save a nice bottle of beer for a special occasion -- you're not getting more of the beer, you're delaying your use of it for a better time.
-
@BoneTone said in AutoSave Sessions Mod:
you're delaying your use of it for a better time.
This is exactly why I save money in the bank, just for the record.
-
@LonM well, yeah, it's part of the reason I do a well. And I could have perhaps picked a different object for the sentence, but I was just illustrating the difference between the varied connotations of the verb save. It's not about accumulating more of the entity, rather it's to reserve its use for evening activities instead of morning activities. Whether or not the economic effects are substantial, it's nice to have an extra hour of daylight after work enabling us to do more outside in the warm weather. As you get further away from the equator, this effect is more pronounced with some places having usable daylight until almost 10pm.
PS - I apologize for pushing this thread offtopic. If any further discussion occurs about this, I'll spin it off into another topic.