Skip to content

Commit

Permalink
Merge pull request #381 from Gelio/hide-widgets-container-when-none-a…
Browse files Browse the repository at this point in the history
…re-enabled

Hide widgets container when none are enabled
  • Loading branch information
Jean-Tinland authored Dec 23, 2023
2 parents ce2066e + be84fa7 commit 878658e
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const refreshFrequency = false;
const settings = Settings.get();
const { yabaiPath = "/usr/local/bin/yabai", shell } = settings.global;
const { processWidget } = settings.widgets;
const hasAnyWidgetEnabled = Object.entries(settings.widgets)
.filter(([widgetName]) => widgetName !== "processWidget")
.some(([_, enabled]) => enabled);
const { hideWindowTitle, displayOnlyIcon, displaySkhdMode } = settings.process;

const enableTitleChangedSignal = hideWindowTitle || displayOnlyIcon;
Expand Down Expand Up @@ -127,28 +130,30 @@ const render = ({ output, error }) => {
skhdMode={skhdMode}
/>
)}
<div className="simple-bar__data">
<Settings.Wrapper />
<UserWidgets display={displayIndex} />
<Zoom.Widget display={displayIndex} />
<BrowserTrack.Widget display={displayIndex} />
<Spotify.Widget display={displayIndex} />
<Crypto.Widget display={displayIndex} />
<Stock.Widget display={displayIndex} />
<Music.Widget display={displayIndex} />
<Mpd.Widget display={displayIndex} />
<Weather.Widget display={displayIndex} />
<Netstats.Widget display={displayIndex} />
<Cpu.Widget display={displayIndex} />
<Battery.Widget display={displayIndex} />
<Mic.Widget display={displayIndex} />
<Sound.Widget display={displayIndex} />
<ViscosityVPN.Widget display={displayIndex} />
<Wifi.Widget display={displayIndex} />
<Keyboard.Widget display={displayIndex} />
<DateDisplay.Widget display={displayIndex} />
<Time.Widget display={displayIndex} />
</div>
<Settings.Wrapper />
{hasAnyWidgetEnabled && (
<div className="simple-bar__data">
<UserWidgets display={displayIndex} />
<Zoom.Widget display={displayIndex} />
<BrowserTrack.Widget display={displayIndex} />
<Spotify.Widget display={displayIndex} />
<Crypto.Widget display={displayIndex} />
<Stock.Widget display={displayIndex} />
<Music.Widget display={displayIndex} />
<Mpd.Widget display={displayIndex} />
<Weather.Widget display={displayIndex} />
<Netstats.Widget display={displayIndex} />
<Cpu.Widget display={displayIndex} />
<Battery.Widget display={displayIndex} />
<Mic.Widget display={displayIndex} />
<Sound.Widget display={displayIndex} />
<ViscosityVPN.Widget display={displayIndex} />
<Wifi.Widget display={displayIndex} />
<Keyboard.Widget display={displayIndex} />
<DateDisplay.Widget display={displayIndex} />
<Time.Widget display={displayIndex} />
</div>
)}
</div>
);
};
Expand Down

0 comments on commit 878658e

Please sign in to comment.