From bb75df9eb364de0cac403c2e9e63a3635ac7c2b9 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 29 Apr 2024 18:59:06 +0700 Subject: [PATCH] fix null not window error; don't add nulls when ternaries are wrong --- .config/ags/config.js | 3 ++- .../ags/modules/.commonwidgets/configwidgets.js | 16 ++++++++-------- .../ags/modules/.commonwidgets/statusicons.js | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.config/ags/config.js b/.config/ags/config.js index a8924a288..77555b4c9 100644 --- a/.config/ags/config.js +++ b/.config/ags/config.js @@ -46,6 +46,7 @@ applyStyle().catch(print); const Windows = () => [ // forMonitors(DesktopBackground), + Overview(), forMonitors(Indicator), forMonitors(Cheatsheet), @@ -53,7 +54,7 @@ const Windows = () => [ SideRight(), forMonitors(Osk), forMonitors(Session), - userOptions.dock.enabled ? forMonitors(Dock) : null, + ...(userOptions.dock.enabled ? [forMonitors(Dock)] : []), ...(userOptions.appearance.fakeScreenRounding ? [ forMonitors((id) => Corner(id, 'top left', true)), forMonitors((id) => Corner(id, 'top right', true)), diff --git a/.config/ags/modules/.commonwidgets/configwidgets.js b/.config/ags/modules/.commonwidgets/configwidgets.js index 60b136222..e66847f07 100644 --- a/.config/ags/modules/.commonwidgets/configwidgets.js +++ b/.config/ags/modules/.commonwidgets/configwidgets.js @@ -50,12 +50,12 @@ export const ConfigToggle = ({ tooltipText: desc, className: 'txt spacing-h-5 configtoggle-box', children: [ - (icon !== undefined ? MaterialIcon(icon, 'norm') : null), - (name !== undefined ? Label({ + ...(icon !== undefined ? [MaterialIcon(icon, 'norm')] : []), + ...(name !== undefined ? [Label({ className: 'txt txt-small', label: name, - }) : null), - expandWidget ? Box({ hexpand: true }) : null, + })] : []), + ...(expandWidget ? [Box({ hexpand: true })] : []), toggleButton, ] }); @@ -203,12 +203,12 @@ export const ConfigSpinButton = ({ tooltipText: desc, className: 'txt spacing-h-5 configtoggle-box', children: [ - (icon !== undefined ? MaterialIcon(icon, 'norm') : null), - (name !== undefined ? Label({ + ...(icon !== undefined ? [MaterialIcon(icon, 'norm')] : []), + ...(name !== undefined ? [Label({ className: 'txt txt-small', label: name, - }) : null), - expandWidget ? Box({ hexpand: true }) : null, + })] : []), + ...(expandWidget ? [Box({ hexpand: true })] : []), spinButton, ], setup: (self) => { diff --git a/.config/ags/modules/.commonwidgets/statusicons.js b/.config/ags/modules/.commonwidgets/statusicons.js index 340ef51bc..d74cf9979 100644 --- a/.config/ags/modules/.commonwidgets/statusicons.js +++ b/.config/ags/modules/.commonwidgets/statusicons.js @@ -106,7 +106,7 @@ const BluetoothDevices = () => Widget.Box({ tooltipText: device.name, children: [ Widget.Icon(`${device.iconName}-symbolic`), - (device.batteryPercentage ? Widget.Label({ + ...(device.batteryPercentage ? [Widget.Label({ className: 'txt-smallie', label: `${device.batteryPercentage}`, setup: (self) => { @@ -114,7 +114,7 @@ const BluetoothDevices = () => Widget.Box({ self.label = `${device.batteryPercentage}`; }, 'notify::batteryPercentage') } - }) : null), + })] : []), ] }); });