mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-21 21:15:59 +01:00
Various fixes (#103)
* Update README.md * Update README.md * Added relative workspace switching * Added a haiku to readme * haiku in readme * Limit workspace from 1 to 10 (relative switching) * Fixed workspace animation direction * move window to relative workspace * faster split ratio change * turns out relative workspace is already there lol * Adjustable splitratio * removed vscode stuff * a * Fixed y resize speed * clean * Added a separate config value for resize speed * Update hypr.conf * Update hypr.conf * Apply requested changes by vaxry * use new config name for RESIZEANIMATIONSPEED
This commit is contained in:
parent
03daf47f50
commit
d1e83d16c2
7 changed files with 79 additions and 39 deletions
|
@ -55,11 +55,12 @@ col.inactive_border=0x77222222
|
||||||
|
|
||||||
# animations
|
# animations
|
||||||
Animations {
|
Animations {
|
||||||
enabled=1
|
enabled=1 # For windows
|
||||||
speed=5
|
window_resize_speed=5 # This is for windows resizing
|
||||||
|
workspaces=1 # For workspace animations (fixed, enabling by default)
|
||||||
|
speed=5 # This is for workspaces
|
||||||
cheap=1 # highly recommended
|
cheap=1 # highly recommended
|
||||||
borders=0
|
borders=0
|
||||||
workspaces=0 # not really recommended
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# example window rules, more in the wiki
|
# example window rules, more in the wiki
|
||||||
|
|
|
@ -171,6 +171,18 @@ void KeybindManager::movefocus(std::string arg) {
|
||||||
g_pWindowManager->moveActiveFocusTo(arg[0]);
|
g_pWindowManager->moveActiveFocusTo(arg[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeybindManager::movetorelativeworkspace(std::string arg) {
|
||||||
|
try {
|
||||||
|
if (arg == "+")
|
||||||
|
g_pWindowManager->moveActiveWindowToRelativeWorkspace(1);
|
||||||
|
else if (arg == "-")
|
||||||
|
g_pWindowManager->moveActiveWindowToRelativeWorkspace(-1);
|
||||||
|
} catch (...) {
|
||||||
|
Debug::log(ERR, "Invalid arg in movetoworkspace, arg: " + arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void KeybindManager::movetoworkspace(std::string arg) {
|
void KeybindManager::movetoworkspace(std::string arg) {
|
||||||
try {
|
try {
|
||||||
if (arg == "scratchpad")
|
if (arg == "scratchpad")
|
||||||
|
@ -260,7 +272,7 @@ void KeybindManager::toggleActiveWindowFloating(std::string arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeybindManager::changeSplitRatio(std::string args) {
|
void KeybindManager::changeSplitRatio(std::string args) {
|
||||||
g_pWindowManager->changeSplitRatioCurrent(args[0]);
|
g_pWindowManager->changeSplitRatioCurrent(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeybindManager::togglePseudoActive(std::string args) {
|
void KeybindManager::togglePseudoActive(std::string args) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace KeybindManager {
|
||||||
void toggleActiveWindowFullscreen(std::string args);
|
void toggleActiveWindowFullscreen(std::string args);
|
||||||
void toggleActiveWindowFloating(std::string args);
|
void toggleActiveWindowFloating(std::string args);
|
||||||
void movetoworkspace(std::string args);
|
void movetoworkspace(std::string args);
|
||||||
|
void movetorelativeworkspace(std::string args);
|
||||||
void changeSplitRatio(std::string args);
|
void changeSplitRatio(std::string args);
|
||||||
void togglePseudoActive(std::string args);
|
void togglePseudoActive(std::string args);
|
||||||
void toggleScratchpad(std::string args);
|
void toggleScratchpad(std::string args);
|
||||||
|
|
|
@ -51,10 +51,11 @@ void ConfigManager::init() {
|
||||||
|
|
||||||
// animations
|
// animations
|
||||||
configValues["animations:speed"].floatValue = 1;
|
configValues["animations:speed"].floatValue = 1;
|
||||||
|
configValues["animations:window_resize_speed"].floatValue = 1;
|
||||||
configValues["animations:enabled"].intValue = 0;
|
configValues["animations:enabled"].intValue = 0;
|
||||||
configValues["animations:cheap"].intValue = 1;
|
configValues["animations:cheap"].intValue = 1;
|
||||||
configValues["animations:borders"].intValue = 1;
|
configValues["animations:borders"].intValue = 1;
|
||||||
configValues["animations:workspaces"].intValue = 0;
|
configValues["animations:workspaces"].intValue = 1;
|
||||||
|
|
||||||
configValues["autogenerated"].intValue = 0;
|
configValues["autogenerated"].intValue = 0;
|
||||||
|
|
||||||
|
@ -129,6 +130,7 @@ void handleBind(const std::string& command, const std::string& value) {
|
||||||
if (HANDLER == "movewindow") dispatcher = KeybindManager::movewindow;
|
if (HANDLER == "movewindow") dispatcher = KeybindManager::movewindow;
|
||||||
if (HANDLER == "movefocus") dispatcher = KeybindManager::movefocus;
|
if (HANDLER == "movefocus") dispatcher = KeybindManager::movefocus;
|
||||||
if (HANDLER == "movetoworkspace") dispatcher = KeybindManager::movetoworkspace;
|
if (HANDLER == "movetoworkspace") dispatcher = KeybindManager::movetoworkspace;
|
||||||
|
if (HANDLER == "movetorelativeworkspace") dispatcher = KeybindManager::movetorelativeworkspace;
|
||||||
if (HANDLER == "workspace") dispatcher = KeybindManager::changeworkspace;
|
if (HANDLER == "workspace") dispatcher = KeybindManager::changeworkspace;
|
||||||
if (HANDLER == "lastworkspace") dispatcher = KeybindManager::changetolastworkspace;
|
if (HANDLER == "lastworkspace") dispatcher = KeybindManager::changetolastworkspace;
|
||||||
if (HANDLER == "togglefloating") dispatcher = KeybindManager::toggleActiveWindowFloating;
|
if (HANDLER == "togglefloating") dispatcher = KeybindManager::toggleActiveWindowFloating;
|
||||||
|
|
|
@ -8,6 +8,7 @@ void AnimationUtil::move() {
|
||||||
lastFrame = std::chrono::high_resolution_clock::now();
|
lastFrame = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
const double ANIMATIONSPEED = std::max(1.f / ((double)ConfigManager::getFloat("animations:speed") * DELTA) * 462.f, (double)1.f);
|
const double ANIMATIONSPEED = std::max(1.f / ((double)ConfigManager::getFloat("animations:speed") * DELTA) * 462.f, (double)1.f);
|
||||||
|
const double RESIZEANIMATIONSPEED = std::max(1.f / ((double)ConfigManager::getFloat("animations:window_resize_speed") * DELTA) * 462.f, (double)1.f);
|
||||||
|
|
||||||
bool updateRequired = false;
|
bool updateRequired = false;
|
||||||
// Now we are (or should be, lul) thread-safe.
|
// Now we are (or should be, lul) thread-safe.
|
||||||
|
@ -77,7 +78,7 @@ void AnimationUtil::move() {
|
||||||
const auto REALSIZ = window.getRealSize();
|
const auto REALSIZ = window.getRealSize();
|
||||||
const auto EFFSIZ = window.getEffectiveSize();
|
const auto EFFSIZ = window.getEffectiveSize();
|
||||||
|
|
||||||
window.setRealSize(Vector2D(parabolic(REALSIZ.x, EFFSIZ.x, ANIMATIONSPEED), parabolic(REALSIZ.y, EFFSIZ.y, ANIMATIONSPEED)));
|
window.setRealSize(Vector2D(parabolic(REALSIZ.x, EFFSIZ.x, RESIZEANIMATIONSPEED), parabolic(REALSIZ.y, EFFSIZ.y, RESIZEANIMATIONSPEED)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set not animated if already done here
|
// set not animated if already done here
|
||||||
|
|
|
@ -1553,6 +1553,11 @@ void CWindowManager::warpCursorTo(Vector2D to) {
|
||||||
free(pointerreply);
|
free(pointerreply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWindowManager::moveActiveWindowToRelativeWorkspace(int relativenum) {
|
||||||
|
if (activeWorkspaceID + relativenum < 1) return;
|
||||||
|
moveActiveWindowToWorkspace(activeWorkspaceID + relativenum);
|
||||||
|
}
|
||||||
|
|
||||||
void CWindowManager::moveActiveWindowToWorkspace(int workspace) {
|
void CWindowManager::moveActiveWindowToWorkspace(int workspace) {
|
||||||
|
|
||||||
auto PWINDOW = getWindowFromDrawable(LastWindow);
|
auto PWINDOW = getWindowFromDrawable(LastWindow);
|
||||||
|
@ -1756,7 +1761,6 @@ void CWindowManager::moveActiveFocusTo(char dir) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindowManager::changeWorkspaceByID(int ID) {
|
void CWindowManager::changeWorkspaceByID(int ID) {
|
||||||
|
|
||||||
auto MONITOR = getMonitorFromCursor();
|
auto MONITOR = getMonitorFromCursor();
|
||||||
|
|
||||||
if (!MONITOR) {
|
if (!MONITOR) {
|
||||||
|
@ -1775,7 +1779,7 @@ void CWindowManager::changeWorkspaceByID(int ID) {
|
||||||
// mark old workspace dirty
|
// mark old workspace dirty
|
||||||
setAllWorkspaceWindowsDirtyByID(activeWorkspaces[MONITOR->ID]);
|
setAllWorkspaceWindowsDirtyByID(activeWorkspaces[MONITOR->ID]);
|
||||||
|
|
||||||
// save old workspace for anim
|
// save old workspace for animation
|
||||||
auto OLDWORKSPACE = activeWorkspaces[MONITOR->ID];
|
auto OLDWORKSPACE = activeWorkspaces[MONITOR->ID];
|
||||||
lastActiveWorkspaceID = OLDWORKSPACE;
|
lastActiveWorkspaceID = OLDWORKSPACE;
|
||||||
|
|
||||||
|
@ -1794,8 +1798,9 @@ void CWindowManager::changeWorkspaceByID(int ID) {
|
||||||
// if fullscreen, set to the fullscreen window
|
// if fullscreen, set to the fullscreen window
|
||||||
focusOnWorkspace(ID);
|
focusOnWorkspace(ID);
|
||||||
|
|
||||||
// Update bar info
|
// Update bar info, activeWorkspaceID
|
||||||
updateBarInfo();
|
updateBarInfo();
|
||||||
|
activeWorkspaceID = ID;
|
||||||
|
|
||||||
Debug::log(LOG, "Bar info updated with workspace changed.");
|
Debug::log(LOG, "Bar info updated with workspace changed.");
|
||||||
|
|
||||||
|
@ -1816,8 +1821,9 @@ void CWindowManager::changeWorkspaceByID(int ID) {
|
||||||
activeWorkspaces[MONITOR->ID] = workspaces[workspaces.size() - 1].getID();
|
activeWorkspaces[MONITOR->ID] = workspaces[workspaces.size() - 1].getID();
|
||||||
LastWindow = -1;
|
LastWindow = -1;
|
||||||
|
|
||||||
// Update bar info
|
// Update bar info, activeWorkspaceID
|
||||||
updateBarInfo();
|
updateBarInfo();
|
||||||
|
activeWorkspaceID = ID;
|
||||||
|
|
||||||
// Wipe animation
|
// Wipe animation
|
||||||
startWipeAnimOnWorkspace(OLDWORKSPACE, ID);
|
startWipeAnimOnWorkspace(OLDWORKSPACE, ID);
|
||||||
|
@ -2481,6 +2487,7 @@ void CWindowManager::recalcAllDocks() {
|
||||||
void CWindowManager::startWipeAnimOnWorkspace(const int& oldwork, const int& newwork) {
|
void CWindowManager::startWipeAnimOnWorkspace(const int& oldwork, const int& newwork) {
|
||||||
const auto PMONITOR = getMonitorFromWorkspace(newwork);
|
const auto PMONITOR = getMonitorFromWorkspace(newwork);
|
||||||
|
|
||||||
|
if (newwork < oldwork) { // Wipe from left to right
|
||||||
for (auto& work : workspaces) {
|
for (auto& work : workspaces) {
|
||||||
if (work.getID() == oldwork) {
|
if (work.getID() == oldwork) {
|
||||||
if (ConfigManager::getInt("animations:workspaces") == 1)
|
if (ConfigManager::getInt("animations:workspaces") == 1)
|
||||||
|
@ -2498,6 +2505,25 @@ void CWindowManager::startWipeAnimOnWorkspace(const int& oldwork, const int& new
|
||||||
work.setAnimationInProgress(true);
|
work.setAnimationInProgress(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else { // Wipe from right to left (oldwork < newwork)
|
||||||
|
for (auto& work : workspaces) {
|
||||||
|
if (work.getID() == oldwork) {
|
||||||
|
if (ConfigManager::getInt("animations:workspaces") == 1)
|
||||||
|
work.setCurrentOffset(Vector2D(0,0));
|
||||||
|
else
|
||||||
|
work.setCurrentOffset(Vector2D(150000, 150000));
|
||||||
|
work.setGoalOffset(Vector2D(-PMONITOR->vecSize.x, 0));
|
||||||
|
work.setAnimationInProgress(true);
|
||||||
|
} else if (work.getID() == newwork) {
|
||||||
|
if (ConfigManager::getInt("animations:workspaces") == 1)
|
||||||
|
work.setCurrentOffset(Vector2D(PMONITOR->vecSize.x, 0));
|
||||||
|
else
|
||||||
|
work.setCurrentOffset(Vector2D(0, 0));
|
||||||
|
work.setGoalOffset(Vector2D(0, 0));
|
||||||
|
work.setAnimationInProgress(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindowManager::dispatchQueuedWarp() {
|
void CWindowManager::dispatchQueuedWarp() {
|
||||||
|
@ -2541,7 +2567,7 @@ SMonitor* CWindowManager::getMonitorFromCoord(const Vector2D coord) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindowManager::changeSplitRatioCurrent(const char& dir) {
|
void CWindowManager::changeSplitRatioCurrent(std::string dir) {
|
||||||
|
|
||||||
const auto CURRENT = getWindowFromDrawable(LastWindow);
|
const auto CURRENT = getWindowFromDrawable(LastWindow);
|
||||||
|
|
||||||
|
@ -2557,17 +2583,12 @@ void CWindowManager::changeSplitRatioCurrent(const char& dir) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(dir) {
|
if (dir == "+")
|
||||||
case '+':
|
|
||||||
PARENT->setSplitRatio(PARENT->getSplitRatio() + 0.05f);
|
PARENT->setSplitRatio(PARENT->getSplitRatio() + 0.05f);
|
||||||
break;
|
else if (dir == "-")
|
||||||
case '-':
|
|
||||||
PARENT->setSplitRatio(PARENT->getSplitRatio() - 0.05f);
|
PARENT->setSplitRatio(PARENT->getSplitRatio() - 0.05f);
|
||||||
break;
|
else
|
||||||
default:
|
PARENT->setSplitRatio(PARENT->getSplitRatio() + std::stof(dir));
|
||||||
Debug::log(ERR, "changeSplitRatioCurrent called with an invalid dir!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PARENT->setSplitRatio(std::clamp(PARENT->getSplitRatio(), 0.1f, 1.9f));
|
PARENT->setSplitRatio(std::clamp(PARENT->getSplitRatio(), 0.1f, 1.9f));
|
||||||
|
|
||||||
|
@ -2650,7 +2671,7 @@ void CWindowManager::processCursorDeltaOnWindowResizeTiled(CWindow* pWindow, con
|
||||||
const auto TOPCONTAINER = PARENTSIDEBYSIDE ? PPARENT2 : PPARENT;
|
const auto TOPCONTAINER = PARENTSIDEBYSIDE ? PPARENT2 : PPARENT;
|
||||||
|
|
||||||
allowedMovement.x *= 2.f / SIDECONTAINER->getSize().x;
|
allowedMovement.x *= 2.f / SIDECONTAINER->getSize().x;
|
||||||
allowedMovement.y *= 2.f / TOPCONTAINER->getSize().x;
|
allowedMovement.y *= 2.f / TOPCONTAINER->getSize().y;
|
||||||
|
|
||||||
SIDECONTAINER->setSplitRatio(std::clamp(SIDECONTAINER->getSplitRatio() + allowedMovement.x, (double)0.05f, (double)1.95f));
|
SIDECONTAINER->setSplitRatio(std::clamp(SIDECONTAINER->getSplitRatio() + allowedMovement.x, (double)0.05f, (double)1.95f));
|
||||||
TOPCONTAINER->setSplitRatio(std::clamp(TOPCONTAINER->getSplitRatio() + allowedMovement.y, (double)0.05f, (double)1.95f));
|
TOPCONTAINER->setSplitRatio(std::clamp(TOPCONTAINER->getSplitRatio() + allowedMovement.y, (double)0.05f, (double)1.95f));
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
// holds the IDs of open workspaces, Monitor ID -> workspace ID
|
// holds the IDs of open workspaces, Monitor ID -> workspace ID
|
||||||
std::deque<int> activeWorkspaces;
|
std::deque<int> activeWorkspaces;
|
||||||
int lastActiveWorkspaceID = 1;
|
int lastActiveWorkspaceID = 1;
|
||||||
|
int activeWorkspaceID = 1;
|
||||||
|
|
||||||
// Not really pipes, but files. Oh well. Used for IPC.
|
// Not really pipes, but files. Oh well. Used for IPC.
|
||||||
SIPCPipe m_sIPCBarPipeIn = {ISDEBUG ? "/tmp/hypr/hyprbarind" : "/tmp/hypr/hyprbarin", 0};
|
SIPCPipe m_sIPCBarPipeIn = {ISDEBUG ? "/tmp/hypr/hyprbarind" : "/tmp/hypr/hyprbarin", 0};
|
||||||
|
@ -93,6 +94,7 @@ public:
|
||||||
void moveActiveWindowTo(char);
|
void moveActiveWindowTo(char);
|
||||||
void moveActiveFocusTo(char);
|
void moveActiveFocusTo(char);
|
||||||
void moveActiveWindowToWorkspace(int);
|
void moveActiveWindowToWorkspace(int);
|
||||||
|
void moveActiveWindowToRelativeWorkspace(int);
|
||||||
void warpCursorTo(Vector2D);
|
void warpCursorTo(Vector2D);
|
||||||
void toggleWindowFullscrenn(const int&);
|
void toggleWindowFullscrenn(const int&);
|
||||||
void recalcAllDocks();
|
void recalcAllDocks();
|
||||||
|
@ -148,7 +150,7 @@ public:
|
||||||
|
|
||||||
bool shouldBeManaged(const int&);
|
bool shouldBeManaged(const int&);
|
||||||
|
|
||||||
void changeSplitRatioCurrent(const char& dir);
|
void changeSplitRatioCurrent(std::string dir);
|
||||||
|
|
||||||
void processCursorDeltaOnWindowResizeTiled(CWindow*, const Vector2D&);
|
void processCursorDeltaOnWindowResizeTiled(CWindow*, const Vector2D&);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue