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

View File

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

View File

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