💥 ags(nightlight, control-center/nightlight): fixed wrong fidelity temperature value (10000 changed to 6000)
This commit is contained in:
@@ -37,7 +37,7 @@ class NightLight extends GObject.Object {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.#watchInterval = interval(500, () => {
|
this.#watchInterval = interval(1000, () => {
|
||||||
execAsync("hyprctl hyprsunset temperature").then(t => {
|
execAsync("hyprctl hyprsunset temperature").then(t => {
|
||||||
if(t.trim() !== "" && t.trim().length <= 5) {
|
if(t.trim() !== "" && t.trim().length <= 5) {
|
||||||
const val = Number.parseInt(t.trim());
|
const val = Number.parseInt(t.trim());
|
||||||
@@ -80,6 +80,10 @@ class NightLight extends GObject.Object {
|
|||||||
execAsync(`hyprctl hyprsunset temperature ${value}`).then(() => {
|
execAsync(`hyprctl hyprsunset temperature ${value}`).then(() => {
|
||||||
this.#temperature = value;
|
this.#temperature = value;
|
||||||
this.notify("temperature");
|
this.notify("temperature");
|
||||||
|
|
||||||
|
this.#identity = false;
|
||||||
|
this.#prevTemperature = null;
|
||||||
|
this.#prevGamma = null;
|
||||||
}).catch((r) => console.error(
|
}).catch((r) => console.error(
|
||||||
`Night Light(hyprsunset): Couldn't set temperature. Stderr: ${r}`
|
`Night Light(hyprsunset): Couldn't set temperature. Stderr: ${r}`
|
||||||
));
|
));
|
||||||
@@ -97,6 +101,10 @@ class NightLight extends GObject.Object {
|
|||||||
execAsync(`hyprctl hyprsunset gamma ${value}`).then(() => {
|
execAsync(`hyprctl hyprsunset gamma ${value}`).then(() => {
|
||||||
this.#gamma = value;
|
this.#gamma = value;
|
||||||
this.notify("gamma");
|
this.notify("gamma");
|
||||||
|
|
||||||
|
this.#identity = false;
|
||||||
|
this.#prevTemperature = null;
|
||||||
|
this.#prevGamma = null;
|
||||||
}).catch((r) => console.error(
|
}).catch((r) => console.error(
|
||||||
`Night Light(hyprsunset): Couldn't set gamma. Stderr: ${r}`
|
`Night Light(hyprsunset): Couldn't set gamma. Stderr: ${r}`
|
||||||
));
|
));
|
||||||
@@ -108,13 +116,9 @@ class NightLight extends GObject.Object {
|
|||||||
this.#prevGamma = this.#gamma;
|
this.#prevGamma = this.#gamma;
|
||||||
this.#prevTemperature = this.#temperature;
|
this.#prevTemperature = this.#temperature;
|
||||||
|
|
||||||
execAsync("hyprctl hyprsunset identity").then(() => {
|
|
||||||
this.#identity = true;
|
this.#identity = true;
|
||||||
this.temperature = 10000;
|
this.temperature = 6000;
|
||||||
this.gamma = this.maxGamma;
|
this.gamma = this.maxGamma;
|
||||||
}).catch((r) => console.error(
|
|
||||||
`Night Light(hyprsunset): Couldn't set filters to identity(no filters). Stderr: ${r}`
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public filter(): void {
|
public filter(): void {
|
||||||
@@ -123,5 +127,8 @@ class NightLight extends GObject.Object {
|
|||||||
this.#identity = false;
|
this.#identity = false;
|
||||||
this.setTemperature(this.#prevTemperature ?? 1000);
|
this.setTemperature(this.#prevTemperature ?? 1000);
|
||||||
this.setGamma(this.#prevGamma ?? 100);
|
this.setGamma(this.#prevGamma ?? 100);
|
||||||
|
|
||||||
|
this.#prevTemperature = null;
|
||||||
|
this.#prevGamma = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const TileNightLight = Tile({
|
|||||||
bind(NightLight.getDefault(), "temperature"),
|
bind(NightLight.getDefault(), "temperature"),
|
||||||
bind(NightLight.getDefault(), "gamma")
|
bind(NightLight.getDefault(), "gamma")
|
||||||
], (temp, gamma) =>
|
], (temp, gamma) =>
|
||||||
(temp === 10000 ? tr("control_center.tiles.night_light.default_desc")
|
(temp === 6000 ? tr("control_center.tiles.night_light.default_desc")
|
||||||
: `${temp}K`) + (gamma < NightLight.getDefault().maxGamma ?
|
: `${temp}K`) + (gamma < NightLight.getDefault().maxGamma ?
|
||||||
` (${gamma}%)` : "")
|
` (${gamma}%)` : "")
|
||||||
)(),
|
)(),
|
||||||
@@ -21,6 +21,5 @@ export const TileNightLight = Tile({
|
|||||||
onToggledOn: () => NightLight.getDefault().identity = false,
|
onToggledOn: () => NightLight.getDefault().identity = false,
|
||||||
enableOnClickMore: true,
|
enableOnClickMore: true,
|
||||||
onClickMore: () => togglePage(PageNightLight),
|
onClickMore: () => togglePage(PageNightLight),
|
||||||
toggleState: bind(NightLight.getDefault(), "identity").as(identity =>
|
toggleState: bind(NightLight.getDefault(), "identity").as(identity => !identity)
|
||||||
identity ? false : true)
|
|
||||||
} as TileProps);
|
} as TileProps);
|
||||||
|
|||||||
Reference in New Issue
Block a user