diff --git a/webui/src/api/ksu.js b/webui/src/api/ksu.js index f794f22..fe22238 100644 --- a/webui/src/api/ksu.js +++ b/webui/src/api/ksu.js @@ -1,4 +1,4 @@ -import { exec, moduleInfo, enableEdgeToEdge } from 'kernelsu' +import { exec, moduleInfo } from 'kernelsu' import { devMock } from './devMock.js' export const MODULE_DIR = '/data/adb/modules/LuminPro' @@ -42,13 +42,19 @@ export function shellQuote(value) { } /** - * 启用 edge-to-edge:内容延伸至状态栏/手势条区域, - * insets.css 的 --window-inset-* 随之生效,顶栏/底栏据此避让。 - * 不同 KernelSU 版本的命名不同,逐个尝试,全部不可用则忽略。 + * 启用 edge-to-edge:内容延伸至状态栏/手势条区域,insets.css 的 + * --window-inset-* / --safe-area-inset-* 随之生效。 + * + * 注意:不能直接调用从 npm 包 import 的 enableEdgeToEdge——该绑定总是存在, + * 不支持时是包内部调用 ksu 对象时抛错,会打断后续脚本(FontMM 踩过同样的坑)。 + * 这里改为探测全局 ksu 对象,并兼容 KernelSU-Next 的 enableInsets 命名。 */ export function applyEdgeToEdge() { try { - enableEdgeToEdge(true) + const ksuApi = globalThis.ksu + if (!ksuApi) return + const fn = ksuApi.enableEdgeToEdge ?? ksuApi.enableInsets + if (typeof fn === 'function') fn.call(ksuApi, true) } catch { /* 老版本没有该 API:布局仍可用,只是安全区取 0 */ } diff --git a/webui/src/components/AppBottomNav.vue b/webui/src/components/AppBottomNav.vue index 67fb7cc..c34248f 100644 --- a/webui/src/components/AppBottomNav.vue +++ b/webui/src/components/AppBottomNav.vue @@ -16,16 +16,18 @@ const tabs = [ diff --git a/webui/src/theme/app.css b/webui/src/theme/app.css index dc4621b..1832a39 100644 --- a/webui/src/theme/app.css +++ b/webui/src/theme/app.css @@ -138,10 +138,16 @@ } /* ── M3 导航栏 ────────────────────────────────────────────────────── */ -md-navigation-bar { +/* 底栏容器:色块填充法——容器背景延伸至屏幕最底部,手势导航条区域 + 与导航栏同色;内边距把导航内容抬到手势条之上。 + 安全区变量在不同 KernelSU 版本命名不同,最后兜底 env()。 */ +.bottom-nav { flex: 0 0 auto; - /* 背景延伸到屏幕底部,内容抬到手势条之上 */ - padding-bottom: var(--safe-area-inset-bottom, var(--window-inset-bottom, 0px)); + background-color: var(--md-sys-color-surface-container); + padding-bottom: var(--safe-area-inset-bottom, var(--window-inset-bottom, env(safe-area-inset-bottom, 0px))); +} + +md-navigation-bar { --md-navigation-bar-container-color: var(--md-sys-color-surface-container); --md-navigation-bar-active-indicator-color: var(--md-sys-color-secondary-container); --md-navigation-bar-active-icon-color: var(--md-sys-color-on-secondary-container);