Skip to content

Commit bc74bce

Browse files
committed
➕ Add keep alive in presentation mode
1 parent 7cf99e1 commit bc74bce

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

frontend/src/modals/SetlistPresent.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ import { injectStrict, hkBackKey, hkCancelKey, hkDownKey, hkForwardKey, hkHideKe
210210
import 'vue3-carousel/dist/carousel.css';
211211
import { Carousel, Slide, type CarouselExposed } from 'vue3-carousel';
212212
import { logicOr } from '@vueuse/math';
213-
import { whenever } from '@vueuse/core';
213+
import { useWakeLock, whenever } from '@vueuse/core';
214214
import { ref, computed, watch, onMounted, onUnmounted, nextTick, type PropType } from 'vue';
215215
import { useI18n } from 'vue-i18n';
216216
import type { SetlistSongPresentation } from '@/definitions';
@@ -363,6 +363,13 @@ watch (() => props.remoteHide, (val: boolean) => {
363363
}
364364
});
365365
366+
// keep the screen awake while presenting
367+
const { request: requestWakeLock, release: releaseWakeLock } = useWakeLock();
368+
watch(() => props.active, (isActive) => {
369+
if (isActive) requestWakeLock('screen');
370+
else releaseWakeLock();
371+
}, { immediate: true });
372+
366373
// handle mount / unmount hooks
367374
onMounted(() => {
368375
// alternate colon visibility of clock each second

frontend/src/modals/SongPresent.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<script setup lang="ts">
4848
import { injectStrict, hkCancelKey, hkThemeKey } from '@/keys';
4949
import { ref, watch, onMounted, onUnmounted, nextTick, type PropType } from 'vue';
50-
import { whenever } from '@vueuse/core';
50+
import { useWakeLock, whenever } from '@vueuse/core';
5151
import { useI18n } from 'vue-i18n';
5252
import ModalDialog from '@/elements/ModalDialog.vue';
5353
import SecondaryButton from '@/elements/SecondaryButton.vue';
@@ -122,6 +122,13 @@ watch (
122122
() => maximizeFontsize()
123123
);
124124
125+
// keep the screen awake while presenting
126+
const { request: requestWakeLock, release: releaseWakeLock } = useWakeLock();
127+
watch(() => props.active, (isActive) => {
128+
if (isActive) requestWakeLock('screen');
129+
else releaseWakeLock();
130+
}, { immediate: true });
131+
125132
// handle mount / unmount hooks
126133
onMounted(() => {
127134
// handle viewport resizes

0 commit comments

Comments
 (0)