Merge branch 'ryo' into ryo
This commit is contained in:
+12
-2
@@ -2,8 +2,12 @@ import { Astal } from "astal/gtk3";
|
||||
|
||||
import AstalApps from "gi://AstalApps";
|
||||
import AstalHyprland from "gi://AstalHyprland";
|
||||
import { execAsync } from "astal";
|
||||
|
||||
|
||||
const astalApps: AstalApps.Apps = new AstalApps.Apps();
|
||||
const uwsmIsActive: boolean = await execAsync("uwsm check is-active").then((stdout) =>
|
||||
/hyprland/gi.test(stdout)).catch(() => false);
|
||||
let appsList: Array<AstalApps.Application> = astalApps.get_list();
|
||||
|
||||
export function getApps(): Array<AstalApps.Application> {
|
||||
@@ -19,8 +23,14 @@ export function getAstalApps(): AstalApps.Apps {
|
||||
return astalApps;
|
||||
}
|
||||
|
||||
export function cleanExec(app: AstalApps.Application): void {
|
||||
AstalHyprland.get_default().dispatch("exec", app.executable.replace(/(%f|%F|%u|%U|%i|%c|%k)/g, ""));
|
||||
/** handles running with uwsm if it's installed */
|
||||
export function execApp(app: AstalApps.Application|string, dispatchExecArgs?: string) {
|
||||
const executable = (typeof app === "string") ? app
|
||||
: app.executable.replace(/(%f|%F|%u|%U|%i|%c|%k)/g, "");
|
||||
|
||||
AstalHyprland.get_default().dispatch("exec",
|
||||
`${dispatchExecArgs ? `${dispatchExecArgs} ` : ""}${uwsmIsActive ? "uwsm app -- " : ""}${executable}`
|
||||
);
|
||||
}
|
||||
|
||||
export function getAppsByName(appName: string): (Array<AstalApps.Application>|undefined) {
|
||||
|
||||
+10
-11
@@ -22,11 +22,10 @@ class NightLight extends GObject.Object {
|
||||
public get gamma() { return this.#gamma; }
|
||||
public set gamma(newValue: number) { this.setGamma(newValue); }
|
||||
|
||||
@property(Number)
|
||||
public get maxTemperature() { return 20000; }
|
||||
|
||||
@property(Number)
|
||||
public get maxGamma() { return 100; }
|
||||
public readonly maxTemperature = 20000;
|
||||
public readonly minTemperature = 1000;
|
||||
public readonly identityTemperature = 6000;
|
||||
public readonly maxGamma = 100;
|
||||
|
||||
@property(Boolean)
|
||||
public get identity() { return this.#identity; }
|
||||
@@ -72,7 +71,7 @@ class NightLight extends GObject.Object {
|
||||
return this.instance;
|
||||
}
|
||||
|
||||
private async setTemperature(value: number): Promise<void> {
|
||||
private setTemperature(value: number): void {
|
||||
if(value === this.temperature) return;
|
||||
|
||||
if(value > this.maxTemperature || value < 1000) {
|
||||
@@ -93,7 +92,7 @@ class NightLight extends GObject.Object {
|
||||
));
|
||||
}
|
||||
|
||||
private async setGamma(value: number) {
|
||||
private setGamma(value: number): void {
|
||||
if(value === this.gamma) return;
|
||||
|
||||
if(value > this.maxGamma || value < 0) {
|
||||
@@ -114,14 +113,14 @@ class NightLight extends GObject.Object {
|
||||
));
|
||||
}
|
||||
|
||||
private applyIdentity(): void {
|
||||
public applyIdentity(): void {
|
||||
if(this.#identity) return;
|
||||
|
||||
this.#prevGamma = this.#gamma;
|
||||
this.#prevTemperature = this.#temperature;
|
||||
|
||||
this.#identity = true;
|
||||
this.temperature = 6000;
|
||||
this.temperature = this.identityTemperature;
|
||||
this.gamma = this.maxGamma;
|
||||
}
|
||||
|
||||
@@ -129,8 +128,8 @@ class NightLight extends GObject.Object {
|
||||
if(!this.#identity) return;
|
||||
|
||||
this.#identity = false;
|
||||
this.setTemperature(this.#prevTemperature ?? 1000);
|
||||
this.setGamma(this.#prevGamma ?? 100);
|
||||
this.setTemperature(this.#prevTemperature ?? this.identityTemperature);
|
||||
this.setGamma(this.#prevGamma ?? this.maxGamma);
|
||||
|
||||
this.#prevTemperature = null;
|
||||
this.#prevGamma = null;
|
||||
|
||||
@@ -12,11 +12,11 @@ export class Stylesheet {
|
||||
"./style.scss"
|
||||
];
|
||||
|
||||
public compileSass(): void {
|
||||
public async compileSass(): Promise<void> {
|
||||
console.log("Stylesheet: Compiling Sass");
|
||||
|
||||
exec(`bash -c "sass ${this.#styles.map(style => `-I ${style}`).join('\s')
|
||||
} ${this.#outputPath.get_path()!}/style.css"`);
|
||||
exec(`bash -c "sass ${this.#styles.map(style => `-I ${style}`).join('\s')} ${
|
||||
this.#outputPath.get_path()!}/style.css"`);
|
||||
}
|
||||
|
||||
public async reapply(cssFilePath: string): Promise<void> {
|
||||
@@ -37,8 +37,10 @@ export class Stylesheet {
|
||||
}
|
||||
|
||||
public async compileApply(): Promise<void> {
|
||||
this.compileSass();
|
||||
this.reapply(this.#outputPath.get_path()! + "/style.css");
|
||||
await this.compileSass().catch((err: Gio.IOErrorEnum) =>
|
||||
console.error(`Stylesheet: An Error occurred and Sass couldn't be compiled. Stderr:\n${err.message ?
|
||||
`\t${err.message}\n` : ""}${err.stack}\n`)
|
||||
).then(() => this.reapply(this.#outputPath.get_path()! + "/style.css"));
|
||||
}
|
||||
|
||||
public static getDefault(): Stylesheet {
|
||||
|
||||
Reference in New Issue
Block a user