mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
ui: 移除状态页「自动亮度调节」开关
- 删除 StatusView 开关行及 useStatus 中的读写与 mock 逻辑 - 清理 components.css 死样式;模块的自动亮度休眠策略不受影响
This commit is contained in:
1 parent
5fb8e9b87d
commit
c22e90589e
4 files changed
+1
-46
No files matched your search
@@ -500,22 +500,6 @@ input:checked + .slider:before {
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Auto Brightness Row */
|
||||
.auto-brightness-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: var(--spacing-s) var(--spacing-m);
|
||||
background-color: rgba(var(--md-sys-color-primary-rgb), 0.08);
|
||||
border-radius: var(--border-radius-s);
|
||||
}
|
||||
|
||||
.auto-brightness-label {
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
.unsaved-dot {
|
||||
display: inline-block;
|
||||
|
||||
@@ -33,9 +33,6 @@ export function useStatus() {
|
||||
const hdrRatio = ref('—')
|
||||
const sleepStatus = ref('—')
|
||||
|
||||
// 自动亮度
|
||||
const autoBriMode = ref(false)
|
||||
|
||||
// 缓存配置字段(避免每次刷新都 readConfig)
|
||||
let _nowBriFile = null
|
||||
let _sysMaxBriFile = null
|
||||
@@ -62,12 +59,11 @@ export function useStatus() {
|
||||
|
||||
// 所有 Shell 命令一次并发,消除多轮顺序等待
|
||||
// PID + 进程状态合并为一条命令以减少 exec 次数
|
||||
const [pidStateRes, stopRes, autoBriRes, hdrRes, cBriRes, sBriRes] = await Promise.all([
|
||||
const [pidStateRes, stopRes, hdrRes, cBriRes, sBriRes] = await Promise.all([
|
||||
runCmd(
|
||||
`PID=$(cat "${PID_FILE}" 2>/dev/null || true); printf '%s\\n' "$PID"; [ -n "$PID" ] && grep '^State:' "/proc/$PID/status" 2>/dev/null | awk '{print $2}' || true`,
|
||||
),
|
||||
runCmd(`[ -f "${STOP_FLAG_FILE}" ] && echo "1" || echo "0"`),
|
||||
runCmd(`settings get system screen_brightness_mode`),
|
||||
runCmd(
|
||||
`dumpsys display 2>/dev/null | sed -n 's/.*hdrSdrRatio \\([0-9.]*\\).*/\\1/p' | head -n 1`,
|
||||
),
|
||||
@@ -89,8 +85,6 @@ export function useStatus() {
|
||||
inotifydPid.value = pidStr || '离线'
|
||||
inotifydState.value = isRunning.value ? stateChar || '已退出' : '离线'
|
||||
|
||||
autoBriMode.value = autoBriRes.errno === 0 && parseInt(autoBriRes.stdout.trim(), 10) === 1
|
||||
|
||||
const hdrRaw = hdrRes.errno === 0 ? hdrRes.stdout.trim() : ''
|
||||
hdrRatio.value = hdrRaw && /^\d+(\.\d+)?$/.test(hdrRaw) ? parseFloat(hdrRaw).toFixed(2) : '-'
|
||||
|
||||
@@ -136,17 +130,6 @@ export function useStatus() {
|
||||
}
|
||||
}
|
||||
|
||||
async function setAutoBrightness(enabled, toast) {
|
||||
const mode = enabled ? 1 : 0
|
||||
const res = await runCmd(`settings put system screen_brightness_mode ${mode}`)
|
||||
if (res.errno === 0) {
|
||||
autoBriMode.value = enabled
|
||||
toast(enabled ? '自动亮度已启用' : '手动亮度已启用')
|
||||
} else {
|
||||
toast('设置失败: ' + (res.stderr || '未知错误'))
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
currentBri,
|
||||
sysMaxBri,
|
||||
@@ -158,12 +141,10 @@ export function useStatus() {
|
||||
statusText,
|
||||
hdrRatio,
|
||||
sleepStatus,
|
||||
autoBriMode,
|
||||
load,
|
||||
invalidatePaths,
|
||||
toggleService,
|
||||
restartService,
|
||||
setBrightness,
|
||||
setAutoBrightness,
|
||||
}
|
||||
}
|
||||
@@ -49,8 +49,6 @@ export async function runCmd(cmd) {
|
||||
// 状态模拟
|
||||
if (cmd.includes('cat') && cmd.includes('inotifyd.pid'))
|
||||
return { errno: 0, stdout: '12345', stderr: '' }
|
||||
if (cmd.includes('settings get system screen_brightness_mode'))
|
||||
return { errno: 0, stdout: '1', stderr: '' }
|
||||
if (cmd.includes('[ -f') && cmd.includes('stop.flag'))
|
||||
return { errno: 0, stdout: '0', stderr: '' }
|
||||
if (cmd.includes('cat') && (cmd.includes('brightness') || cmd.includes('now_bri')))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup>
|
||||
import { inject, computed, ref } from 'vue'
|
||||
import Button from '@/components/ui/Button.vue'
|
||||
import Switch from '@/components/ui/Switch.vue'
|
||||
import Badge from '@/components/ui/Badge.vue'
|
||||
import {
|
||||
RefreshCw,
|
||||
@@ -110,13 +109,6 @@ const statusItems = computed(() => [
|
||||
/>
|
||||
<span class="brightness-label">100%</span>
|
||||
</div>
|
||||
<div class="auto-brightness-row">
|
||||
<span class="auto-brightness-label">自动亮度调节</span>
|
||||
<Switch
|
||||
:model-value="status.autoBriMode.value"
|
||||
@update:model-value="status.setAutoBrightness($event, showToast)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
Reference in new issue
Block a user