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:
@@ -0,0 +1,99 @@
|
||||
import qs.config
|
||||
import qs.modules.components
|
||||
import qs.services
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Wayland
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
Connections {
|
||||
target: Brightness
|
||||
|
||||
function onBrightnessChanged() {
|
||||
root.shouldShowOsd = true;
|
||||
hideTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
property var monitor: Brightness.monitors.length > 0 ? Brightness.monitors[0] : null
|
||||
|
||||
property bool shouldShowOsd: false
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
interval: 3000
|
||||
onTriggered: root.shouldShowOsd = false
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
active: root.shouldShowOsd
|
||||
|
||||
PanelWindow {
|
||||
visible: Config.runtime.overlays.brightnessOverlayEnabled && Config.runtime.overlays.enabled
|
||||
WlrLayershell.namespace: "nucleus:brightnessOsd"
|
||||
exclusiveZone: 0
|
||||
anchors.top: Config.runtime.overlays.brightnessOverlayPosition.startsWith("top")
|
||||
anchors.bottom: Config.runtime.overlays.brightnessOverlayPosition.startsWith("bottom")
|
||||
anchors.right: Config.runtime.overlays.brightnessOverlayPosition.endsWith("right")
|
||||
anchors.left: Config.runtime.overlays.brightnessOverlayPosition.endsWith("left")
|
||||
margins {
|
||||
top: Metrics.margin(10)
|
||||
bottom: Metrics.margin(10)
|
||||
left: Metrics.margin(10)
|
||||
right: Metrics.margin(10)
|
||||
}
|
||||
|
||||
implicitWidth: 460
|
||||
implicitHeight: 105
|
||||
color: "transparent"
|
||||
mask: Region {}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Appearance.rounding.childish
|
||||
color: Appearance.m3colors.m3background
|
||||
|
||||
RowLayout {
|
||||
spacing: Metrics.spacing(10)
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: Metrics.margin(15)
|
||||
rightMargin: Metrics.margin(25)
|
||||
}
|
||||
|
||||
MaterialSymbol {
|
||||
property real brightnessLevel: Math.floor(Brightness.getMonitorForScreen(Hyprland.focusedMonitor)?.multipliedBrightness*100)
|
||||
icon: {
|
||||
if (brightnessLevel > 66) return "brightness_high"
|
||||
else if (brightnessLevel > 33) return "brightness_medium"
|
||||
else return "brightness_low"
|
||||
}
|
||||
iconSize: Metrics.iconSize(30)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
implicitHeight: 40
|
||||
spacing: Metrics.spacing(5)
|
||||
|
||||
StyledText {
|
||||
animate: false
|
||||
text: "Brightness - " + Math.round(monitor.brightness * 100) + '%'
|
||||
font.pixelSize: Metrics.fontSize(18)
|
||||
}
|
||||
|
||||
StyledSlider {
|
||||
implicitHeight: 35
|
||||
from: 0
|
||||
to: 100
|
||||
value: Math.round(monitor.brightness * 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
VolumeOverlay{}
|
||||
BrightnessOverlay{}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import qs.config
|
||||
import qs.modules.components
|
||||
import qs.services
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.Pipewire
|
||||
import Quickshell.Widgets
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [ Pipewire.defaultAudioSink ]
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Pipewire.defaultAudioSink?.audio ?? null
|
||||
|
||||
function onVolumeChanged() {
|
||||
root.shouldShowOsd = true;
|
||||
hideTimer.restart();
|
||||
}
|
||||
|
||||
function onMutedChanged() {
|
||||
root.shouldShowOsd = true;
|
||||
hideTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
property bool shouldShowOsd: false
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
interval: 3000
|
||||
onTriggered: root.shouldShowOsd = false
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
active: root.shouldShowOsd
|
||||
|
||||
PanelWindow {
|
||||
visible: Config.runtime.overlays.volumeOverlayEnabled && Config.runtime.overlays.enabled
|
||||
WlrLayershell.namespace: "nucleus:brightnessOsd"
|
||||
exclusiveZone: 0
|
||||
anchors.top: Config.runtime.overlays.volumeOverlayPosition.startsWith("top")
|
||||
anchors.bottom: Config.runtime.overlays.volumeOverlayPosition.startsWith("bottom")
|
||||
anchors.right: Config.runtime.overlays.volumeOverlayPosition.endsWith("right")
|
||||
anchors.left: Config.runtime.overlays.volumeOverlayPosition.endsWith("left")
|
||||
margins {
|
||||
top: Metrics.margin(10)
|
||||
bottom: Metrics.margin(10)
|
||||
left: Metrics.margin(10)
|
||||
right: Metrics.margin(10)
|
||||
}
|
||||
implicitWidth: 460
|
||||
implicitHeight: 105
|
||||
color: "transparent"
|
||||
|
||||
mask: Region {}
|
||||
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Appearance.rounding.childish
|
||||
color: Appearance.m3colors.m3background
|
||||
|
||||
RowLayout {
|
||||
spacing: Metrics.spacing(10)
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: Metrics.margin(15)
|
||||
rightMargin: Metrics.margin(25)
|
||||
}
|
||||
|
||||
MaterialSymbol {
|
||||
property real volume: Pipewire.defaultAudioSink?.audio.muted ? 0 : Pipewire.defaultAudioSink?.audio.volume * 100
|
||||
icon: volume > 50 ? "volume_up" : volume > 0 ? "volume_down" : 'volume_off'
|
||||
iconSize: Metrics.iconSize(34);
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: Metrics.spacing(2)
|
||||
|
||||
StyledText {
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
|
||||
animate: false
|
||||
text: (Pipewire.defaultAudioSink?.description ?? "Unknown") + " - " +
|
||||
(Pipewire.defaultAudioSink?.audio.muted ? 'Muted' : Math.floor(Pipewire.defaultAudioSink?.audio.volume * 100) + '%')
|
||||
font.pixelSize: Metrics.fontSize(18)
|
||||
}
|
||||
|
||||
StyledSlider {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 35
|
||||
value: (Pipewire.defaultAudioSink?.audio.muted ? 0 : Pipewire.defaultAudioSink?.audio.volume) * 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user