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 { getIcon } from '../utils.js';
|
||||||
import Box from 'types/widgets/box.js';
|
import Box from 'types/widgets/box.js';
|
||||||
import { Attribute, Child } from 'lib/types/widget.js';
|
import { Attribute, Child } from 'lib/types/widget.js';
|
||||||
|
import options from 'options';
|
||||||
|
|
||||||
|
const { raiseMaximumVolume } = options.menus.volume;
|
||||||
|
|
||||||
const renderActivePlayback = (): Box<Child, Attribute>[] => {
|
const renderActivePlayback = (): Box<Child, Attribute>[] => {
|
||||||
return [
|
return [
|
||||||
@@ -52,6 +55,11 @@ const renderActivePlayback = (): Box<Child, Attribute>[] => {
|
|||||||
min: 0,
|
min: 0,
|
||||||
max: 1,
|
max: 1,
|
||||||
onChange: ({ value }) => (audio.speaker.volume = value),
|
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: {
|
menus: {
|
||||||
transition: opt<Transition>('crossfade'),
|
transition: opt<Transition>('crossfade'),
|
||||||
transitionTime: opt(200),
|
transitionTime: opt(200),
|
||||||
|
volume: {
|
||||||
|
raiseMaximumVolume: opt(false),
|
||||||
|
},
|
||||||
power: {
|
power: {
|
||||||
showLabel: opt(true),
|
showLabel: opt(true),
|
||||||
confirmation: opt(true),
|
confirmation: opt(true),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint --config .eslintrc.js .",
|
"lint": "eslint --config .eslintrc.js .",
|
||||||
"lint:fix": "eslint --config .eslintrc.js .",
|
"lint:fix": "eslint --config .eslintrc.js . --fix",
|
||||||
"format": "prettier --write 'modules/**/*.ts'"
|
"format": "prettier --write 'modules/**/*.ts'"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { OSDSettings } from './osd/index';
|
|||||||
import { CustomModuleSettings } from 'customModules/config';
|
import { CustomModuleSettings } from 'customModules/config';
|
||||||
import { PowerMenuSettings } from './menus/power';
|
import { PowerMenuSettings } from './menus/power';
|
||||||
import { GBox } from 'lib/types/widget';
|
import { GBox } from 'lib/types/widget';
|
||||||
|
import { VolumeMenuSettings } from './menus/volume';
|
||||||
|
|
||||||
type Page =
|
type Page =
|
||||||
| 'General'
|
| 'General'
|
||||||
@@ -14,6 +15,7 @@ type Page =
|
|||||||
| 'Clock Menu'
|
| 'Clock Menu'
|
||||||
| 'Dashboard Menu'
|
| 'Dashboard Menu'
|
||||||
| 'Power Menu'
|
| 'Power Menu'
|
||||||
|
| 'Volume'
|
||||||
| 'Notifications'
|
| 'Notifications'
|
||||||
| 'OSD'
|
| 'OSD'
|
||||||
| 'Custom Modules';
|
| 'Custom Modules';
|
||||||
@@ -26,6 +28,7 @@ const pagerMap: Page[] = [
|
|||||||
'Notifications',
|
'Notifications',
|
||||||
'OSD',
|
'OSD',
|
||||||
'Power Menu',
|
'Power Menu',
|
||||||
|
'Volume',
|
||||||
'Clock Menu',
|
'Clock Menu',
|
||||||
'Dashboard Menu',
|
'Dashboard Menu',
|
||||||
'Custom Modules',
|
'Custom Modules',
|
||||||
@@ -57,6 +60,7 @@ export const SettingsMenu = (): GBox => {
|
|||||||
Bar: BarSettings(),
|
Bar: BarSettings(),
|
||||||
Notifications: NotificationSettings(),
|
Notifications: NotificationSettings(),
|
||||||
OSD: OSDSettings(),
|
OSD: OSDSettings(),
|
||||||
|
Volume: VolumeMenuSettings(),
|
||||||
'Clock Menu': ClockMenuSettings(),
|
'Clock Menu': ClockMenuSettings(),
|
||||||
'Dashboard Menu': DashboardMenuSettings(),
|
'Dashboard Menu': DashboardMenuSettings(),
|
||||||
'Custom Modules': CustomModuleSettings(),
|
'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