mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 09:36:46 +00:00
quickshell and hyprland additions
This commit is contained in:
50
.config/quickshell/nucleus-shell/services/Volume.qml
Executable file
50
.config/quickshell/nucleus-shell/services/Volume.qml
Executable file
@@ -0,0 +1,50 @@
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Pipewire
|
||||
|
||||
|
||||
Singleton {
|
||||
PwObjectTracker {
|
||||
objects: [
|
||||
Pipewire.defaultAudioSource,
|
||||
Pipewire.defaultAudioSink,
|
||||
Pipewire.nodes,
|
||||
Pipewire.links
|
||||
]
|
||||
}
|
||||
|
||||
property var sinks: Pipewire.nodes.values.filter(node => node.isSink && !node.isStream && node.audio)
|
||||
property PwNode defaultSink: Pipewire.defaultAudioSink
|
||||
|
||||
property var sources: Pipewire.nodes.values.filter(node => !node.isSink && !node.isStream && node.audio)
|
||||
property PwNode defaultSource: Pipewire.defaultAudioSource
|
||||
|
||||
property real volume: defaultSink?.audio?.volume ?? 0
|
||||
property bool muted: defaultSink?.audio?.muted ?? false
|
||||
|
||||
function setVolume(to: real): void {
|
||||
if (defaultSink?.ready && defaultSink?.audio) {
|
||||
defaultSink.audio.muted = false;
|
||||
defaultSink.audio.volume = Math.max(0, Math.min(1, to));
|
||||
}
|
||||
}
|
||||
|
||||
function setSourceVolume(to: real): void {
|
||||
if (defaultSource?.ready && defaultSource?.audio) {
|
||||
defaultSource.audio.muted = false;
|
||||
defaultSource.audio.volume = Math.max(0, Math.min(1, to));
|
||||
}
|
||||
}
|
||||
|
||||
function setDefaultSink(sink: PwNode): void {
|
||||
Pipewire.preferredDefaultAudioSink = sink;
|
||||
}
|
||||
|
||||
function setDefaultSource(source: PwNode): void {
|
||||
Pipewire.preferredDefaultAudioSource = source;
|
||||
}
|
||||
|
||||
function init() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user