feat: raise maximum volume (#384)
* feat: raise maximum volume * feat: raise maximum volume * feat: raise maximum volume * feat: add volume settings menu * feat: move binding * Update modules/menus/audio/active/SelectedPlayback.ts Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com> --------- Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
@@ -2,6 +2,9 @@ const audio = await Service.import('audio');
|
||||
import { getIcon } from '../utils.js';
|
||||
import Box from 'types/widgets/box.js';
|
||||
import { Attribute, Child } from 'lib/types/widget.js';
|
||||
import options from 'options';
|
||||
|
||||
const { raiseMaximumVolume } = options.menus.volume;
|
||||
|
||||
const renderActivePlayback = (): Box<Child, Attribute>[] => {
|
||||
return [
|
||||
@@ -52,6 +55,11 @@ const renderActivePlayback = (): Box<Child, Attribute>[] => {
|
||||
min: 0,
|
||||
max: 1,
|
||||
onChange: ({ value }) => (audio.speaker.volume = value),
|
||||
setup: (self) => {
|
||||
self.hook(raiseMaximumVolume, () => {
|
||||
self.max = raiseMaximumVolume.value ? 1.5 : 1;
|
||||
});
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
|
||||
@@ -1054,6 +1054,9 @@ const options = mkOptions(OPTIONS, {
|
||||
menus: {
|
||||
transition: opt<Transition>('crossfade'),
|
||||
transitionTime: opt(200),
|
||||
volume: {
|
||||
raiseMaximumVolume: opt(false),
|
||||
},
|
||||
power: {
|
||||
showLabel: opt(true),
|
||||
confirmation: opt(true),
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --config .eslintrc.js .",
|
||||
"lint:fix": "eslint --config .eslintrc.js .",
|
||||
"lint:fix": "eslint --config .eslintrc.js . --fix",
|
||||
"format": "prettier --write 'modules/**/*.ts'"
|
||||
},
|
||||
"keywords": [],
|
||||
|
||||
@@ -7,6 +7,7 @@ import { OSDSettings } from './osd/index';
|
||||
import { CustomModuleSettings } from 'customModules/config';
|
||||
import { PowerMenuSettings } from './menus/power';
|
||||
import { GBox } from 'lib/types/widget';
|
||||
import { VolumeMenuSettings } from './menus/volume';
|
||||
|
||||
type Page =
|
||||
| 'General'
|
||||
@@ -14,6 +15,7 @@ type Page =
|
||||
| 'Clock Menu'
|
||||
| 'Dashboard Menu'
|
||||
| 'Power Menu'
|
||||
| 'Volume'
|
||||
| 'Notifications'
|
||||
| 'OSD'
|
||||
| 'Custom Modules';
|
||||
@@ -26,6 +28,7 @@ const pagerMap: Page[] = [
|
||||
'Notifications',
|
||||
'OSD',
|
||||
'Power Menu',
|
||||
'Volume',
|
||||
'Clock Menu',
|
||||
'Dashboard Menu',
|
||||
'Custom Modules',
|
||||
@@ -57,6 +60,7 @@ export const SettingsMenu = (): GBox => {
|
||||
Bar: BarSettings(),
|
||||
Notifications: NotificationSettings(),
|
||||
OSD: OSDSettings(),
|
||||
Volume: VolumeMenuSettings(),
|
||||
'Clock Menu': ClockMenuSettings(),
|
||||
'Dashboard Menu': DashboardMenuSettings(),
|
||||
'Custom Modules': CustomModuleSettings(),
|
||||
|
||||
24
widget/settings/pages/config/menus/volume.ts
Normal file
24
widget/settings/pages/config/menus/volume.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Option } from 'widget/settings/shared/Option';
|
||||
import { Header } from 'widget/settings/shared/Header';
|
||||
|
||||
import options from 'options';
|
||||
import Scrollable from 'types/widgets/scrollable';
|
||||
import { Attribute, Child } from 'lib/types/widget';
|
||||
|
||||
export const VolumeMenuSettings = (): Scrollable<Child, Attribute> => {
|
||||
return Widget.Scrollable({
|
||||
vscroll: 'automatic',
|
||||
child: Widget.Box({
|
||||
class_name: 'bar-theme-page paged-container',
|
||||
vertical: true,
|
||||
children: [
|
||||
Header('Volume'),
|
||||
Option({
|
||||
opt: options.menus.volume.raiseMaximumVolume,
|
||||
title: 'Allow Raising Volume Above 100%',
|
||||
type: 'boolean',
|
||||
}),
|
||||
],
|
||||
}),
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user