Skip to content

Commit

Permalink
Add initial extension
Browse files Browse the repository at this point in the history
This is simple code that is executed to inject the script, which
overwrites window.navigator in a way that Slack web app thinks we're
using ChromeOS.

On ChromeOS the left sidebar includes workspaces switcher panel.

This trick allows non-ChromeOS users enjoy workspace switcher in Slack.
  • Loading branch information
hubertlepicki committed Oct 19, 2020
1 parent 4df18a7 commit 3fcd2c1
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions content_script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const tag = document.createElement("script");

tag.innerHTML = "(function() { Object.defineProperty(navigator, 'userAgent', { value: navigator.userAgent + ' CrOS' }); })()";

document.documentElement.appendChild(tag);
Binary file added images/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"manifest_version": 2,
"name": "Slack Workspace Switcher For All",
"description": "Liberate your Slack in browser with a workspace switcher known from Chrome OS / native apps!",
"version": "0.0.1",
"icons": {
"16": "images/icon16.png",
"48": "images/icon48.png",
"128": "images/icon128.png"
},
"browser_action": {
"default_icon": {
"19": "images/icon48.png"
},
"default_title": "Slack Workspace Switcher For All"
},
"permissions": ["https://app.slack.com/"],
"content_scripts": [
{
"all_frames": false,
"js": ["content_script.js"],
"matches": ["https://app.slack.com/*"],
"run_at": "document_start"
}
],
"content_security_policy": "script-src 'self'; object-src 'self'",
"web_accessible_resources": ["images/*.*"]
}

0 comments on commit 3fcd2c1

Please sign in to comment.