diff options
| author | xDarksome <dev@darkso.me> | 2022-06-24 18:58:11 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-24 18:58:11 +0300 |
| commit | be460ea9547691eb136bf8b600b67b778af47e3f (patch) | |
| tree | b74869ad39dd804aec31694d4dd429822c223644 /src/config | |
| parent | 776ca3baf269059e8c13ba8b625645215e71f78c (diff) | |
| parent | e7467c60f9fe9e66c74dd8dc7c752a73ed4bc4db (diff) | |
Merge branch 'hyprwm:main' into main
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/ConfigManager.cpp | 38 | ||||
| -rw-r--r-- | src/config/ConfigManager.hpp | 7 | ||||
| -rw-r--r-- | src/config/defaultConfig.hpp | 2 |
3 files changed, 37 insertions, 10 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index d511c05a..c3621847 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -20,7 +20,7 @@ CConfigManager::CConfigManager() { void CConfigManager::setDefaultVars() { configValues["general:max_fps"].intValue = 240; configValues["general:sensitivity"].floatValue = 0.25f; - configValues["general:apply_sens_to_raw"].intValue = 1; + configValues["general:apply_sens_to_raw"].intValue = 0; configValues["general:main_mod"].strValue = "SUPER"; // exposed to the user for easier configuring configValues["general:main_mod_internal"].intValue = g_pKeybindManager->stringToModMask("SUPER"); // actually used and automatically calculated @@ -28,6 +28,7 @@ void CConfigManager::setDefaultVars() { configValues["general:damage_tracking_internal"].intValue = DAMAGE_TRACKING_NONE; configValues["general:border_size"].intValue = 1; + configValues["general:no_border_on_floating"].intValue = 0; configValues["general:gaps_in"].intValue = 5; configValues["general:gaps_out"].intValue = 20; configValues["general:col.active_border"].intValue = 0xffffffff; @@ -46,6 +47,7 @@ void CConfigManager::setDefaultVars() { configValues["decoration:inactive_opacity"].floatValue = 1; configValues["decoration:fullscreen_opacity"].floatValue = 1; configValues["decoration:multisample_edges"].intValue = 0; + configValues["decoration:no_blur_on_oversized"].intValue = 1; configValues["dwindle:pseudotile"].intValue = 0; configValues["dwindle:col.group_border"].intValue = 0x66777700; @@ -415,7 +417,7 @@ void CConfigManager::handleAnimation(const std::string& command, const std::stri configSetValueSafe("animations:" + ANIMNAME + "_style", curitem); } -void CConfigManager::handleBind(const std::string& command, const std::string& value) { +void CConfigManager::handleBind(const std::string& command, const std::string& value, bool locked) { // example: // bind=SUPER,G,exec,dmenu_run <args> @@ -448,7 +450,7 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v } if (KEY != "") - g_pKeybindManager->addKeybind(SKeybind{KEY, MOD, HANDLER, COMMAND}); + g_pKeybindManager->addKeybind(SKeybind{KEY, MOD, HANDLER, COMMAND, locked, m_szCurrentSubmap}); } void CConfigManager::handleUnbind(const std::string& command, const std::string& value) { @@ -495,16 +497,23 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str void CConfigManager::handleDefaultWorkspace(const std::string& command, const std::string& value) { const auto DISPLAY = value.substr(0, value.find_first_of(',')); - const auto WORKSPACEID = stoi(value.substr(value.find_first_of(',') + 1)); + const auto WORKSPACE = value.substr(value.find_first_of(',') + 1); for (auto& mr : m_dMonitorRules) { if (mr.name == DISPLAY) { - mr.defaultWorkspaceID = WORKSPACEID; + mr.defaultWorkspace = WORKSPACE; break; } } } +void CConfigManager::handleSubmap(const std::string& command, const std::string& submap) { + if (submap == "reset") + m_szCurrentSubmap = ""; + else + m_szCurrentSubmap = submap; +} + void CConfigManager::handleSource(const std::string& command, const std::string& rawpath) { static const char* const ENVHOME = getenv("HOME"); @@ -578,12 +587,14 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std:: } else if (COMMAND == "monitor") handleMonitor(COMMAND, VALUE); else if (COMMAND == "bind") handleBind(COMMAND, VALUE); + else if (COMMAND == "bindl") handleBind(COMMAND, VALUE, true); else if (COMMAND == "unbind") handleUnbind(COMMAND, VALUE); else if (COMMAND == "workspace") handleDefaultWorkspace(COMMAND, VALUE); else if (COMMAND == "windowrule") handleWindowRule(COMMAND, VALUE); else if (COMMAND == "bezier") handleBezier(COMMAND, VALUE); else if (COMMAND == "animation") handleAnimation(COMMAND, VALUE); else if (COMMAND == "source") handleSource(COMMAND, VALUE); + else if (COMMAND == "submap") handleSubmap(COMMAND, VALUE); else configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE); @@ -900,15 +911,26 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow) { std::string title = g_pXWaylandManager->getTitle(pWindow); std::string appidclass = g_pXWaylandManager->getAppIDClass(pWindow); + Debug::log(LOG, "Searching for matching rules for %s (title: %s)", appidclass.c_str(), title.c_str()); + for (auto& rule : m_dWindowRules) { // check if we have a matching rule try { - std::regex classCheck(rule.szValue); + if (rule.szValue.find("title:") == 0) { + // we have a title rule. + std::regex RULECHECK(rule.szValue.substr(6)); + + if (!std::regex_search(title, RULECHECK)) + continue; + } else { + std::regex classCheck(rule.szValue); - if (!std::regex_search(title, classCheck) && !std::regex_search(appidclass, classCheck)) - continue; + if (!std::regex_search(appidclass, classCheck)) + continue; + } } catch (...) { Debug::log(ERR, "Regex error at %s", rule.szValue.c_str()); + continue; } // applies. Read the rule and behave accordingly diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 866b8b8e..8c0bd857 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -28,7 +28,7 @@ struct SMonitorRule { Vector2D offset = Vector2D(0,0); float scale = 1; float refreshRate = 60; - int defaultWorkspaceID = -1; + std::string defaultWorkspace = ""; bool disabled = false; wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL; }; @@ -88,6 +88,8 @@ private: std::string parseError = ""; // For storing a parse error to display later + std::string m_szCurrentSubmap = ""; // For storing the current keybind submap + bool isFirstLaunch = true; // For exec-once std::deque<SMonitorRule> m_dMonitorRules; @@ -106,13 +108,14 @@ private: void configSetValueSafe(const std::string&, const std::string&); void handleRawExec(const std::string&, const std::string&); void handleMonitor(const std::string&, const std::string&); - void handleBind(const std::string&, const std::string&); + void handleBind(const std::string&, const std::string&, bool locked = false); void handleUnbind(const std::string&, const std::string&); void handleWindowRule(const std::string&, const std::string&); void handleDefaultWorkspace(const std::string&, const std::string&); void handleBezier(const std::string&, const std::string&); void handleAnimation(const std::string&, const std::string&); void handleSource(const std::string&, const std::string&); + void handleSubmap(const std::string&, const std::string&); }; inline std::unique_ptr<CConfigManager> g_pConfigManager;
\ No newline at end of file diff --git a/src/config/defaultConfig.hpp b/src/config/defaultConfig.hpp index 30ef5009..fbf3981d 100644 --- a/src/config/defaultConfig.hpp +++ b/src/config/defaultConfig.hpp @@ -34,6 +34,8 @@ general { col.active_border=0x66ee1111 col.inactive_border=0x66333333 + apply_sens_to_raw=0 # do not apply the sensitivity to raw input (e.g. used by games where you aim) + damage_tracking=full # leave it on full unless you hate your GPU and want to make it suffer } |
