mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
VolumesSubTab: add option to change volume change audio feedback sound
This commit is contained in:
@@ -779,6 +779,9 @@
|
||||
"volumes-output-volume-description": "System-wide volume level.",
|
||||
"volumes-step-size-description": "Adjust the step size for volume changes (scroll wheel, keyboard shortcuts).",
|
||||
"volumes-step-size-label": "Volume step size",
|
||||
"volumes-feedback-sound-file-description": "Path to the sound file played when changing output volume.",
|
||||
"volumes-feedback-sound-file-label": "Volume feedback sound file",
|
||||
"volumes-feedback-sound-file-select-title": "Select volume feedback sound file",
|
||||
"volumes-volume-feedback-description": "Play a feedback sound when adjusting volume.",
|
||||
"volumes-volume-feedback-label": "Play volume feedback sound",
|
||||
"volumes-volume-overdrive-description": "Allow raising volume above 100%. May not be supported by all hardware.",
|
||||
|
||||
@@ -453,7 +453,8 @@
|
||||
"visualizerType": "linear",
|
||||
"mprisBlacklist": [],
|
||||
"preferredPlayer": "",
|
||||
"volumeFeedback": false
|
||||
"volumeFeedback": false,
|
||||
"volumeFeedbackSoundFile": ""
|
||||
},
|
||||
"brightness": {
|
||||
"brightnessStep": 5,
|
||||
|
||||
@@ -89,6 +89,15 @@
|
||||
"subTab": 0,
|
||||
"subTabLabel": "common.volumes"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.audio.volumes-feedback-sound-file-label",
|
||||
"descriptionKey": "panels.audio.volumes-feedback-sound-file-description",
|
||||
"widget": "NTextInputButton",
|
||||
"tab": 13,
|
||||
"tabLabel": "panels.audio.title",
|
||||
"subTab": 0,
|
||||
"subTabLabel": "common.volumes"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.osd.types-input-volume-label",
|
||||
"descriptionKey": "panels.audio.volumes-input-volume-description",
|
||||
|
||||
@@ -661,6 +661,7 @@ Singleton {
|
||||
property list<string> mprisBlacklist: []
|
||||
property string preferredPlayer: ""
|
||||
property bool volumeFeedback: false
|
||||
property string volumeFeedbackSoundFile: ""
|
||||
}
|
||||
|
||||
// brightness
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
import qs.Services.Media
|
||||
import qs.Services.System
|
||||
import qs.Widgets
|
||||
|
||||
ColumnLayout {
|
||||
@@ -83,6 +85,28 @@ ColumnLayout {
|
||||
defaultValue: Settings.getDefaultValue("audio.volumeFeedback")
|
||||
onToggled: checked => Settings.data.audio.volumeFeedback = checked
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
enabled: SoundService.multimediaAvailable && Settings.data.audio.volumeFeedback
|
||||
spacing: Style.marginXXS
|
||||
Layout.fillWidth: true
|
||||
|
||||
NLabel {
|
||||
label: I18n.tr("panels.audio.volumes-feedback-sound-file-label")
|
||||
description: I18n.tr("panels.audio.volumes-feedback-sound-file-description")
|
||||
}
|
||||
|
||||
NTextInputButton {
|
||||
enabled: parent.enabled
|
||||
Layout.fillWidth: true
|
||||
placeholderText: I18n.tr("panels.notifications.sounds-files-placeholder")
|
||||
text: Settings.data.audio.volumeFeedbackSoundFile ?? ""
|
||||
buttonIcon: "folder-open"
|
||||
buttonTooltip: I18n.tr("panels.notifications.sounds-files-select-file")
|
||||
onInputEditingFinished: Settings.data.audio.volumeFeedbackSoundFile = text
|
||||
onButtonClicked: volumeFeedbackFilePicker.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
@@ -156,4 +180,17 @@ ColumnLayout {
|
||||
onToggled: checked => Settings.data.audio.volumeOverdrive = checked
|
||||
}
|
||||
}
|
||||
|
||||
NFilePicker {
|
||||
id: volumeFeedbackFilePicker
|
||||
title: I18n.tr("panels.audio.volumes-feedback-sound-file-select-title")
|
||||
selectionMode: "files"
|
||||
initialPath: Quickshell.env("HOME")
|
||||
nameFilters: ["*.wav", "*.mp3", "*.ogg", "*.flac", "*.m4a", "*.aac"]
|
||||
onAccepted: paths => {
|
||||
if (paths.length > 0) {
|
||||
Settings.data.audio.volumeFeedbackSoundFile = paths[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,7 +619,10 @@ Singleton {
|
||||
lastVolumeFeedbackTime = now;
|
||||
|
||||
const feedbackVolume = currentVolume;
|
||||
SoundService.playSound("volume-change.wav", {
|
||||
const configuredSoundFile = Settings.data.audio.volumeFeedbackSoundFile;
|
||||
const soundFile = (configuredSoundFile && configuredSoundFile.trim() !== "") ? configuredSoundFile : "volume-change.wav";
|
||||
|
||||
SoundService.playSound(soundFile, {
|
||||
volume: feedbackVolume,
|
||||
fallback: false,
|
||||
repeat: false
|
||||
|
||||
Reference in New Issue
Block a user