mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-22 13:35:57 +01:00
Merge pull request #33 from imaphatduc/main
Change to the last opened workspace feature
This commit is contained in:
commit
fad22f452b
5 changed files with 18 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "KeybindManager.hpp"
|
#include "KeybindManager.hpp"
|
||||||
#include "utilities/Util.hpp"
|
#include "utilities/Util.hpp"
|
||||||
#include "events/events.hpp"
|
#include "events/events.hpp"
|
||||||
|
#include "windowManager.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -157,11 +158,15 @@ void KeybindManager::changeworkspace(std::string arg) {
|
||||||
|
|
||||||
if (ID != -1) {
|
if (ID != -1) {
|
||||||
Debug::log(LOG, "Changing the current workspace to " + std::to_string(ID));
|
Debug::log(LOG, "Changing the current workspace to " + std::to_string(ID));
|
||||||
|
|
||||||
g_pWindowManager->changeWorkspaceByID(ID);
|
g_pWindowManager->changeWorkspaceByID(ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeybindManager::changetolastworkspace(std::string arg) {
|
||||||
|
Debug::log(LOG, "Changing the current workspace to the last workspace");
|
||||||
|
g_pWindowManager->changeToLastWorkspace();
|
||||||
|
}
|
||||||
|
|
||||||
void KeybindManager::toggleActiveWindowFullscreen(std::string unusedArg) {
|
void KeybindManager::toggleActiveWindowFullscreen(std::string unusedArg) {
|
||||||
g_pWindowManager->toggleWindowFullscrenn(g_pWindowManager->LastWindow);
|
g_pWindowManager->toggleWindowFullscrenn(g_pWindowManager->LastWindow);
|
||||||
}
|
}
|
||||||
|
@ -206,4 +211,4 @@ void KeybindManager::toggleActiveWindowFloating(std::string unusedArg) {
|
||||||
|
|
||||||
g_pWindowManager->setAllFloatingWindowsTop();
|
g_pWindowManager->setAllFloatingWindowsTop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ namespace KeybindManager {
|
||||||
void movewindow(std::string args);
|
void movewindow(std::string args);
|
||||||
void movefocus(std::string args);
|
void movefocus(std::string args);
|
||||||
void changeworkspace(std::string args);
|
void changeworkspace(std::string args);
|
||||||
|
void changetolastworkspace(std::string args);
|
||||||
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);
|
||||||
};
|
};
|
||||||
|
|
|
@ -119,6 +119,7 @@ void handleBind(const std::string& command, const std::string& value) {
|
||||||
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 == "workspace") dispatcher = KeybindManager::changeworkspace;
|
if (HANDLER == "workspace") dispatcher = KeybindManager::changeworkspace;
|
||||||
|
if (HANDLER == "lastworkspace") dispatcher = KeybindManager::changetolastworkspace;
|
||||||
if (HANDLER == "togglefloating") dispatcher = KeybindManager::toggleActiveWindowFloating;
|
if (HANDLER == "togglefloating") dispatcher = KeybindManager::toggleActiveWindowFloating;
|
||||||
|
|
||||||
if (dispatcher && KEY != 0)
|
if (dispatcher && KEY != 0)
|
||||||
|
@ -543,4 +544,4 @@ std::vector<SWindowRule> ConfigManager::getMatchingRules(xcb_window_t w) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return returns;
|
return returns;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1617,6 +1617,7 @@ void CWindowManager::changeWorkspaceByID(int ID) {
|
||||||
|
|
||||||
// save old workspace for anim
|
// save old workspace for anim
|
||||||
auto OLDWORKSPACE = activeWorkspaces[MONITOR->ID];
|
auto OLDWORKSPACE = activeWorkspaces[MONITOR->ID];
|
||||||
|
lastActiveWorkspaceID = OLDWORKSPACE;
|
||||||
|
|
||||||
for (auto& workspace : workspaces) {
|
for (auto& workspace : workspaces) {
|
||||||
if (workspace.getID() == ID) {
|
if (workspace.getID() == ID) {
|
||||||
|
@ -1669,6 +1670,10 @@ void CWindowManager::changeWorkspaceByID(int ID) {
|
||||||
// no need for the new dirty, it's empty
|
// no need for the new dirty, it's empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWindowManager::changeToLastWorkspace() {
|
||||||
|
changeWorkspaceByID(lastActiveWorkspaceID);
|
||||||
|
}
|
||||||
|
|
||||||
void CWindowManager::focusOnWorkspace(const int& work) {
|
void CWindowManager::focusOnWorkspace(const int& work) {
|
||||||
const auto PWORKSPACE = getWorkspaceByID(work);
|
const auto PWORKSPACE = getWorkspaceByID(work);
|
||||||
const auto PMONITOR = getMonitorFromWorkspace(work);
|
const auto PMONITOR = getMonitorFromWorkspace(work);
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
|
|
||||||
std::deque<CWorkspace> workspaces;
|
std::deque<CWorkspace> workspaces;
|
||||||
std::deque<int> activeWorkspaces;
|
std::deque<int> activeWorkspaces;
|
||||||
|
int lastActiveWorkspaceID = 1;
|
||||||
|
|
||||||
// Pipes
|
// Pipes
|
||||||
SIPCPipe m_sIPCBarPipeIn = {ISDEBUG ? "/tmp/hypr/hyprbarind" : "/tmp/hypr/hyprbarin", 0};
|
SIPCPipe m_sIPCBarPipeIn = {ISDEBUG ? "/tmp/hypr/hyprbarind" : "/tmp/hypr/hyprbarin", 0};
|
||||||
|
@ -90,6 +91,7 @@ public:
|
||||||
void recalcAllDocks();
|
void recalcAllDocks();
|
||||||
|
|
||||||
void changeWorkspaceByID(int);
|
void changeWorkspaceByID(int);
|
||||||
|
void changeToLastWorkspace();
|
||||||
void setAllWorkspaceWindowsDirtyByID(int);
|
void setAllWorkspaceWindowsDirtyByID(int);
|
||||||
int getHighestWorkspaceID();
|
int getHighestWorkspaceID();
|
||||||
CWorkspace* getWorkspaceByID(int);
|
CWorkspace* getWorkspaceByID(int);
|
||||||
|
|
Loading…
Reference in a new issue