initial commit
This commit is contained in:
commit
9fde6d4fc6
27 changed files with 1110 additions and 0 deletions
38
modules/Backlight.qml
Normal file
38
modules/Backlight.qml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import "." as M
|
||||
|
||||
Row {
|
||||
id: root
|
||||
spacing: 4
|
||||
visible: percent > 0
|
||||
|
||||
property int percent: 0
|
||||
|
||||
FileView {
|
||||
id: current
|
||||
path: "/sys/class/backlight/intel_backlight/brightness"
|
||||
watchChanges: true
|
||||
onFileChanged: reload()
|
||||
onLoaded: root._update()
|
||||
}
|
||||
FileView {
|
||||
id: max
|
||||
path: "/sys/class/backlight/intel_backlight/max_brightness"
|
||||
onLoaded: root._update()
|
||||
}
|
||||
|
||||
function _update() {
|
||||
const c = parseInt(current.text());
|
||||
const m = parseInt(max.text());
|
||||
if (m > 0) root.percent = Math.round((c / m) * 100);
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root.percent + "% "
|
||||
color: M.Theme.base05
|
||||
font.pixelSize: M.Theme.fontSize
|
||||
font.family: M.Theme.fontFamily
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue