mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 02:34:45 +00:00
Add night color quick setting
This commit is contained in:
parent
d2f42085ff
commit
94609d2590
1 changed files with 25 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
|
import org.kde.plasma.networkmanagement 0.2 as PlasmaNM
|
||||||
import org.kde.bluezqt 1.0 as BluezQt
|
import org.kde.bluezqt 1.0 as BluezQt
|
||||||
|
import org.kde.colorcorrect 0.1 as CC
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -84,6 +85,16 @@ Item {
|
||||||
adapter.powered = enable;
|
adapter.powered = enable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleNightColor() {
|
||||||
|
if (compositorAdaptor.active) {
|
||||||
|
compositorAdaptor.activeStaged = false;
|
||||||
|
} else {
|
||||||
|
compositorAdaptor.activeStaged = true;
|
||||||
|
compositorAdaptor.modeStaged = 3; // always on
|
||||||
|
}
|
||||||
|
compositorAdaptor.sendConfigurationAll();
|
||||||
|
}
|
||||||
|
|
||||||
function requestShutdown() {
|
function requestShutdown() {
|
||||||
print("Shutdown requested, depends on ksmserver running");
|
print("Shutdown requested, depends on ksmserver running");
|
||||||
|
|
@ -138,6 +149,12 @@ Item {
|
||||||
disableBrightnessUpdate = false;
|
disableBrightnessUpdate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// night color
|
||||||
|
CC.CompositorAdaptor {
|
||||||
|
id: compositorAdaptor
|
||||||
|
}
|
||||||
|
|
||||||
//HACK: make the list know about the applet delegate which is a qtobject
|
//HACK: make the list know about the applet delegate which is a qtobject
|
||||||
QtObject {
|
QtObject {
|
||||||
id: nullApplet
|
id: nullApplet
|
||||||
|
|
@ -224,6 +241,14 @@ Item {
|
||||||
"toggleFunction": "toggleRotation",
|
"toggleFunction": "toggleRotation",
|
||||||
"applet": null
|
"applet": null
|
||||||
});
|
});
|
||||||
|
settingsModel.append({
|
||||||
|
"text": i18n("Night Color"),
|
||||||
|
"icon": "redshift-status-on",
|
||||||
|
"enabled": compositorAdaptor.active,
|
||||||
|
"settingsCommand": "", // change once night color kcm is added
|
||||||
|
"toggleFunction": "toggleNightColor",
|
||||||
|
"applet": null
|
||||||
|
});
|
||||||
|
|
||||||
brightnessSlider.moved.connect(function() {
|
brightnessSlider.moved.connect(function() {
|
||||||
root.screenBrightness = brightnessSlider.value;
|
root.screenBrightness = brightnessSlider.value;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue