Skip to content

Commit 5e262c7

Browse files
committed
Add migration script to disable 'hideToTrayOnMinimize' setting if it was enabled on Wayland
1 parent 2009973 commit 5e262c7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/datastores/handlers/base.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { app } from 'electron'
12
import * as db from '../index'
23

34
class Settings {
@@ -57,6 +58,19 @@ class Settings {
5758
await db.settings.removeAsync({ _id: 'screenshotAskPath' })
5859
}
5960

61+
// In FreeTube 0.24.1 and earlier, the 'Minimize to system tray' setting could be enabled on Wayland despite lacking support.
62+
// The setting is now hidden from Wayland users.
63+
// This migration disables the setting for existing users who had it enabled.
64+
// This prevents users from being stuck with an enabled setting they can no longer change
65+
// if Wayland gains 'minimize' state support in the future.
66+
// Note: This will have to be removed if support is added back in the future
67+
const hideToTrayOnMinimize = await db.settings.findOneAsync({ _id: 'hideToTrayOnMinimize' })
68+
69+
if (hideToTrayOnMinimize && hideToTrayOnMinimize.value &&
70+
process.platform === 'linux' && app.commandLine.getSwitchValue('ozone-platform') === 'wayland') {
71+
await this.upsert('hideToTrayOnMinimize', false)
72+
}
73+
6074
return db.settings.findAsync({ _id: { $ne: 'bounds' } })
6175
}
6276

0 commit comments

Comments
 (0)