mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-12-26 03:09:49 +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 "utilities/Util.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "windowManager.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
|
@ -157,11 +158,15 @@ void KeybindManager::changeworkspace(std::string arg) {
|
|||
|
||||
if (ID != -1) {
|
||||
Debug::log(LOG, "Changing the current workspace to " + std::to_string(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) {
|
||||
g_pWindowManager->toggleWindowFullscrenn(g_pWindowManager->LastWindow);
|
||||
}
|
||||
|
@ -206,4 +211,4 @@ void KeybindManager::toggleActiveWindowFloating(std::string unusedArg) {
|
|||
|
||||
g_pWindowManager->setAllFloatingWindowsTop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,8 @@ namespace KeybindManager {
|
|||
void movewindow(std::string args);
|
||||
void movefocus(std::string args);
|
||||
void changeworkspace(std::string args);
|
||||
void changetolastworkspace(std::string args);
|
||||
void toggleActiveWindowFullscreen(std::string args);
|
||||
void toggleActiveWindowFloating(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 == "movetoworkspace") dispatcher = KeybindManager::movetoworkspace;
|
||||
if (HANDLER == "workspace") dispatcher = KeybindManager::changeworkspace;
|
||||
if (HANDLER == "lastworkspace") dispatcher = KeybindManager::changetolastworkspace;
|
||||
if (HANDLER == "togglefloating") dispatcher = KeybindManager::toggleActiveWindowFloating;
|
||||
|
||||
if (dispatcher && KEY != 0)
|
||||
|
@ -543,4 +544,4 @@ std::vector<SWindowRule> ConfigManager::getMatchingRules(xcb_window_t w) {
|
|||
}
|
||||
|
||||
return returns;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1617,6 +1617,7 @@ void CWindowManager::changeWorkspaceByID(int ID) {
|
|||
|
||||
// save old workspace for anim
|
||||
auto OLDWORKSPACE = activeWorkspaces[MONITOR->ID];
|
||||
lastActiveWorkspaceID = OLDWORKSPACE;
|
||||
|
||||
for (auto& workspace : workspaces) {
|
||||
if (workspace.getID() == ID) {
|
||||
|
@ -1669,6 +1670,10 @@ void CWindowManager::changeWorkspaceByID(int ID) {
|
|||
// no need for the new dirty, it's empty
|
||||
}
|
||||
|
||||
void CWindowManager::changeToLastWorkspace() {
|
||||
changeWorkspaceByID(lastActiveWorkspaceID);
|
||||
}
|
||||
|
||||
void CWindowManager::focusOnWorkspace(const int& work) {
|
||||
const auto PWORKSPACE = getWorkspaceByID(work);
|
||||
const auto PMONITOR = getMonitorFromWorkspace(work);
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
|
||||
std::deque<CWorkspace> workspaces;
|
||||
std::deque<int> activeWorkspaces;
|
||||
int lastActiveWorkspaceID = 1;
|
||||
|
||||
// Pipes
|
||||
SIPCPipe m_sIPCBarPipeIn = {ISDEBUG ? "/tmp/hypr/hyprbarind" : "/tmp/hypr/hyprbarin", 0};
|
||||
|
@ -90,6 +91,7 @@ public:
|
|||
void recalcAllDocks();
|
||||
|
||||
void changeWorkspaceByID(int);
|
||||
void changeToLastWorkspace();
|
||||
void setAllWorkspaceWindowsDirtyByID(int);
|
||||
int getHighestWorkspaceID();
|
||||
CWorkspace* getWorkspaceByID(int);
|
||||
|
|
Loading…
Reference in a new issue