Combine laptop battery/network and asus/disk widgets

This commit is contained in:
2026-02-18 21:20:01 -08:00
committed by Kat Huang
parent d61b4bbdc6
commit 9dd86cfac9

View File

@@ -219,10 +219,14 @@ audioWidget :: TaffyIO Gtk.Widget
audioWidget = audioWidget =
decorateWithClassAndBoxM "audio" PulseAudio.pulseAudioNew decorateWithClassAndBoxM "audio" PulseAudio.pulseAudioNew
networkInnerWidget :: TaffyIO Gtk.Widget
networkInnerWidget =
withNmAppletMenu NetworkManager.networkManagerWifiIconLabelNew
>>= flip widgetSetClassGI "network"
networkWidget :: TaffyIO Gtk.Widget networkWidget :: TaffyIO Gtk.Widget
networkWidget = networkWidget =
decorateWithClassAndBoxM "network" $ decorateWithClassAndBoxM "network" networkInnerWidget
withNmAppletMenu NetworkManager.networkManagerWifiIconLabelNew
layoutWidget :: TaffyIO Gtk.Widget layoutWidget :: TaffyIO Gtk.Widget
layoutWidget = layoutWidget =
@@ -340,11 +344,15 @@ mprisWidget =
} }
} }
batteryWidget :: TaffyIO Gtk.Widget batteryInnerWidget :: TaffyIO Gtk.Widget
batteryWidget = do batteryInnerWidget = do
iconWidget <- batteryTextIconNew iconWidget <- batteryTextIconNew
labelWidget <- textBatteryNew "$percentage$%" labelWidget <- textBatteryNew "$percentage$%"
decorateWithClassAndBox "battery" =<< liftIO (buildIconLabelBox iconWidget labelWidget) liftIO (buildIconLabelBox iconWidget labelWidget) >>= flip widgetSetClassGI "battery"
batteryWidget :: TaffyIO Gtk.Widget
batteryWidget =
decorateWithClassAndBoxM "battery" batteryInnerWidget
backlightWidget :: TaffyIO Gtk.Widget backlightWidget :: TaffyIO Gtk.Widget
backlightWidget = backlightWidget =
@@ -359,9 +367,13 @@ backlightWidget =
} }
) )
diskUsageInnerWidget :: TaffyIO Gtk.Widget
diskUsageInnerWidget =
diskUsageNew >>= flip widgetSetClassGI "disk-usage"
diskUsageWidget :: TaffyIO Gtk.Widget diskUsageWidget :: TaffyIO Gtk.Widget
diskUsageWidget = diskUsageWidget =
decorateWithClassAndBoxM "disk-usage" diskUsageNew decorateWithClassAndBoxM "disk-usage" diskUsageInnerWidget
stackInPill :: Text -> [TaffyIO Gtk.Widget] -> TaffyIO Gtk.Widget stackInPill :: Text -> [TaffyIO Gtk.Widget] -> TaffyIO Gtk.Widget
stackInPill klass builders = stackInPill klass builders =
@@ -435,9 +447,20 @@ audioBacklightWidget =
} }
] ]
asusInnerWidget :: TaffyIO Gtk.Widget
asusInnerWidget = ASUS.asusWidgetNew
asusWidget :: TaffyIO Gtk.Widget asusWidget :: TaffyIO Gtk.Widget
asusWidget = asusWidget =
decorateWithClassAndBoxM "asus-profile" ASUS.asusWidgetNew decorateWithClassAndBoxM "asus-profile" asusInnerWidget
batteryNetworkWidget :: TaffyIO Gtk.Widget
batteryNetworkWidget =
stackInPill "battery-network" [batteryInnerWidget, networkInnerWidget]
asusDiskUsageWidget :: TaffyIO Gtk.Widget
asusDiskUsageWidget =
stackInPill "asus-disk-usage" [diskUsageInnerWidget, asusInnerWidget]
screenLockWidget :: TaffyIO Gtk.Widget screenLockWidget :: TaffyIO Gtk.Widget
screenLockWidget = screenLockWidget =
@@ -501,8 +524,8 @@ endWidgetsForHost :: String -> [TaffyIO Gtk.Widget]
endWidgetsForHost hostName = endWidgetsForHost hostName =
-- NOTE: end widgets are packed with Gtk.boxPackEnd, so the list order is -- NOTE: end widgets are packed with Gtk.boxPackEnd, so the list order is
-- right-to-left on screen. Make the tray appear at the far right by placing -- right-to-left on screen. Make the tray appear at the far right by placing
-- it first in the list. (On laptops: battery is far right, tray immediately -- it first in the list. (On laptops: the battery/wifi stack is far right,
-- left of it.) -- tray immediately left of it.)
let baseEndWidgets = let baseEndWidgets =
[ sniTrayWidget, [ sniTrayWidget,
audioWidget, audioWidget,
@@ -513,13 +536,11 @@ endWidgetsForHost hostName =
mprisWidget mprisWidget
] ]
laptopEndWidgets = laptopEndWidgets =
[ batteryWidget, [ batteryNetworkWidget,
sniTrayWidget, sniTrayWidget,
asusWidget, asusDiskUsageWidget,
audioBacklightWidget, audioBacklightWidget,
ramSwapWidget, ramSwapWidget,
diskUsageWidget,
networkWidget,
sunLockWidget, sunLockWidget,
mprisWidget mprisWidget
] ]