mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-26 14:55:58 +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
|
# animations
|
||||||
anim.enabled=1
|
Animations {
|
||||||
anim.speed=5
|
enabled=1
|
||||||
anim.cheap=1 # highly recommended
|
speed=5
|
||||||
|
cheap=1 # highly recommended
|
||||||
|
}
|
||||||
|
|
||||||
# keybinds
|
# keybinds
|
||||||
bind=SUPER,R,exec,dmenu_run
|
bind=SUPER,R,exec,dmenu_run
|
||||||
|
|
|
@ -38,9 +38,9 @@ void ConfigManager::init() {
|
||||||
configValues["col.inactive_border"].intValue = 0x77222222;
|
configValues["col.inactive_border"].intValue = 0x77222222;
|
||||||
|
|
||||||
// animations
|
// animations
|
||||||
configValues["anim.speed"].floatValue = 1;
|
configValues["anim:speed"].floatValue = 1;
|
||||||
configValues["anim.enabled"].intValue = 0;
|
configValues["anim:enabled"].intValue = 0;
|
||||||
configValues["anim.cheap"].intValue = 1;
|
configValues["anim:cheap"].intValue = 1;
|
||||||
|
|
||||||
if (!g_pWindowManager->statusBar) {
|
if (!g_pWindowManager->statusBar) {
|
||||||
isFirstLaunch = true;
|
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) {
|
void parseLine(std::string& line) {
|
||||||
// first check if its not a comment
|
// first check if its not a comment
|
||||||
const auto COMMENTSTART = line.find_first_of('#');
|
const auto COMMENTSTART = line.find_first_of('#');
|
||||||
|
@ -246,20 +260,30 @@ void parseLine(std::string& line) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.find("Bar {") != std::string::npos) {
|
if (line.find("Bar {") != std::string::npos) {
|
||||||
ConfigManager::isBar = true;
|
ConfigManager::currentCategory = "bar";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.find("}") != std::string::npos && ConfigManager::isBar) {
|
if (line.find("Animations {") != std::string::npos) {
|
||||||
ConfigManager::isBar = false;
|
ConfigManager::currentCategory = "anim";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigManager::isBar) {
|
if (line.find("}") != std::string::npos && ConfigManager::currentCategory != "") {
|
||||||
|
ConfigManager::currentCategory = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ConfigManager::currentCategory == "bar") {
|
||||||
parseBarLine(line);
|
parseBarLine(line);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ConfigManager::currentCategory == "anim") {
|
||||||
|
parseAnimLine(line);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// And parse
|
// And parse
|
||||||
// check if command
|
// check if command
|
||||||
const auto EQUALSPLACE = line.find_first_of('=');
|
const auto EQUALSPLACE = line.find_first_of('=');
|
||||||
|
@ -290,7 +314,7 @@ void parseLine(std::string& line) {
|
||||||
void ConfigManager::loadConfigLoadVars() {
|
void ConfigManager::loadConfigLoadVars() {
|
||||||
Debug::log(LOG, "Reloading the config!");
|
Debug::log(LOG, "Reloading the config!");
|
||||||
ConfigManager::parseError = ""; // reset the error
|
ConfigManager::parseError = ""; // reset the error
|
||||||
ConfigManager::isBar = false; // reset the bar
|
ConfigManager::currentCategory = ""; // reset the category
|
||||||
|
|
||||||
if (loadBar && g_pWindowManager->statusBar) {
|
if (loadBar && g_pWindowManager->statusBar) {
|
||||||
// clear modules as we overwrite them
|
// clear modules as we overwrite them
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace ConfigManager {
|
||||||
|
|
||||||
inline bool loadBar = false;
|
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;
|
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();
|
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();
|
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;
|
bool updateRequired = false;
|
||||||
|
@ -16,7 +16,7 @@ void AnimationUtil::move() {
|
||||||
// check if window needs an animation.
|
// check if window needs an animation.
|
||||||
window.setIsAnimated(false);
|
window.setIsAnimated(false);
|
||||||
|
|
||||||
if (ConfigManager::getInt("anim.enabled") == 0 || window.getIsFloating()) {
|
if (ConfigManager::getInt("anim:enabled") == 0 || window.getIsFloating()) {
|
||||||
// Disabled animations. instant warps.
|
// Disabled animations. instant warps.
|
||||||
|
|
||||||
if (VECTORDELTANONZERO(window.getRealPosition(), window.getEffectivePosition())
|
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 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[0] = (int)window.getRealSize().x;
|
||||||
Values[1] = (int)window.getRealSize().y;
|
Values[1] = (int)window.getRealSize().y;
|
||||||
xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, Values);
|
xcb_configure_window(DisplayConnection, window.getDrawable(), XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, Values);
|
||||||
window.setFirstAnimFrame(true);
|
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
|
// first frame, fix the size if smaller
|
||||||
window.setFirstAnimFrame(false);
|
window.setFirstAnimFrame(false);
|
||||||
if (window.getRealSize().x < window.getEffectiveSize().x || window.getRealSize().y < window.getEffectiveSize().y) {
|
if (window.getRealSize().x < window.getEffectiveSize().x || window.getRealSize().y < window.getEffectiveSize().y) {
|
||||||
|
|
Loading…
Reference in a new issue