-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 41ad49c
Showing
12 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
max_line_length = 80 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
logs | ||
*.log | ||
.DS_Store | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"endOfLine": "lf", | ||
"singleQuote": false, | ||
"tabWidth": 2, | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Emmanuel Pilande | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<div align="center"> | ||
<h1>Alfred Browser Tabs 🔍</h1> | ||
</div> | ||
|
||
<p align="center"> | ||
<strong>Search browser tabs from Chrome, Brave, & Safari</strong> | ||
</p> | ||
|
||
## Why? | ||
|
||
You have hundreds of tabs open that you need to swift through and ain't nobody got time for that. | ||
|
||
## Features | ||
|
||
- 🏎 Blazing fast! | ||
- 💪 Supports Chrome, Brave, & Safari. | ||
- 🔍 Fuzzy search title & URLs. | ||
- ✨ Relevant results (last active window). | ||
- 🌶️ Customizable hotkeys & keywords. | ||
- 👯♀️ Copy URL. | ||
|
||
## Installation | ||
|
||
1. Download the Alfred Workflow. | ||
1. Double-click to import into Alfred (requires Powerpack). | ||
1. Review workflow, add hotkeys, customize. | ||
|
||
## Usage | ||
|
||
I would recommend setting up a hotkey to toggle the workflow to immediately search open tabs. | ||
|
||
### Commands | ||
|
||
- `chrome tabs {query}` - Fetch tabs from Google Chrome and filter based on query. | ||
- `brave tabs {query}` - Fetch tabs from Brave Browser and filter based on query. | ||
- `safari tabs {query}` - Fetch tabs from Safari and filter based on query. | ||
|
||
### Copy to clipboard | ||
|
||
Holding the `CTRL` key while selecting an item will copy the selected tab URL to your clipboard. | ||
|
||
## License | ||
|
||
[MIT License](https://oss.ninja/mit/epilande/) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env osascript -l JavaScript | ||
|
||
function run(args) { | ||
let safari = Application("Safari"); | ||
let query = args[0]; | ||
let [windowIndex, url] = query.split(","); | ||
|
||
function getTab() { | ||
let result; | ||
let window = safari.windows[windowIndex]; | ||
if (window) { | ||
for (let index in window.tabs) { | ||
let tab = window.tabs[index]; | ||
let tabURL = tab.url() || tab.name(); | ||
if (tabURL && tabURL.startsWith(url)) { | ||
result = tab; | ||
break; | ||
} | ||
} | ||
return result; | ||
} | ||
} | ||
|
||
let tab = getTab(); | ||
safari.activate(); | ||
safari.windows[windowIndex].currentTab = tab; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env osascript -l JavaScript | ||
|
||
function run(args) { | ||
ObjC.import("stdlib"); | ||
let browser = $.getenv("browser"); | ||
let chrome = Application(browser); | ||
let query = args[0]; | ||
let [arg1, arg2] = query.split(","); | ||
let windowIndex = parseInt(arg1); | ||
let tabIndex = parseInt(arg2); | ||
|
||
chrome.activate(); | ||
chrome.windows[windowIndex].visible = true; | ||
chrome.windows[windowIndex].activeTabIndex = tabIndex + 1; | ||
chrome.windows[windowIndex].index = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env osascript -l JavaScript | ||
|
||
function run(args) { | ||
let browser = args[0]; | ||
let chrome = Application(browser); | ||
chrome.includeStandardAdditions = true; | ||
let windowCount = chrome.windows.length; | ||
let tabsTitle = chrome.windows.tabs.name(); | ||
let tabsUrl = chrome.windows.tabs.url(); | ||
let tabsMap = {}; | ||
|
||
for (let w = 0; w < windowCount; w++) { | ||
for (let t = 0; t < tabsTitle[w].length; t++) { | ||
let url = tabsUrl[w][t] || ""; | ||
let matchUrl = url.replace(/(^\w+:|^)\/\//, ""); | ||
let title = tabsTitle[w][t] || matchUrl; | ||
|
||
tabsMap[url] = { | ||
title, | ||
url, | ||
subtitle: url, | ||
windowIndex: w, | ||
tabIndex: t, | ||
arg: `${w},${url || title}`, | ||
match: `${title} ${matchUrl}`, | ||
}; | ||
} | ||
} | ||
|
||
let items = Object.keys(tabsMap).reduce((acc, url) => { | ||
acc.push(tabsMap[url]); | ||
return acc; | ||
}, []); | ||
|
||
return JSON.stringify({ items }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env osascript -l JavaScript | ||
|
||
function run(args) { | ||
let browser = args[0]; | ||
let chrome = Application(browser); | ||
chrome.includeStandardAdditions = true; | ||
let windowCount = chrome.windows.length; | ||
let tabsTitle = | ||
browser === "Safari" | ||
? chrome.windows.tabs.name() | ||
: chrome.windows.tabs.title(); | ||
let tabsUrl = chrome.windows.tabs.url(); | ||
let tabsMap = {}; | ||
|
||
for (let w = 0; w < windowCount; w++) { | ||
for (let t = 0; t < tabsTitle[w].length; t++) { | ||
let url = tabsUrl[w][t] || ""; | ||
let matchUrl = url.replace(/(^\w+:|^)\/\//, ""); | ||
let title = tabsTitle[w][t] || matchUrl; | ||
|
||
tabsMap[url] = { | ||
title, | ||
url, | ||
subtitle: url, | ||
windowIndex: w, | ||
tabIndex: t, | ||
arg: `${w},${t},${url}`, | ||
match: `${title} ${matchUrl}`, | ||
}; | ||
} | ||
} | ||
|
||
let items = Object.keys(tabsMap).reduce((acc, url) => { | ||
acc.push(tabsMap[url]); | ||
return acc; | ||
}, []); | ||
|
||
return JSON.stringify({ items }); | ||
} |