Remove generate-random-theme feature and unused Kodi/xmonad debug sessions

main
Warinyourself 1 month ago
parent 6535f5c6e9
commit 5e8e856146

@ -26,12 +26,6 @@ export default defineComponent({
{buildCheckbox('show-framerate')} {buildCheckbox('show-framerate')}
{buildCheckbox('no-transition')} {buildCheckbox('no-transition')}
{buildCheckbox('only-ui')} {buildCheckbox('only-ui')}
<AppSwitch
inline={true}
label={t('settings.generate-random-theme')}
modelValue={appStore.generateRandomThemes}
onUpdate:modelValue={(value: boolean) => { appStore.generateRandomThemes = value }}
/>
</div> </div>
) )
} }

@ -4,7 +4,6 @@ export interface AppSettings {
username: string; username: string;
desktop: string; desktop: string;
defaultColor: string; defaultColor: string;
generateRandomThemes: boolean;
bodyClass: Record<string, boolean>; bodyClass: Record<string, boolean>;
themes: AppTheme[]; themes: AppTheme[];
} }

@ -5,7 +5,7 @@ import router from '@/router'
import type { AppTheme, AppSettings, AppInputTheme, AppInputThemeValue } from '@/models/app' import type { AppTheme, AppSettings, AppInputTheme, AppInputThemeValue } from '@/models/app'
import type { LightdmSession, LightdmUsers } from '@/models/lightdm' import type { LightdmSession, LightdmUsers } from '@/models/lightdm'
import { isDifferentRoute, parseQueryValue, randomize, randomizeSettingsTheme, setCSSVariable } from '@/utils/helper' import { isDifferentRoute, parseQueryValue, randomizeSettingsTheme, setCSSVariable } from '@/utils/helper'
import { AppThemes, defaultTheme } from '@/utils/constant' import { AppThemes, defaultTheme } from '@/utils/constant'
import { LightdmHandler } from '@/utils/lightdm' import { LightdmHandler } from '@/utils/lightdm'
import { version } from '../../package.json' import { version } from '../../package.json'
@ -22,7 +22,6 @@ export const useAppStore = defineStore('app', {
users: LightdmHandler.users as LightdmUsers[], users: LightdmHandler.users as LightdmUsers[],
desktops: LightdmHandler.sessions as LightdmSession[], desktops: LightdmHandler.sessions as LightdmSession[],
showPassword: false, showPassword: false,
generateRandomThemes: false,
themes: AppThemes as AppTheme[], themes: AppThemes as AppTheme[],
bodyClass: { bodyClass: {
blur: true, blur: true,
@ -59,7 +58,6 @@ export const useAppStore = defineStore('app', {
bodyClass: state.bodyClass, bodyClass: state.bodyClass,
currentTheme: state.currentTheme, currentTheme: state.currentTheme,
defaultColor: state.defaultColor, defaultColor: state.defaultColor,
generateRandomThemes: state.generateRandomThemes
}), }),
personalInfo: (state) => ({ personalInfo: (state) => ({
@ -87,9 +85,6 @@ export const useAppStore = defineStore('app', {
if (isExistTheme && themeSettings) { if (isExistTheme && themeSettings) {
this.changeSettingsTheme({ theme: finalTheme, settings: themeSettings }) this.changeSettingsTheme({ theme: finalTheme, settings: themeSettings })
} }
this.syncThemeColor()
this.syncStoreWithQuery()
}, },
login() { login() {
@ -156,31 +151,24 @@ export const useAppStore = defineStore('app', {
syncThemeWithStore({ settings, query }: { settings: AppSettings; query: RouteLocationNormalized['query'] }) { syncThemeWithStore({ settings, query }: { settings: AppSettings; query: RouteLocationNormalized['query'] }) {
let themeName = (query.themeName as string) || settings.currentTheme let themeName = (query.themeName as string) || settings.currentTheme
const { generateRandomThemes } = settings
const indexTheme = Math.floor(randomize(0, this.themes.length - 1))
const syncTheme = this.themes.reduce((themes: AppTheme[], theme, index) => { const syncTheme = this.themes.reduce((themes: AppTheme[], theme, index) => {
const cachedTheme = settings.themes.find(({ name }) => name === theme.name) const cachedTheme = settings.themes.find(({ name }) => name === theme.name)
const isActiveTheme = generateRandomThemes ? indexTheme === index : theme.name === themeName const isActiveTheme = theme.name === themeName
const hasCachedTheme = cachedTheme && cachedTheme.settings const hasCachedTheme = cachedTheme && cachedTheme.settings
if (hasCachedTheme) { if (hasCachedTheme) {
if (isActiveTheme && generateRandomThemes) { theme.settings = theme.settings?.map((input) => {
themeName = theme.name const cachedInput = this.getThemeInput(input.name, cachedTheme)
theme.settings = randomizeSettingsTheme(theme) let value = cachedInput?.value ?? input.value
} else {
theme.settings = theme.settings?.map((input) => { if (isActiveTheme) {
const cachedInput = this.getThemeInput(input.name, cachedTheme) const queryInput = input.name in query ? parseQueryValue(query[input.name] as string) : null
let value = cachedInput?.value ?? input.value value = queryInput ?? value
}
if (isActiveTheme) {
const queryInput = input.name in query ? parseQueryValue(query[input.name] as string) : null return { ...input, value }
value = queryInput ?? value })
}
return { ...input, value }
})
}
} }
themes.push(theme) themes.push(theme)
@ -197,7 +185,6 @@ export const useAppStore = defineStore('app', {
try { try {
const settings: AppSettings = JSON.parse(localStorage.getItem('settings') || '{}') const settings: AppSettings = JSON.parse(localStorage.getItem('settings') || '{}')
this.generateRandomThemes = settings.generateRandomThemes || false
if (settings.themes) this.syncThemeWithStore({ settings, query }) if (settings.themes) this.syncThemeWithStore({ settings, query })

@ -20,12 +20,10 @@ if (lightdmDebug) {
sessions: [ sessions: [
{ name: 'i3wm', key: 'i3' }, { name: 'i3wm', key: 'i3' },
{ name: 'KDE 5', key: 'plasma-shell' }, { name: 'KDE 5', key: 'plasma-shell' },
{ name: 'Kodi', key: 'kodi' },
{ name: 'Gnome 3', key: 'gnome-shell' }, { name: 'Gnome 3', key: 'gnome-shell' },
{ name: 'XFCE 4', key: 'xfce' }, { name: 'XFCE 4', key: 'xfce' },
{ name: 'Openbox', key: 'openbox' }, { name: 'Openbox', key: 'openbox' },
{ name: 'Cinnamon', key: 'cinnamon' }, { name: 'Cinnamon', key: 'cinnamon' },
{ name: 'xmonad', key: 'xmonad' }
], ],
users: [ users: [
{ {

Loading…
Cancel
Save