josh- / CloudyTabs

CloudyTabs is a simple menu bar application that lists your iCloud Tabs.

Home Page:http://joshparnham.com/projects/cloudytabs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tabs are out of order

garyking opened this issue · comments

commented

At the moment, tabs in CloudyTabs appear in the order in the CloudTabs.db database, but this is not the correct order that actually appears in Safari on iPhone, and in Safari on Mac.

Safari on Mac is able to display the tabs in the correct order, so the information exists somewhere, likely in the position column, which is unfortunately in binary format.

commented

Thanks. I hadn't come around to this until just now. I wrote my own solution in Ruby, so I'll post it here as another option:

require 'json'
require 'sqlite3'
require 'zlib'

db_file_path = '/CloudTabs.db'

db = SQLite3::Database.new(db_file_path)
query = 'SELECT title, position FROM cloud_tabs'
rows = []

db.execute query do |row|
  title = row[0]
  position = row[1]

  parsed = JSON.parse(Zlib::Inflate.inflate(position))

  rows.push(
    title: title,
    position: parsed['sortValues'][0]['sortValue']
  )
end

puts rows.sort_by { |row| row[:position] }

Hey everyone, I've just released Version 2.0 which persists the position of tabs across devices – thanks so much for all the information here!

Please let me know if you have feedback on the feature 😄