💥 ags(control-center/tiles): hide tiles if its dependencies aren't installed
This commit is contained in:
@@ -4,8 +4,11 @@ import { NightLight } from "../../../scripts/nightlight";
|
|||||||
import { PageNightLight } from "../pages/NightLight";
|
import { PageNightLight } from "../pages/NightLight";
|
||||||
import { tr } from "../../../i18n/intl";
|
import { tr } from "../../../i18n/intl";
|
||||||
import { TilesPages } from "../Tiles";
|
import { TilesPages } from "../Tiles";
|
||||||
|
import { isInstalled } from "../../../scripts/utils";
|
||||||
|
import { Widget } from "astal/gtk3";
|
||||||
|
|
||||||
export const TileNightLight = Tile({
|
export const TileNightLight = () => isInstalled("hyprsunset") ?
|
||||||
|
Tile({
|
||||||
title: tr("control_center.tiles.night_light.title"),
|
title: tr("control_center.tiles.night_light.title"),
|
||||||
icon: "",
|
icon: "",
|
||||||
description: Variable.derive([
|
description: Variable.derive([
|
||||||
@@ -22,4 +25,5 @@ export const TileNightLight = Tile({
|
|||||||
enableOnClickMore: true,
|
enableOnClickMore: true,
|
||||||
onClickMore: () => TilesPages?.toggle(PageNightLight()),
|
onClickMore: () => TilesPages?.toggle(PageNightLight()),
|
||||||
toggleState: bind(NightLight.getDefault(), "identity").as(identity => !identity)
|
toggleState: bind(NightLight.getDefault(), "identity").as(identity => !identity)
|
||||||
} as TileProps);
|
} as TileProps)()
|
||||||
|
: new Widget.Box({ visible: false } as Widget.BoxProps);
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { Recording } from "../../../scripts/recording";
|
|||||||
import { bind, Variable } from "astal";
|
import { bind, Variable } from "astal";
|
||||||
import { tr } from "../../../i18n/intl";
|
import { tr } from "../../../i18n/intl";
|
||||||
import { getDateTime } from "../../../scripts/time";
|
import { getDateTime } from "../../../scripts/time";
|
||||||
|
import { isInstalled } from "../../../scripts/utils";
|
||||||
|
|
||||||
|
const wfRecorderInstalled = isInstalled("wf-recorder");
|
||||||
|
|
||||||
export const TileRecording = Tile({
|
export const TileRecording = Tile({
|
||||||
title: tr("control_center.tiles.recording.title") || "Screen Recording",
|
title: tr("control_center.tiles.recording.title") || "Screen Recording",
|
||||||
@@ -25,6 +28,7 @@ export const TileRecording = Tile({
|
|||||||
}:${ seconds < 10 ? `0${seconds}` : seconds }`;
|
}:${ seconds < 10 ? `0${seconds}` : seconds }`;
|
||||||
})(),
|
})(),
|
||||||
icon: "",
|
icon: "",
|
||||||
|
visible: wfRecorderInstalled,
|
||||||
onToggledOff: () => Recording.getDefault().stopRecording(),
|
onToggledOff: () => Recording.getDefault().stopRecording(),
|
||||||
onToggledOn: () => Recording.getDefault().startRecording(),
|
onToggledOn: () => Recording.getDefault().startRecording(),
|
||||||
toggleState: bind(Recording.getDefault(), "recording"),
|
toggleState: bind(Recording.getDefault(), "recording"),
|
||||||
|
|||||||
Reference in New Issue
Block a user