Add option to not center the time

Setting this will make https://github.com/scorpion-26/gBar/issues/4 less
likely.
This commit is contained in:
scorpion-26 2023-01-29 21:31:00 +01:00
parent a623018ee2
commit dce92a63f8
4 changed files with 8 additions and 1 deletions

View file

@ -27,3 +27,7 @@ BatteryFolder: /sys/class/power_supply/BAT1
# The default symbol for the workspaces # The default symbol for the workspaces
DefaultWorkspaceSymbol:  DefaultWorkspaceSymbol: 
# Forces the time to be centered.
# This can cause issues, if there is not enough space on screen (e.g. when opening the text)
CenterTime: true

View file

@ -2,6 +2,7 @@
#include "System.h" #include "System.h"
#include "Common.h" #include "Common.h"
#include "Config.h"
namespace Bar namespace Bar
{ {
@ -409,7 +410,7 @@ namespace Bar
monitorID = monitor; monitorID = monitor;
auto mainWidget = Widget::Create<Box>(); auto mainWidget = Widget::Create<Box>();
mainWidget->SetSpacing({0, true}); mainWidget->SetSpacing({0, Config::Get().centerTime});
mainWidget->SetClass("bar"); mainWidget->SetClass("bar");
{ {
#ifdef HAS_HYPRLAND #ifdef HAS_HYPRLAND

View file

@ -123,6 +123,7 @@ void Config::Load()
AddConfigVar("LockCommand", config.lockCommand, lineView, foundProperty); AddConfigVar("LockCommand", config.lockCommand, lineView, foundProperty);
AddConfigVar("ExitCommand", config.exitCommand, lineView, foundProperty); AddConfigVar("ExitCommand", config.exitCommand, lineView, foundProperty);
AddConfigVar("BatteryFolder", config.batteryFolder, lineView, foundProperty); AddConfigVar("BatteryFolder", config.batteryFolder, lineView, foundProperty);
AddConfigVar("CenterTime", config.centerTime, lineView, foundProperty);
AddConfigVar("DefaultWorkspaceSymbol", config.defaultWorkspaceSymbol, lineView, foundProperty); AddConfigVar("DefaultWorkspaceSymbol", config.defaultWorkspaceSymbol, lineView, foundProperty);
for (int i = 1; i < 10; i++) for (int i = 1; i < 10; i++)
{ {

View file

@ -13,6 +13,7 @@ public:
std::vector<std::string> workspaceSymbols = std::vector<std::string>(9, ""); std::vector<std::string> workspaceSymbols = std::vector<std::string>(9, "");
std::string defaultWorkspaceSymbol = ""; std::string defaultWorkspaceSymbol = "";
bool centerTime = true;
static void Load(); static void Load();
static const Config& Get(); static const Config& Get();