💥 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 { tr } from "../../../i18n/intl";
|
||||
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"),
|
||||
icon: "",
|
||||
description: Variable.derive([
|
||||
@@ -22,4 +25,5 @@ export const TileNightLight = Tile({
|
||||
enableOnClickMore: true,
|
||||
onClickMore: () => TilesPages?.toggle(PageNightLight()),
|
||||
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 { tr } from "../../../i18n/intl";
|
||||
import { getDateTime } from "../../../scripts/time";
|
||||
import { isInstalled } from "../../../scripts/utils";
|
||||
|
||||
const wfRecorderInstalled = isInstalled("wf-recorder");
|
||||
|
||||
export const TileRecording = Tile({
|
||||
title: tr("control_center.tiles.recording.title") || "Screen Recording",
|
||||
@@ -25,6 +28,7 @@ export const TileRecording = Tile({
|
||||
}:${ seconds < 10 ? `0${seconds}` : seconds }`;
|
||||
})(),
|
||||
icon: "",
|
||||
visible: wfRecorderInstalled,
|
||||
onToggledOff: () => Recording.getDefault().stopRecording(),
|
||||
onToggledOn: () => Recording.getDefault().startRecording(),
|
||||
toggleState: bind(Recording.getDefault(), "recording"),
|
||||
|
||||
Reference in New Issue
Block a user