added border color config

This commit is contained in:
vaxerski 2021-11-22 19:06:00 +01:00
parent 4ffa3ab6a1
commit 6898923463
3 changed files with 21 additions and 8 deletions

View File

@ -6,10 +6,14 @@
gaps_in=5
border_size=1
gaps_out=20
bar_height=15
bar_height=20
max_fps=60
# colors
col.active_border=0x77ff3333
col.inactive_border=0x77222222
# keybinds
bind=SUPER,R,exec,dmenu_run
bind=SUPER,Q,exec,kitty

View File

@ -19,6 +19,11 @@ void ConfigManager::init() {
configValues["bar_monitor"].intValue = 0;
configValues["bar_height"].intValue = 15;
// Set Colors ARGB
configValues["col.active_border"].intValue = 0x77FF3333;
configValues["col.inactive_border"].intValue = 0x77222222;
loadConfigLoadVars();
}
@ -88,7 +93,12 @@ void parseLine(std::string& line) {
auto& CONFIGENTRY = ConfigManager::configValues.at(COMMAND);
if (CONFIGENTRY.intValue != -1) {
try {
CONFIGENTRY.intValue = stoi(VALUE);
if (VALUE.find("0x") == 0) {
// Values with 0x are hex
const auto VALUEWITHOUTHEX = VALUE.substr(2);
CONFIGENTRY.intValue = stoi(VALUEWITHOUTHEX, nullptr, 16);
} else
CONFIGENTRY.intValue = stoi(VALUE);
} catch (...) {
Debug::log(WARN, "Error reading value of " + COMMAND);
}

View File

@ -149,7 +149,7 @@ void CWindowManager::setupManager() {
updateBarInfo();
// start its' update thread
Events::setThread();
//Events::setThread();
Debug::log(LOG, "Bar done.");
@ -312,11 +312,10 @@ void CWindowManager::refreshDirtyWindows() {
Values[0] = (int)ConfigManager::getInt("border_size");
xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_BORDER_WIDTH, Values);
Values[0] = 0xFF3333; // RED :)
Values[0] = ConfigManager::getInt("col.active_border");
xcb_change_window_attributes(DisplayConnection, window.getDrawable(), XCB_CW_BORDER_PIXEL, Values);
} else {
Values[0] = 0x222222; // GRAY :)
Values[0] = ConfigManager::getInt("col.inactive_border");
xcb_change_window_attributes(DisplayConnection, window.getDrawable(), XCB_CW_BORDER_PIXEL, Values);
}
@ -332,10 +331,10 @@ void CWindowManager::setFocusedWindow(xcb_drawable_t window) {
xcb_set_input_focus(DisplayConnection, XCB_INPUT_FOCUS_POINTER_ROOT, window, XCB_CURRENT_TIME);
// Fix border from the old window that was in focus.
Values[0] = 0x555555; // GRAY :)
Values[0] = ConfigManager::getInt("col.inactive_border");
xcb_change_window_attributes(DisplayConnection, LastWindow, XCB_CW_BORDER_PIXEL, Values);
Values[0] = 0xFF3333; // RED :)
Values[0] = ConfigManager::getInt("col.active_border");
xcb_change_window_attributes(DisplayConnection, window, XCB_CW_BORDER_PIXEL, Values);
LastWindow = window;