Make datetime format configurable (#18)

Co-authored-by: Sciu-Crak <sciu-crak@crak-tower.ironyworld>
Co-authored-by: FaulTTY <faultty@localhost>
This commit is contained in:
faulTTY 2023-05-26 08:57:02 +02:00 committed by GitHub
parent 77924b5097
commit 9aa310fd07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 1 deletions

View file

@ -43,6 +43,9 @@ UseHyprlandIPC: false
# This can cause issues, if there is not enough space on screen (e.g. when opening the text)
CenterTime: true
# Set datetime style
# DateTimeStyle: %a %D - %H:%M:%S %Z
# Adds a audio input(aka. microphone) widget
AudioInput: false

View file

@ -165,6 +165,7 @@ void Config::Load()
AddConfigVar("ExitCommand", config.exitCommand, lineView, foundProperty);
AddConfigVar("BatteryFolder", config.batteryFolder, lineView, foundProperty);
AddConfigVar("DefaultWorkspaceSymbol", config.defaultWorkspaceSymbol, lineView, foundProperty);
AddConfigVar("DateTimeStyle", config.dateTimeStyle, lineView, foundProperty);
AddConfigVar("CheckPackagesCommand", config.checkPackagesCommand, lineView, foundProperty);
for (int i = 1; i < 10; i++)
{

View file

@ -15,6 +15,7 @@ public:
std::string batteryFolder = ""; // this can be BAT0, BAT1, etc. Usually in /sys/class/power_supply
std::vector<std::string> workspaceSymbols = std::vector<std::string>(9, "");
std::string defaultWorkspaceSymbol = "";
std::string dateTimeStyle = "%a %D - %H:%M:%S %Z"; // A sane default
// Script that returns how many packages are out-of-date. The script should only print a number!
// See data/update.sh for a human-readable version

View file

@ -604,7 +604,7 @@ namespace System
time_t stdTime = time(NULL);
tm* localTime = localtime(&stdTime);
std::stringstream str;
str << std::put_time(localTime, "%a %D - %H:%M:%S %Z");
str << std::put_time(localTime, Config::Get().dateTimeStyle.c_str());
return str.str();
}