Merge branch 'rebuild' of github.com:Ly-sec/Noctalia into rebuild
This commit is contained in:
commit
860a65b9ca
7 changed files with 492 additions and 0 deletions
|
|
@ -119,6 +119,10 @@ Variants {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Brightness {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Clock {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
|
|
|||
74
Modules/Bar/Brightness.qml
Normal file
74
Modules/Bar/Brightness.qml
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Modules.Settings
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
width: pill.width
|
||||
height: pill.height
|
||||
|
||||
// Used to avoid opening the pill on Quickshell startup
|
||||
property bool firstBrightnessReceived: false
|
||||
property real lastBrightness: -1
|
||||
|
||||
function getIcon() {
|
||||
if (!BrightnessService.available) {
|
||||
return "brightness_auto"
|
||||
}
|
||||
var brightness = BrightnessService.brightness
|
||||
return brightness <= 0 ? "brightness_1" :
|
||||
brightness < 33 ? "brightness_low" :
|
||||
brightness < 66 ? "brightness_medium" : "brightness_high"
|
||||
}
|
||||
|
||||
// Connection used to open the pill when brightness changes
|
||||
Connections {
|
||||
target: BrightnessService.focusedMonitor
|
||||
function onBrightnessUpdated() {
|
||||
var currentBrightness = BrightnessService.brightness
|
||||
|
||||
// Ignore if this is the first time or if brightness hasn't actually changed
|
||||
if (!firstBrightnessReceived) {
|
||||
firstBrightnessReceived = true
|
||||
lastBrightness = currentBrightness
|
||||
return
|
||||
}
|
||||
|
||||
// Only show pill if brightness actually changed (not just loaded from settings)
|
||||
if (Math.abs(currentBrightness - lastBrightness) > 0.1) {
|
||||
pill.show()
|
||||
}
|
||||
|
||||
lastBrightness = currentBrightness
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
icon: getIcon()
|
||||
iconCircleColor: Colors.mPrimary
|
||||
collapsedIconColor: Colors.mOnSurface
|
||||
autoHide: true
|
||||
text: Math.round(BrightnessService.brightness) + "%"
|
||||
tooltipText: "Brightness: " + Math.round(BrightnessService.brightness) + "%\nMethod: " + BrightnessService.currentMethod + "\nLeft click for advanced settings.\nScroll up/down to change brightness."
|
||||
|
||||
onWheel: function (angle) {
|
||||
if (!BrightnessService.available) return
|
||||
|
||||
if (angle > 0) {
|
||||
BrightnessService.increaseBrightness()
|
||||
} else if (angle < 0) {
|
||||
BrightnessService.decreaseBrightness()
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
settingsPanel.requestedTab = SettingsPanel.Tab.Display
|
||||
settingsPanel.isLoaded = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -301,6 +301,60 @@ NLoader {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
// Brightness Control
|
||||
ColumnLayout {
|
||||
spacing: Style.marginMedium * scaling
|
||||
NText {
|
||||
text: "Brightness Control"
|
||||
color: Colors.mSecondary
|
||||
font.weight: Style.fontWeightBold
|
||||
}
|
||||
|
||||
NText {
|
||||
text: `Brightness: ${Math.round(Brightness.brightness)}%`
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: Style.marginSmall * scaling
|
||||
NIconButton {
|
||||
icon: "brightness_low"
|
||||
fontPointSize: Style.fontSizeLarge * scaling
|
||||
onClicked: {
|
||||
Brightness.decreaseBrightness()
|
||||
}
|
||||
}
|
||||
NSlider {
|
||||
from: 0
|
||||
to: 100
|
||||
stepSize: 1
|
||||
value: Brightness.brightness
|
||||
implicitWidth: bgRect.width * 0.5
|
||||
onMoved: {
|
||||
Brightness.setBrightnessDebounced(value)
|
||||
}
|
||||
}
|
||||
NIconButton {
|
||||
icon: "brightness_high"
|
||||
fontPointSize: Style.fontSizeLarge * scaling
|
||||
onClicked: {
|
||||
Brightness.increaseBrightness()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NText {
|
||||
text: `Method: ${Brightness.currentMethod} | Available: ${Brightness.available}`
|
||||
color: Colors.mOnSurfaceVariant
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,55 @@ Item {
|
|||
color: Colors.mOnSurface
|
||||
}
|
||||
|
||||
// Brightness Section
|
||||
ColumnLayout {
|
||||
spacing: Style.marginSmall * scaling
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginSmall * scaling
|
||||
|
||||
NText {
|
||||
text: "Brightness Step Size"
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Colors.mOnSurface
|
||||
}
|
||||
|
||||
NText {
|
||||
text: "Adjust the step size for brightness changes (scroll wheel, ipc bind)"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: Colors.mOnSurface
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 1
|
||||
to: 50
|
||||
value: Settings.data.brightness.brightnessStep
|
||||
stepSize: 1
|
||||
onMoved: {
|
||||
Settings.data.brightness.brightnessStep = value
|
||||
}
|
||||
}
|
||||
|
||||
NText {
|
||||
text: Settings.data.brightness.brightnessStep + "%"
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: Colors.mOnSurface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginLarge * 2 * scaling
|
||||
Layout.bottomMargin: Style.marginLarge * scaling
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: Quickshell.screens || []
|
||||
delegate: Rectangle {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue