feat: Customizable shortcuts/hotkeys (#439)

This implements the logic for allowing hotkeys with modifiers.
Implemented globalhotkeys and videocontrol hotkeys
Also implements saving the forward backwards seconds to the user.

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2025-08-08 16:36:50 +02:00 committed by GitHub
parent 23385d8e62
commit fa30e634b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 1360 additions and 162 deletions

View file

@ -38,6 +38,14 @@ _$VideoPlayerSettingsModelImpl _$$VideoPlayerSettingsModelImplFromJson(
$enumDecode(_$SegmentSkipEnumMap, e)),
) ??
defaultSegmentSkipValues,
hotKeys: (json['hotKeys'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(
$enumDecode(_$VideoHotKeysEnumMap, k),
e == null
? null
: KeyCombination.fromJson(e as Map<String, dynamic>)),
) ??
const {},
);
Map<String, dynamic> _$$VideoPlayerSettingsModelImplToJson(
@ -60,6 +68,8 @@ Map<String, dynamic> _$$VideoPlayerSettingsModelImplToJson(
'audioDevice': instance.audioDevice,
'segmentSkipSettings': instance.segmentSkipSettings.map((k, e) =>
MapEntry(_$MediaSegmentTypeEnumMap[k]!, _$SegmentSkipEnumMap[e]!)),
'hotKeys': instance.hotKeys
.map((k, e) => MapEntry(_$VideoHotKeysEnumMap[k]!, e)),
};
const _$BoxFitEnumMap = {
@ -123,3 +133,19 @@ const _$MediaSegmentTypeEnumMap = {
MediaSegmentType.outro: 'outro',
MediaSegmentType.intro: 'intro',
};
const _$VideoHotKeysEnumMap = {
VideoHotKeys.playPause: 'playPause',
VideoHotKeys.seekForward: 'seekForward',
VideoHotKeys.seekBack: 'seekBack',
VideoHotKeys.mute: 'mute',
VideoHotKeys.volumeUp: 'volumeUp',
VideoHotKeys.volumeDown: 'volumeDown',
VideoHotKeys.nextVideo: 'nextVideo',
VideoHotKeys.prevVideo: 'prevVideo',
VideoHotKeys.nextChapter: 'nextChapter',
VideoHotKeys.prevChapter: 'prevChapter',
VideoHotKeys.fullScreen: 'fullScreen',
VideoHotKeys.skipMediaSegment: 'skipMediaSegment',
VideoHotKeys.exit: 'exit',
};