Added the ability to adjust application specific audio levels. (#608)
* Added a playback volume module in audio menu. * Finish playback source volume adjuster.
This commit is contained in:
@@ -8,11 +8,11 @@ import AstalHyprland from 'gi://AstalHyprland?version=0.1';
|
||||
* This function searches for a matching window title in the predefined `windowTitleMap` based on the class of the provided window.
|
||||
* If a match is found, it returns an object containing the icon and label for the window. If no match is found, it returns a default icon and label.
|
||||
*
|
||||
* @param windowtitle The window object containing the class information.
|
||||
* @param client The window object containing the class information.
|
||||
*
|
||||
* @returns An object containing the icon and label for the window.
|
||||
*/
|
||||
export const getWindowMatch = (windowtitle: AstalHyprland.Client): Record<string, string> => {
|
||||
export const getWindowMatch = (client: AstalHyprland.Client): Record<string, string> => {
|
||||
const windowTitleMap = [
|
||||
// user provided values
|
||||
...options.bar.windowtitle.title_map.get(),
|
||||
@@ -119,17 +119,17 @@ export const getWindowMatch = (windowtitle: AstalHyprland.Client): Record<string
|
||||
['^$', '', 'Desktop'],
|
||||
|
||||
// Fallback icon
|
||||
['(.+)', '', `${capitalizeFirstLetter(windowtitle?.class ?? 'Unknown')}`],
|
||||
['(.+)', '', `${capitalizeFirstLetter(client?.class ?? 'Unknown')}`],
|
||||
];
|
||||
|
||||
if (!windowtitle?.class) {
|
||||
if (!client?.class) {
|
||||
return {
|
||||
icon: '',
|
||||
label: 'Desktop',
|
||||
};
|
||||
}
|
||||
|
||||
const foundMatch = windowTitleMap.find((wt) => RegExp(wt[0]).test(windowtitle?.class.toLowerCase()));
|
||||
const foundMatch = windowTitleMap.find((wt) => RegExp(wt[0]).test(client?.class.toLowerCase()));
|
||||
|
||||
if (!foundMatch || foundMatch.length !== 3) {
|
||||
return {
|
||||
@@ -157,13 +157,12 @@ export const getWindowMatch = (windowtitle: AstalHyprland.Client): Record<string
|
||||
* @returns The title of the window as a string.
|
||||
*/
|
||||
export const getTitle = (client: AstalHyprland.Client, useCustomTitle: boolean, useClassName: boolean): string => {
|
||||
if (client === null) return getWindowMatch(client).label;
|
||||
|
||||
if (useCustomTitle) return getWindowMatch(client).label;
|
||||
if (useClassName) return client.class;
|
||||
if (client === null || useCustomTitle) return getWindowMatch(client).label;
|
||||
|
||||
const title = client.title;
|
||||
// If the title is empty or only filled with spaces, fallback to the class name
|
||||
|
||||
if (!title || useClassName) return client.class;
|
||||
|
||||
if (title.length === 0 || title.match(/^ *$/)) {
|
||||
return client.class;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ export const WorkspaceModule = ({ monitor }: WorkspaceModuleProps): JSX.Element
|
||||
self.toggleClassName('active', activeWorkspace === wsId);
|
||||
self.toggleClassName(
|
||||
'occupied',
|
||||
(hyprlandService.get_workspace(wsId)?.get_clients().length || 0) > 0,
|
||||
(hyprlandService.get_workspace(wsId)?.get_clients()?.length || 0) > 0,
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -140,7 +140,10 @@ export const CustomModuleSettings = (): JSX.Element => {
|
||||
<Option
|
||||
opt={options.bar.customModules.netstat.networkInterface}
|
||||
title="Network Interface"
|
||||
subtitle="Wiki: https://hyprpanel.com/configuration/panel.html#custom-modules"
|
||||
subtitle={
|
||||
'Name of the network interface to poll.\n' +
|
||||
"HINT: Get a list of interfaces with 'cat /proc/net/dev"
|
||||
}
|
||||
type="string"
|
||||
/>
|
||||
<Option
|
||||
@@ -280,6 +283,79 @@ export const CustomModuleSettings = (): JSX.Element => {
|
||||
<Option opt={options.bar.customModules.weather.middleClick} title="Middle Click" type="string" />
|
||||
<Option opt={options.bar.customModules.weather.scrollUp} title="Scroll Up" type="string" />
|
||||
<Option opt={options.bar.customModules.weather.scrollDown} title="Scroll Down" type="string" />
|
||||
|
||||
{/* Hyprsunset Section */}
|
||||
<Header title="Hyprsunset" />
|
||||
<Option
|
||||
opt={options.bar.customModules.hyprsunset.temperature}
|
||||
title="Temperature"
|
||||
subtitle="Ex: 1000k, 2000k, 5000k, etc."
|
||||
type="string"
|
||||
/>
|
||||
<Option
|
||||
opt={options.theme.bar.buttons.modules.hyprsunset.enableBorder}
|
||||
title="Button Border"
|
||||
type="boolean"
|
||||
/>
|
||||
<Option opt={options.bar.customModules.hyprsunset.onIcon} title="Enabled Icon" type="string" />
|
||||
<Option opt={options.bar.customModules.hyprsunset.offIcon} title="Disabled Icon" type="string" />
|
||||
<Option opt={options.bar.customModules.hyprsunset.onLabel} title="Enabled Label" type="string" />
|
||||
<Option opt={options.bar.customModules.hyprsunset.offLabel} title="Disabled Label" type="string" />
|
||||
<Option opt={options.bar.customModules.hyprsunset.label} title="Show Label" type="boolean" />
|
||||
<Option opt={options.theme.bar.buttons.modules.hyprsunset.spacing} title="Spacing" type="string" />
|
||||
<Option
|
||||
opt={options.bar.customModules.hyprsunset.pollingInterval}
|
||||
title="Polling Interval"
|
||||
type="number"
|
||||
min={100}
|
||||
max={60 * 24 * 1000}
|
||||
increment={1000}
|
||||
/>
|
||||
<Option opt={options.bar.customModules.hyprsunset.rightClick} title="Right Click" type="string" />
|
||||
<Option opt={options.bar.customModules.hyprsunset.middleClick} title="Middle Click" type="string" />
|
||||
<Option opt={options.bar.customModules.hyprsunset.scrollUp} title="Scroll Up" type="string" />
|
||||
<Option opt={options.bar.customModules.hyprsunset.scrollDown} title="Scroll Down" type="string" />
|
||||
|
||||
{/* Hypridle Section */}
|
||||
<Header title="Hypridle" />
|
||||
<Option
|
||||
opt={options.theme.bar.buttons.modules.hypridle.enableBorder}
|
||||
title="Button Border"
|
||||
type="boolean"
|
||||
/>
|
||||
<Option opt={options.bar.customModules.hypridle.onIcon} title="Enabled Icon" type="string" />
|
||||
<Option opt={options.bar.customModules.hypridle.offIcon} title="Disabled Icon" type="string" />
|
||||
<Option opt={options.bar.customModules.hypridle.onLabel} title="Enabled Label" type="string" />
|
||||
<Option opt={options.bar.customModules.hypridle.offLabel} title="Disabled Label" type="string" />
|
||||
<Option opt={options.bar.customModules.hypridle.label} title="Show Label" type="boolean" />
|
||||
<Option opt={options.theme.bar.buttons.modules.hypridle.spacing} title="Spacing" type="string" />
|
||||
<Option
|
||||
opt={options.bar.customModules.hypridle.pollingInterval}
|
||||
title="Polling Interval"
|
||||
type="number"
|
||||
min={100}
|
||||
max={60 * 24 * 1000}
|
||||
increment={1000}
|
||||
/>
|
||||
<Option opt={options.bar.customModules.hypridle.rightClick} title="Right Click" type="string" />
|
||||
<Option opt={options.bar.customModules.hypridle.middleClick} title="Middle Click" type="string" />
|
||||
<Option opt={options.bar.customModules.hypridle.scrollUp} title="Scroll Up" type="string" />
|
||||
<Option opt={options.bar.customModules.hypridle.scrollDown} title="Scroll Down" type="string" />
|
||||
|
||||
{/* Power Section */}
|
||||
<Header title="Power" />
|
||||
<Option
|
||||
opt={options.theme.bar.buttons.modules.power.enableBorder}
|
||||
title="Button Border"
|
||||
type="boolean"
|
||||
/>
|
||||
<Option opt={options.theme.bar.buttons.modules.power.spacing} title="Spacing" type="string" />
|
||||
<Option opt={options.bar.customModules.power.icon} title="Power Button Icon" type="string" />
|
||||
<Option opt={options.bar.customModules.power.leftClick} title="Left Click" type="string" />
|
||||
<Option opt={options.bar.customModules.power.rightClick} title="Right Click" type="string" />
|
||||
<Option opt={options.bar.customModules.power.middleClick} title="Middle Click" type="string" />
|
||||
<Option opt={options.bar.customModules.power.scrollUp} title="Scroll Up" type="string" />
|
||||
<Option opt={options.bar.customModules.power.scrollDown} title="Scroll Down" type="string" />
|
||||
</box>
|
||||
</scrollable>
|
||||
);
|
||||
|
||||
@@ -158,6 +158,56 @@ export const CustomModuleTheme = (): JSX.Element => {
|
||||
type="color"
|
||||
/>
|
||||
<Option opt={options.theme.bar.buttons.modules.weather.border} title="Border" type="color" />
|
||||
|
||||
{/* Hyprsunset Module Section */}
|
||||
<Header title="Hyprsunset" />
|
||||
<Option opt={options.theme.bar.buttons.modules.hyprsunset.text} title="Text" type="color" />
|
||||
<Option opt={options.theme.bar.buttons.modules.hyprsunset.icon} title="Icon" type="color" />
|
||||
<Option
|
||||
opt={options.theme.bar.buttons.modules.hyprsunset.background}
|
||||
title="Label Background"
|
||||
type="color"
|
||||
/>
|
||||
<Option
|
||||
opt={options.theme.bar.buttons.modules.hyprsunset.icon_background}
|
||||
title="Icon Background"
|
||||
subtitle="Applies a background color to the icon section of the button.\nRequires 'split' button styling."
|
||||
type="color"
|
||||
/>
|
||||
<Option opt={options.theme.bar.buttons.modules.hyprsunset.border} title="Border" type="color" />
|
||||
|
||||
{/* Hypridle Module Section */}
|
||||
<Header title="Hypridle" />
|
||||
<Option opt={options.theme.bar.buttons.modules.hypridle.text} title="Text" type="color" />
|
||||
<Option opt={options.theme.bar.buttons.modules.hypridle.icon} title="Icon" type="color" />
|
||||
<Option
|
||||
opt={options.theme.bar.buttons.modules.hypridle.background}
|
||||
title="Label Background"
|
||||
type="color"
|
||||
/>
|
||||
<Option
|
||||
opt={options.theme.bar.buttons.modules.hypridle.icon_background}
|
||||
title="Icon Background"
|
||||
subtitle="Applies a background color to the icon section of the button.\nRequires 'split' button styling."
|
||||
type="color"
|
||||
/>
|
||||
<Option opt={options.theme.bar.buttons.modules.hypridle.border} title="Border" type="color" />
|
||||
|
||||
{/* Power Module Section */}
|
||||
<Header title="Power" />
|
||||
<Option opt={options.theme.bar.buttons.modules.power.icon} title="Icon" type="color" />
|
||||
<Option
|
||||
opt={options.theme.bar.buttons.modules.power.background}
|
||||
title="Label Background"
|
||||
type="color"
|
||||
/>
|
||||
<Option
|
||||
opt={options.theme.bar.buttons.modules.power.icon_background}
|
||||
title="Icon Background"
|
||||
subtitle="Applies a background color to the icon section of the button.\nRequires 'split' button styling."
|
||||
type="color"
|
||||
/>
|
||||
<Option opt={options.theme.bar.buttons.modules.power.border} title="Border" type="color" />
|
||||
</box>
|
||||
</scrollable>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user