mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-02 13:11:55 -07:00
Compare commits
18 Commits
v0.1.2beta
...
v0.2.0beta
Author | SHA1 | Date | |
---|---|---|---|
|
85128ebb7d | ||
|
ad98b96891 | ||
|
2e7586e841 | ||
|
f6ba9909d6 | ||
|
c9041bf5c9 | ||
|
b2474d406a | ||
|
eee9698ec9 | ||
|
1f4c938c67 | ||
|
c44c79abb2 | ||
|
1e096f6fcd | ||
|
b1c11f3d2e | ||
|
da63503d5f | ||
|
7167be9c48 | ||
|
e81790f357 | ||
|
edf57c50ff | ||
|
e2be91582a | ||
|
7522ade58d | ||
|
3d7abfea92 |
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -3,6 +3,7 @@ name: Bug report
|
|||||||
about: Found a bug? Report it here!
|
about: Found a bug? Report it here!
|
||||||
title: ''
|
title: ''
|
||||||
labels: bug
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -13,3 +14,5 @@ labels: bug
|
|||||||
|
|
||||||
|
|
||||||
Please attach a log (it's in /tmp/hypr/hyprland.log) and, if crashing, a crashdump (coredumpctl, then coredumpctl info <pid>)
|
Please attach a log (it's in /tmp/hypr/hyprland.log) and, if crashing, a crashdump (coredumpctl, then coredumpctl info <pid>)
|
||||||
|
|
||||||
|
*Please do NOT attach coredumps from any packaged version of Hyprland (AUR, etc.). Compile manually, and THEN attach a coredump of that.*
|
||||||
|
1
.github/ISSUE_TEMPLATE/feature_request.md
vendored
1
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -3,6 +3,7 @@ name: Feature request
|
|||||||
about: Suggest a feature/change/idea
|
about: Suggest a feature/change/idea
|
||||||
title: ''
|
title: ''
|
||||||
labels: enhancement
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@@ -30,6 +30,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Checkout Hyprland
|
- name: Checkout Hyprland
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- name: Build Hyprland With default settings
|
- name: Build Hyprland With default settings
|
||||||
run: |
|
run: |
|
||||||
|
2
.github/workflows/nix-build.yaml
vendored
2
.github/workflows/nix-build.yaml
vendored
@@ -8,6 +8,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Clone repository
|
- name: Clone repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
- name: Install nix
|
- name: Install nix
|
||||||
uses: cachix/install-nix-action@v17
|
uses: cachix/install-nix-action@v17
|
||||||
with:
|
with:
|
||||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "wlroots"]
|
||||||
|
path = wlroots
|
||||||
|
url = https://gitlab.freedesktop.org/wlroots/wlroots
|
15
Makefile
15
Makefile
@@ -89,6 +89,7 @@ clear:
|
|||||||
rm -rf build
|
rm -rf build
|
||||||
rm -f *.o *-protocol.h *-protocol.c
|
rm -f *.o *-protocol.h *-protocol.c
|
||||||
rm -f ./hyprctl/hyprctl
|
rm -f ./hyprctl/hyprctl
|
||||||
|
rm -rf ./wlroots/build
|
||||||
|
|
||||||
all:
|
all:
|
||||||
make config
|
make config
|
||||||
@@ -113,4 +114,16 @@ uninstall:
|
|||||||
rm -f ${PREFIX}/bin/hyprctl
|
rm -f ${PREFIX}/bin/hyprctl
|
||||||
rm -rf ${PREFIX}/share/hyprland
|
rm -rf ${PREFIX}/share/hyprland
|
||||||
|
|
||||||
config: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o wlr-screencopy-unstable-v1-protocol.o idle-protocol.o ext-workspace-unstable-v1-protocol.o pointer-constraints-unstable-v1-protocol.o
|
protocols: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o wlr-screencopy-unstable-v1-protocol.o idle-protocol.o ext-workspace-unstable-v1-protocol.o pointer-constraints-unstable-v1-protocol.o
|
||||||
|
|
||||||
|
config:
|
||||||
|
make protocols
|
||||||
|
|
||||||
|
sed -i -E 's/(soversion = 11)([^032]|$$)/soversion = 11032/g' ./wlroots/meson.build
|
||||||
|
|
||||||
|
rm -rf ./wlroots/build
|
||||||
|
|
||||||
|
cd wlroots && meson ./build --prefix=/usr --buildtype=release
|
||||||
|
cd wlroots && ninja -C build/
|
||||||
|
|
||||||
|
cd wlroots && sudo cp ./build/libwlroots.so.11032 /usr/lib/
|
||||||
|
@@ -64,7 +64,7 @@ dwindle {
|
|||||||
# example binds
|
# example binds
|
||||||
bind=SUPER,Q,exec,kitty
|
bind=SUPER,Q,exec,kitty
|
||||||
bind=SUPER,C,killactive,
|
bind=SUPER,C,killactive,
|
||||||
bind=SUPER,M,exec,pkill Hyprland
|
bind=SUPER,M,exit,
|
||||||
bind=SUPER,E,exec,dolphin
|
bind=SUPER,E,exec,dolphin
|
||||||
bind=SUPER,V,togglefloating,
|
bind=SUPER,V,togglefloating,
|
||||||
bind=SUPER,R,exec,wofi --show drun -o DP-3
|
bind=SUPER,R,exec,wofi --show drun -o DP-3
|
||||||
|
@@ -592,7 +592,7 @@ CWorkspace* CCompositor::getWorkspaceByID(const int& id) {
|
|||||||
|
|
||||||
void CCompositor::sanityCheckWorkspaces() {
|
void CCompositor::sanityCheckWorkspaces() {
|
||||||
for (auto it = m_lWorkspaces.begin(); it != m_lWorkspaces.end(); ++it) {
|
for (auto it = m_lWorkspaces.begin(); it != m_lWorkspaces.end(); ++it) {
|
||||||
if (getWindowsOnWorkspace(it->m_iID) == 0 && !isWorkspaceVisible(it->m_iID)) {
|
if ((getWindowsOnWorkspace(it->m_iID) == 0 && !isWorkspaceVisible(it->m_iID))) {
|
||||||
it = m_lWorkspaces.erase(it);
|
it = m_lWorkspaces.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -622,6 +622,9 @@ void CCompositor::fixXWaylandWindowsOnWorkspace(const int& id) {
|
|||||||
|
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(id);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(id);
|
||||||
|
|
||||||
|
if (!PWORKSPACE)
|
||||||
|
return;
|
||||||
|
|
||||||
for (auto& w : m_lWindows) {
|
for (auto& w : m_lWindows) {
|
||||||
if (w.m_iWorkspaceID == id) {
|
if (w.m_iWorkspaceID == id) {
|
||||||
|
|
||||||
@@ -820,8 +823,8 @@ CWorkspace* CCompositor::getWorkspaceByString(const std::string& str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int id = std::stoi(str);
|
std::string name = "";
|
||||||
return getWorkspaceByID(id);
|
return getWorkspaceByID(getWorkspaceIDFromString(str, name));
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
Debug::log(ERR, "Error in getWorkspaceByString, invalid id");
|
Debug::log(ERR, "Error in getWorkspaceByString, invalid id");
|
||||||
}
|
}
|
||||||
@@ -937,3 +940,85 @@ void CCompositor::updateWindowBorderColor(CWindow* pWindow) {
|
|||||||
else
|
else
|
||||||
pWindow->m_cRealBorderColor = CColor(pWindow == m_pLastWindow ? *ACTIVECOL : *INACTIVECOL);
|
pWindow->m_cRealBorderColor = CColor(pWindow == m_pLastWindow ? *ACTIVECOL : *INACTIVECOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCompositor::moveWindowToWorkspace(CWindow* pWindow, const std::string& work) {
|
||||||
|
m_pLastWindow = pWindow;
|
||||||
|
g_pKeybindManager->moveActiveToWorkspace(work);
|
||||||
|
|
||||||
|
g_pInputManager->refocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CCompositor::getNextAvailableMonitorID() {
|
||||||
|
int64_t topID = -1;
|
||||||
|
for (auto& m : m_lMonitors) {
|
||||||
|
if ((int64_t)m.ID > topID)
|
||||||
|
topID = m.ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
return topID + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, SMonitor* pMonitor) {
|
||||||
|
|
||||||
|
// We trust the workspace and monitor to be correct.
|
||||||
|
|
||||||
|
if (pWorkspace->m_iMonitorID == pMonitor->ID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Debug::log(LOG, "moveWorkspaceToMonitor: Moving %d to monitor %d", pWorkspace->m_iID, pMonitor->ID);
|
||||||
|
|
||||||
|
const auto POLDMON = getMonitorFromID(pWorkspace->m_iMonitorID);
|
||||||
|
|
||||||
|
const bool SWITCHINGISACTIVE = POLDMON->activeWorkspace == pWorkspace->m_iID;
|
||||||
|
|
||||||
|
// fix old mon
|
||||||
|
int nextWorkspaceOnMonitorID = -1;
|
||||||
|
for (auto& w : m_lWorkspaces) {
|
||||||
|
if (w.m_iMonitorID == POLDMON->ID && w.m_iID != pWorkspace->m_iID) {
|
||||||
|
nextWorkspaceOnMonitorID = w.m_iID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextWorkspaceOnMonitorID == -1) {
|
||||||
|
nextWorkspaceOnMonitorID = 1;
|
||||||
|
|
||||||
|
while (getWorkspaceByID(nextWorkspaceOnMonitorID))
|
||||||
|
nextWorkspaceOnMonitorID++;
|
||||||
|
|
||||||
|
Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with new %d", nextWorkspaceOnMonitorID);
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with existing %d", nextWorkspaceOnMonitorID);
|
||||||
|
|
||||||
|
g_pKeybindManager->focusMonitor(std::to_string(POLDMON->ID));
|
||||||
|
g_pKeybindManager->changeworkspace(std::to_string(nextWorkspaceOnMonitorID));
|
||||||
|
|
||||||
|
// move the workspace
|
||||||
|
|
||||||
|
pWorkspace->m_iMonitorID = pMonitor->ID;
|
||||||
|
pWorkspace->moveToMonitor(pMonitor->ID);
|
||||||
|
|
||||||
|
for (auto& w : m_lWindows) {
|
||||||
|
if (w.m_iWorkspaceID == pWorkspace->m_iID)
|
||||||
|
w.m_iMonitorID = pMonitor->ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SWITCHINGISACTIVE) { // if it was active, preserve its' status. If it wasn't, don't.
|
||||||
|
Debug::log(LOG, "moveWorkspaceToMonitor: SWITCHINGISACTIVE, active %d -> %d", pMonitor->activeWorkspace, pWorkspace->m_iID);
|
||||||
|
|
||||||
|
getWorkspaceByID(pMonitor->activeWorkspace)->startAnim(false, false);
|
||||||
|
|
||||||
|
pMonitor->activeWorkspace = pWorkspace->m_iID;
|
||||||
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pMonitor->ID);
|
||||||
|
|
||||||
|
pWorkspace->startAnim(true, true, true);
|
||||||
|
|
||||||
|
wlr_cursor_warp(m_sWLRCursor, m_sSeat.mouse->mouse, pMonitor->vecPosition.x + pMonitor->vecTransformedSize.x / 2, pMonitor->vecPosition.y + pMonitor->vecTransformedSize.y / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// finalize
|
||||||
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(POLDMON->ID);
|
||||||
|
|
||||||
|
g_pInputManager->refocus();
|
||||||
|
}
|
@@ -126,6 +126,9 @@ public:
|
|||||||
SMonitor* getMonitorInDirection(const char&);
|
SMonitor* getMonitorInDirection(const char&);
|
||||||
void updateAllWindowsBorders();
|
void updateAllWindowsBorders();
|
||||||
void updateWindowBorderColor(CWindow*);
|
void updateWindowBorderColor(CWindow*);
|
||||||
|
void moveWindowToWorkspace(CWindow*, const std::string&);
|
||||||
|
int getNextAvailableMonitorID();
|
||||||
|
void moveWorkspaceToMonitor(CWorkspace*, SMonitor*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAllSignals();
|
void initAllSignals();
|
||||||
|
@@ -14,3 +14,33 @@ CWindow::~CWindow() {
|
|||||||
g_pCompositor->m_pLastWindow = nullptr;
|
g_pCompositor->m_pLastWindow = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wlr_box CWindow::getFullWindowBoundingBox() {
|
||||||
|
|
||||||
|
SWindowDecorationExtents maxExtents;
|
||||||
|
|
||||||
|
for (auto& wd : m_dWindowDecorations) {
|
||||||
|
|
||||||
|
const auto EXTENTS = wd->getWindowDecorationExtents();
|
||||||
|
|
||||||
|
if (EXTENTS.topLeft.x > maxExtents.topLeft.x)
|
||||||
|
maxExtents.topLeft.x = EXTENTS.topLeft.x;
|
||||||
|
|
||||||
|
if (EXTENTS.topLeft.y > maxExtents.topLeft.y)
|
||||||
|
maxExtents.topLeft.y = EXTENTS.topLeft.y;
|
||||||
|
|
||||||
|
if (EXTENTS.bottomRight.x > maxExtents.bottomRight.x)
|
||||||
|
maxExtents.bottomRight.x = EXTENTS.bottomRight.x;
|
||||||
|
|
||||||
|
if (EXTENTS.bottomRight.y > maxExtents.bottomRight.y)
|
||||||
|
maxExtents.bottomRight.y = EXTENTS.bottomRight.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add extents to the real base BB and return
|
||||||
|
wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x,
|
||||||
|
m_vRealPosition.vec().y - maxExtents.topLeft.y,
|
||||||
|
m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x,
|
||||||
|
m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
|
||||||
|
|
||||||
|
return finalBox;
|
||||||
|
}
|
@@ -105,4 +105,7 @@ public:
|
|||||||
return m_uSurface.xdg == rhs.m_uSurface.xdg && m_uSurface.xwayland == rhs.m_uSurface.xwayland && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize && m_bFadingOut == rhs.m_bFadingOut;
|
return m_uSurface.xdg == rhs.m_uSurface.xdg && m_uSurface.xwayland == rhs.m_uSurface.xwayland && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize && m_bFadingOut == rhs.m_bFadingOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// methods
|
||||||
|
wlr_box getFullWindowBoundingBox();
|
||||||
|
|
||||||
};
|
};
|
@@ -71,7 +71,7 @@ dwindle {
|
|||||||
# example binds
|
# example binds
|
||||||
bind=SUPER,Q,exec,kitty
|
bind=SUPER,Q,exec,kitty
|
||||||
bind=SUPER,C,killactive,
|
bind=SUPER,C,killactive,
|
||||||
bind=SUPER,M,exec,pkill Hyprland
|
bind=SUPER,M,exit,
|
||||||
bind=SUPER,E,exec,dolphin
|
bind=SUPER,E,exec,dolphin
|
||||||
bind=SUPER,V,togglefloating,
|
bind=SUPER,V,togglefloating,
|
||||||
bind=SUPER,R,exec,wofi --show drun -o DP-3
|
bind=SUPER,R,exec,wofi --show drun -o DP-3
|
||||||
|
@@ -26,8 +26,8 @@ std::string monitorsRequest() {
|
|||||||
std::string clientsRequest() {
|
std::string clientsRequest() {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
for (auto& w : g_pCompositor->m_lWindows) {
|
for (auto& w : g_pCompositor->m_lWindows) {
|
||||||
result += getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i, %i\n\tworkspace: %i (%s)\n\tfloating: %i\n\n",
|
result += getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i, %i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\n",
|
||||||
&w, w.m_szTitle.c_str(), (int)w.m_vRealPosition.vec().x, (int)w.m_vRealPosition.vec().y, (int)w.m_vRealSize.vec().x, (int)w.m_vRealSize.vec().y, w.m_iWorkspaceID, (w.m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w.m_iWorkspaceID)->m_szName.c_str()), (int)w.m_bIsFloating);
|
&w, w.m_szTitle.c_str(), (int)w.m_vRealPosition.vec().x, (int)w.m_vRealPosition.vec().y, (int)w.m_vRealSize.vec().x, (int)w.m_vRealSize.vec().y, w.m_iWorkspaceID, (w.m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w.m_iWorkspaceID)->m_szName.c_str()), (int)w.m_bIsFloating, w.m_iMonitorID);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -47,8 +47,8 @@ std::string activeWindowRequest() {
|
|||||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||||
return "Invalid";
|
return "Invalid";
|
||||||
|
|
||||||
return getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i, %i\n\tworkspace: %i (%s)\n\tfloating: %i\n\n",
|
return getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i, %i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\n",
|
||||||
PWINDOW, PWINDOW->m_szTitle.c_str(), (int)PWINDOW->m_vRealPosition.vec().x, (int)PWINDOW->m_vRealPosition.vec().y, (int)PWINDOW->m_vRealSize.vec().x, (int)PWINDOW->m_vRealSize.vec().y, PWINDOW->m_iWorkspaceID, (PWINDOW->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_szName.c_str()), (int)PWINDOW->m_bIsFloating);
|
PWINDOW, PWINDOW->m_szTitle.c_str(), (int)PWINDOW->m_vRealPosition.vec().x, (int)PWINDOW->m_vRealPosition.vec().y, (int)PWINDOW->m_vRealSize.vec().x, (int)PWINDOW->m_vRealSize.vec().y, PWINDOW->m_iWorkspaceID, (PWINDOW->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_szName.c_str()), (int)PWINDOW->m_bIsFloating, (int)PWINDOW->m_iMonitorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string layersRequest() {
|
std::string layersRequest() {
|
||||||
|
@@ -58,7 +58,12 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
|
|||||||
|
|
||||||
Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface);
|
Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface);
|
||||||
|
|
||||||
if (!layersurface->fadingOut) {
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
|
||||||
|
|
||||||
|
if (!g_pCompositor->getMonitorFromID(layersurface->monitorID))
|
||||||
|
Debug::log(WARN, "Layersurface destroyed on an invalid monitor (removed?)");
|
||||||
|
|
||||||
|
if (!layersurface->fadingOut && PMONITOR) {
|
||||||
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
|
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
|
||||||
layersurface->alpha.setValueAndWarp(0.f);
|
layersurface->alpha.setValueAndWarp(0.f);
|
||||||
layersurface->fadingOut = true;
|
layersurface->fadingOut = true;
|
||||||
@@ -70,8 +75,6 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
|
|||||||
layersurface->hyprListener_unmapLayerSurface.removeCallback();
|
layersurface->hyprListener_unmapLayerSurface.removeCallback();
|
||||||
layersurface->hyprListener_newPopup.removeCallback();
|
layersurface->hyprListener_newPopup.removeCallback();
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
|
|
||||||
|
|
||||||
// rearrange to fix the reserved areas
|
// rearrange to fix the reserved areas
|
||||||
if (PMONITOR) {
|
if (PMONITOR) {
|
||||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||||
@@ -131,6 +134,11 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
|||||||
|
|
||||||
Debug::log(LOG, "LayerSurface %x unmapped", layersurface->layerSurface);
|
Debug::log(LOG, "LayerSurface %x unmapped", layersurface->layerSurface);
|
||||||
|
|
||||||
|
if (!g_pCompositor->getMonitorFromID(layersurface->monitorID)) {
|
||||||
|
Debug::log(WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// make a snapshot and start fade
|
// make a snapshot and start fade
|
||||||
g_pHyprOpenGL->makeLayerSnapshot(layersurface);
|
g_pHyprOpenGL->makeLayerSnapshot(layersurface);
|
||||||
layersurface->alpha = 0.f;
|
layersurface->alpha = 0.f;
|
||||||
|
@@ -70,7 +70,7 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
|||||||
|
|
||||||
SMonitor newMonitor;
|
SMonitor newMonitor;
|
||||||
newMonitor.output = OUTPUT;
|
newMonitor.output = OUTPUT;
|
||||||
newMonitor.ID = g_pCompositor->m_lMonitors.size();
|
newMonitor.ID = g_pCompositor->getNextAvailableMonitorID();
|
||||||
newMonitor.szName = OUTPUT->name;
|
newMonitor.szName = OUTPUT->name;
|
||||||
|
|
||||||
wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
|
wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
|
||||||
@@ -110,7 +110,7 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
|||||||
wlr_ext_workspace_group_handle_v1_output_enter(PNEWMONITOR->pWLRWorkspaceGroupHandle, PNEWMONITOR->output);
|
wlr_ext_workspace_group_handle_v1_output_enter(PNEWMONITOR->pWLRWorkspaceGroupHandle, PNEWMONITOR->output);
|
||||||
|
|
||||||
// Workspace
|
// Workspace
|
||||||
const auto WORKSPACEID = monitorRule.defaultWorkspaceID == -1 ? g_pCompositor->m_lWorkspaces.size() + 1 /* Cuz workspaces doesnt have the new one yet and we start with 1 */ : monitorRule.defaultWorkspaceID;
|
const auto WORKSPACEID = monitorRule.defaultWorkspaceID == -1 && !g_pCompositor->getWorkspaceByID(monitorRule.defaultWorkspaceID) ? g_pCompositor->m_lWorkspaces.size() + 1 /* Cuz workspaces doesnt have the new one yet and we start with 1 */ : monitorRule.defaultWorkspaceID;
|
||||||
g_pCompositor->m_lWorkspaces.emplace_back(newMonitor.ID);
|
g_pCompositor->m_lWorkspaces.emplace_back(newMonitor.ID);
|
||||||
const auto PNEWWORKSPACE = &g_pCompositor->m_lWorkspaces.back();
|
const auto PNEWWORKSPACE = &g_pCompositor->m_lWorkspaces.back();
|
||||||
|
|
||||||
@@ -296,7 +296,56 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
|
|||||||
if (!pMonitor)
|
if (!pMonitor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Cleanup everything. Move windows back, snap cursor, shit.
|
||||||
|
const auto BACKUPMON = &g_pCompositor->m_lMonitors.front();
|
||||||
|
const auto BACKUPWORKSPACE = BACKUPMON->activeWorkspace > 0 ? std::to_string(BACKUPMON->activeWorkspace) : "name:" + g_pCompositor->getWorkspaceByID(BACKUPMON->activeWorkspace)->m_szName;
|
||||||
|
|
||||||
|
if (!BACKUPMON) {
|
||||||
|
Debug::log(CRIT, "No monitors! Unplugged last! Exiting.");
|
||||||
|
g_pCompositor->cleanupExit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// snap cursor
|
||||||
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, BACKUPMON->vecPosition.x + BACKUPMON->vecTransformedSize.x / 2.f, BACKUPMON->vecPosition.y + BACKUPMON->vecTransformedSize.y / 2.f);
|
||||||
|
|
||||||
|
// move workspaces
|
||||||
|
std::deque<CWorkspace*> wspToMove;
|
||||||
|
for (auto& w : g_pCompositor->m_lWorkspaces) {
|
||||||
|
if (w.m_iMonitorID == pMonitor->ID) {
|
||||||
|
wspToMove.push_back(&w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& w : wspToMove) {
|
||||||
|
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
|
||||||
|
w->startAnim(true, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
pMonitor->activeWorkspace = -1;
|
||||||
|
|
||||||
|
for (auto it = g_pCompositor->m_lWorkspaces.begin(); it != g_pCompositor->m_lWorkspaces.end(); ++it) {
|
||||||
|
if (it->m_iMonitorID == pMonitor->ID) {
|
||||||
|
it = g_pCompositor->m_lWorkspaces.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug::log(LOG, "Removed monitor %s!", pMonitor->szName.c_str());
|
||||||
|
|
||||||
g_pCompositor->m_lMonitors.remove(*pMonitor);
|
g_pCompositor->m_lMonitors.remove(*pMonitor);
|
||||||
|
|
||||||
// TODO: cleanup windows
|
// update the pMostHzMonitor
|
||||||
|
if (pMostHzMonitor == pMonitor) {
|
||||||
|
int mostHz = 0;
|
||||||
|
SMonitor* pMonitorMostHz = nullptr;
|
||||||
|
|
||||||
|
for (auto& m : g_pCompositor->m_lMonitors) {
|
||||||
|
if (m.refreshRate > mostHz) {
|
||||||
|
pMonitorMostHz = &m;
|
||||||
|
mostHz = m.refreshRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pMostHzMonitor = pMonitorMostHz;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,6 +31,8 @@ CWorkspace::CWorkspace(int monitorID) {
|
|||||||
CWorkspace::~CWorkspace() {
|
CWorkspace::~CWorkspace() {
|
||||||
m_vRenderOffset.unregister();
|
m_vRenderOffset.unregister();
|
||||||
|
|
||||||
|
Debug::log(LOG, "Destroying workspace ID %d", m_iID);
|
||||||
|
|
||||||
if (m_pWlrHandle) {
|
if (m_pWlrHandle) {
|
||||||
wlr_ext_workspace_handle_v1_set_active(m_pWlrHandle, false);
|
wlr_ext_workspace_handle_v1_set_active(m_pWlrHandle, false);
|
||||||
wlr_ext_workspace_handle_v1_destroy(m_pWlrHandle);
|
wlr_ext_workspace_handle_v1_destroy(m_pWlrHandle);
|
||||||
@@ -38,7 +40,7 @@ CWorkspace::~CWorkspace() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspace::startAnim(bool in, bool left) {
|
void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
||||||
const auto ANIMSTYLE = g_pConfigManager->getString("animations:workspaces_style");
|
const auto ANIMSTYLE = g_pConfigManager->getString("animations:workspaces_style");
|
||||||
|
|
||||||
if (ANIMSTYLE == "fade") {
|
if (ANIMSTYLE == "fade") {
|
||||||
@@ -64,6 +66,11 @@ void CWorkspace::startAnim(bool in, bool left) {
|
|||||||
m_vRenderOffset = Vector2D(left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
|
m_vRenderOffset = Vector2D(left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (instant) {
|
||||||
|
m_vRenderOffset.warp();
|
||||||
|
m_fAlpha.warp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspace::setActive(bool on) {
|
void CWorkspace::setActive(bool on) {
|
||||||
@@ -71,3 +78,25 @@ void CWorkspace::setActive(bool on) {
|
|||||||
wlr_ext_workspace_handle_v1_set_active(m_pWlrHandle, on);
|
wlr_ext_workspace_handle_v1_set_active(m_pWlrHandle, on);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWorkspace::moveToMonitor(const int& id) {
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(id);
|
||||||
|
|
||||||
|
if (!PMONITOR)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wlr_ext_workspace_handle_v1_set_active(m_pWlrHandle, false);
|
||||||
|
wlr_ext_workspace_handle_v1_destroy(m_pWlrHandle);
|
||||||
|
|
||||||
|
m_pWlrHandle = wlr_ext_workspace_handle_v1_create(PMONITOR->pWLRWorkspaceGroupHandle);
|
||||||
|
|
||||||
|
// set geometry here cuz we can
|
||||||
|
wl_array_init(&m_wlrCoordinateArr);
|
||||||
|
*reinterpret_cast<int*>(wl_array_add(&m_wlrCoordinateArr, sizeof(int))) = (int)PMONITOR->vecPosition.x;
|
||||||
|
*reinterpret_cast<int*>(wl_array_add(&m_wlrCoordinateArr, sizeof(int))) = (int)PMONITOR->vecPosition.y;
|
||||||
|
wlr_ext_workspace_handle_v1_set_coordinates(m_pWlrHandle, &m_wlrCoordinateArr);
|
||||||
|
wlr_ext_workspace_handle_v1_set_hidden(m_pWlrHandle, false);
|
||||||
|
wlr_ext_workspace_handle_v1_set_urgent(m_pWlrHandle, false);
|
||||||
|
|
||||||
|
wlr_ext_workspace_handle_v1_set_name(m_pWlrHandle, m_szName.c_str());
|
||||||
|
}
|
@@ -33,6 +33,8 @@ public:
|
|||||||
bool m_bDefaultFloating = false;
|
bool m_bDefaultFloating = false;
|
||||||
bool m_bDefaultPseudo = false;
|
bool m_bDefaultPseudo = false;
|
||||||
|
|
||||||
void startAnim(bool in, bool left);
|
void startAnim(bool in, bool left, bool instant = false);
|
||||||
void setActive(bool on);
|
void setActive(bool on);
|
||||||
|
|
||||||
|
void moveToMonitor(const int&);
|
||||||
};
|
};
|
@@ -34,56 +34,56 @@
|
|||||||
#define static
|
#define static
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <wlr/backend.h>
|
#include "../wlroots/include/wlr/backend.h"
|
||||||
#include <wlr/backend/libinput.h>
|
#include "../wlroots/include/wlr/backend/libinput.h"
|
||||||
#include <wlr/render/allocator.h>
|
#include "../wlroots/include/wlr/render/allocator.h"
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include "../wlroots/include/wlr/render/wlr_renderer.h"
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include "../wlroots/include/wlr/types/wlr_compositor.h"
|
||||||
#include <wlr/types/wlr_cursor.h>
|
#include "../wlroots/include/wlr/types/wlr_cursor.h"
|
||||||
#include <wlr/types/wlr_data_control_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_data_control_v1.h"
|
||||||
#include <wlr/types/wlr_data_device.h>
|
#include "../wlroots/include/wlr/types/wlr_data_device.h"
|
||||||
#include <wlr/types/wlr_export_dmabuf_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_export_dmabuf_v1.h"
|
||||||
#include <wlr/types/wlr_linux_dmabuf_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_linux_dmabuf_v1.h"
|
||||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_gamma_control_v1.h"
|
||||||
#include <wlr/types/wlr_idle.h>
|
#include "../wlroots/include/wlr/types/wlr_idle.h"
|
||||||
#include <wlr/types/wlr_input_device.h>
|
#include "../wlroots/include/wlr/types/wlr_input_device.h"
|
||||||
#include <wlr/types/wlr_keyboard.h>
|
#include "../wlroots/include/wlr/types/wlr_keyboard.h"
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_layer_shell_v1.h"
|
||||||
#include <wlr/types/wlr_matrix.h>
|
#include "../wlroots/include/wlr/types/wlr_matrix.h"
|
||||||
#include <wlr/types/wlr_output.h>
|
#include "../wlroots/include/wlr/types/wlr_output.h"
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include "../wlroots/include/wlr/types/wlr_output_layout.h"
|
||||||
#include <wlr/types/wlr_output_management_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_output_management_v1.h"
|
||||||
#include <wlr/types/wlr_pointer.h>
|
#include "../wlroots/include/wlr/types/wlr_pointer.h"
|
||||||
#include <wlr/types/wlr_presentation_time.h>
|
#include "../wlroots/include/wlr/types/wlr_presentation_time.h"
|
||||||
#include <wlr/types/wlr_primary_selection.h>
|
#include "../wlroots/include/wlr/types/wlr_primary_selection.h"
|
||||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_primary_selection_v1.h"
|
||||||
#include <wlr/types/wlr_screencopy_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_screencopy_v1.h"
|
||||||
#include <wlr/types/wlr_seat.h>
|
#include "../wlroots/include/wlr/types/wlr_seat.h"
|
||||||
#include <wlr/types/wlr_server_decoration.h>
|
#include "../wlroots/include/wlr/types/wlr_server_decoration.h"
|
||||||
#include <wlr/types/wlr_viewporter.h>
|
#include "../wlroots/include/wlr/types/wlr_viewporter.h"
|
||||||
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_virtual_keyboard_v1.h"
|
||||||
#include <wlr/types/wlr_xcursor_manager.h>
|
#include "../wlroots/include/wlr/types/wlr_xcursor_manager.h"
|
||||||
#include <wlr/types/wlr_xdg_activation_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_xdg_activation_v1.h"
|
||||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_xdg_decoration_v1.h"
|
||||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_xdg_output_v1.h"
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include "../wlroots/include/wlr/types/wlr_xdg_shell.h"
|
||||||
#include <wlr/types/wlr_subcompositor.h>
|
#include "../wlroots/include/wlr/types/wlr_subcompositor.h"
|
||||||
#include <wlr/types/wlr_scene.h>
|
#include "../wlroots/include/wlr/types/wlr_scene.h"
|
||||||
#include <wlr/types/wlr_output_damage.h>
|
#include "../wlroots/include/wlr/types/wlr_output_damage.h"
|
||||||
#include <wlr/types/wlr_input_inhibitor.h>
|
#include "../wlroots/include/wlr/types/wlr_input_inhibitor.h"
|
||||||
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h"
|
||||||
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_virtual_pointer_v1.h"
|
||||||
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_foreign_toplevel_management_v1.h"
|
||||||
#include <wlr/util/log.h>
|
#include "../wlroots/include/wlr/util/log.h"
|
||||||
#include <wlr/xwayland.h>
|
#include "../wlroots/include/wlr/xwayland.h"
|
||||||
#include <wlr/util/region.h>
|
#include "../wlroots/include/wlr/util/region.h"
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
#include <wlr/render/egl.h>
|
#include "../wlroots/include/wlr/render/egl.h"
|
||||||
#include <wlr/render/gles2.h>
|
#include "../wlroots/include/wlr/render/gles2.h"
|
||||||
#include <wlr/render/wlr_texture.h>
|
#include "../wlroots/include/wlr/render/wlr_texture.h"
|
||||||
#include <wlr/types/wlr_pointer_constraints_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_pointer_constraints_v1.h"
|
||||||
#include <wlr/types/wlr_relative_pointer_v1.h>
|
#include "../wlroots/include/wlr/types/wlr_relative_pointer_v1.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef class
|
#undef class
|
||||||
|
@@ -357,7 +357,7 @@ void CHyprDwindleLayout::recalculateMonitor(const int& monid) {
|
|||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
|
||||||
|
|
||||||
// Ignore any recalc events if we have a fullscreen window.
|
// Ignore any recalc events if we have a fullscreen window.
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow)
|
if (!PWORKSPACE || PWORKSPACE->m_bHasFullscreenWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto TOPNODE = getMasterNodeOnWorkspace(PMONITOR->activeWorkspace);
|
const auto TOPNODE = getMasterNodeOnWorkspace(PMONITOR->activeWorkspace);
|
||||||
|
@@ -221,7 +221,6 @@ void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
|
|||||||
// notify app if we didnt handle it
|
// notify app if we didnt handle it
|
||||||
if (g_pCompositor->doesSeatAcceptInput(g_pCompositor->m_pLastFocus)) {
|
if (g_pCompositor->doesSeatAcceptInput(g_pCompositor->m_pLastFocus)) {
|
||||||
wlr_seat_pointer_notify_button(g_pCompositor->m_sSeat.seat, e->time_msec, e->button, e->state);
|
wlr_seat_pointer_notify_button(g_pCompositor->m_sSeat.seat, e->time_msec, e->button, e->state);
|
||||||
Debug::log(LOG, "Seat notified of button %i (state %i) on surface %x", e->button, e->state, g_pCompositor->m_pLastFocus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -360,8 +359,6 @@ void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboar
|
|||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if (e->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (e->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
Debug::log(LOG, "Pressed key %i, with the MODMASK being %i", e->keycode, MODS);
|
|
||||||
|
|
||||||
for (int i = 0; i < syms; ++i)
|
for (int i = 0; i < syms; ++i)
|
||||||
found = g_pKeybindManager->handleKeybinds(MODS, keysyms[i]) || found;
|
found = g_pKeybindManager->handleKeybinds(MODS, keysyms[i]) || found;
|
||||||
} else if (e->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
} else if (e->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
||||||
|
@@ -21,6 +21,8 @@ CKeybindManager::CKeybindManager() {
|
|||||||
m_mDispatchers["movecursortocorner"] = moveCursorToCorner;
|
m_mDispatchers["movecursortocorner"] = moveCursorToCorner;
|
||||||
m_mDispatchers["workspaceopt"] = workspaceOpt;
|
m_mDispatchers["workspaceopt"] = workspaceOpt;
|
||||||
m_mDispatchers["exit"] = exitHyprland;
|
m_mDispatchers["exit"] = exitHyprland;
|
||||||
|
m_mDispatchers["movecurrentworkspacetomonitor"] = moveCurrentWorkspaceToMonitor;
|
||||||
|
m_mDispatchers["moveworkspacetomonitor"] = moveWorkspaceToMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::addKeybind(SKeybind kb) {
|
void CKeybindManager::addKeybind(SKeybind kb) {
|
||||||
@@ -89,6 +91,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t
|
|||||||
Debug::log(ERR, "Inavlid handler in a keybind! (handler %s does not exist)", k.handler.c_str());
|
Debug::log(ERR, "Inavlid handler in a keybind! (handler %s does not exist)", k.handler.c_str());
|
||||||
} else {
|
} else {
|
||||||
// call the dispatcher
|
// call the dispatcher
|
||||||
|
Debug::log(LOG, "Keybind triggered, calling dispatcher (%d, %d)", modmask, KBKEYUPPER);
|
||||||
DISPATCHER->second(k.arg);
|
DISPATCHER->second(k.arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,6 +234,9 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||||||
g_pCompositor->deactivateAllWLRWorkspaces(PWORKSPACETOCHANGETO->m_pWlrHandle);
|
g_pCompositor->deactivateAllWLRWorkspaces(PWORKSPACETOCHANGETO->m_pWlrHandle);
|
||||||
PWORKSPACETOCHANGETO->setActive(true);
|
PWORKSPACETOCHANGETO->setActive(true);
|
||||||
|
|
||||||
|
// recalc layout
|
||||||
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWORKSPACETOCHANGETO->m_iMonitorID);
|
||||||
|
|
||||||
Debug::log(LOG, "Changed to workspace %i", workspaceToChangeTo);
|
Debug::log(LOG, "Changed to workspace %i", workspaceToChangeTo);
|
||||||
|
|
||||||
// focus
|
// focus
|
||||||
@@ -251,7 +257,8 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||||||
const auto ANIMTOLEFT = workspaceToChangeTo > OLDWORKSPACE;
|
const auto ANIMTOLEFT = workspaceToChangeTo > OLDWORKSPACE;
|
||||||
|
|
||||||
// start anim on old workspace
|
// start anim on old workspace
|
||||||
g_pCompositor->getWorkspaceByID(OLDWORKSPACE)->startAnim(false, ANIMTOLEFT);
|
if (const auto POLDWORKSPACE = g_pCompositor->getWorkspaceByID(OLDWORKSPACE); POLDWORKSPACE)
|
||||||
|
POLDWORKSPACE->startAnim(false, ANIMTOLEFT);
|
||||||
|
|
||||||
g_pCompositor->m_lWorkspaces.emplace_back(PMONITOR->ID);
|
g_pCompositor->m_lWorkspaces.emplace_back(PMONITOR->ID);
|
||||||
const auto PWORKSPACE = &g_pCompositor->m_lWorkspaces.back();
|
const auto PWORKSPACE = &g_pCompositor->m_lWorkspaces.back();
|
||||||
@@ -297,7 +304,7 @@ void CKeybindManager::fullscreenActive(std::string args) {
|
|||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, args == "1" ? eFullscreenMode::FULLSCREEN_MAXIMIZED : eFullscreenMode::FULLSCREEN_FULL);
|
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, args == "1" ? eFullscreenMode::FULLSCREEN_MAXIMIZED : eFullscreenMode::FULLSCREEN_FULL);
|
||||||
|
|
||||||
g_pXWaylandManager->setWindowFullscreen(PWINDOW, PWINDOW->m_bIsFullscreen);
|
g_pXWaylandManager->setWindowFullscreen(PWINDOW, PWINDOW->m_bIsFullscreen && args == "0");
|
||||||
|
|
||||||
// make all windows on the same workspace under the fullscreen window
|
// make all windows on the same workspace under the fullscreen window
|
||||||
for (auto& w : g_pCompositor->m_lWindows) {
|
for (auto& w : g_pCompositor->m_lWindows) {
|
||||||
@@ -317,15 +324,23 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
|||||||
const auto OLDWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
|
const auto OLDWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
|
||||||
|
|
||||||
// hack
|
// hack
|
||||||
|
std::string unusedName;
|
||||||
|
const auto WORKSPACEID = getWorkspaceIDFromString(args, unusedName);
|
||||||
|
|
||||||
g_pKeybindManager->changeworkspace(args);
|
g_pKeybindManager->changeworkspace(args);
|
||||||
|
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByString(args);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID);
|
||||||
|
|
||||||
if (PWORKSPACE == OLDWORKSPACE) {
|
if (PWORKSPACE == OLDWORKSPACE) {
|
||||||
Debug::log(LOG, "Not moving to workspace because it didn't change.");
|
Debug::log(LOG, "Not moving to workspace because it didn't change.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!PWORKSPACE) {
|
||||||
|
Debug::log(ERR, "Workspace null in moveActiveToWorkspace?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
OLDWORKSPACE->m_bHasFullscreenWindow = false;
|
OLDWORKSPACE->m_bHasFullscreenWindow = false;
|
||||||
|
|
||||||
PWINDOW->m_iWorkspaceID = PWORKSPACE->m_iID;
|
PWINDOW->m_iWorkspaceID = PWORKSPACE->m_iID;
|
||||||
@@ -681,3 +696,55 @@ void CKeybindManager::exitHyprland(std::string argz) {
|
|||||||
g_pCompositor->cleanupExit();
|
g_pCompositor->cleanupExit();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) {
|
||||||
|
if (!isNumber(args) && !isDirection(args)) {
|
||||||
|
Debug::log(ERR, "moveCurrentWorkspaceToMonitor arg not a number or direction!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto PMONITOR = isDirection(args) ? g_pCompositor->getMonitorInDirection(args[0]) : g_pCompositor->getMonitorFromID(std::stoi(args));
|
||||||
|
|
||||||
|
if (!PMONITOR) {
|
||||||
|
Debug::log(ERR, "Ignoring moveCurrentWorkspaceToMonitor: monitor doesnt exist");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the current workspace
|
||||||
|
const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace);
|
||||||
|
|
||||||
|
if (!PCURRENTWORKSPACE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_pCompositor->moveWorkspaceToMonitor(PCURRENTWORKSPACE, PMONITOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKeybindManager::moveWorkspaceToMonitor(std::string args) {
|
||||||
|
|
||||||
|
std::string workspace = args.substr(0, args.find_first_of(' '));
|
||||||
|
std::string monitor = args.substr(args.find_first_of(' ') + 1);
|
||||||
|
|
||||||
|
if (!isNumber(monitor) && !isDirection(monitor)) {
|
||||||
|
Debug::log(ERR, "moveWorkspaceToMonitor monitor arg not a number or direction!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto PMONITOR = isDirection(monitor) ? g_pCompositor->getMonitorInDirection(monitor[0]) : g_pCompositor->getMonitorFromID(std::stoi(monitor));
|
||||||
|
|
||||||
|
if (!PMONITOR){
|
||||||
|
Debug::log(ERR, "Ignoring moveWorkspaceToMonitor: monitor doesnt exist");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string workspaceName;
|
||||||
|
const int WORKSPACEID = getWorkspaceIDFromString(workspace, workspaceName);
|
||||||
|
|
||||||
|
if (WORKSPACEID == INT_MAX) {
|
||||||
|
Debug::log(ERR, "moveWorkspaceToMonitor invalid workspace!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID);
|
||||||
|
|
||||||
|
g_pCompositor->moveWorkspaceToMonitor(PWORKSPACE, PMONITOR);
|
||||||
|
}
|
@@ -51,6 +51,10 @@ private:
|
|||||||
static void moveCursorToCorner(std::string);
|
static void moveCursorToCorner(std::string);
|
||||||
static void workspaceOpt(std::string);
|
static void workspaceOpt(std::string);
|
||||||
static void exitHyprland(std::string);
|
static void exitHyprland(std::string);
|
||||||
|
static void moveCurrentWorkspaceToMonitor(std::string);
|
||||||
|
static void moveWorkspaceToMonitor(std::string);
|
||||||
|
|
||||||
|
friend class CCompositor;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<CKeybindManager> g_pKeybindManager;
|
inline std::unique_ptr<CKeybindManager> g_pKeybindManager;
|
@@ -32,7 +32,7 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool shouldRenderWindow(CWindow* pWindow, SMonitor* pMonitor) {
|
bool shouldRenderWindow(CWindow* pWindow, SMonitor* pMonitor) {
|
||||||
wlr_box geometry = {pWindow->m_vRealPosition.vec().x, pWindow->m_vRealPosition.vec().y, pWindow->m_vRealSize.vec().x, pWindow->m_vRealSize.vec().y};
|
wlr_box geometry = pWindow->getFullWindowBoundingBox();
|
||||||
|
|
||||||
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry))
|
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry))
|
||||||
return false;
|
return false;
|
||||||
|
1
wlroots
Submodule
1
wlroots
Submodule
Submodule wlroots added at 75d31509db
Reference in New Issue
Block a user