Skip to content

Commit

Permalink
feat: workaround for multi account support via separated instances
Browse files Browse the repository at this point in the history
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
  • Loading branch information
ShGKme committed Apr 17, 2024
1 parent 5438f4b commit e634f59
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@
- Works with limitations:
- File Viewer — only images and videos

## 👥 Multi-account

Full multi-account currently [is not currently supported](https://github.com/nextcloud/talk-desktop/issues/7).

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:

```
/path/to/apps/
├── home-apps/
│ └── Nextcloud Talk/
│ ├── ...
│ ├── Nextcloud Talk (Home).exe
│ └── ...
└── work-apps/
└── Nextcloud Talk/
├── ...
├── Nextcloud Talk (Work).exe
└── ...
```

## 🧑‍💻 Development Setup

### Initial setup
Expand Down
11 changes: 6 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ const ARGUMENTS = {
}

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

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

ipcMain.on('app:quit', () => app.quit())
ipcMain.handle('app:getOs', () => getOs())
ipcMain.handle('app:getAppName', () => app.getName())
ipcMain.handle('app:getSystemL10n', () => ({
locale: app.getLocale().replace('-', '_'),
language: app.getPreferredSystemLanguages()[0].replace('-', '_'),
Expand Down
6 changes: 6 additions & 0 deletions src/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ const TALK_DESKTOP = {
* @type {typeof packageInfo} packageInfo
*/
packageInfo,
/**
* Get app name
*
* @return {Promise<string>}
*/
getAppName: () => ipcRenderer.invoke('app:getAppName'),
/**
* Quit the application
*/
Expand Down
2 changes: 2 additions & 0 deletions src/talk/renderer/talk.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ if (!window.location.hash) {
window.location.hash = '#/apps/spreed'
}

document.title = await window.TALK_DESKTOP.getAppName()

await setupWebPage()

const { router } = await init()
Expand Down

0 comments on commit e634f59

Please sign in to comment.