feat(Sidebar): set screen mode

This commit is contained in:
AkiChase 2024-04-30 21:05:17 +08:00
parent 95b302c39f
commit 63fa9eb73c
3 changed files with 25 additions and 8 deletions

View File

@ -2,9 +2,7 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": [
"main"
],
"windows": ["main"],
"permissions": [
"event:default",
"window:default",
@ -27,6 +25,8 @@
"clipboard-manager:default",
"clipboard-manager:allow-write-text",
"process:default",
"process:allow-restart"
"process:allow-restart",
"webview:default",
"webview:allow-internal-toggle-devtools"
]
}
}

View File

@ -9,22 +9,30 @@ import {
VolumeLowOutline,
StopOutline,
ListOutline,
BulbOutline,
Bulb,
} from "@vicons/ionicons5";
import { Keyboard24Regular } from "@vicons/fluent";
import { NIcon, useMessage } from "naive-ui";
import { useGlobalStore } from "../store/global";
import { sendInjectKeycode } from "../frontcommand/controlMsg";
import {
sendInjectKeycode,
sendSetScreenPowerMode,
} from "../frontcommand/controlMsg";
import {
AndroidKeyEventAction,
AndroidKeycode,
AndroidMetastate,
} from "../frontcommand/android";
import { ref } from "vue";
const router = useRouter();
const route = useRoute();
const store = useGlobalStore();
const message = useMessage();
const nextScreenPowerMode = ref(0);
function nav(name: string) {
router.replace({ name });
}
@ -88,6 +96,17 @@ async function sendKeyCodeToDevice(code: AndroidKeycode) {
</div>
<div class="nav">
<div
@click="
sendSetScreenPowerMode({ mode: nextScreenPowerMode });
nextScreenPowerMode = nextScreenPowerMode ? 0 : 2;
"
>
<NIcon>
<Bulb v-if="nextScreenPowerMode" />
<BulbOutline v-else />
</NIcon>
</div>
<div @click="sendKeyCodeToDevice(AndroidKeycode.AKEYCODE_VOLUME_UP)">
<NIcon>
<VolumeHighOutline />

View File

@ -18,8 +18,6 @@ import { DropdownOption, NDropdown, useDialog, useMessage } from "naive-ui";
import { onBeforeRouteLeave } from "vue-router";
import { useKeyboardStore } from "../../store/keyboard";
// TODO
// TODO
// TODO 线rustconnet
const store = useGlobalStore();