mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 05:05:59 +01:00
Added execr
This commit is contained in:
parent
67e13fbb64
commit
6e16627cbc
2 changed files with 67 additions and 58 deletions
|
@ -15,6 +15,7 @@ CKeybindManager::CKeybindManager() {
|
||||||
// initialize all dispatchers
|
// initialize all dispatchers
|
||||||
|
|
||||||
m_mDispatchers["exec"] = spawn;
|
m_mDispatchers["exec"] = spawn;
|
||||||
|
m_mDispatchers["execr"] = spawnRaw;
|
||||||
m_mDispatchers["killactive"] = killActive;
|
m_mDispatchers["killactive"] = killActive;
|
||||||
m_mDispatchers["closewindow"] = kill;
|
m_mDispatchers["closewindow"] = kill;
|
||||||
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
||||||
|
@ -530,6 +531,20 @@ void CKeybindManager::spawn(std::string args) {
|
||||||
else
|
else
|
||||||
args = "WAYLAND_DISPLAY=" + std::string(g_pCompositor->m_szWLDisplaySocket) + " " + args;
|
args = "WAYLAND_DISPLAY=" + std::string(g_pCompositor->m_szWLDisplaySocket) + " " + args;
|
||||||
|
|
||||||
|
const uint64_t PROC = spawnRaw(args);
|
||||||
|
|
||||||
|
if (!RULES.empty()) {
|
||||||
|
const auto RULESLIST = CVarList(RULES, 0, ';');
|
||||||
|
|
||||||
|
for (auto& r : RULESLIST) {
|
||||||
|
g_pConfigManager->addExecRule({r, (unsigned long)PROC});
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug::log(LOG, "Applied %i rule arguments for exec.", RULESLIST.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t CKeybindManager::spawnRaw(std::string args) {
|
||||||
Debug::log(LOG, "Executing %s", args.c_str());
|
Debug::log(LOG, "Executing %s", args.c_str());
|
||||||
|
|
||||||
int socket[2];
|
int socket[2];
|
||||||
|
@ -543,7 +558,7 @@ void CKeybindManager::spawn(std::string args) {
|
||||||
close(socket[0]);
|
close(socket[0]);
|
||||||
close(socket[1]);
|
close(socket[1]);
|
||||||
Debug::log(LOG, "Fail to create the first fork");
|
Debug::log(LOG, "Fail to create the first fork");
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
if (child == 0) {
|
if (child == 0) {
|
||||||
// run in child
|
// run in child
|
||||||
|
@ -575,20 +590,12 @@ void CKeybindManager::spawn(std::string args) {
|
||||||
waitpid(child, NULL, 0);
|
waitpid(child, NULL, 0);
|
||||||
if (child < 0) {
|
if (child < 0) {
|
||||||
Debug::log(LOG, "Fail to create the second fork");
|
Debug::log(LOG, "Fail to create the second fork");
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Process Created with pid %d", grandchild);
|
Debug::log(LOG, "Process Created with pid %d", grandchild);
|
||||||
|
|
||||||
if (!RULES.empty()) {
|
return grandchild;
|
||||||
const auto RULESLIST = CVarList(RULES, 0, ';');
|
|
||||||
|
|
||||||
for (auto& r : RULESLIST) {
|
|
||||||
g_pConfigManager->addExecRule({r, (unsigned long)grandchild});
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug::log(LOG, "Applied %i rule arguments for exec.", RULESLIST.size());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::killActive(std::string args) {
|
void CKeybindManager::killActive(std::string args) {
|
||||||
|
@ -1158,8 +1165,8 @@ void CKeybindManager::focusUrgentOrLast(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::focusCurrentOrLast(std::string args) {
|
void CKeybindManager::focusCurrentOrLast(std::string args) {
|
||||||
const auto PWINDOWPREV = g_pCompositor->m_pLastWindow ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1]) :
|
const auto PWINDOWPREV = g_pCompositor->m_pLastWindow ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1]) :
|
||||||
(g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0]);
|
(g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0]);
|
||||||
|
|
||||||
if (!PWINDOWPREV)
|
if (!PWINDOWPREV)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -25,7 +25,8 @@ struct SKeybind {
|
||||||
bool shadowed = false;
|
bool shadowed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eFocusWindowMode {
|
enum eFocusWindowMode
|
||||||
|
{
|
||||||
MODE_CLASS_REGEX = 0,
|
MODE_CLASS_REGEX = 0,
|
||||||
MODE_TITLE_REGEX,
|
MODE_TITLE_REGEX,
|
||||||
MODE_ADDRESS,
|
MODE_ADDRESS,
|
||||||
|
@ -87,50 +88,51 @@ class CKeybindManager {
|
||||||
bool ensureMouseBindState();
|
bool ensureMouseBindState();
|
||||||
|
|
||||||
// -------------- Dispatchers -------------- //
|
// -------------- Dispatchers -------------- //
|
||||||
static void killActive(std::string);
|
static void killActive(std::string);
|
||||||
static void kill(std::string);
|
static void kill(std::string);
|
||||||
static void spawn(std::string);
|
static void spawn(std::string);
|
||||||
static void toggleActiveFloating(std::string);
|
static uint64_t spawnRaw(std::string);
|
||||||
static void toggleActivePseudo(std::string);
|
static void toggleActiveFloating(std::string);
|
||||||
static void changeworkspace(std::string);
|
static void toggleActivePseudo(std::string);
|
||||||
static void fullscreenActive(std::string);
|
static void changeworkspace(std::string);
|
||||||
static void fakeFullscreenActive(std::string);
|
static void fullscreenActive(std::string);
|
||||||
static void moveActiveToWorkspace(std::string);
|
static void fakeFullscreenActive(std::string);
|
||||||
static void moveActiveToWorkspaceSilent(std::string);
|
static void moveActiveToWorkspace(std::string);
|
||||||
static void moveFocusTo(std::string);
|
static void moveActiveToWorkspaceSilent(std::string);
|
||||||
static void focusUrgentOrLast(std::string);
|
static void moveFocusTo(std::string);
|
||||||
static void focusCurrentOrLast(std::string);
|
static void focusUrgentOrLast(std::string);
|
||||||
static void centerWindow(std::string);
|
static void focusCurrentOrLast(std::string);
|
||||||
static void moveActiveTo(std::string);
|
static void centerWindow(std::string);
|
||||||
static void toggleGroup(std::string);
|
static void moveActiveTo(std::string);
|
||||||
static void changeGroupActive(std::string);
|
static void toggleGroup(std::string);
|
||||||
static void alterSplitRatio(std::string);
|
static void changeGroupActive(std::string);
|
||||||
static void focusMonitor(std::string);
|
static void alterSplitRatio(std::string);
|
||||||
static void toggleSplit(std::string);
|
static void focusMonitor(std::string);
|
||||||
static void moveCursorToCorner(std::string);
|
static void toggleSplit(std::string);
|
||||||
static void workspaceOpt(std::string);
|
static void moveCursorToCorner(std::string);
|
||||||
static void renameWorkspace(std::string);
|
static void workspaceOpt(std::string);
|
||||||
static void exitHyprland(std::string);
|
static void renameWorkspace(std::string);
|
||||||
static void moveCurrentWorkspaceToMonitor(std::string);
|
static void exitHyprland(std::string);
|
||||||
static void moveWorkspaceToMonitor(std::string);
|
static void moveCurrentWorkspaceToMonitor(std::string);
|
||||||
static void toggleSpecialWorkspace(std::string);
|
static void moveWorkspaceToMonitor(std::string);
|
||||||
static void forceRendererReload(std::string);
|
static void toggleSpecialWorkspace(std::string);
|
||||||
static void resizeActive(std::string);
|
static void forceRendererReload(std::string);
|
||||||
static void moveActive(std::string);
|
static void resizeActive(std::string);
|
||||||
static void moveWindow(std::string);
|
static void moveActive(std::string);
|
||||||
static void resizeWindow(std::string);
|
static void moveWindow(std::string);
|
||||||
static void circleNext(std::string);
|
static void resizeWindow(std::string);
|
||||||
static void focusWindow(std::string);
|
static void circleNext(std::string);
|
||||||
static void setSubmap(std::string);
|
static void focusWindow(std::string);
|
||||||
static void pass(std::string);
|
static void setSubmap(std::string);
|
||||||
static void layoutmsg(std::string);
|
static void pass(std::string);
|
||||||
static void toggleOpaque(std::string);
|
static void layoutmsg(std::string);
|
||||||
static void dpms(std::string);
|
static void toggleOpaque(std::string);
|
||||||
static void swapnext(std::string);
|
static void dpms(std::string);
|
||||||
static void swapActiveWorkspaces(std::string);
|
static void swapnext(std::string);
|
||||||
static void pinActive(std::string);
|
static void swapActiveWorkspaces(std::string);
|
||||||
static void mouse(std::string);
|
static void pinActive(std::string);
|
||||||
static void bringActiveToTop(std::string);
|
static void mouse(std::string);
|
||||||
|
static void bringActiveToTop(std::string);
|
||||||
|
|
||||||
friend class CCompositor;
|
friend class CCompositor;
|
||||||
friend class CInputManager;
|
friend class CInputManager;
|
||||||
|
|
Loading…
Reference in a new issue