mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-12-24 02:19:49 +01:00
I broke your configs. (see example.conf animations part)
np guys love yall too
This commit is contained in:
parent
d44c5a9f16
commit
2ac537a2fa
5 changed files with 42 additions and 16 deletions
|
@ -46,9 +46,11 @@ col.inactive_border=0x77222222
|
|||
#
|
||||
|
||||
# animations
|
||||
anim.enabled=1
|
||||
anim.speed=5
|
||||
anim.cheap=1 # highly recommended
|
||||
Animations {
|
||||
enabled=1
|
||||
speed=5
|
||||
cheap=1 # highly recommended
|
||||
}
|
||||
|
||||
# keybinds
|
||||
bind=SUPER,R,exec,dmenu_run
|
||||
|
|
|
@ -38,9 +38,9 @@ void ConfigManager::init() {
|
|||
configValues["col.inactive_border"].intValue = 0x77222222;
|
||||
|
||||
// animations
|
||||
configValues["anim.speed"].floatValue = 1;
|
||||
configValues["anim.enabled"].intValue = 0;
|
||||
configValues["anim.cheap"].intValue = 1;
|
||||
configValues["anim:speed"].floatValue = 1;
|
||||
configValues["anim:enabled"].intValue = 0;
|
||||
configValues["anim:cheap"].intValue = 1;
|
||||
|
||||
if (!g_pWindowManager->statusBar) {
|
||||
isFirstLaunch = true;
|
||||
|
@ -230,6 +230,20 @@ void parseBarLine(const std::string& line) {
|
|||
}
|
||||
}
|
||||
|
||||
void parseAnimLine(const std::string& line) {
|
||||
// And parse
|
||||
// check if command
|
||||
const auto EQUALSPLACE = line.find_first_of('=');
|
||||
|
||||
if (EQUALSPLACE == std::string::npos)
|
||||
return;
|
||||
|
||||
const auto COMMAND = line.substr(0, EQUALSPLACE);
|
||||
const auto VALUE = line.substr(EQUALSPLACE + 1);
|
||||
|
||||
configSetValueSafe("anim:" + COMMAND, VALUE);
|
||||
}
|
||||
|
||||
void parseLine(std::string& line) {
|
||||
// first check if its not a comment
|
||||
const auto COMMENTSTART = line.find_first_of('#');
|
||||
|
@ -246,20 +260,30 @@ void parseLine(std::string& line) {
|
|||
}
|
||||
|
||||
if (line.find("Bar {") != std::string::npos) {
|
||||
ConfigManager::isBar = true;
|
||||
ConfigManager::currentCategory = "bar";
|
||||
return;
|
||||
}
|
||||
|
||||
if (line.find("}") != std::string::npos && ConfigManager::isBar) {
|
||||
ConfigManager::isBar = false;
|
||||
if (line.find("Animations {") != std::string::npos) {
|
||||
ConfigManager::currentCategory = "anim";
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigManager::isBar) {
|
||||
if (line.find("}") != std::string::npos && ConfigManager::currentCategory != "") {
|
||||
ConfigManager::currentCategory = "";
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigManager::currentCategory == "bar") {
|
||||
parseBarLine(line);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigManager::currentCategory == "anim") {
|
||||
parseAnimLine(line);
|
||||
return;
|
||||
}
|
||||
|
||||
// And parse
|
||||
// check if command
|
||||
const auto EQUALSPLACE = line.find_first_of('=');
|
||||
|
@ -290,7 +314,7 @@ void parseLine(std::string& line) {
|
|||
void ConfigManager::loadConfigLoadVars() {
|
||||
Debug::log(LOG, "Reloading the config!");
|
||||
ConfigManager::parseError = ""; // reset the error
|
||||
ConfigManager::isBar = false; // reset the bar
|
||||
ConfigManager::currentCategory = ""; // reset the category
|
||||
|
||||
if (loadBar && g_pWindowManager->statusBar) {
|
||||
// clear modules as we overwrite them
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace ConfigManager {
|
|||
|
||||
inline bool loadBar = false;
|
||||
|
||||
inline bool isBar = false; // If true we send the command to the bar parser
|
||||
inline std::string currentCategory = "";
|
||||
|
||||
inline bool isFirstLaunch = false;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ void AnimationUtil::move() {
|
|||
const double DELTA = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - lastFrame).count();
|
||||
lastFrame = std::chrono::high_resolution_clock::now();
|
||||
|
||||
const double ANIMATIONSPEED = ((double)1 / (double)ConfigManager::getFloat("anim.speed")) * DELTA;
|
||||
const double ANIMATIONSPEED = ((double)1 / (double)ConfigManager::getFloat("anim:speed")) * DELTA;
|
||||
|
||||
|
||||
bool updateRequired = false;
|
||||
|
@ -16,7 +16,7 @@ void AnimationUtil::move() {
|
|||
// check if window needs an animation.
|
||||
window.setIsAnimated(false);
|
||||
|
||||
if (ConfigManager::getInt("anim.enabled") == 0 || window.getIsFloating()) {
|
||||
if (ConfigManager::getInt("anim:enabled") == 0 || window.getIsFloating()) {
|
||||
// Disabled animations. instant warps.
|
||||
|
||||
if (VECTORDELTANONZERO(window.getRealPosition(), window.getEffectivePosition())
|
||||
|
|
|
@ -404,14 +404,14 @@ void CWindowManager::refreshDirtyWindows() {
|
|||
}
|
||||
|
||||
// If it isn't animated or we have non-cheap animations, update the real size
|
||||
if (!window.getIsAnimated() || ConfigManager::getInt("anim.cheap") == 0) {
|
||||
if (!window.getIsAnimated() || ConfigManager::getInt("anim:cheap") == 0) {
|
||||
Values[0] = (int)window.getRealSize().x;
|
||||
Values[1] = (int)window.getRealSize().y;
|
||||
xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, Values);
|
||||
window.setFirstAnimFrame(true);
|
||||
}
|
||||
|
||||
if (ConfigManager::getInt("anim.cheap") == 1 && window.getFirstAnimFrame() && window.getIsAnimated()) {
|
||||
if (ConfigManager::getInt("anim:cheap") == 1 && window.getFirstAnimFrame() && window.getIsAnimated()) {
|
||||
// first frame, fix the size if smaller
|
||||
window.setFirstAnimFrame(false);
|
||||
if (window.getRealSize().x < window.getEffectiveSize().x || window.getRealSize().y < window.getEffectiveSize().y) {
|
||||
|
|
Loading…
Reference in a new issue