Add config for modifying sensor size

This wasn't possible with css, as I hardcoded 24 for the size

For ping: https://github.com/scorpion-26/gBar/issues/64
This commit is contained in:
scorpion-26 2023-11-23 23:37:57 +01:00
parent 9c0dcb7385
commit 1279d3e2fb
4 changed files with 12 additions and 3 deletions

View file

@ -153,6 +153,12 @@ DrmAmdCard: card0
# Use tooltips instead of sliders for the sensors
SensorTooltips: false
# The size of the of the circular sensors
SensorSize: 24
# The size of the network icon
NetworkIconSize: 24
# Enables tray icons
EnableSNI: true

View file

@ -463,7 +463,7 @@ namespace Bar
}
sensor->SetStyle({angle});
sensor->AddTimer<Sensor>(std::move(callback), DynCtx::updateTime);
Utils::SetTransform(*sensor, {24, true, Alignment::Fill});
Utils::SetTransform(*sensor, {(int)Config::Get().sensorSize, true, Alignment::Fill});
switch (side)
{
@ -751,7 +751,7 @@ namespace Bar
sensor->SetLimitDown({(double)Config::Get().minDownloadBytes, (double)Config::Get().maxDownloadBytes});
sensor->SetAngle(Utils::GetAngle());
sensor->AddTimer<NetworkSensor>(DynCtx::UpdateNetwork, DynCtx::updateTime);
Utils::SetTransform(*sensor, {24, true, Alignment::Fill});
Utils::SetTransform(*sensor, {(int)Config::Get().networkIconSize, true, Alignment::Fill});
switch (side)
{

View file

@ -244,7 +244,6 @@ void Config::Load()
AddConfigVar("CheckPackagesCommand", config.checkPackagesCommand, lineView, foundProperty);
AddConfigVar("DiskPartition", config.diskPartition, lineView, foundProperty);
AddConfigVar("ShutdownIcon", config.shutdownIcon, lineView, foundProperty);
AddConfigVar("RebootIcon", config.rebootIcon, lineView, foundProperty);
AddConfigVar("SleepIcon", config.sleepIcon, lineView, foundProperty);
@ -285,6 +284,8 @@ void Config::Load()
AddConfigVar("TimeSpace", config.timeSpace, lineView, foundProperty);
AddConfigVar("NumWorkspaces", config.numWorkspaces, lineView, foundProperty);
AddConfigVar("AudioScrollSpeed", config.audioScrollSpeed, lineView, foundProperty);
AddConfigVar("SensorSize", config.sensorSize, lineView, foundProperty);
AddConfigVar("NetworkIconSize", config.networkIconSize, lineView, foundProperty);
AddConfigVar("AudioMinVolume", config.audioMinVolume, lineView, foundProperty);
AddConfigVar("AudioMaxVolume", config.audioMaxVolume, lineView, foundProperty);

View file

@ -76,6 +76,8 @@ public:
uint32_t checkUpdateInterval = 5 * 60; // Interval to run the "checkPackagesCommand". In seconds
uint32_t timeSpace = 300; // How much time should be reserved for the time widget.
uint32_t numWorkspaces = 9; // How many workspaces to display
uint32_t sensorSize = 24; // The size of the circular sensors
uint32_t networkIconSize = 24; // The size of the two network arrows
char location = 'T'; // The Location of the bar. Can be L,R,T,B