Skip to content

Commit

Permalink
Change hotkeys, now they work on every browser:
Browse files Browse the repository at this point in the history
- Open extension popup (mac: ⌃R, win+linx: Alt+R)
- Save/highlight on Chrome (mac: ⌘⇧S, win+linx: Ctrl+Shift+S)
- Save/highlight other browser (mac: ⌃X, win+linx: Alt+X)
- Open sidebar (mac: ⌘., win+linx: Ctrl+.)
  • Loading branch information
exentrich committed Jul 22, 2024
1 parent 0e09ee3 commit ffe57a1
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 76 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Be sure to run `npm i` before calling any commands below
| web | `npm run build` |
| electron | `npm run build:electron` |
| chrome | `npm run build:extension:chrome` |
| firefox | `npm run build:extension:firefox` | Saved to `dist/firefox/prod`
| edge | `npm run build:extension:edge` |
| firefox | `npm run build:extension:firefox` | Saved to `dist/firefox/prod`
| opera | `npm run build:extension:opera` |
| safari | `npm run build:extension:safari` | Then open **build/xcode** project

Expand Down
1 change: 1 addition & 0 deletions build/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = (env={}, args={}) => {

switch(env.vendor) {
case 'chrome': env.sentry = { urlPrefix: 'chrome-extension://ldgfbffkinooeloadekpmfoklnobpien/' }; break
case 'edge': env.sentry = { urlPrefix: 'chrome-extension://lpngnnjemnkjmgpoolldhiejhkmmgfge/' }; break
case 'firefox': env.sentry = { disabled: true }; break //ignored, because reviewers complain
case 'opera': env.sentry = { urlPrefix: 'chrome-extension://omkjjddnkfagilfgmbmeeffkljlpaglj/' }; break
case 'safari': env.sentry = { urlPrefix: 'safari-web-extension://F54B64D3-0D2D-4C9C-BDF5-8671C44683E7/' }; break
Expand Down
4 changes: 2 additions & 2 deletions build/xcode/Save to Raindrop.io/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>5.6.41</string>
<string>5.6.50</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>354</string>
<string>360</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions build/xcode/Save to Raindrop.io/Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>5.6.41</string>
<string>5.6.50</string>
<key>CFBundleVersion</key>
<string>354</string>
<string>360</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSExtension</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
CODE_SIGN_ENTITLEMENTS = Extension/Extension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 354;
CURRENT_PROJECT_VERSION = 360;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 7459JWM5TY;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -452,7 +452,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 5.6.41;
MARKETING_VERSION = 5.6.50;
PRODUCT_BUNDLE_IDENTIFIER = io.raindrop.safari.extension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -467,7 +467,7 @@
CODE_SIGN_ENTITLEMENTS = Extension/Extension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 354;
CURRENT_PROJECT_VERSION = 360;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 7459JWM5TY;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -478,7 +478,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 5.6.41;
MARKETING_VERSION = 5.6.50;
PRODUCT_BUNDLE_IDENTIFIER = io.raindrop.safari.extension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -497,7 +497,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 354;
CURRENT_PROJECT_VERSION = 360;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 7459JWM5TY;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -508,7 +508,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 5.6.41;
MARKETING_VERSION = 5.6.50;
PRODUCT_BUNDLE_IDENTIFIER = io.raindrop.safari;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -525,7 +525,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 354;
CURRENT_PROJECT_VERSION = 360;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 7459JWM5TY;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -536,7 +536,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 5.6.41;
MARKETING_VERSION = 5.6.50;
PRODUCT_BUNDLE_IDENTIFIER = io.raindrop.safari;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app",
"version": "5.6.46",
"version": "5.6.50",
"description": "All-in-one bookmark manager",
"author": "Rustem Mussabekov",
"license": "MIT",
Expand All @@ -15,6 +15,7 @@
"build": "webpack --config build/web.js --env production",
"build:extension": "npm run build:extension:chrome && npm run build:extension:firefox && npm run build:extension:opera && npm run build:extension:safari && npm run build:extension:safari-ios",
"build:extension:chrome": "webpack --config build/extension.js --env production --env vendor=chrome",
"build:extension:edge": "webpack --config build/extension.js --env production --env vendor=edge",
"build:extension:firefox": "webpack --config build/extension.js --env production --env vendor=firefox",
"build:extension:opera": "webpack --config build/extension.js --env production --env vendor=opera",
"build:extension:safari": "webpack --config build/extension.js --env production --env vendor=safari && cd 'build/xcode/Save to Raindrop.io' && ./version.sh",
Expand Down
64 changes: 22 additions & 42 deletions src/assets/target/extension/welcome/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,10 @@ <h2>Collect & organize web pages</h2>

<a href="#pin" class="button size-regular variant-primary">Pin in Toolbar</a>
<span class="or-text">or press</span>
<span data-system-show="macos">
<button class="button size-regular variant-secondary only-icon" disabled></button>
<button data-browser-hide="firefox" class="button size-regular variant-secondary only-icon" disabled></button>
<button data-browser-show="firefox" class="button size-regular variant-secondary only-icon" disabled></button>
<button class="button size-regular variant-secondary only-icon" disabled>S</button>
</span>
<span data-system-show="windows linux">
<button class="button size-regular variant-secondary" disabled>
<span data-browser-hide="firefox">Ctrl</span><span data-browser-show="firefox">Alt</span>
+Shift+S
</button>
</span>

<button data-system-show="macos" class="button size-regular variant-secondary only-icon" disabled></button>
<button data-system-hide="macos" class="button size-regular variant-secondary" disabled>Alt</button>
<button class="button size-regular variant-secondary only-icon" disabled>R</button>
</div>
</div>

Expand Down Expand Up @@ -96,16 +88,9 @@ <h2>Collection always at hand</h2>

<span class="or-text">or press</span>

<span data-system-show="macos">
<button class="button size-regular variant-secondary only-icon" disabled></button>
<button class="button size-regular variant-secondary only-icon" disabled></button>
<button class="button size-regular variant-secondary only-icon" disabled>B</button>
</span>
<span data-system-show="windows linux">
<button class="button size-regular variant-secondary" disabled>
Alt+Shift+B
</button>
</span>
<button data-system-show="macos" class="button size-regular variant-secondary only-icon" disabled></button>
<button data-system-hide="macos" class="button size-regular variant-secondary" disabled>Ctrl</button>
<button class="button size-regular variant-secondary only-icon" disabled>.</button>
</div>
</div>

Expand All @@ -121,16 +106,9 @@ <h3>Open Raindrop.io Sidebar</h3>
<p>
Or press

<span data-system-show="macos">
<button class="button size-regular variant-secondary only-icon" disabled></button>
<button class="button size-regular variant-secondary only-icon" disabled></button>
<button class="button size-regular variant-secondary only-icon" disabled>B</button>
</span>
<span data-system-show="windows linux">
<button class="button size-regular variant-secondary" disabled>
Alt+Shift+B
</button>
</span>
<button data-system-show="macos" class="button size-regular variant-secondary only-icon" disabled></button>
<button data-system-hide="macos" class="button size-regular variant-secondary" disabled>Ctrl</button>
<button class="button size-regular variant-secondary only-icon" disabled>.</button>
</p>
<hr class="blue-green-gradient" />
<p>In sidebar you can browse your collection, search and add new items.</p>
Expand Down Expand Up @@ -168,7 +146,7 @@ <h3>Address Bar Integration</h3>
</div>
</div>

<!-- Multiplayer -->
<!-- Highlights -->
<div class="slide columns right" id="highlights" data-is-intersecting="false">
<div class="image-column">
<img src="screen-highlights.webp" />
Expand All @@ -181,17 +159,19 @@ <h2>Save important passages</h2>

<button class="button size-regular variant-secondary" disabled>Select text</button>
<span class="or-text">and press</span>
<span data-system-show="macos">
<button class="button size-regular variant-secondary only-icon" disabled></button>
<button data-browser-hide="firefox" class="button size-regular variant-secondary only-icon" disabled></button>
<button data-browser-show="firefox" class="button size-regular variant-secondary only-icon" disabled></button>

<span data-browser-show="chrome">
<button data-system-show="macos" class="button size-regular variant-secondary only-icon" disabled></button>
<button data-system-hide="macos" class="button size-regular variant-secondary" disabled>Ctrl</button>
<button data-system-show="macos" class="button size-regular variant-secondary only-icon" disabled></button>
<button data-system-hide="macos" class="button size-regular variant-secondary" disabled>Shift</button>
<button class="button size-regular variant-secondary only-icon" disabled>S</button>
</span>
<span data-system-show="windows linux">
<button class="button size-regular variant-secondary" disabled>
<span data-browser-hide="firefox">Ctrl</span><span data-browser-show="firefox">Alt</span>
+Shift+S
</button>

<span data-browser-hide="chrome">
<button data-system-show="macos" class="button size-regular variant-secondary only-icon" disabled></button>
<button data-system-hide="macos" class="button size-regular variant-secondary" disabled>Alt</button>
<button class="button size-regular variant-secondary only-icon" disabled>X</button>
</span>
</div>
</div>
Expand Down
3 changes: 0 additions & 3 deletions src/target/extension/background/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ async function onCommand(command, tab) {
active: true
})

case 'open_app':
return open('/', { width: 1280, height: 800 })

case 'execute_side_panel': {
const { windowId } = tab
return browser.sidePanel.open({ windowId })
Expand Down
9 changes: 5 additions & 4 deletions src/target/extension/hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const hotkeys = {
async getAll() {
try{
const commands = await browser.commands.getAll()
if (Array.isArray(commands) && commands.length)
if (commands?.[0]?.name)
return commands
} catch(e){
console.log(e)
Expand All @@ -17,11 +17,11 @@ export const hotkeys = {
const { os } = await browser.runtime.getPlatformInfo()

return Object.entries(commands)
.map(([name, { suggested_key, description }])=>{
var shortcut = suggested_key ? (suggested_key[os] || suggested_key.default || '') : ''
.map(([name, { suggested_key={}, description='' }])=>{
var shortcut = suggested_key?.[os] || suggested_key?.default || ''

if (os == 'mac')
shortcut = shortcut.replace(/^Ctrl/, '⌘')
shortcut = shortcut.replace(/^Ctrl/, '⌘').replace(/^MacCtrl/, '⌃')

return {
name,
Expand All @@ -48,6 +48,7 @@ export const hotkeys = {
return 'https://support.mozilla.org/en-US/kb/manage-extension-shortcuts-firefox'

case 'chrome':
case 'edge':
case 'opera':
return 'chrome://extensions/shortcuts'
}
Expand Down
29 changes: 17 additions & 12 deletions src/target/extension/manifest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = ({ vendor, production=false }, l) => {
'index.html?action',
default_icon: {
//chrome based icon
...(vendor == 'chrome' || vendor == 'opera' ? {
...(vendor == 'chrome' || vendor == 'edge' || vendor == 'opera' ? {
16: file(l, '../../../assets/target/extension/action_chrome_16.png'),
24: file(l, '../../../assets/target/extension/action_chrome_24.png'),
32: file(l, '../../../assets/target/extension/action_chrome_32.png')
Expand Down Expand Up @@ -93,7 +93,7 @@ module.exports = ({ vendor, production=false }, l) => {
'activeTab',
'scripting',
'storage',
...(vendor == 'chrome' ? ['sidePanel'] : []),
...(vendor == 'chrome' || vendor == 'edge' ? ['sidePanel'] : []),
...(vendor == 'safari-ios' ? ['tabs'] : [])
],

Expand Down Expand Up @@ -129,26 +129,31 @@ module.exports = ({ vendor, production=false }, l) => {
commands: {
_execute_action: {
suggested_key: {
default: 'Ctrl+Shift+E'
default: 'Alt+R',
mac: 'MacCtrl+R'
}
},
save_page: {
suggested_key: {
default: vendor == 'firefox' ? 'Alt+Shift+S' : 'Ctrl+Shift+S'
suggested_key: vendor == 'chrome' ? {
default: 'Ctrl+Shift+S'
} : {
default: 'Alt+X',
mac: 'MacCtrl+X'
},
description: '__MSG_savePageOrHighlight__'
},
open_raindrop: {
description: '__MSG_openRaindrop__',
},
open_app: {
description: '__MSG_openApp__',
suggested_key: {
default: 'Alt+A',
mac: 'MacCtrl+A'
}
},

...(vendor == 'chrome' ? {
...(vendor == 'chrome' || vendor == 'edge' ? {
execute_side_panel: {
suggested_key: {
default: 'Alt+Shift+B'
default: 'Ctrl+Period'
},
description: '__MSG_openSidePanel__'
}
Expand All @@ -157,15 +162,15 @@ module.exports = ({ vendor, production=false }, l) => {
...(vendor == 'firefox' || vendor == 'opera' ? {
_execute_sidebar_action: {
suggested_key: {
default: 'Alt+Shift+B'
default: 'Ctrl+Period'
},
description: '__MSG_openSidePanel__'
}
}: {}),
},

//sidebar
...(vendor == 'chrome' ? {
...(vendor == 'chrome' || vendor == 'edge' ? {
side_panel: {
default_path: 'sidepanel.html'
}
Expand Down
2 changes: 1 addition & 1 deletion src/target/extension/manifest/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = ({ emitFile })=>{
description: ''
},
savePageOrHighlight: {
message: s(lang, 'newBookmark') + ' / ' + s(lang, 'save') + ' ' + s(lang, 'highlights').toLowerCase(),
message: s(lang, 'bookmark') + ' / ' + s(lang, 'save') + ' ' + s(lang, 'highlights').toLowerCase(),
description: ''
},
saveLink: {
Expand Down

0 comments on commit ffe57a1

Please sign in to comment.