Merge branch 'main' of github.com:noctalia-dev/noctalia-shell
This commit is contained in:
commit
8ebcfa4bc6
4 changed files with 112 additions and 0 deletions
|
|
@ -99,6 +99,24 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "volume"
|
||||||
|
function increase() {
|
||||||
|
AudioService.increaseVolume()
|
||||||
|
}
|
||||||
|
function decrease() {
|
||||||
|
AudioService.decreaseVolume()
|
||||||
|
}
|
||||||
|
function muteOutput() {
|
||||||
|
AudioService.setMuted(!AudioService.muted)
|
||||||
|
}
|
||||||
|
function muteInput() {
|
||||||
|
if (AudioService.source?.ready && AudioService.source?.audio) {
|
||||||
|
AudioService.source.audio.muted = !AudioService.source.audio.muted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "powerPanel"
|
target: "powerPanel"
|
||||||
function toggle() {
|
function toggle() {
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,54 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Input Volume
|
||||||
|
ColumnLayout {
|
||||||
|
spacing: Style.marginS * scaling
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: Style.marginM * scaling
|
||||||
|
|
||||||
|
NLabel {
|
||||||
|
label: "Input Volume"
|
||||||
|
description: "Microphone input volume level."
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
NSlider {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
from: 0
|
||||||
|
to: 1.0
|
||||||
|
value: AudioService.inputVolume
|
||||||
|
stepSize: 0.01
|
||||||
|
onMoved: {
|
||||||
|
AudioService.setInputVolume(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NText {
|
||||||
|
text: Math.floor(AudioService.inputVolume * 100) + "%"
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
Layout.leftMargin: Style.marginS * scaling
|
||||||
|
color: Color.mOnSurface
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Input Mute Toggle
|
||||||
|
ColumnLayout {
|
||||||
|
spacing: Style.marginS * scaling
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: Style.marginM * scaling
|
||||||
|
|
||||||
|
NToggle {
|
||||||
|
label: "Mute Audio Input"
|
||||||
|
description: "Mute or unmute the default audio input (microphone)."
|
||||||
|
checked: AudioService.inputMuted
|
||||||
|
onToggled: checked => {
|
||||||
|
AudioService.setInputMuted(checked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Volume Step Size
|
// Volume Step Size
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: Style.marginS * scaling
|
spacing: Style.marginS * scaling
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,10 @@ The following commands apply to the Nix flake and also the AUR package installat
|
||||||
| Open Calculator | `noctalia-shell ipc call launcher calculator` |
|
| Open Calculator | `noctalia-shell ipc call launcher calculator` |
|
||||||
| Increase Brightness | `noctalia-shell ipc call brightness increase` |
|
| Increase Brightness | `noctalia-shell ipc call brightness increase` |
|
||||||
| Decrease Brightness | `noctalia-shell ipc call brightness decrease` |
|
| Decrease Brightness | `noctalia-shell ipc call brightness decrease` |
|
||||||
|
| Increase Output Volume | `noctalia-shell ipc call volume increase` |
|
||||||
|
| Decrease Output Volume | `noctalia-shell ipc call volume decrease` |
|
||||||
|
| Toggle Mute Audio Output | `noctalia-shell ipc call volume muteOutput` |
|
||||||
|
| Toggle Mute Audio Input | `noctalia-shell ipc call volume muteInput` |
|
||||||
| Toggle Power Panel | `noctalia-shell ipc call powerPanel toggle` |
|
| Toggle Power Panel | `noctalia-shell ipc call powerPanel toggle` |
|
||||||
| Toggle Idle Inhibitor | `noctalia-shell ipc call idleInhibitor toggle` |
|
| Toggle Idle Inhibitor | `noctalia-shell ipc call idleInhibitor toggle` |
|
||||||
| Toggle Settings Window | `noctalia-shell ipc call settings toggle` |
|
| Toggle Settings Window | `noctalia-shell ipc call settings toggle` |
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,13 @@ Singleton {
|
||||||
readonly property alias muted: root._muted
|
readonly property alias muted: root._muted
|
||||||
property bool _muted: !!sink?.audio?.muted
|
property bool _muted: !!sink?.audio?.muted
|
||||||
|
|
||||||
|
// Input volume [0..1] is readonly from outside
|
||||||
|
readonly property alias inputVolume: root._inputVolume
|
||||||
|
property real _inputVolume: source?.audio?.volume ?? 0
|
||||||
|
|
||||||
|
readonly property alias inputMuted: root._inputMuted
|
||||||
|
property bool _inputMuted: !!source?.audio?.muted
|
||||||
|
|
||||||
readonly property real stepVolume: Settings.data.audio.volumeStep / 100.0
|
readonly property real stepVolume: Settings.data.audio.volumeStep / 100.0
|
||||||
|
|
||||||
PwObjectTracker {
|
PwObjectTracker {
|
||||||
|
|
@ -58,6 +65,23 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: source?.audio ? source?.audio : null
|
||||||
|
|
||||||
|
function onVolumeChanged() {
|
||||||
|
var vol = (source?.audio.volume ?? 0)
|
||||||
|
if (isNaN(vol)) {
|
||||||
|
vol = 0
|
||||||
|
}
|
||||||
|
root._inputVolume = vol
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMutedChanged() {
|
||||||
|
root._inputMuted = (source?.audio.muted ?? true)
|
||||||
|
Logger.log("AudioService", "OnInputMuteChanged:", root._inputMuted)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function increaseVolume() {
|
function increaseVolume() {
|
||||||
setVolume(volume + stepVolume)
|
setVolume(volume + stepVolume)
|
||||||
}
|
}
|
||||||
|
|
@ -85,6 +109,24 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setInputVolume(newVolume: real) {
|
||||||
|
if (source?.ready && source?.audio) {
|
||||||
|
// Clamp it accordingly
|
||||||
|
source.audio.muted = false
|
||||||
|
source.audio.volume = Math.max(0, Math.min(1, newVolume))
|
||||||
|
} else {
|
||||||
|
Logger.warn("AudioService", "No source available")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setInputMuted(muted: bool) {
|
||||||
|
if (source?.ready && source?.audio) {
|
||||||
|
source.audio.muted = muted
|
||||||
|
} else {
|
||||||
|
Logger.warn("AudioService", "No source available")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setAudioSink(newSink: PwNode): void {
|
function setAudioSink(newSink: PwNode): void {
|
||||||
Pipewire.preferredDefaultAudioSink = newSink
|
Pipewire.preferredDefaultAudioSink = newSink
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue