diff --git a/src/background.js b/src/background.js
index 92f11c5..c490a0b 100644
--- a/src/background.js
+++ b/src/background.js
@@ -1,4 +1,5 @@
let actions = [];
+let newtaburl = "";
// Clear actions and append default ones
const clearActions = () => {
@@ -175,12 +176,39 @@ chrome.action.onClicked.addListener((tab) => {
// Listen for the open omni shortcut
chrome.commands.onCommand.addListener((command) => {
if (command === "open-omni") {
- chrome.tabs.query({active: true, currentWindow: true}, (tabs) => {
- chrome.tabs.sendMessage(tabs[0].id, {request: "open-omni"});
+ getCurrentTab().then((response) => {
+ if (!response.url.includes("chrome://") && !response.url.includes("chrome.google.com")) {
+ chrome.tabs.sendMessage(response.id, {request: "open-omni"});
+ } else {
+ chrome.tabs.create({
+ url: "./newtab.html"
+ }).then(() => {
+ newtaburl = response.url;
+ chrome.tabs.remove(response.id);
+ })
+ }
});
}
});
+// Get the current tab
+const getCurrentTab = async () => {
+ const queryOptions = { active: true, currentWindow: true };
+ const [tab] = await chrome.tabs.query(queryOptions);
+ return tab;
+}
+
+// Restore the new tab page (workaround to show Omni in new tab page)
+function restoreNewTab() {
+ getCurrentTab().then((response) => {
+ chrome.tabs.create({
+ url: newtaburl
+ }).then(() => {
+ chrome.tabs.remove(response.id);
+ })
+ })
+}
+
const resetOmni = () => {
clearActions();
getTabs();
@@ -197,13 +225,6 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => resetOmni());
chrome.tabs.onCreated.addListener((tab) => resetOmni());
chrome.tabs.onRemoved.addListener((tabId, changeInfo) => resetOmni());
-// Get the current tab
-const getCurrentTab = async () => {
- const queryOptions = { active: true, currentWindow: true };
- const [tab] = await chrome.tabs.query(queryOptions);
- return tab;
-}
-
// Get tabs to populate in the actions
const getTabs = () => {
chrome.tabs.query({}, (tabs) => {
@@ -408,13 +429,13 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
break;
case "search-history":
chrome.history.search({text:message.query, maxResults:1000, startTime:31536000000*5}).then((data) => {
- for (let action in actions) {
+ data.forEach((action, index) => {
action.type = "history";
action.emoji = true;
action.emojiChar = "🏛";
action.action = "history";
action.keyCheck = false;
- };
+ });
sendResponse({history:data});
})
return true;
@@ -456,6 +477,9 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
{text:message.query}
)
break;
+ case "restore-new-tab":
+ restoreNewTab();
+ break;
}
});
diff --git a/src/content.css b/src/content.css
index 3ea1295..9e328da 100644
--- a/src/content.css
+++ b/src/content.css
@@ -3,351 +3,354 @@ html {
}
/* Scrollbar size */
::-webkit-scrollbar {
- width: 10px;
- height: 10px;
- transition: 1.0s;
+ width: 10px;
+ height: 10px;
+ transition: 1s;
}
::-webkit-scrollbar-thumb {
- background-color: rgba(127, 127, 127, 0.6);
- background-clip: padding-box;
- border: 2px solid transparent;
- border-radius: 5px;
- transition: 1.0s;
+ background-color: rgba(127, 127, 127, 0.6);
+ background-clip: padding-box;
+ border: 2px solid transparent;
+ border-radius: 5px;
+ transition: 1s;
}
::-webkit-scrollbar-thumb:vertical:hover,
::-webkit-scrollbar-thumb:horizontal:hover {
- background-color: rgb(110, 110, 110);
- transition: 0.3s;
+ background-color: rgb(110, 110, 110);
+ transition: 0.3s;
}
::-webkit-scrollbar-track {
- background-color: transparent;
+ background-color: transparent;
}
-
-
::-webkit-scrollbar-thumb:vertical:active,
::-webkit-scrollbar-thumb:horizontal:active {
- background: rgba(95, 91, 91, 1);
-
+ background: rgba(95, 91, 91, 1);
}
::-webkit-scrollbar-corner {
- background: none;
+ background: none;
}
@media (prefers-color-scheme: dark) {
- :root {
- --background: #1E2128;
- --border: #35373E;
- --text: #F1F1F1;
- --text-2: #C5C6CA;
- --text-3: #A5A5AE;
- --select: #17191E;
- --accent: #6068D2;
- --accent-hover: #484FAC;
- --shortcut: #383E4A;
- --placeholder: #63687B;
- --background-2: #292D36;
- }
+ :root {
+ --background: #1e2128;
+ --border: #35373e;
+ --text: #f1f1f1;
+ --text-2: #c5c6ca;
+ --text-3: #a5a5ae;
+ --select: #17191e;
+ --accent: #6068d2;
+ --accent-hover: #484fac;
+ --shortcut: #383e4a;
+ --placeholder: #63687b;
+ --background-2: #292d36;
+ }
}
@media (prefers-color-scheme: light) {
- :root {
- --background: #FAFCFF;
- --border: #F2F3FB;
- --text: #2B2D41;
- --text-2: #2B2D41;
- --text-3: #929DB2;
- --select: #EFF3F9;
- --accent: #6068D2;
- --accent-hover: #484FAC;
- --shortcut: #DADEEA;
- --placeholder: #BAC2D1;
- --background-2: #292D36;
- }
+ :root {
+ --background: #fafcff;
+ --border: #f2f3fb;
+ --text: #2b2d41;
+ --text-2: #2b2d41;
+ --text-3: #929db2;
+ --select: #eff3f9;
+ --accent: #6068d2;
+ --accent-hover: #484fac;
+ --shortcut: #dadeea;
+ --placeholder: #bac2d1;
+ --background-2: #292d36;
+ }
}
@font-face {
- font-family: 'Inter';
- font-style: normal;
- font-weight: 400;
- src: url('chrome-extension://__MSG_@@extension_id__/assets/Inter-Regular.ttf');
+ font-family: "Inter";
+ font-style: normal;
+ font-weight: 400;
+ src: url("chrome-extension://__MSG_@@extension_id__/assets/Inter-Regular.ttf");
}
@font-face {
- font-family: 'Inter';
- font-style: normal;
- font-weight: 500;
- src: url('chrome-extension://__MSG_@@extension_id__/assets/Inter-Medium.ttf');
+ font-family: "Inter";
+ font-style: normal;
+ font-weight: 500;
+ src: url("chrome-extension://__MSG_@@extension_id__/assets/Inter-Medium.ttf");
}
@font-face {
- font-family: 'Inter';
- font-style: normal;
- font-weight: 600;
- src: url('chrome-extension://__MSG_@@extension_id__/assets/Inter-SemiBold.ttf');
+ font-family: "Inter";
+ font-style: normal;
+ font-weight: 600;
+ src: url("chrome-extension://__MSG_@@extension_id__/assets/Inter-SemiBold.ttf");
}
@font-face {
- font-family: 'Inter';
- font-style: normal;
- font-weight: 700;
- src: url('chrome-extension://__MSG_@@extension_id__/assets/Inter-Bold.ttf');
+ font-family: "Inter";
+ font-style: normal;
+ font-weight: 700;
+ src: url("chrome-extension://__MSG_@@extension_id__/assets/Inter-Bold.ttf");
}
.omni-extension * {
- display: block;
+ display: block;
+ width: unset;
+ box-shadow: unset;
+ padding: unset;
+ margin: unset;
+ background-color: unset;
+ border-radius: unset;
}
.omni-extension .omni-item-details * {
- line-height: normal;
+ line-height: normal;
}
.omni-extension {
- font-family: Inter!important;
- z-index: 99999999999;
+ font-family: Inter !important;
+ z-index: 99999999999;
}
.omni-extension #omni-wrap {
- position: fixed;
- width: 700px;
- border: 1px solid transparent;
- border-radius: 5px;
- margin: auto;
- top: 0px;
- right: 0px;
- bottom: 0px;
- left: 0px;
- z-index: 9999999999;
- height: 540px;
- transition: all .2s cubic-bezier(.05,.03,.35,1);
+ position: fixed;
+ width: 700px;
+ border: 1px solid transparent;
+ border-radius: 5px;
+ margin: auto;
+ top: 0px;
+ right: 0px;
+ bottom: 0px;
+ left: 0px;
+ z-index: 9999999999;
+ height: 540px;
+ transition: all 0.2s cubic-bezier(0.05, 0.03, 0.35, 1);
}
.omni-extension #omni {
- position: absolute;
- width: 100%;
- background: var(--background);
- border: 1px solid var(--border);
- border-radius: 5px;
- top: 0px;
- left: 0px;
- z-index: 9999999998;
- height: fit-content;
- transition: all .2s cubic-bezier(.05,.03,.35,1);
- display: block;
+ position: absolute;
+ width: 100%;
+ background: var(--background);
+ border: 1px solid var(--border);
+ border-radius: 5px;
+ top: 0px;
+ left: 0px;
+ z-index: 9999999998;
+ height: fit-content;
+ transition: all 0.2s cubic-bezier(0.05, 0.03, 0.35, 1);
+ display: block;
}
.omni-closing #omni {
- transform: scale(.9);
- opacity: 0;
- display: none!important;
+ transform: scale(0.9);
+ opacity: 0;
}
.omni-closing {
- pointer-events: none;
+ pointer-events: none;
+ display: none !important;
}
.omni-extension #omni-overlay {
- height: 100%;
- width: 100%;
- position: fixed;
- top: 0px;
- left: 0px;
- background-color: #000;
- z-index: 9999;
- opacity: .6;
- transition: all .1s cubic-bezier(.05,.03,.35,1);
+ height: 100%;
+ width: 100%;
+ position: fixed;
+ top: 0px;
+ left: 0px;
+ background-color: #000;
+ z-index: 9999;
+ opacity: 0.6;
+ transition: all 0.1s cubic-bezier(0.05, 0.03, 0.35, 1);
}
.omni-closing #omni-overlay {
- opacity: 0!important;
+ opacity: 0 !important;
}
.omni-extension #omni-head {
- height: 50px;
- line-height: 50px;
- width: 95%;
- margin-left: auto;
- margin-right: auto;
- border-bottom: 1px solid var(--border);
+ height: 50px;
+ line-height: 50px;
+ width: 95%;
+ margin-left: auto;
+ margin-right: auto;
+ border-bottom: 1px solid var(--border);
}
.omni-extension #omni-name {
- color: var(--text);
- font-size: 12px;
- font-weight: 600;
- float: left;
+ color: var(--text);
+ font-size: 12px;
+ font-weight: 600;
+ float: left;
}
.omni-extension #omni-close {
- color: var(--text-3);
- float: right;
- font-size: 12px;
- font-weight: 500;
+ color: var(--text-3);
+ float: right;
+ font-size: 12px;
+ font-weight: 500;
}
.omni-extension #omni-close span {
- margin-left: 3px;
+ margin-left: 3px;
}
.omni-extension .omni-shortcut {
- display: inline-block!important;
- font-size: 13px;
- border-radius: 5px;
- background-color: var(--shortcut);
- color: var(--text);
- text-align: center;
- height: 20px;
- line-height: 20px;
- min-width: 20px;
- padding-left: 3px;
- padding-right: 3px;
+ display: inline-block !important;
+ font-size: 13px;
+ border-radius: 5px;
+ background-color: var(--shortcut);
+ color: var(--text);
+ text-align: center;
+ height: 20px;
+ line-height: 20px;
+ min-width: 20px;
+ padding-left: 3px;
+ padding-right: 3px;
}
.omni-extension input {
- background: transparent;
- border: 0px;
- outline: none;
- font-size: 20px;
- font-weight: 400;
- height: 50px;
- width: 92%;
- margin-left: auto;
- margin-right: auto;
- display: block;
- color: var(--text);
- caret-color: var(--accent);
- font-family: Inter!important;
- margin-top: 5px;
- margin-bottom: 5px;
- box-sizing: border-box;
- outline: none;
- border: 0px;
- box-shadow: none;
+ background: transparent;
+ border: 0px;
+ outline: none;
+ font-size: 20px;
+ font-weight: 400;
+ height: 50px;
+ width: 92%;
+ margin-left: auto;
+ margin-right: auto;
+ display: block;
+ color: var(--text);
+ caret-color: var(--accent);
+ font-family: Inter !important;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ box-sizing: border-box;
+ outline: none;
+ border: 0px;
+ box-shadow: none;
}
.omni-extension ::placeholder {
- color: var(--placeholder);
- opacity: 1;
+ color: var(--placeholder);
+ opacity: 1;
}
.omni-extension :-ms-input-placeholder {
- color: var(--placeholder);
+ color: var(--placeholder);
}
.omni-extension ::-ms-input-placeholder {
- color: var(--placeholder);
+ color: var(--placeholder);
}
.omni-extension #omni-list {
- width: 100%;
- overflow: auto;
- height: 100%;
- max-height: 400px;
- border-top: 1px solid var(--border);
- position: relative;
+ width: 100%;
+ overflow: overlay;
+ height: 100%;
+ max-height: 400px;
+ border-top: 1px solid var(--border);
+ position: relative;
}
.omni-extension .omni-item {
- height: 60px;
- width: 100%;
+ height: 60px;
+ width: 100%;
}
.omni-extension .omni-item:hover {
- cursor: pointer;
+ cursor: pointer;
}
.omni-extension .omni-item-active {
- background-color: var(--select);
- position: relative;
+ background-color: var(--select);
+ position: relative;
}
.omni-extension .omni-item-active:before {
- height: 100%;
- position: absolute;
- display: block;
- content: "";
- width: 2px;
- background-color: var(--accent);
+ height: 100%;
+ position: absolute;
+ display: block;
+ content: "";
+ width: 2px;
+ background-color: var(--accent);
}
.omni-extension .omni-select {
- float: right;
- vertical-align: middle;
- color: var(--text-3);
- font-size: 12px;
- font-weight: 500;
- display: none;
- margin-top: 20px;
- margin-right: 5%;
+ float: right;
+ vertical-align: middle;
+ color: var(--text-3);
+ font-size: 12px;
+ font-weight: 500;
+ display: none;
+ margin-top: 20px;
+ margin-right: 5%;
}
.omni-extension .omni-select span {
- margin-left: 3px;
+ margin-left: 3px;
}
.omni-extension .omni-item-active .omni-select {
- display: block!important;
+ display: block !important;
}
.omni-extension .omni-icon {
- width: 20px;
- height: 20px;
- margin-left: 5%;
- display: inline-block;
- vertical-align: middle;
- margin-top: -12px;
+ width: 20px;
+ height: 20px;
+ margin-left: 5%;
+ display: inline-block;
+ vertical-align: middle;
+ margin-top: -12px;
}
.omni-extension .omni-emoji-action {
- display: inline-block;
- vertical-align: middle;
- margin-top: -12px;
- width: 20px;
- height: 20px;
- text-align: center;
- margin-left: 5%;
- font-size: 18px;
+ display: inline-block;
+ vertical-align: middle;
+ margin-top: -12px;
+ width: 20px;
+ height: 20px;
+ text-align: center;
+ margin-left: 5%;
+ font-size: 18px;
}
.omni-extension .omni-item-details {
- display: inline-block!important;
- margin-left: 10px;
- vertical-align: middle;
- margin-top: 10px;
+ display: inline-block !important;
+ margin-left: 10px;
+ vertical-align: middle;
+ margin-top: 10px;
}
.omni-extension .omni-item-name {
- color: var(--text-2);
- font-size: 14px;
- font-weight: 500;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- width: 460px;
+ color: var(--text-2);
+ font-size: 14px;
+ font-weight: 500;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ width: 460px;
}
.omni-extension .omni-item-active .omni-item-name {
- color: var(--text)!important;
+ color: var(--text) !important;
}
.omni-extension .omni-item-desc {
- color: var(--text-3);
- margin-top: 5px;
- font-size: 14px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- width: 460px;
+ color: var(--text-3);
+ margin-top: 5px;
+ font-size: 14px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ width: 460px;
}
.omni-extension #omni-footer {
- height: 45px;
- line-height: 45px;
- border-top: 1px solid var(--border);
- width: 92%;
- margin-left: auto;
- margin-right: auto;
+ height: 45px;
+ line-height: 45px;
+ border-top: 1px solid var(--border);
+ width: 92%;
+ margin-left: auto;
+ margin-right: auto;
}
.omni-extension #omni-results {
- color: var(--text-3);
- font-size: 12px;
- font-weight: 500;
- float: left;
+ color: var(--text-3);
+ font-size: 12px;
+ font-weight: 500;
+ float: left;
}
.omni-extension #omni-arrows {
- color: var(--text-3);
- font-size: 12px;
- font-weight: 500;
- float: right;
+ color: var(--text-3);
+ font-size: 12px;
+ font-weight: 500;
+ float: right;
}
.omni-extension #omni-arrows span {
- margin-left: 3px;
- margin-right: 3px;
+ margin-left: 3px;
+ margin-right: 3px;
}
.omni-extension .omni-keys {
- float: right;
- vertical-align: middle;
- font-weight: 500;
- margin-top: 20px;
- margin-right: 5%;
+ float: right;
+ vertical-align: middle;
+ font-weight: 500;
+ margin-top: 20px;
+ margin-right: 5%;
}
.omni-extension .omni-item-active .omni-keys {
- display: none!important;
+ display: none !important;
}
.omni-extension .omni-keys span {
- margin-left: 3px;
+ margin-left: 3px;
}
#body-wrap {
- width: calc(100% - 350px);
- overflow: auto;
- position: absolute;
- top: 0px;
- left: 0px;
+ width: calc(100% - 350px);
+ overflow: auto;
+ position: absolute;
+ top: 0px;
+ left: 0px;
}
diff --git a/src/content.js b/src/content.js
index c3687d8..c69a94d 100644
--- a/src/content.js
+++ b/src/content.js
@@ -6,16 +6,26 @@ $(document).ready(function(){
// Append the omni into the current page
$.get(chrome.runtime.getURL('/content.html'), function(data) {
$(data).appendTo('body');
- });
- // Request actions from the background
- chrome.runtime.sendMessage({request:"get-actions"}, function(response) {
- actions = response.actions;
- populateOmni();
+ // Request actions from the background
+ chrome.runtime.sendMessage({request:"get-actions"}, function(response) {
+ actions = response.actions;
+ populateOmni();
+ });
+
+ // New tab page workaround
+ if (window.location.href == "chrome-extension://mpanekjjajcabgnlbabmopeenljeoggm/newtab.html") {
+ isOpen = true;
+ $("#omni-extension").removeClass("omni-closing");
+ window.setTimeout(function(){
+ $("#omni-extension input").focus();
+ }, 100);
+ }
});
// Add actions to the omni
function populateOmni() {
+ console.log("check times");
$("#omni-extension #omni-list").html("");
actions.forEach(function(action, index){
var keys = "";
@@ -57,6 +67,7 @@ $(document).ready(function(){
keys += "";
}
var img = "
";
+ console.log(action)
if (action.emoji) {
img = ""+action.emojiChar+""
}
@@ -74,8 +85,8 @@ $(document).ready(function(){
chrome.runtime.sendMessage({request:"get-actions"}, function(response) {
isOpen = true;
actions = response.actions;
- populateOmni();
$("#omni-extension input").val("");
+ populateOmni();
$("html, body").stop();
$("#omni-extension").removeClass("omni-closing");
window.setTimeout(function(){
@@ -86,8 +97,12 @@ $(document).ready(function(){
// Close the omni
function closeOmni() {
- isOpen = false;
- $("#omni-extension").addClass("omni-closing");
+ if (window.location.href == "chrome-extension://mpanekjjajcabgnlbabmopeenljeoggm/newtab.html") {
+ chrome.runtime.sendMessage({request:"restore-new-tab"});
+ } else {
+ isOpen = false;
+ $("#omni-extension").addClass("omni-closing");
+ }
}
// Hover over an action in the omni
diff --git a/src/manifest.json b/src/manifest.json
index f2e4660..ef7504f 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -2,7 +2,7 @@
"name": "Omni",
"description": "Supercharge Chrome with commands, shortcuts, and more",
"offline_enabled": true,
- "version": "1.3.5",
+ "version": "1.3.6",
"manifest_version": 3,
"action": {
"icons": {
@@ -19,8 +19,8 @@
"commands": {
"open-omni": {
"suggested_key": {
- "default": "Ctrl+K",
- "mac": "Command+K"
+ "default": "Ctrl+Shift+K",
+ "mac": "Command+Shift+K"
},
"description": "Open command menu"
}
@@ -40,7 +40,7 @@
],
"web_accessible_resources": [
{
- "resources": ["content.html", "assets/*", "popup.css", "popup.js"],
+ "resources": ["content.html", "newtab.html", "assets/*", "popup.css", "popup.js"],
"matches": [""]
}
],
diff --git a/src/newtab.html b/src/newtab.html
new file mode 100644
index 0000000..06a4289
--- /dev/null
+++ b/src/newtab.html
@@ -0,0 +1,18 @@
+
+
+
+ Omni
+
+
+
+
+
+
+
+
+