From 9476c6700ed4743e75bd7a5bc761995a07603eba Mon Sep 17 00:00:00 2001 From: myamusashi Date: Tue, 24 Dec 2024 12:33:53 +0700 Subject: [PATCH] Toggle icons for binding --- src/components/bar/modules/warp/index.tsx | 7 ++++--- src/options.ts | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/bar/modules/warp/index.tsx b/src/components/bar/modules/warp/index.tsx index 1a5637988..3eeeb3840 100644 --- a/src/components/bar/modules/warp/index.tsx +++ b/src/components/bar/modules/warp/index.tsx @@ -8,7 +8,8 @@ import { Astal } from "astal/gtk3"; const { label, - icon, + onIcon, + offIcon, onLabel, offLabel, rightClick, @@ -20,8 +21,8 @@ const { const thorttledToggleWarp = throttleInput(() => toggleWarp(isWarpConnect), 1000); export const Warp = (): BarBoxChild => { - const iconBinding = Variable.derive([bind(isWarpConnect), bind(icon)], (active, icn) => { - return active ? icn : '󰇖'; + const iconBinding = Variable.derive([bind(isWarpConnect), bind(onIcon), bind(offIcon)], (active, onIcn, offIcn) => { + return active ? onIcn : offIcn; }) const tooltipBinding = Variable.derive([isWarpConnect], (active) => { diff --git a/src/options.ts b/src/options.ts index 433beb715..1b2691811 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1152,8 +1152,9 @@ const options = mkOptions(CONFIG, { scrollDown: opt(''), }, warp: { - icon: opt(''), label: opt(true), + onIcon: opt(''), + offIcon: opt('󰇖'), onLabel: opt('On'), offLabel: opt('Off'), rightClick: opt(''),