Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(linux): add setting to disable the floating frame

bamboo09c934dab6a8
diff --git a/apps/desktop/src/components/editor/CloudSyncSelectionDialog.vue b/apps/desktop/src/components/editor/CloudSyncSelectionDialog.vue
index ed2a486b18..bea3280b84 100644
--- a/apps/desktop/src/components/editor/CloudSyncSelectionDialog.vue
+++ b/apps/desktop/src/components/editor/CloudSyncSelectionDialog.vue
@@ -71,6 +71,7 @@ const backupSettingsCategoryLabelKeys: Record<BackupSettingsCategoryId, string>
const nonSyncableEditorSettingIds = new Set(["updateNotificationsEnabled", "autoDownloadUpdates", "autoUpdateApp", "autoUpdateDrivers", "autoUpdateJdbc", "autoUpdateMcp", "autoUpdatePlugins", "updateDownloadSource", "ignoredUpdateVersion"]);
const desktopSettingCategories: Record<string, BackupSettingsCategoryId> = {
show_tray_icon: "appearance",
+ linux_floating_frame_enabled: "appearance",
icon_theme: "appearance",
quit_on_close: "appearance",
close_action_prompted: "appearance",
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index 9a99098e58..dc118b3522 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -312,7 +312,7 @@ import {
toggleMcpAllowedToolName,
type McpExecutionMode,
} from "@/lib/mcp/mcpPolicySelection";
-import { isMacOS, isWindows } from "@/lib/backend/platform";
+import { getPlatform, isMacOS, isWindows } from "@/lib/backend/platform";
import { combineDataTypeForDatabase, dataTypeLengthInputValue, getDataTypeOptions, getDefaultLengthForType, isDataTypeLengthDisabled, splitDataType } from "@/lib/table/tableStructureEditorState";
import { useToast } from "@/composables/useToast";
import type { InstalledPlugin, DatabaseType, SqlShortcutAction, SqlSnippet } from "@/types/database";
@@ -812,6 +812,7 @@ const editTabGroupMode = ref<TabGroupMode>(settingsStore.editorSettings.tabGroup
const editTabSortMode = ref<TabSortMode>(settingsStore.editorSettings.tabSortMode);
const editTabMaxWidth = ref<number>(settingsStore.editorSettings.tabMaxWidth);
const editTabGroupRows = ref<TabGroupRowMode>(settingsStore.editorSettings.tabGroupRows);
+const editLinuxFloatingFrameEnabled = ref(settingsStore.desktopSettings.linux_floating_frame_enabled ?? true);
const editShowTrayIcon = ref(settingsStore.desktopSettings.show_tray_icon);
const editQuitOnClose = ref(settingsStore.desktopSettings.quit_on_close);
const desktopCloseBehaviorResetPending = ref(false);
@@ -2263,6 +2264,7 @@ watch(
void historyRetention.load();
void mcpHistoryRetention.load();
editShowTrayIcon.value = settingsStore.desktopSettings.show_tray_icon;
+ editLinuxFloatingFrameEnabled.value = settingsStore.desktopSettings.linux_floating_frame_enabled ?? true;
editQuitOnClose.value = settingsStore.desktopSettings.quit_on_close;
editIconTheme.value = settingsStore.desktopSettings.icon_theme;
editDebugLoggingEnabled.value = settingsStore.desktopSettings.debug_logging_enabled;
@@ -2545,6 +2547,7 @@ function hasChanges(): boolean {
mcpHistoryRetention.changed.value ||
hasImportedSettingsPendingApply.value ||
hasEditorDraftChanges.value ||
+ editLinuxFloatingFrameEnabled.value !== (settingsStore.desktopSettings.linux_floating_frame_enabled ?? true) ||
editShowTrayIcon.value !== settingsStore.desktopSettings.show_tray_icon ||
editQuitOnClose.value !== settingsStore.desktopSettings.quit_on_close ||
editIconTheme.value !== settingsStore.desktopSettings.icon_theme ||
@@ -2586,6 +2589,7 @@ async function persistSettings() {
const metadataCacheMaxMemoryMb = normalizeMetadataCacheMemoryMb(editMetadataCacheMaxMemoryMb.value);
await settingsStore.updateDesktopSettings({
show_tray_icon: editShowTrayIcon.value,
+ linux_floating_frame_enabled: editLinuxFloatingFrameEnabled.value,
quit_on_close: editQuitOnClose.value,
close_action_prompted: desktopCloseBehaviorResetPending.value ? false : true,
icon_theme: editIconTheme.value,
@@ -2731,6 +2735,7 @@ function resetDefaultsForTab(tab: SettingsCategory) {
editTabMaxWidth.value = DEFAULT_EDITOR_SETTINGS.tabMaxWidth;
editTabGroupRows.value = DEFAULT_EDITOR_SETTINGS.tabGroupRows;
editShowTrayIcon.value = DEFAULT_DESKTOP_SETTINGS.show_tray_icon;
+ editLinuxFloatingFrameEnabled.value = DEFAULT_DESKTOP_SETTINGS.linux_floating_frame_enabled ?? true;
editQuitOnClose.value = DEFAULT_DESKTOP_SETTINGS.quit_on_close;
desktopCloseBehaviorResetPending.value = true;
editIconTheme.value = DEFAULT_DESKTOP_SETTINGS.icon_theme;
@@ -2905,6 +2910,7 @@ function resetAllDefaults() {
editAppLayout.value = DEFAULT_EDITOR_SETTINGS.appLayout;
editWebLogoPosition.value = DEFAULT_EDITOR_SETTINGS.webLogoPosition;
editShowTrayIcon.value = DEFAULT_DESKTOP_SETTINGS.show_tray_icon;
+ editLinuxFloatingFrameEnabled.value = DEFAULT_DESKTOP_SETTINGS.linux_floating_frame_enabled ?? true;
editQuitOnClose.value = DEFAULT_DESKTOP_SETTINGS.quit_on_close;
desktopCloseBehaviorResetPending.value = true;
editIconTheme.value = DEFAULT_DESKTOP_SETTINGS.icon_theme;
@@ -5694,6 +5700,7 @@ watch(
await settingsStore.initAiConfigs();
await settingsStore.initDesktopSettings();
editShowTrayIcon.value = settingsStore.desktopSettings.show_tray_icon;
+ editLinuxFloatingFrameEnabled.value = settingsStore.desktopSettings.linux_floating_frame_enabled ?? true;
editQuitOnClose.value = settingsStore.desktopSettings.quit_on_close;
editIconTheme.value = settingsStore.desktopSettings.icon_theme;
editDebugLoggingEnabled.value = settingsStore.desktopSettings.debug_logging_enabled;
@@ -8815,6 +8822,14 @@ onUnmounted(() => {
</div>
</div>
+ <div v-if="!isWeb && getPlatform() === 'linux'" class="settings-item flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
+ <div class="space-y-1">
+ <Label for="linux-floating-frame">{{ t("settings.linuxFloatingFrame") }}</Label>
+ <p class="text-xs text-muted-foreground">{{ t("settings.linuxFloatingFrameDescription") }}</p>
+ </div>
+ <Switch id="linux-floating-frame" v-model="editLinuxFloatingFrameEnabled" />
+ </div>
+
<div v-if="!isWeb" class="settings-item flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
<div class="space-y-1">
<Label for="show-tray-icon">{{ t("settings.showTrayIcon") }}</Label>
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index cf104a14fe..1cc5c2a422 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -9308,6 +9308,8 @@ export default {
iconThemeBlack: "Black",
iconThemeBlackDescription: "Use the black DBX logo in the app.",
iconThemeBlackDescriptionMac: "Use the black logo in the app; Dock uses a black plate, menu bar follows the system.",
+ linuxFloatingFrame: "Window transparency",
+ linuxFloatingFrameDescription: "Automatically enable the transparent frame on supported desktops. Turn off if the window flickers. Apply and restart DBX to take effect. Environment overrides take priority.",
showTrayIcon: "Show tray/menu bar icon",
showTrayIconDescription: "When disabled, no icon is shown, but closing the window still hides DBX in the background as before.",
quitOnClose: "Quit when closing window",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index be762dc2b2..37e6a22ed0 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -9609,6 +9609,8 @@ export default withEnglishFallback({
tabGroupRowsSingle: "Una fila",
tabGroupRowsTwoRow: "Dos filas (grupos en su propia fila)",
tabGroupRowsDescription: "Solo se aplica a una barra de pestañas superior o inferior con la agrupación activada: los grupos ocupan su propia fila y las pestañas del grupo seleccionado aparecen en la fila siguiente.",
+ linuxFloatingFrame: "Efecto de transparencia de ventana",
+ linuxFloatingFrameDescription: "Habilita automáticamente bordes transparentes en escritorios compatibles. Si la ventana parpadea, se puede desactivar; surte efecto tras aplicar y reiniciar DBX. La configuración de las variables de entorno tiene prioridad.",
shortcutExecuteAllSql: "Ejecutar todo el SQL",
},
driverStore: {
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index e802c9d9b6..9dbaed12d8 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -9358,6 +9358,8 @@ export default withEnglishFallback({
tabGroupRowsSingle: "Riga singola",
tabGroupRowsTwoRow: "Due righe (gruppi su una riga dedicata)",
tabGroupRowsDescription: "Si applica solo a una barra delle schede superiore o inferiore con raggruppamento attivo: i gruppi occupano una riga dedicata e le schede del gruppo selezionato compaiono nella riga successiva.",
+ linuxFloatingFrame: "Effetto di trasparenza della finestra",
+ linuxFloatingFrameDescription: "Abilita automaticamente i bordi trasparenti sui desktop supportati. Può essere disattivato se la finestra sfarfalla; ha effetto dopo l'applicazione e il riavvio di DBX. Le impostazioni delle variabili d'ambiente hanno la precedenza.",
shortcutExecuteAllSql: "Esegui tutto il SQL",
},
driverStore: {
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 2945566610..15c7739a0b 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -9395,6 +9395,8 @@ export default withEnglishFallback({
tabGroupRowsSingle: "1行",
tabGroupRowsTwoRow: "2行(グループを独立した行に表示)",
tabGroupRowsDescription: "タブバーが上または下に配置されていて、グループ化が有効な場合にのみ適用されます。グループは専用の行に表示され、選択したグループのタブは次の行に表示されます。",
+ linuxFloatingFrame: "ウィンドウの透明効果",
+ linuxFloatingFrameDescription: "サポートされているデスクトップで透明な枠線を自動的に有効にします。ウィンドウがちらつく場合は無効にでき、適用して DBX を再起動すると反映されます。環境変数の設定が優先されます。",
shortcutExecuteAllSql: "すべての SQL を実行",
},
driverStore: {
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index 04f4e91a61..e9a8bef6a0 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -9303,6 +9303,8 @@ export default withEnglishFallback({
tabGroupRowsSingle: "한 줄",
tabGroupRowsTwoRow: "두 줄 (그룹을 별도 줄에 표시)",
tabGroupRowsDescription: "탭 표시줄이 위쪽 또는 아래쪽에 있고 그룹화가 활성화된 경우에만 적용됩니다. 그룹은 별도의 줄에 표시되고 선택한 그룹의 탭은 다음 줄에 표시됩니다.",
+ linuxFloatingFrame: "창 투명 효과",
+ linuxFloatingFrameDescription: "지원되는 데스크톱에서 투명 테두리를 자동으로 활성화합니다. 창이 깜박이면 끌 수 있으며, 적용하고 DBX를 다시 시작한 후 적용됩니다. 환경 변수 설정이 우선합니다.",
shortcutExecuteAllSql: "모든 SQL 실행",
},
driverStore: {
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 8262153803..bfb4158358 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -9355,6 +9355,8 @@ export default withEnglishFallback({
tabGroupRowsSingle: "Uma linha",
tabGroupRowsTwoRow: "Duas linhas (grupos em linha própria)",
tabGroupRowsDescription: "Aplica-se apenas a uma barra de abas no topo ou na base com agrupamento ativado: os grupos ocupam uma linha própria e as abas do grupo selecionado aparecem na linha seguinte.",
+ linuxFloatingFrame: "Efeito de transparência da janela",
+ linuxFloatingFrameDescription: "Ativa automaticamente bordas transparentes em desktops compatíveis. Pode ser desativado se a janela piscar; entra em vigor após aplicar e reiniciar o DBX. As configurações de variáveis de ambiente têm prioridade.",
shortcutExecuteAllSql: "Executar todo o SQL",
},
driverStore: {
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index 9371fec292..24a57f7a2b 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -10786,6 +10786,8 @@ export default withEnglishFallback({
tabGroupRowsSingle: "Одна строка",
tabGroupRowsTwoRow: "Две строки (группы на отдельной строке)",
tabGroupRowsDescription: "Действует только для верхней или нижней панели вкладок с включённой группировкой: группы занимают отдельную строку, а вкладки выбранной группы отображаются на следующей строке.",
+ linuxFloatingFrame: "Эффект прозрачности окна",
+ linuxFloatingFrameDescription: "Автоматически включает прозрачные границы на поддерживаемых рабочих столах. Если окно мерцает, эту функцию можно отключить; изменения вступят в силу после применения и перезапуска DBX. Настройки переменных среды имеют приоритет.",
shortcutExecuteAllSql: "Выполнить весь SQL",
},
driverStore: {
diff --git a/apps/desktop/src/i18n/locales/th.ts b/apps/desktop/src/i18n/locales/th.ts
index 63e189d11c..50ee564149 100644
--- a/apps/desktop/src/i18n/locales/th.ts
+++ b/apps/desktop/src/i18n/locales/th.ts
@@ -11204,6 +11204,8 @@ export default withEnglishFallback({
tabGroupRowsSingle: "แถวเดียว",
tabGroupRowsTwoRow: "สองแถว (กลุ่มแสดงในแถวของตัวเอง)",
tabGroupRowsDescription: "ใช้เฉพาะเมื่อแถบแท็บอยู่ด้านบนหรือด้านล่างและเปิดใช้งานการจัดกลุ่ม: กลุ่มจะแสดงในแถวของตัวเอง และแท็บของกลุ่มที่เลือกจะแสดงในแถวถัดไป",
+ linuxFloatingFrame: "เอฟเฟกต์ความโปร่งใสของหน้าต่าง",
+ linuxFloatingFrameDescription: "เปิดใช้ขอบโปร่งใสโดยอัตโนมัติบนเดสก์ท็อปที่รองรับ หากหน้าต่างกะพริบสามารถปิดได้ มีผลหลังนำไปใช้และรีสตาร์ท DBX การตั้งค่าตัวแปรสภาพแวดล้อมมีลำดับความสำคัญ",
shortcutExecuteAllSql: "เรียกใช้ SQL ทั้งหมด",
},
driverStore: {
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 9971e3f325..3f96824b26 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -9276,6 +9276,8 @@ export default withEnglishFallback({
iconThemeBlack: "黑色",
iconThemeBlackDescription: "应用内使用黑色 DBX 标识。",
iconThemeBlackDescriptionMac: "应用内使用黑色标识;Dock 使用黑色底板,菜单栏跟随系统。",
+ linuxFloatingFrame: "窗口透明效果",
+ linuxFloatingFrameDescription: "在支持的桌面上自动启用透明边框。窗口闪烁时可关闭,应用并重启 DBX 后生效。环境变量设置优先。",
showTrayIcon: "显示系统托盘/菜单栏图标",
showTrayIconDescription: "关闭后不显示图标,但关闭窗口仍会像之前一样隐藏到后台。",
quitOnClose: "关闭窗口时退出程序",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 24c010202d..8148e38e22 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -8704,6 +8704,8 @@ export default withEnglishFallback({
shortcutSelectLineEnds: "選取行尾",
openQueryOnConnectionOpen: "開啟連線時進入查詢頁",
openQueryOnConnectionOpenDescription: "啟用後,開啟連線或資料庫時進入對應的 default.sql 預設查詢,修改自動儲存。",
+ linuxFloatingFrame: "視窗透明效果",
+ linuxFloatingFrameDescription: "在支援的桌面上自動啟用透明邊框。視窗閃爍時可關閉,套用並重新啟動 DBX 後生效。環境變數設定優先。",
},
driverStore: {
jreDirRemoveFailed: "無法刪除舊的 JRE 目錄:{path}(原始錯誤:{error})",
diff --git a/apps/desktop/src/lib/backend/http.ts b/apps/desktop/src/lib/backend/http.ts
index e537a076ee..191e651f94 100644
--- a/apps/desktop/src/lib/backend/http.ts
+++ b/apps/desktop/src/lib/backend/http.ts
@@ -343,6 +343,7 @@ import { uuid } from "@/lib/common/utils";
const DESKTOP_SETTINGS_STORAGE_KEY = "dbx-desktop-settings";
const DEFAULT_DESKTOP_SETTINGS: DesktopSettings = {
show_tray_icon: true,
+ linux_floating_frame_enabled: true,
icon_theme: "default",
quit_on_close: false,
close_action_prompted: false,
diff --git a/apps/desktop/src/lib/backend/tauri.ts b/apps/desktop/src/lib/backend/tauri.ts
index c07f6713a9..c0c1798fe0 100644
--- a/apps/desktop/src/lib/backend/tauri.ts
+++ b/apps/desktop/src/lib/backend/tauri.ts
@@ -319,6 +319,7 @@ export interface DriverRuntimeSummary {
export interface DesktopSettings {
show_tray_icon: boolean;
+ linux_floating_frame_enabled?: boolean;
icon_theme: "default" | "black";
quit_on_close: boolean;
close_action_prompted: boolean;
diff --git a/apps/desktop/src/lib/settings/settingsSearch.ts b/apps/desktop/src/lib/settings/settingsSearch.ts
index 2e3a2bd102..4605fdf091 100644
--- a/apps/desktop/src/lib/settings/settingsSearch.ts
+++ b/apps/desktop/src/lib/settings/settingsSearch.ts
@@ -1,3 +1,4 @@
+import { getPlatform } from "@/lib/backend/platform";
import { SQL_VARIABLE_SYNTAX_KEYS, SQL_VARIABLE_SYNTAX_TOKENS } from "@/lib/sql/sqlVariableSyntax";
import { APP_CUSTOM_UI_COLOR_DEFS } from "@/lib/app/appTheme";
import { MCP_TOOL_OPTIONS, MCP_EXECUTION_MODE_COLUMNS } from "@/lib/mcp/mcpPolicySelection";
@@ -341,6 +342,7 @@ export const SETTINGS_SEARCH_DEFINITIONS: readonly SettingsSearchDefinition[] =
visible: webOnly,
keywordKeys: ["settings.webLogoPositionLeft", "settings.webLogoPositionRight", "settings.webLogoPositionHidden"],
},
+ { id: "appearance-linux-floating-frame", category: "appearance", titleKey: "settings.linuxFloatingFrame", descriptionKey: "settings.linuxFloatingFrameDescription", targetId: "appearance", visible: (context) => !context.isWeb && getPlatform() === "linux" },
{ id: "appearance-tray", category: "appearance", titleKey: "settings.showTrayIcon", descriptionKey: "settings.showTrayIconDescription", targetId: "appearance", visible: desktopOnly },
{ id: "appearance-quit", category: "appearance", titleKey: "settings.quitOnClose", descriptionKey: "settings.quitOnCloseDescription", targetId: "appearance", visible: desktopOnly },
{ id: "about-debug-logs", category: "about", titleKey: "settings.debugLoggingEnabled", descriptionKey: "settings.debugLoggingEnabledDescription", targetId: "about", visible: desktopOnly },
diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts
index 0e677f7e78..ee81a82750 100644
--- a/apps/desktop/src/stores/settingsStore.ts
+++ b/apps/desktop/src/stores/settingsStore.ts
@@ -84,6 +84,7 @@ export type {
export interface DesktopSettings {
show_tray_icon: boolean;
+ linux_floating_frame_enabled?: boolean;
icon_theme: DesktopIconTheme;
quit_on_close: boolean;
close_action_prompted: boolean;
@@ -168,6 +169,7 @@ const SQL_SEMANTIC_DIAGNOSTICS_AUTO_ENABLED = false;
export const DEFAULT_DESKTOP_SETTINGS: DesktopSettings = {
show_tray_icon: true,
+ linux_floating_frame_enabled: true,
icon_theme: "default",
quit_on_close: false,
close_action_prompted: false,
@@ -275,6 +277,7 @@ export function normalizeDesktopSettings(settings: Partial<DesktopSettings> | nu
const iconTheme = settings?.icon_theme === "black" ? "black" : DEFAULT_DESKTOP_SETTINGS.icon_theme;
const sidebarTablePageSize = typeof settings?.sidebar_table_page_size === "number" && settings.sidebar_table_page_size > 0 ? settings.sidebar_table_page_size : DEFAULT_DESKTOP_SETTINGS.sidebar_table_page_size;
return {
+ linux_floating_frame_enabled: settings?.linux_floating_frame_enabled ?? true,
show_tray_icon: settings?.show_tray_icon ?? DEFAULT_DESKTOP_SETTINGS.show_tray_icon,
icon_theme: iconTheme,
quit_on_close: settings?.quit_on_close ?? DEFAULT_DESKTOP_SETTINGS.quit_on_close,
diff --git a/crates/dbx-core/src/persistence/storage.rs b/crates/dbx-core/src/persistence/storage.rs
index 7c55adb7ef..fb59583d67 100644
--- a/crates/dbx-core/src/persistence/storage.rs
+++ b/crates/dbx-core/src/persistence/storage.rs
@@ -452,6 +452,8 @@ pub struct TabRuntimeCachePruneResult {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DesktopSettings {
pub show_tray_icon: bool,
+ #[serde(default = "default_linux_floating_frame_enabled")]
+ pub linux_floating_frame_enabled: bool,
pub icon_theme: DesktopIconTheme,
#[serde(default)]
pub quit_on_close: bool,
@@ -1000,10 +1002,15 @@ pub fn default_duckdb_worker_max_processes() -> usize {
DUCKDB_WORKER_MAX_PROCESSES_DEFAULT
}
+fn default_linux_floating_frame_enabled() -> bool {
+ true
+}
+
impl Default for DesktopSettings {
fn default() -> Self {
Self {
show_tray_icon: true,
+ linux_floating_frame_enabled: true,
icon_theme: DesktopIconTheme::Default,
quit_on_close: false,
close_action_prompted: false,
@@ -5393,6 +5400,10 @@ impl Storage {
pub async fn save_desktop_settings(&self, desktop_settings: &DesktopSettings) -> Result<(), String> {
let mut settings = self.load_app_settings_json().await?;
+ settings.insert(
+ "linux_floating_frame_enabled".to_string(),
+ serde_json::Value::Bool(desktop_settings.linux_floating_frame_enabled),
+ );
settings.remove("run_in_background");
settings.insert("show_tray_icon".to_string(), serde_json::Value::Bool(desktop_settings.show_tray_icon));
settings.insert(
@@ -5482,6 +5493,10 @@ impl Storage {
pub async fn load_desktop_settings(&self) -> Result<DesktopSettings, String> {
let settings = self.load_app_settings_json().await?;
Ok(DesktopSettings {
+ linux_floating_frame_enabled: settings
+ .get("linux_floating_frame_enabled")
+ .and_then(|value| value.as_bool())
+ .unwrap_or(true),
show_tray_icon: settings
.get("show_tray_icon")
.and_then(|value| value.as_bool())
@@ -9434,6 +9449,10 @@ fn apply_desktop_settings_in_tx(
selected_keys: Option<&[String]>,
) -> Result<(), String> {
let mut values = serde_json::Map::new();
+ values.insert(
+ "linux_floating_frame_enabled".to_string(),
+ serde_json::Value::Bool(settings.linux_floating_frame_enabled),
+ );
values.insert("show_tray_icon".to_string(), serde_json::Value::Bool(settings.show_tray_icon));
values.insert("icon_theme".to_string(), serde_json::to_value(settings.icon_theme).map_err(|e| e.to_string())?);
values.insert("quit_on_close".to_string(), serde_json::Value::Bool(settings.quit_on_close));
@@ -13445,6 +13464,7 @@ mod tests {
storage
.save_desktop_settings(&DesktopSettings {
show_tray_icon: false,
+ linux_floating_frame_enabled: true,
icon_theme: DesktopIconTheme::Black,
quit_on_close: true,
close_action_prompted: false,
@@ -13469,6 +13489,7 @@ mod tests {
storage.load_desktop_settings().await.unwrap(),
DesktopSettings {
show_tray_icon: false,
+ linux_floating_frame_enabled: true,
icon_theme: DesktopIconTheme::Black,
quit_on_close: true,
close_action_prompted: false,
@@ -13591,6 +13612,21 @@ mod tests {
);
}
+ #[tokio::test]
+ async fn desktop_settings_persist_linux_floating_frame_preference() {
+ let path = temp_db_path("desktop-settings-linux-floating-frame");
+ let storage = crate::persistence::test_storage::open(&path).await.unwrap();
+ assert!(storage.load_desktop_settings().await.unwrap().linux_floating_frame_enabled);
+ for enabled in [false, true] {
+ let settings = DesktopSettings { linux_floating_frame_enabled: enabled, ..DesktopSettings::default() };
+ storage.save_desktop_settings(&settings).await.unwrap();
+ assert_eq!(storage.load_desktop_settings().await.unwrap().linux_floating_frame_enabled, enabled);
+ }
+ let mut legacy = serde_json::to_value(DesktopSettings::default()).unwrap();
+ legacy.as_object_mut().unwrap().remove("linux_floating_frame_enabled");
+ assert!(serde_json::from_value::<DesktopSettings>(legacy).unwrap().linux_floating_frame_enabled);
+ }
+
#[tokio::test]
async fn desktop_settings_persist_sidebar_table_page_size() {
let path = temp_db_path("desktop-settings-sidebar-page-size");
@@ -13746,6 +13782,7 @@ mod tests {
storage
.save_desktop_settings(&DesktopSettings {
show_tray_icon: false,
+ linux_floating_frame_enabled: true,
icon_theme: DesktopIconTheme::Black,
..DesktopSettings::default()
})
@@ -13758,6 +13795,7 @@ mod tests {
storage.load_desktop_settings().await.unwrap(),
DesktopSettings {
show_tray_icon: false,
+ linux_floating_frame_enabled: true,
icon_theme: DesktopIconTheme::Black,
..DesktopSettings::default()
}
diff --git a/docs/content/docs/faq.cn.mdx b/docs/content/docs/faq.cn.mdx
index c197c32a8f..883a6155b7 100644
--- a/docs/content/docs/faq.cn.mdx
+++ b/docs/content/docs/faq.cn.mdx
@@ -37,7 +37,9 @@ description: DBX 常见问题:连接数据保存在哪里、如何备份、如
在 GNOME 的 Wayland 会话中且系统已开启窗口合成时,Linux 主窗口会绘制带圆角、阴影的浮动边框;X11 下的 GNOME(“GNOME on Xorg”)以及其他桌面(KDE、XFCE、Cinnamon 等)默认使用不透明背景,避免部分显卡驱动与 WebKitGTK 的透明窗口合成兼容问题。两种模式都不会关闭 GPU 加速或改变 Wayland/X11 后端。
-可以通过环境变量覆盖默认行为。在 X11 或其他桌面强制启用浮动边框:
+若窗口闪烁,可在 **设置 → 外观 → 窗口透明效果** 中关闭开关,点击应用并完全退出 DBX(包括托盘)后重新启动。开关默认开启,沿用桌面环境的自动选择规则。
+
+环境变量优先于设置开关。在 X11 或其他桌面强制启用浮动边框:
```bash
DBX_LINUX_FLOATING_FRAME=1 dbx
diff --git a/docs/content/docs/faq.mdx b/docs/content/docs/faq.mdx
index 56e41ccff7..3ee7b05bca 100644
--- a/docs/content/docs/faq.mdx
+++ b/docs/content/docs/faq.mdx
@@ -37,7 +37,9 @@ description: Frequently asked questions about DBX, including where connection da
The Linux main window draws a rounded, shadowed floating frame on GNOME in a Wayland session when a compositing manager is running. GNOME on X11 ("GNOME on Xorg") and other desktops (KDE, XFCE, Cinnamon, ...) use an opaque background by default to avoid transparent-window compositing problems with some graphics driver and WebKitGTK combinations. Neither mode disables GPU acceleration or changes the Wayland/X11 backend.
-The default can be overridden with an environment variable. To force the floating frame on X11 or another desktop:
+If the window flickers, turn off **Settings → Appearance → Window transparency**, apply the change, then fully quit DBX (including its tray process) and restart. The switch is on by default and follows the desktop detection rules.
+
+Environment overrides take priority over the setting. To force the floating frame on X11 or another desktop:
```bash
DBX_LINUX_FLOATING_FRAME=1 dbx
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 404a5f1d07..11c5c9befb 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -189,9 +189,8 @@ pub(crate) fn linux_compositing_available() -> bool {
gtk::gdk::Screen::default().is_some_and(|screen| screen.is_composited())
}
-/// Desktops where the transparent floating frame is known to render correctly. Others (notably
-/// KDE, which shows flickering or missing content with some driver/WebKitGTK combinations) keep
-/// the opaque window unless the user forces the frame on.
+/// Desktops where the floating frame is enabled automatically. Driver/WebKitGTK combinations
+/// can still cause flickering on GNOME, so the saved setting can disable this default.
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
fn linux_desktop_supports_floating_frame(current_desktop: Option<&std::ffi::OsStr>) -> bool {
current_desktop
@@ -199,7 +198,7 @@ fn linux_desktop_supports_floating_frame(current_desktop: Option<&std::ffi::OsSt
.unwrap_or(false)
}
-/// `DBX_LINUX_FLOATING_FRAME=1|0` is an optional override; without it the frame is only used on
+/// `DBX_LINUX_FLOATING_FRAME=1|0` overrides the saved preference; otherwise the frame is only used on
/// GNOME running as a native Wayland client. GNOME on X11 ("GNOME on Xorg") keeps the opaque
/// window: there the transparent WebKitGTK window stays see-through and only repaints the regions
/// that get damaged (e.g. under the mouse).
@@ -209,6 +208,7 @@ fn should_enable_linux_floating_frame(
native_wayland: bool,
override_value: Option<&std::ffi::OsStr>,
current_desktop: Option<&std::ffi::OsStr>,
+ enabled: bool,
) -> bool {
if !compositing {
return false;
@@ -216,14 +216,14 @@ fn should_enable_linux_floating_frame(
match override_value.and_then(|value| value.to_str()) {
Some("1") => true,
Some("0") => false,
- _ => native_wayland && linux_desktop_supports_floating_frame(current_desktop),
+ _ => enabled && native_wayland && linux_desktop_supports_floating_frame(current_desktop),
}
}
/// The Linux config declares the main window with `create: false` so its transparency can
/// depend at runtime on the desktop, the Wayland/X11 session and whether a compositor is available.
#[cfg(target_os = "linux")]
-fn create_linux_main_window(app: &tauri::App) -> tauri::Result<()> {
+fn create_linux_main_window(app: &tauri::App, floating_frame_enabled: bool) -> tauri::Result<()> {
let Some(config) = app.config().app.windows.iter().find(|window| window.label == "main").cloned() else {
return Ok(());
};
@@ -240,6 +240,7 @@ fn create_linux_main_window(app: &tauri::App) -> tauri::Result<()> {
native_wayland,
override_value.as_deref(),
current_desktop.as_deref(),
+ floating_frame_enabled,
);
log::info!(
"[WINDOW] Linux main window compositing={compositing}; native_wayland={native_wayland}; floating_frame={floating_frame}"
@@ -1271,36 +1272,83 @@ mod tests {
#[test]
fn linux_floating_frame_is_enabled_by_default_on_gnome_wayland_only() {
for desktop in ["GNOME", "ubuntu:GNOME", "gnome", "GNOME-Classic:GNOME"] {
- assert!(should_enable_linux_floating_frame(true, true, None, Some(OsStr::new(desktop))), "{desktop}");
+ assert!(should_enable_linux_floating_frame(true, true, None, Some(OsStr::new(desktop)), true), "{desktop}");
}
for desktop in ["KDE", "XFCE", "X-Cinnamon", "sway", "", "GNOMEISH"] {
- assert!(!should_enable_linux_floating_frame(true, true, None, Some(OsStr::new(desktop))), "{desktop}");
+ assert!(
+ !should_enable_linux_floating_frame(true, true, None, Some(OsStr::new(desktop)), true),
+ "{desktop}"
+ );
}
- assert!(!should_enable_linux_floating_frame(true, true, None, None));
+ assert!(!should_enable_linux_floating_frame(true, true, None, None, true));
}
#[test]
fn linux_floating_frame_is_disabled_by_default_on_gnome_x11() {
for desktop in ["GNOME", "ubuntu:GNOME", "GNOME-Classic:GNOME"] {
- assert!(!should_enable_linux_floating_frame(true, false, None, Some(OsStr::new(desktop))), "{desktop}");
+ assert!(
+ !should_enable_linux_floating_frame(true, false, None, Some(OsStr::new(desktop)), true),
+ "{desktop}"
+ );
}
- assert!(should_enable_linux_floating_frame(true, false, Some(OsStr::new("1")), Some(OsStr::new("GNOME"))));
+ assert!(should_enable_linux_floating_frame(
+ true,
+ false,
+ Some(OsStr::new("1")),
+ Some(OsStr::new("GNOME")),
+ true
+ ));
}
#[test]
fn linux_floating_frame_override_wins_over_desktop() {
- assert!(should_enable_linux_floating_frame(true, true, Some(OsStr::new("1")), Some(OsStr::new("KDE"))));
- assert!(!should_enable_linux_floating_frame(true, true, Some(OsStr::new("0")), Some(OsStr::new("GNOME"))));
+ assert!(should_enable_linux_floating_frame(true, true, Some(OsStr::new("1")), Some(OsStr::new("KDE")), true));
+ assert!(!should_enable_linux_floating_frame(
+ true,
+ true,
+ Some(OsStr::new("0")),
+ Some(OsStr::new("GNOME")),
+ true
+ ));
for value in ["", "true", "auto", "01"] {
- assert!(should_enable_linux_floating_frame(true, true, Some(OsStr::new(value)), Some(OsStr::new("GNOME"))));
- assert!(!should_enable_linux_floating_frame(true, true, Some(OsStr::new(value)), Some(OsStr::new("KDE"))));
+ assert!(should_enable_linux_floating_frame(
+ true,
+ true,
+ Some(OsStr::new(value)),
+ Some(OsStr::new("GNOME")),
+ true
+ ));
+ assert!(!should_enable_linux_floating_frame(
+ true,
+ true,
+ Some(OsStr::new(value)),
+ Some(OsStr::new("KDE")),
+ true
+ ));
}
}
#[test]
fn linux_floating_frame_requires_compositing() {
- assert!(!should_enable_linux_floating_frame(false, true, Some(OsStr::new("1")), Some(OsStr::new("GNOME"))));
- assert!(!should_enable_linux_floating_frame(false, true, None, Some(OsStr::new("GNOME"))));
+ assert!(!should_enable_linux_floating_frame(
+ false,
+ true,
+ Some(OsStr::new("1")),
+ Some(OsStr::new("GNOME")),
+ true
+ ));
+ assert!(!should_enable_linux_floating_frame(false, true, None, Some(OsStr::new("GNOME")), true));
+ }
+
+ #[test]
+ fn linux_floating_frame_setting_can_disable_gnome_default() {
+ let desktop = Some(OsStr::new("GNOME"));
+ assert!(!should_enable_linux_floating_frame(true, true, None, desktop, false));
+ assert!(!should_enable_linux_floating_frame(true, true, Some(OsStr::new("auto")), desktop, false));
+ assert!(should_enable_linux_floating_frame(true, true, Some(OsStr::new("1")), desktop, false));
+ assert!(!should_enable_linux_floating_frame(true, true, Some(OsStr::new("0")), desktop, true));
+ assert!(!should_enable_linux_floating_frame(true, false, None, desktop, true));
+ assert!(!should_enable_linux_floating_frame(false, true, Some(OsStr::new("1")), desktop, false));
}
#[test]
@@ -1925,22 +1973,23 @@ pub fn run() {
})
.setup(move |app| {
let setup_start = Instant::now();
- #[cfg(target_os = "linux")]
- create_linux_main_window(app)?;
eprintln!("[STARTUP] plugins registered in {:?}", startup_begin.elapsed());
append_startup_probe(format!("setup entered after {:?}", startup_begin.elapsed()));
- window_state_guard::restore_main_window_state(app.handle());
-
- if should_show_main_window_before_setup_tasks() {
- prepare_main_window_for_display(app.handle());
- show_main_window(app.handle());
- append_startup_probe(format!(
- "early main window show requested; {}",
- main_window_probe_state(app.handle())
- ));
- startup_recovery::report_window_visibility_probe(startup_recovery::probe_main_window_visible(
- app.handle(),
- ));
+ #[cfg(not(target_os = "linux"))]
+ {
+ window_state_guard::restore_main_window_state(app.handle());
+
+ if should_show_main_window_before_setup_tasks() {
+ prepare_main_window_for_display(app.handle());
+ show_main_window(app.handle());
+ append_startup_probe(format!(
+ "early main window show requested; {}",
+ main_window_probe_state(app.handle())
+ ));
+ startup_recovery::report_window_visibility_probe(startup_recovery::probe_main_window_visible(
+ app.handle(),
+ ));
+ }
}
append_startup_probe("resolving app data dir");
@@ -1992,6 +2041,22 @@ pub fn run() {
let migration_gate = Arc::new(migration_gate::MigrationGate::new(migration_ready));
app.manage(migration_gate.clone());
let desktop_settings = tauri::async_runtime::block_on(storage.load_desktop_settings()).unwrap_or_default();
+ #[cfg(target_os = "linux")]
+ {
+ // Transparency must be chosen before creating the native window. Read the saved
+ // preference first so a disabled frame is never briefly shown during startup.
+ create_linux_main_window(app, desktop_settings.linux_floating_frame_enabled)?;
+ window_state_guard::restore_main_window_state(app.handle());
+
+ if should_show_main_window_before_setup_tasks() {
+ prepare_main_window_for_display(app.handle());
+ show_main_window(app.handle());
+ append_startup_probe(format!(
+ "early main window show requested; {}",
+ main_window_probe_state(app.handle())
+ ));
+ }
+ }
app.handle().plugin(
tauri_plugin_log::Builder::default()
.timezone_strategy(tauri_plugin_log::TimezoneStrategy::UseLocal)