Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const { triggerDownloadUrl } = require('./app/downloads.ts')
const { setupReleaseNotificationScheduler } = require('./app/githubReleaseNotification.service.js')
const { initLaunchAtStartupListener } = require('./app/launchAtStartup.config.ts')
const { runMigrations } = require('./app/migration.service.ts')
const { systemInfo, isLinux, isMac, isWindows, isSameExecution } = require('./app/system.utils.ts')
const { systemInfo, isLinux, isMac, isWindows, isSameExecution, clearFlatpakFontConfigCache } = require('./app/system.utils.ts')
const { applyTheme } = require('./app/theme.config.ts')
const { buildTitle } = require('./app/utils.ts')
const { enableWebRequestInterceptor, disableWebRequestInterceptor } = require('./app/webRequestInterceptor.js')
Expand Down Expand Up @@ -132,6 +132,7 @@ ipcMain.handle('app:getDesktopCapturerSources', async () => {
thumbnail: source.thumbnail && !source.thumbnail.isEmpty() ? source.thumbnail.toDataURL() : null,
}))
})
ipcMain.handle('app:cleanFlatpakFontConfigCache', () => clearFlatpakFontConfigCache())

/**
* Whether the window is being relaunched.
Expand Down
6 changes: 6 additions & 0 deletions src/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@
* @return {Promise<{ id: string, name: string, icon?: string }[]|null>}
*/
getDesktopCapturerSources: () => ipcRenderer.invoke('app:getDesktopCapturerSources'),
/**
* Clean Flatpak font config cache
*
* @return {Promise<string | undefined>} - Error message if any
*/
cleanFlatpakFontConfigCache: () => ipcRenderer.invoke('app:cleanFlatpakFontConfigCache'),
/**
* Relaunch an entire application
*/
Expand All @@ -99,7 +105,7 @@
* Set an application config value by key
*
* @param {string} key - Config key
* @param {any} [value] - Config value

Check warning on line 108 in src/preload.js

View workflow job for this annotation

GitHub Actions / NPM lint

Prefer a more specific type to `any`
* @return {Promise<void>}
*/
setAppConfig: (key, value) => ipcRenderer.invoke('app:config:set', key, value),
Expand Down Expand Up @@ -129,7 +135,7 @@
/**
* Invoke app:anything
*
* @param {...any} args - Arguments

Check warning on line 138 in src/preload.js

View workflow job for this annotation

GitHub Actions / NPM lint

Prefer a more specific type to `any`
*/
invokeAnything: (...args) => ipcRenderer.invoke('app:anything', ...args),
/**
Expand Down
8 changes: 8 additions & 0 deletions src/talk/renderer/Settings/DesktopSettingsSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ import NcRadioGroupButton from '@nextcloud/vue/components/NcRadioGroupButton'
import IconThemeLightDark from 'vue-material-design-icons/ThemeLightDark.vue'
import IconWeatherNight from 'vue-material-design-icons/WeatherNight.vue'
import IconWeatherSunny from 'vue-material-design-icons/WeatherSunny.vue'
import DesktopSettingsSectionFlatpakFontCache from './components/DesktopSettingsSectionFlatpakFontCache.vue'
import DesktopSettingsSectionRelaunchNote from './components/DesktopSettingsSectionRelaunchNote.vue'
import UiFormBoxAudioOutput from './components/UiFormBoxAudioOutput.vue'
import UiFormBoxSelectNative from './components/UiFormBoxSelectNative.vue'
import UiFormGroupZoom from './components/UiFormGroupZoom.vue'
import { useDevMode } from '../../../shared/useDevMode.ts'
import { useAppConfigStore } from './appConfig.store.ts'
import { useAppConfigValue } from './useAppConfigValue.ts'

const isLinux = window.systemInfo.isLinux
const isFlatpak = window.systemInfo.isFlatpak

const { isDevMode } = useDevMode()
const { isRelaunchRequired } = storeToRefs(useAppConfigStore())

const launchAtStartup = useAppConfigValue('launchAtStartup')
Expand Down Expand Up @@ -91,6 +95,10 @@ const secondarySpeakerDevice = useAppConfigValue('secondarySpeakerDevice')
<UiFormBoxAudioOutput v-if="secondarySpeaker" v-model="secondarySpeakerDevice" :label="t('talk_desktop', 'Secondary speaker')" />
</NcFormBox>
</NcFormGroup>

<NcFormGroup v-if="isDevMode && isFlatpak" :label="t('talk_desktop', 'Advanced')">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was about to ask, whether this should always be shown. isDevMode should be good to go with

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not even sure we need this at all to be honest...

<DesktopSettingsSectionFlatpakFontCache />
</NcFormGroup>
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<script setup>
import { ref } from 'vue'
import NcFormBox from '@nextcloud/vue/components/NcFormBox'
import NcFormBoxButton from '@nextcloud/vue/components/NcFormBoxButton'
import NcFormBoxCopyButton from '@nextcloud/vue/components/NcFormBoxCopyButton'
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
import IconConsole from 'vue-material-design-icons/Console.vue'
import { BUILD_CONFIG } from '../../../../shared/build.config.ts'

const isFlatpak = window.systemInfo.isFlatpak
const linuxAppId = BUILD_CONFIG.linuxAppId

const loadingCleanFlatpakFontConfigCache = ref(false)

/**
* Cleans the Flatpak font config cache
*/
async function onCleanFlatpakFontConfigCache() {
loadingCleanFlatpakFontConfigCache.value = true
const error = await window.TALK_DESKTOP.cleanFlatpakFontConfigCache()
if (error) {
loadingCleanFlatpakFontConfigCache.value = false
// Error is not supposed to happen...
// Using alert for an unexpected error in an advanced feature for simplicity
alert(error)
return
}
window.TALK_DESKTOP.relaunch()
}
</script>

<template>
<NcFormBox v-if="isFlatpak">
<NcFormBoxButton
label="Clean Flatpak font config cache and relaunch the app"
description="Might help with font or emoji rendering issues"
:disabled="loadingCleanFlatpakFontConfigCache"
@click="onCleanFlatpakFontConfigCache">
<template #icon>
<NcLoadingIcon v-if="loadingCleanFlatpakFontConfigCache" :size="20" />
<IconConsole v-else :size="20" />
</template>
</NcFormBoxButton>
<NcFormBoxCopyButton
label="Copy the command to clean the font config cache manually"
:value="`rm -rf ~/.var/app/${linuxAppId}/cache/fontconfig/`" />
</NcFormBox>
</template>
Loading