Brightness, fully working (at least on my machine)
This commit is contained in:
parent
593821e998
commit
4ed7324a99
10 changed files with 124 additions and 150 deletions
|
|
@ -139,7 +139,6 @@ Variants {
|
|||
// demoPanel.isLoaded = !demoPanel.isLoaded
|
||||
// }
|
||||
// }
|
||||
|
||||
NIconButton {
|
||||
id: sidePanelToggle
|
||||
icon: "widgets"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ Item {
|
|||
|
||||
function getIcon() {
|
||||
var brightness = BrightnessService.getMonitorForScreen(screen).brightness
|
||||
return brightness <= 0 ? "brightness_1" : brightness < 0.33 ? "brightness_low" : brightness < 0.66 ? "brightness_medium" : "brightness_high"
|
||||
return brightness <= 0 ? "brightness_1" : brightness < 0.33 ? "brightness_low" : brightness
|
||||
< 0.66 ? "brightness_medium" : "brightness_high"
|
||||
}
|
||||
|
||||
// Connection used to open the pill when brightness changes
|
||||
|
|
@ -26,7 +27,7 @@ Item {
|
|||
function onBrightnessUpdated() {
|
||||
Logger.log("Bar-Brightness", "OnBrightnessUpdated")
|
||||
|
||||
var monitor = BrightnessService.getMonitorForScreen(screen);
|
||||
var monitor = BrightnessService.getMonitorForScreen(screen)
|
||||
var currentBrightness = monitor.brightness
|
||||
|
||||
// Ignore if this is the first time or if brightness hasn't actually changed
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ NLoader {
|
|||
"label": "Audio",
|
||||
"icon": "volume_up",
|
||||
"source": audioTab
|
||||
},{
|
||||
}, {
|
||||
"id": SettingsPanel.Tab.Display,
|
||||
"label": "Display",
|
||||
"icon": "monitor",
|
||||
|
|
@ -145,7 +145,7 @@ NLoader {
|
|||
"label": "Brightness",
|
||||
"icon": "brightness_6",
|
||||
"source": brightnessTab
|
||||
}, {
|
||||
}, {
|
||||
"id": SettingsPanel.Tab.TimeWeather,
|
||||
"label": "Time & Weather",
|
||||
"icon": "schedule",
|
||||
|
|
|
|||
|
|
@ -143,102 +143,76 @@ Item {
|
|||
}
|
||||
|
||||
// Single monitor display using the same data source as the bar icon
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
radius: Style.radiusMedium * scaling
|
||||
color: Color.mSurface
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderThin * scaling)
|
||||
implicitHeight: contentCol.implicitHeight + Style.marginXL * 2 * scaling
|
||||
Repeater {
|
||||
model: BrightnessService.monitors
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
radius: Style.radiusMedium * scaling
|
||||
color: Color.mSurface
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderThin * scaling)
|
||||
implicitHeight: contentCol.implicitHeight + Style.marginXL * 2 * scaling
|
||||
|
||||
ColumnLayout {
|
||||
id: contentCol
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginLarge * scaling
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
ColumnLayout {
|
||||
id: contentCol
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginLarge * scaling
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NText {
|
||||
text: "Primary Monitor"
|
||||
font.pointSize: Style.fontSizeLarge * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Color.mSecondary
|
||||
}
|
||||
|
||||
Item {
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NText {
|
||||
text: BrightnessService.currentMethod === "ddcutil" ? "External (DDC)" : "Internal"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: Color.mOnSurfaceVariant
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
}
|
||||
NText {
|
||||
text: `${model.modelData.name} [${model.modelData.model}]`
|
||||
font.pointSize: Style.fontSizeLarge * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Color.mSecondary
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginMedium * scaling
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NText {
|
||||
text: "Brightness:"
|
||||
font.pointSize: Style.fontSizeMedium * scaling
|
||||
color: Color.mOnSurface
|
||||
}
|
||||
|
||||
NSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 0
|
||||
to: 100
|
||||
value: BrightnessService.brightness
|
||||
stepSize: 1
|
||||
enabled: BrightnessService.available
|
||||
onPressedChanged: {
|
||||
if (!pressed && BrightnessService.available) {
|
||||
BrightnessService.setBrightness(value)
|
||||
}
|
||||
NText {
|
||||
text: model.method
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: Color.mOnSurfaceVariant
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
}
|
||||
|
||||
NText {
|
||||
text: BrightnessService.available ? Math.round(BrightnessService.brightness) + "%" : "N/A"
|
||||
font.pointSize: Style.fontSizeMedium * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: BrightnessService.available ? Color.mPrimary : Color.mOnSurfaceVariant
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NText {
|
||||
text: "Method:"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
NText {
|
||||
text: BrightnessService.currentMethod || "Unknown"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: Color.mOnSurface
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
}
|
||||
|
||||
Item {
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
spacing: Style.marginMedium * scaling
|
||||
|
||||
NText {
|
||||
text: BrightnessService.available ? "Available" : "Unavailable"
|
||||
font.pointSize: Style.fontSizeSmall * scaling
|
||||
color: BrightnessService.available ? Color.mPrimary : Color.mError
|
||||
Layout.alignment: Qt.AlignRight
|
||||
NText {
|
||||
text: "Brightness:"
|
||||
font.pointSize: Style.fontSizeMedium * scaling
|
||||
color: Color.mOnSurface
|
||||
}
|
||||
|
||||
NSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 0
|
||||
to: 1
|
||||
value: model.brightness
|
||||
stepSize: 0.05
|
||||
onPressedChanged: {
|
||||
if (!pressed) {
|
||||
var monitor = BrightnessService.getMonitorForScreen(model.modelData)
|
||||
monitor.setBrightness(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NText {
|
||||
text: Math.round(model.brightness * 100) + "%"
|
||||
font.pointSize: Style.fontSizeMedium * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Color.mPrimary
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -384,8 +384,6 @@ NPanel {
|
|||
running: false
|
||||
}
|
||||
|
||||
|
||||
|
||||
Process {
|
||||
id: logoutProcess
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ Singleton {
|
|||
root.ddcMonitors = displays.map(d => {
|
||||
var modelMatch = d.match(/Monitor:.*:(.*):.*/)
|
||||
var busMatch = d.match(/I2C bus:[ ]*\/dev\/i2c-([0-9]+)/)
|
||||
console.log(modelMatch)
|
||||
return {
|
||||
"model": modelMatch ? modelMatch[1] : "",
|
||||
"busNum": busMatch ? busMatch[1] : ""
|
||||
|
|
@ -96,7 +95,7 @@ Singleton {
|
|||
readonly property Process initProc: Process {
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
var dataText = text.trim();
|
||||
var dataText = text.trim()
|
||||
if (dataText === "") {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ Singleton {
|
|||
property bool inOverview: false
|
||||
|
||||
// Generic events
|
||||
signal workspaceChanged()
|
||||
signal activeWindowChanged()
|
||||
signal overviewStateChanged()
|
||||
signal windowListChanged()
|
||||
signal workspaceChanged
|
||||
signal activeWindowChanged
|
||||
signal overviewStateChanged
|
||||
signal windowListChanged
|
||||
|
||||
// Compositor detection
|
||||
Component.onCompleted: {
|
||||
|
|
@ -54,8 +54,6 @@ Singleton {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function detectCompositor() {
|
||||
try {
|
||||
// Try Hyprland first
|
||||
|
|
@ -67,6 +65,7 @@ Singleton {
|
|||
return
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
// Hyprland not available
|
||||
}
|
||||
|
||||
|
|
@ -98,12 +97,12 @@ Singleton {
|
|||
}
|
||||
}
|
||||
|
||||
function setupHyprlandConnections() {
|
||||
// Connections are set up at the top level, this function just marks that Hyprland is ready
|
||||
function setupHyprlandConnections() {// Connections are set up at the top level, this function just marks that Hyprland is ready
|
||||
}
|
||||
|
||||
function updateHyprlandWorkspaces() {
|
||||
if (!isHyprland) return
|
||||
if (!isHyprland)
|
||||
return
|
||||
|
||||
workspaces.clear()
|
||||
try {
|
||||
|
|
@ -113,14 +112,14 @@ Singleton {
|
|||
// Only append workspaces with id >= 1
|
||||
if (ws.id >= 1) {
|
||||
workspaces.append({
|
||||
"id": i,
|
||||
"idx": ws.id,
|
||||
"name": ws.name || "",
|
||||
"output": ws.monitor?.name || "",
|
||||
"isActive": ws.active === true,
|
||||
"isFocused": ws.focused === true,
|
||||
"isUrgent": ws.urgent === true
|
||||
})
|
||||
"id": i,
|
||||
"idx": ws.id,
|
||||
"name": ws.name || "",
|
||||
"output": ws.monitor?.name || "",
|
||||
"isActive": ws.active === true,
|
||||
"isFocused": ws.focused === true,
|
||||
"isUrgent": ws.urgent === true
|
||||
})
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
@ -145,14 +144,16 @@ Singleton {
|
|||
}
|
||||
|
||||
function updateNiriWorkspaces() {
|
||||
if (!isNiri) return
|
||||
if (!isNiri)
|
||||
return
|
||||
|
||||
// Get workspaces from the Niri process
|
||||
niriWorkspaceProcess.running = true
|
||||
}
|
||||
|
||||
function updateNiriWindows() {
|
||||
if (!isNiri) return
|
||||
if (!isNiri)
|
||||
return
|
||||
|
||||
// Get windows from the Niri process
|
||||
niriWindowsProcess.running = true
|
||||
|
|
@ -172,23 +173,23 @@ Singleton {
|
|||
|
||||
for (const ws of workspacesData) {
|
||||
workspacesList.push({
|
||||
"id": ws.id,
|
||||
"idx": ws.idx,
|
||||
"name": ws.name || "",
|
||||
"output": ws.output || "",
|
||||
"isFocused": ws.is_focused === true,
|
||||
"isActive": ws.is_active === true,
|
||||
"isUrgent": ws.is_urgent === true,
|
||||
"isOccupied": ws.active_window_id ? true : false
|
||||
})
|
||||
"id": ws.id,
|
||||
"idx": ws.idx,
|
||||
"name": ws.name || "",
|
||||
"output": ws.output || "",
|
||||
"isFocused": ws.is_focused === true,
|
||||
"isActive": ws.is_active === true,
|
||||
"isUrgent": ws.is_urgent === true,
|
||||
"isOccupied": ws.active_window_id ? true : false
|
||||
})
|
||||
}
|
||||
|
||||
workspacesList.sort((a, b) => {
|
||||
if (a.output !== b.output) {
|
||||
return a.output.localeCompare(b.output)
|
||||
}
|
||||
return a.id - b.id
|
||||
})
|
||||
if (a.output !== b.output) {
|
||||
return a.output.localeCompare(b.output)
|
||||
}
|
||||
return a.id - b.id
|
||||
})
|
||||
|
||||
// Update the workspaces ListModel
|
||||
workspaces.clear()
|
||||
|
|
@ -222,12 +223,12 @@ Singleton {
|
|||
const windowsList = []
|
||||
for (const win of windowsData) {
|
||||
windowsList.push({
|
||||
"id": win.id,
|
||||
"title": win.title || "",
|
||||
"appId": win.app_id || "",
|
||||
"workspaceId": win.workspace_id || null,
|
||||
"isFocused": win.is_focused === true
|
||||
})
|
||||
"id": win.id,
|
||||
"title": win.title || "",
|
||||
"appId": win.app_id || "",
|
||||
"workspaceId": win.workspace_id || null,
|
||||
"isFocused": win.is_focused === true
|
||||
})
|
||||
}
|
||||
|
||||
windowsList.sort((a, b) => a.id - b.id)
|
||||
|
|
@ -292,12 +293,12 @@ Singleton {
|
|||
const windowsList = []
|
||||
for (const win of windowsData) {
|
||||
windowsList.push({
|
||||
"id": win.id,
|
||||
"title": win.title || "",
|
||||
"appId": win.app_id || "",
|
||||
"workspaceId": win.workspace_id || null,
|
||||
"isFocused": win.is_focused === true
|
||||
})
|
||||
"id": win.id,
|
||||
"title": win.title || "",
|
||||
"appId": win.app_id || "",
|
||||
"workspaceId": win.workspace_id || null,
|
||||
"isFocused": win.is_focused === true
|
||||
})
|
||||
}
|
||||
|
||||
windowsList.sort((a, b) => a.id - b.id)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ PanelWindow {
|
|||
property bool showOverlay: Settings.data.general.dimDesktop
|
||||
property int topMargin: Style.barHeight * scaling
|
||||
// Show dimming if this panel is opened OR if we're in a transition (to prevent flickering)
|
||||
property color overlayColor: (showOverlay && (PanelService.openedPanel === root || isTransitioning)) ? Color.applyOpacity(Color.mShadow, "AA") : Color.transparent
|
||||
property color overlayColor: (showOverlay && (PanelService.openedPanel === root
|
||||
|| isTransitioning)) ? Color.applyOpacity(Color.mShadow,
|
||||
"AA") : Color.transparent
|
||||
property bool isTransitioning: false
|
||||
signal dismissed
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue