Feature: moving a window to another workspace changes its windowing mode to respect the new workspace's one
This commit is contained in:
50
src/main.cpp
50
src/main.cpp
@@ -1,37 +1,37 @@
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include "../include/HyprlandService.h"
|
||||
|
||||
void help(char* execPath) {
|
||||
std::cerr << "Usage: " << execPath << " <config_file_path> (-q)\n\n";
|
||||
std::cerr << "-q:\tQuery current windowing mode, don't change anything.\n\tReturns Hyprland window rule active on current workspace.\n\tIf no rule is active, returns a default tiled rule.\n";
|
||||
std::cerr << "Usage: " << execPath << " <config_file_path> (flags)\n\n";
|
||||
std::cerr << "Flags:\n\n";
|
||||
std::cerr << "-q:\t\tQuery current windowing mode, don't change anything.\n\t\tReturns Hyprland window rule active on current workspace.\n\t\tIf no rule is active, returns a default tiled rule.\n\n";
|
||||
std::cerr << "-m [integer]:\tMove currently active window to specified workspace.\n\t\tUpon moving, the window will adapt to the windowing mode of the new workspace.\n\t\tDoesn't work with -q.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc < 2) {
|
||||
if (argc >= 2) {
|
||||
HyprlandService::setConfigFilePath(argv[1]);
|
||||
|
||||
if (argc == 2) {
|
||||
HyprlandService::toggleFloating();
|
||||
}
|
||||
else if (argc == 3 && argv[2] == std::string("-q")) {
|
||||
std::cout << HyprlandService::getActiveWorkspaceRule().toString() << std::endl;
|
||||
} else if (argc == 4 && argv[2] == std::string("-m")) {
|
||||
int workspace = 0;
|
||||
try {
|
||||
HyprlandService::moveToWorkspace(std::stoi(argv[3]));
|
||||
} catch (std::invalid_argument) {
|
||||
help(argv[0]);
|
||||
}
|
||||
} else {
|
||||
help(argv[0]);
|
||||
}
|
||||
} else {
|
||||
help(argv[0]);
|
||||
}
|
||||
|
||||
HyprlandService::setConfigFilePath(argv[1]);
|
||||
|
||||
if (argc == 3 && argv[2] == std::string("-q")) {
|
||||
WindowRule rule = HyprlandService::getActiveWorkspaceRule();
|
||||
std::cout << rule.toString() << std::endl;
|
||||
}
|
||||
else if (argc == 2) {
|
||||
if (HyprlandService::isFloatingRulePresent()) {
|
||||
for (auto& c : HyprlandService::getClientsOnActiveWorkspace()) {
|
||||
HyprlandService::setClientTiled(c);
|
||||
}
|
||||
HyprlandService::setFloatingRule(false);
|
||||
} else {
|
||||
for (auto& c : HyprlandService::getClientsOnActiveWorkspace()) {
|
||||
HyprlandService::setClientFloating(c);
|
||||
}
|
||||
HyprlandService::setFloatingRule(true);
|
||||
}
|
||||
}
|
||||
else (help(argv[0]));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user