Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Alfred Vivaldi workflow
require 'digest/md5'
script = <<-SCRIPT
var list = new Array();
Application("Vivaldi").windows().forEach(function(window){
window.tabs().forEach(function(tab){
list.push(tab.name() + "\t" + tab.url());
});
});
list.join("\\n")
SCRIPT
output = `osascript -l JavaScript -e '#{script}'`
items = ''
output.split("\n").select{|l| l.include?(ARGV[0] || '')}.each do |line|
name, url = line.split("\t")
items << <<-EOH
<item uid="#{Digest::MD5.hexdigest(url)}" valid="yes">
<title>#{name.encode(xml: :text)}</title>
<subtitle>#{url.encode(xml: :text)}</subtitle>
<icon>icon.png</icon>
</item>
EOH
end
puts <<EOH
<?xml version="1.0"?>
<items>
#{items}
</items>
EOH
@DuckJsus

This comment has been minimized.

Copy link

@DuckJsus DuckJsus commented Dec 28, 2020

Good afternoon. Tell me, this script is somehow related to the creation of workspaces in the Vivaldi browser? I'm looking for an analog of workspaces from Opera. Maybe this can help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment