From 1279d3e2fb35b5df01fa86b77fa5d8d2bfa3274e Mon Sep 17 00:00:00 2001 From: scorpion-26 Date: Thu, 23 Nov 2023 23:37:57 +0100 Subject: [PATCH] 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 --- data/config | 6 ++++++ src/Bar.cpp | 4 ++-- src/Config.cpp | 3 ++- src/Config.h | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/data/config b/data/config index 96ac81a..0446868 100644 --- a/data/config +++ b/data/config @@ -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 diff --git a/src/Bar.cpp b/src/Bar.cpp index f99289d..4f30048 100644 --- a/src/Bar.cpp +++ b/src/Bar.cpp @@ -463,7 +463,7 @@ namespace Bar } sensor->SetStyle({angle}); sensor->AddTimer(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(DynCtx::UpdateNetwork, DynCtx::updateTime); - Utils::SetTransform(*sensor, {24, true, Alignment::Fill}); + Utils::SetTransform(*sensor, {(int)Config::Get().networkIconSize, true, Alignment::Fill}); switch (side) { diff --git a/src/Config.cpp b/src/Config.cpp index 3c058fb..71cb603 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -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); diff --git a/src/Config.h b/src/Config.h index c3c5ff1..9aba3c6 100644 --- a/src/Config.h +++ b/src/Config.h @@ -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