Skip to content

Commit

Permalink
新增:投屏时关闭屏幕
Browse files Browse the repository at this point in the history
  • Loading branch information
modstart committed Jan 14, 2025
1 parent 75cf44d commit 34dbe0f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 33 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## v0.4.0

- 新增:投屏时关闭屏幕
- 新增:工单反馈功能,便于解决问题
- 新增:应用 loading 窗口
- 新增:添加文件夹下载功能 [#pr-43](https://github.com/modstart-lib/linkandroid/pull/43)
Expand All @@ -8,6 +9,7 @@
- 优化:工单提交日志收集完善更多信息,方便排查问题
- 优化:将已连接的设备排在最前面,剩下的按照id排序 [#pr-42](https://github.com/modstart-lib/linkandroid/pull/42/files)
- 优化:toast 和 loading 显示位置优化
- 优化:修复文件管理页面的输入窗口焦点问题 [#pr-44](https://github.com/modstart-lib/linkandroid/pull/44)
- 修复:windows下路径编码问题
- 修复:版本号对比检测异常问题修复

Expand Down
12 changes: 6 additions & 6 deletions src/components/Device/DeviceDefaultSettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ defineExpose({
<div class="font-bold text-xl mb-3">
{{ $t('投屏') }}
</div>
<!-- <div class="flex mb-3">-->
<!-- <div class="flex-grow">{{ $t('投屏时调暗屏幕') }}</div>-->
<!-- <div class="">-->
<!-- <SettingItemYesNo v-model="formData.dimWhenMirror"/>-->
<!-- </div>-->
<!-- </div>-->
<div class="flex mb-3">
<div class="flex-grow">{{ $t('投屏时关闭屏幕') }}</div>
<div class="">
<SettingItemYesNo v-model="formData.dimWhenMirror"/>
</div>
</div>
<div class="flex mb-3">
<div class="flex-grow">{{ $t('投屏总在最上层') }}</div>
<div class="">
Expand Down
15 changes: 8 additions & 7 deletions src/components/Device/DeviceSettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ defineExpose({
<div class="font-bold text-xl mb-3">
{{ $t('投屏') }}
</div>
<!-- <div class="flex mb-3">-->
<!-- <div class="flex-grow">{{ $t('投屏时调暗屏幕') }}</div>-->
<!-- <div class="">-->
<!-- <SettingItemYesNoDefault v-model="formData.dimWhenMirror"/>-->
<!-- </div>-->
<!-- </div>-->
<div class="flex mb-3">
<div class="flex-grow">{{ $t('投屏时关闭屏幕') }}</div>
<div class="">
<SettingItemYesNoDefault v-model="formData.dimWhenMirror"/>
</div>
</div>
<div class="flex mb-3">
<div class="flex-grow">{{ $t('投屏总在最上层') }}</div>
<div class="">
Expand All @@ -107,7 +107,8 @@ defineExpose({
<div class="flex mb-3">
<div class="flex-grow">{{ $t('视频比特率') }}</div>
<div class="">
<a-input v-model="formData.videoBitRate" size="small" :placeholder="$t('留空使用默认配置')"/>
<a-input v-model="formData.videoBitRate" size="small"
:placeholder="$t('留空使用默认配置')"/>
</div>
</div>
<div class="flex mb-3">
Expand Down
2 changes: 1 addition & 1 deletion src/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
"4a52703c": "Default Setting",
"4b9352c5": "Recorded %s",
"4c2d6613": "Add as network device",
"4f59d0b6": "Dim screen",
"4f59d0b6": "Close screen when mirror",
"4f997a55": "Delete",
"508513f9": "Are you sure you want to delete the selected files?",
"59950117": "Leave blank to use default",
Expand Down
2 changes: 1 addition & 1 deletion src/lang/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"投屏到电脑": "6793a9ee",
"投屏总在最上层": "196deb0f",
"投屏成功": "2e36d069",
"投屏时调暗屏幕": "4f59d0b6",
"投屏时关闭屏幕": "4f59d0b6",
"投屏时转发声音": "0ec1e5c8",
"按修改时间排序": "0cfe724f",
"按文件名排序": "44fde40e",
Expand Down
2 changes: 1 addition & 1 deletion src/lang/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"4b9352c5": "已录制 %s",
"4c2d6613": "添加为网络设备",
"4e980c75": "正在连接设备",
"4f59d0b6": "投屏时调暗屏幕",
"4f59d0b6": "投屏时关闭屏幕",
"4f997a55": "delete",
"508513f9": "确定删除选中的文件吗?",
"53f5fcc1": "支持的命令:",
Expand Down
20 changes: 3 additions & 17 deletions src/store/modules/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,27 +278,13 @@ export const deviceStore = defineStore("device", {
if (setting.maxFps) {
args.push(`--max-fps="${setting.maxFps}"`)
}
if (setting.dimWhenMirror === 'yes') {
args.push('--turn-screen-off')
}

const mirrorStart = async () => {
if ('yes' === setting.dimWhenMirror) {
try {
const result = await window.$mapi.adb.adbShell('shell settings get system screen_brightness', device.id)
// @ts-ignore
device.runtime.screenBrightness = parseInt(result?.stdout)
console.log('screenBrightness.backup', device.runtime.screenBrightness)
await window.$mapi.adb.adbShell('shell settings put system screen_brightness 1', device.id)
} catch (e) {
console.error('dimWhenMirror.error', e)
}
}
}
const mirrorEnd = async () => {
if ('yes' === setting.dimWhenMirror) {
// console.log('screenBrightness.restore', device.runtime.screenBrightness)
if (device.runtime.screenBrightness) {
await window.$mapi.adb.adbShell(`shell settings put system screen_brightness ${device.runtime.screenBrightness}`, device.id)
}
}
}
try {
runtime.value.mirrorController = await window.$mapi.scrcpy.mirror(device.id, {
Expand Down

0 comments on commit 34dbe0f

Please sign in to comment.