Skip to content

Commit b38c82b

Browse files
authored
Merge pull request #620 from nextcloud/feat/workaround-for-multi-account
feat: workaround for multi-account support with several instance with different executable names
2 parents 38cb36d + 7bcc5d8 commit b38c82b

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,26 @@
2121
- Works with limitations:
2222
- File Viewer — only images and videos
2323

24+
## 👥 Multi-account
25+
26+
Full multi-account currently [is not currently supported](https://github.com/nextcloud/talk-desktop/issues/7).
27+
28+
However, using portable `zip` distribution, you can have several Nextcloud Talk instances run simultaneously. Just rename the executable from default `Nextcloud Talk` to a custom name. For example:
29+
30+
```
31+
/path/to/apps/
32+
├── home-apps/
33+
│ └── Nextcloud Talk/
34+
│ ├── ...
35+
│ ├── Nextcloud Talk (Home).exe
36+
│ └── ...
37+
└── work-apps/
38+
└── Nextcloud Talk/
39+
├── ...
40+
├── Nextcloud Talk (Work).exe
41+
└── ...
42+
```
43+
2444
## 🧑‍💻 Development Setup
2545

2646
### Initial setup

src/main.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ const ARGUMENTS = {
4242
}
4343

4444
/**
45-
* Separate production and development instances, including application and user data
45+
* On production use executable name as application name to allow several independent application instances.
46+
* On development use "Nextcloud Talk (dev)" instead of the default "electron".
4647
*/
47-
if (process.env.NODE_ENV === 'development') {
48-
app.setName('Nextcloud Talk (dev)')
49-
app.setPath('userData', path.join(app.getPath('appData'), 'Nextcloud Talk (dev)'))
50-
}
48+
const APP_NAME = process.env.NODE_ENV !== 'development' ? path.parse(app.getPath('exe')).name : 'Nextcloud Talk (dev)'
49+
app.setName(APP_NAME)
50+
app.setPath('userData', path.join(app.getPath('appData'), app.getName()))
5151
app.setAppUserModelId(app.getName())
5252

5353
/**
@@ -71,6 +71,7 @@ if (process.env.NODE_ENV === 'production') {
7171

7272
ipcMain.on('app:quit', () => app.quit())
7373
ipcMain.handle('app:getOs', () => getOs())
74+
ipcMain.handle('app:getAppName', () => app.getName())
7475
ipcMain.handle('app:getSystemL10n', () => ({
7576
locale: app.getLocale().replace('-', '_'),
7677
language: app.getPreferredSystemLanguages()[0].replace('-', '_'),

src/preload.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ const TALK_DESKTOP = {
4848
* @type {typeof packageInfo} packageInfo
4949
*/
5050
packageInfo,
51+
/**
52+
* Get app name
53+
*
54+
* @return {Promise<string>}
55+
*/
56+
getAppName: () => ipcRenderer.invoke('app:getAppName'),
5157
/**
5258
* Quit the application
5359
*/

src/shared/setupWebPage.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ async function applyL10n() {
8484

8585
/**
8686
* Make all required initial setup for the web page:
87+
* - set title according to app name
8788
* - restore app data
8889
* - get OS info
8990
* - apply theme to HTML data-attrs
9091
* - apply locale to HTML lang and data-locale attrs
9192
* - register translation bundles for Talk and Talk Desktop
9293
*/
9394
export async function setupWebPage() {
95+
document.title = await window.TALK_DESKTOP.getAppName()
9496
initGlobals()
9597
appData.restore()
9698
window.OS = await window.TALK_DESKTOP.getOs()

0 commit comments

Comments
 (0)