diff --git a/package.json b/package.json index d8b505a..eec376e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stapxs-qq-lite", - "version": "2.7.11", + "version": "2.7.12", "private": false, "author": "Stapx Steve [林槐]", "description": "一个兼容 OneBot 的非官方网页版 QQ 客户端,使用 Vue 重制的全新版本。", @@ -14,8 +14,8 @@ "postuninstall": "electron-builder install-app-deps" }, "dependencies": { - "@stapxs/umami-logger-typescript": "^1.0.12", "@jakejarrett/gtk-theme": "^2.0.1", + "@stapxs/umami-logger-typescript": "^1.0.12", "browser-image-compression": "^2.0.0", "char-dust": "^0.1.0", "core-js": "^3.8.3", diff --git a/src/assets/css/append/append_gnome.css b/src/assets/css/append/append_gnome.css new file mode 100644 index 0000000..8b1e659 --- /dev/null +++ b/src/assets/css/append/append_gnome.css @@ -0,0 +1,20 @@ +#app { + margin: 0; + width: calc(100% - 2px); + height: calc(100% - 2px); +} +.top-bar { + width: calc(100% - 2px); +} +.chat-pan.withBar { + height: calc(100% - 27px); + margin-right: 1px; + top: 1px; +} +.friend-list>div:last-child { + margin-left: 0; +} +.opt-main>div:last-child { + padding-top: 35px; + height: calc(100% - 26px); +} \ No newline at end of file diff --git a/src/function/electron/ipc.ts b/src/function/electron/ipc.ts index f84d92d..966e27c 100644 --- a/src/function/electron/ipc.ts +++ b/src/function/electron/ipc.ts @@ -4,7 +4,7 @@ import os from 'os' import { ipcMain, shell, systemPreferences, app, Menu, MenuItemConstructorOptions } from "electron" import { GtkTheme, GtkData } from '@jakejarrett/gtk-theme' -import { queryKeys } from './util' +import { queryKeys, runCommand } from './util' import { win } from '@/background' import { Notification as ELNotification } from 'electron' @@ -219,6 +219,26 @@ export function regIpcListener() { }}) return gtkTheme.getTheme().gtk.css }) + // Linux:获取 gnome extension 设置 + // dconf dump /org/gnome/shell/extensions/ | awk -v RS='' '/\[blur-my-shell\/applications\]/' + ipcMain.handle('sys:getGnomeExt', async () => { + try { + const info = await runCommand('dconf dump /org/gnome/shell/extensions/ | awk -v RS=\'\' \'/\\[blur-my-shell\\/applications\\]/\'') + const str = info.stdout as string + const data = {} as {[key: string]: string} + if(str && str.startsWith('[blur-my-shell/applications]')) { + const lines = str.split('\n').slice(1) + lines.forEach((line) => { + const [key, value] = line.split('=') + if(key != '') + data[key] = value + }) + } + return data + } catch(ex) { + return (ex as Error).message + } + }) // MacOS:初始化菜单 // PS:由于本地化的存在,需要让 vue 获取到本地化信息之后再由 electron 构建 diff --git a/src/function/electron/util.ts b/src/function/electron/util.ts index db4f0f4..9c74bf7 100644 --- a/src/function/electron/util.ts +++ b/src/function/electron/util.ts @@ -14,4 +14,20 @@ export function queryKeys(keyPath: string, value: string) { reject(error) } }) as Promise<{stdout: any, stderr: any}> +} + +export function runCommand(command: string) { + return new Promise(function (resolve, reject) { + try { + child_process.exec(command, (error, stdout, stderr) => { + if (error) { + reject(error) + return + } + resolve({stdout, stderr}) + }); + } catch (error) { + reject(error) + } + }) as Promise<{stdout: any, stderr: any}> } \ No newline at end of file diff --git a/src/function/utils/appUtil.ts b/src/function/utils/appUtil.ts index c983258..c1513d4 100644 --- a/src/function/utils/appUtil.ts +++ b/src/function/utils/appUtil.ts @@ -476,6 +476,22 @@ export function loadAppendStyle() { logger.info('透明 UI 附加样式加载完成') }) } + if(runtimeData.tags.isElectron && platform == 'linux') { + const gnomeExtInfo = runtimeData.reader?.invoke('sys:getGnomeExt') + if(gnomeExtInfo) { + gnomeExtInfo.then((info: any) => { + console.log(info) + if(info['enable-all'] == 'true' || info['whitelist'].indexOf('stapxs-qq-lite') != -1) { + import('@/assets/css/append/append_vibrancy.css').then(() => { + logger.info('透明 UI 附加样式加载完成') + }) + import('@/assets/css/append/append_gnome.css').then(() => { + logger.info('Blur my sell 附加样式加载完成') + }) + } + }) + } + } } export function checkUpdate() { @@ -519,6 +535,13 @@ function showGitChangeLog(version: string, mainTree: string, from: string) { // 过滤掉一些不作为更新记录的提交 info = info.filter((item: any) => !item.commit.message.startsWith('[nl]')) const json = info[0] + // 如果标题是 [ 开头的但不是 [platform],则不显示 + let platform = runtimeData.tags.platform + if(from == 'web') platform = 'web' + if (json.commit.message.startsWith('[') && !json.commit.message.startsWith('[' + platform + ']')) { + return + } + // 如果是 electron 构建的版本,只显示 [build-electron] 的提交 if (from == 'web' || json.commit.message.indexOf('[build-electron]') > 0) { const popInfo = { template: UpdatePan,