mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-12 19:23:13 +08:00
feat(dock): Automatically add N1 to the OS X dock upon install
Note - you need to `killall Dock` to see this after it happens
This commit is contained in:
parent
cb7b3764f5
commit
c7a85af843
2 changed files with 14 additions and 3 deletions
|
@ -20,7 +20,7 @@ export default class WelcomePage extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
_onSelfHosting = () => {
|
_onSelfHosting = () => {
|
||||||
OnboardingActions.moveToPage("self-hosting-restrictions")
|
OnboardingActions.moveToPage("self-hosting-restrictions");
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderContent(isFirstAccount) {
|
_renderContent(isFirstAccount) {
|
||||||
|
|
|
@ -77,7 +77,16 @@ export default class Application extends EventEmitter {
|
||||||
const helper = new DefaultClientHelper();
|
const helper = new DefaultClientHelper();
|
||||||
helper.registerForURLScheme('nylas');
|
helper.registerForURLScheme('nylas');
|
||||||
} else {
|
} else {
|
||||||
app.setAsDefaultProtocolClient('nylas')
|
app.setAsDefaultProtocolClient('nylas');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
const addedToDock = config.get('addedToDock');
|
||||||
|
const appPath = process.argv[0];
|
||||||
|
if (!addedToDock && appPath.includes('/Applications/') && appPath.includes('.app/')) {
|
||||||
|
proc.exec(`defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>${appPath.split('.app/')[0]}.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"`);
|
||||||
|
config.set('addedToDock', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +561,9 @@ export default class Application extends EventEmitter {
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on("move-to-applications", () => {
|
ipcMain.on("move-to-applications", () => {
|
||||||
if (process.platform !== "darwin") return;
|
if (process.platform !== "darwin") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const re = /(^.*?\.app)/i;
|
const re = /(^.*?\.app)/i;
|
||||||
const appPath = (re.exec(process.argv[0]) || [])[0];
|
const appPath = (re.exec(process.argv[0]) || [])[0];
|
||||||
if (!appPath) {
|
if (!appPath) {
|
||||||
|
|
Loading…
Reference in a new issue