Skip to content

Commit

Permalink
Toggle icons for binding
Browse files Browse the repository at this point in the history
  • Loading branch information
myamusashi committed Dec 24, 2024
1 parent 5abb96e commit 9476c67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/components/bar/modules/warp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { Astal } from "astal/gtk3";

const {
label,
icon,
onIcon,
offIcon,
onLabel,
offLabel,
rightClick,
Expand All @@ -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) => {
Expand Down
3 changes: 2 additions & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(''),
Expand Down

0 comments on commit 9476c67

Please sign in to comment.