Merge branch 'master' into master
This commit is contained in:
@@ -4,6 +4,7 @@ import { ensureDirectory } from './session';
|
|||||||
import Variable from 'astal/variable';
|
import Variable from 'astal/variable';
|
||||||
import { monitorFile, readFile, writeFile } from 'astal/file';
|
import { monitorFile, readFile, writeFile } from 'astal/file';
|
||||||
import GLib from 'gi://GLib?version=2.0';
|
import GLib from 'gi://GLib?version=2.0';
|
||||||
|
import { errorHandler } from './utils';
|
||||||
|
|
||||||
type OptProps = {
|
type OptProps = {
|
||||||
persistent?: boolean;
|
persistent?: boolean;
|
||||||
@@ -88,8 +89,8 @@ export class Opt<T = unknown> extends Variable<T> {
|
|||||||
if (rawData && rawData.trim() !== '') {
|
if (rawData && rawData.trim() !== '') {
|
||||||
try {
|
try {
|
||||||
cacheData = JSON.parse(rawData) as Record<string, unknown>;
|
cacheData = JSON.parse(rawData) as Record<string, unknown>;
|
||||||
} catch {
|
} catch (error) {
|
||||||
// do nuffin
|
errorHandler(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,6 +179,7 @@ export function opt<T>(initial: T, props?: OptProps): Opt<T> {
|
|||||||
* @returns An array of all found `Opt` instances.
|
* @returns An array of all found `Opt` instances.
|
||||||
*/
|
*/
|
||||||
function getOptions(object: Record<string, unknown>, path = '', arr: Opt[] = []): Opt[] {
|
function getOptions(object: Record<string, unknown>, path = '', arr: Opt[] = []): Opt[] {
|
||||||
|
try {
|
||||||
for (const key in object) {
|
for (const key in object) {
|
||||||
const value = object[key];
|
const value = object[key];
|
||||||
const id = path ? `${path}.${key}` : key;
|
const id = path ? `${path}.${key}` : key;
|
||||||
@@ -191,6 +193,9 @@ function getOptions(object: Record<string, unknown>, path = '', arr: Opt[] = [])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
|
} catch (error) {
|
||||||
|
errorHandler(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ declare global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function ensureDirectory(path: string): void {
|
export function ensureDirectory(path: string): void {
|
||||||
if (!GLib.file_test(path, GLib.FileTest.EXISTS)) Gio.File.new_for_path(path).make_directory_with_parents(null);
|
if (!GLib.file_test(path, GLib.FileTest.EXISTS)) {
|
||||||
|
Gio.File.new_for_path(path).make_directory_with_parents(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ensureFile(path: string): void {
|
export function ensureFile(path: string): void {
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
.menu-items.audio {
|
||||||
|
border-color: if($bar-menus-monochrome, $bar-menus-border-color, $bar-menus-menu-volume-border-color);
|
||||||
|
opacity: $bar-menus-opacity * 0.01;
|
||||||
|
}
|
||||||
|
|
||||||
.menu-items-container.audio {
|
.menu-items-container.audio {
|
||||||
min-width: 18em * $bar-menus-menu-volume-scaling * 0.01;
|
min-width: 18em * $bar-menus-menu-volume-scaling * 0.01;
|
||||||
|
|
||||||
@@ -9,11 +14,6 @@
|
|||||||
|
|
||||||
background: if($bar-menus-monochrome, $bar-menus-background, $bar-menus-menu-volume-background-color);
|
background: if($bar-menus-monochrome, $bar-menus-background, $bar-menus-menu-volume-background-color);
|
||||||
|
|
||||||
.menu-items {
|
|
||||||
border-color: if($bar-menus-monochrome, $bar-menus-border-color, $bar-menus-menu-volume-border-color);
|
|
||||||
opacity: $bar-menus-opacity * 0.01;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-dropdown-label.audio {
|
.menu-dropdown-label.audio {
|
||||||
color: if($bar-menus-monochrome, $bar-menus-label, $bar-menus-menu-volume-label-color);
|
color: if($bar-menus-monochrome, $bar-menus-label, $bar-menus-menu-volume-label-color);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user