mirror of
https://github.com/Trensa-Organization/Hyprland.git
synced 2025-03-15 18:53:39 +01:00
pull: Added a lot of fixes from pull requests
This commit is contained in:
parent
35ac2ef505
commit
32636aac4c
10 changed files with 85 additions and 59 deletions
|
@ -23,39 +23,49 @@
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
const std::string USAGE = R"#(usage: hyprctl [(opt)flags] [command] [(opt)args]
|
const std::string USAGE = R"#(usage: hyprctl [flags] [<command> [args]]
|
||||||
|
hyprctl --batch {<command 1> [args] ; <command 2> [args] ; ...}
|
||||||
commands:
|
LISTING COMMANDS:
|
||||||
monitors
|
monitors: List outputs
|
||||||
workspaces
|
workspaces: List all workspaces
|
||||||
activeworkspace
|
activeworkspace: Get currently active workspace
|
||||||
workspacerules
|
clients: List clients (e.g. windows)
|
||||||
clients
|
activewindow: Get currently active window
|
||||||
activewindow
|
layers: List layers
|
||||||
layers
|
animations: List animations and bezier curves in use
|
||||||
devices
|
devices: List devices
|
||||||
binds
|
binds: List registered binds
|
||||||
dispatch
|
instances: List running Hyprland instances
|
||||||
keyword
|
layouts: List layouts
|
||||||
version
|
globalshortcuts: List global shortcuts
|
||||||
kill
|
version: Print hyprland version
|
||||||
splash
|
CONFIGURATION COMMANDS:
|
||||||
hyprpaper
|
keyword <keyword> [args]: Execute a keyword
|
||||||
reload
|
getoption <option>: Get value of <option>
|
||||||
setcursor
|
reload: Reload configurations
|
||||||
getoption
|
PLUGIN:
|
||||||
cursorpos
|
plugin list: List loaded plugins
|
||||||
switchxkblayout
|
plugin load <path>: Load plugin from <path>
|
||||||
seterror
|
plugin unload <path>: Unload plugin at <path>
|
||||||
setprop
|
THEMING:
|
||||||
plugin
|
hyprpaper <keywords> Issue hyprpaper keywords using IPC
|
||||||
notify
|
splash: Prints the current random splash
|
||||||
globalshortcuts
|
cursorpos: Get the current cursor position in global layout coordinates
|
||||||
instances
|
setcursor <theme> <size>: Set cursor theme and size, (except for GTK)
|
||||||
layouts
|
ADDITIONAL COMMANDS:
|
||||||
|
dispatch <name> [args]: Run a dispatcher
|
||||||
flags:
|
kill: Enter kill mode, where you can kill an app by clicking on it,
|
||||||
|
use ESCAPE to quit kill mode
|
||||||
|
switchxkblayout <args>: Sets the xkb layout index for a keyboard, see wiki for details
|
||||||
|
setprop <window> <prop>: Set window property, see wiki for details
|
||||||
|
seterror <color> <msg>: Display <msg> as a error message, will reset upon reloading config
|
||||||
|
seterror disable: Clear error message
|
||||||
|
notify <icon> <time_ms> <color> <message>:
|
||||||
|
Sends a notification using the built-in Hyprland notification system.
|
||||||
|
output <args>: Add and remove fake outputs to specified backend, see wiki for details.
|
||||||
|
FLAGS:
|
||||||
-j -> output in JSON
|
-j -> output in JSON
|
||||||
|
--help -> display this help
|
||||||
--batch -> execute a batch of commands, separated by ';'
|
--batch -> execute a batch of commands, separated by ';'
|
||||||
--instance (-i) -> use a specific instance. Can be either signature or index in hyprctl instances (0, 1, etc)
|
--instance (-i) -> use a specific instance. Can be either signature or index in hyprctl instances (0, 1, etc)
|
||||||
)#";
|
)#";
|
||||||
|
|
|
@ -519,15 +519,14 @@ void CCompositor::startCompositor() {
|
||||||
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
if (m_sWLRSession /* Session-less Hyprland usually means a nest, don't update the env in that case */ && fork() == 0)
|
if (m_sWLRSession /* Session-less Hyprland usually means a nest, don't update the env in that case */) {
|
||||||
execl(
|
const auto CMD =
|
||||||
"/bin/sh", "/bin/sh", "-c",
|
|
||||||
#ifdef USES_SYSTEMD
|
#ifdef USES_SYSTEMD
|
||||||
"systemctl --user import-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && hash dbus-update-activation-environment 2>/dev/null && "
|
"systemctl --user import-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP && hash dbus-update-activation-environment 2>/dev/null && "
|
||||||
#endif
|
#endif
|
||||||
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE",
|
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE";
|
||||||
nullptr);
|
g_pKeybindManager->spawn(CMD);
|
||||||
|
}
|
||||||
Debug::log(LOG, "Running on WAYLAND_DISPLAY: {}", m_szWLDisplaySocket);
|
Debug::log(LOG, "Running on WAYLAND_DISPLAY: {}", m_szWLDisplaySocket);
|
||||||
|
|
||||||
if (!wlr_backend_start(m_sWLRBackend)) {
|
if (!wlr_backend_start(m_sWLRBackend)) {
|
||||||
|
@ -1125,6 +1124,21 @@ CWindow* CCompositor::getWindowFromHandle(uint32_t handle) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SIMEPopup* CCompositor::vectorToIMEPopup(const Vector2D& pos, std::list<SIMEPopup>* popups) {
|
||||||
|
for (auto& popup : *popups) {
|
||||||
|
auto surface = popup.pSurface->surface;
|
||||||
|
CBox box{
|
||||||
|
popup.realX,
|
||||||
|
popup.realY,
|
||||||
|
surface->current.width,
|
||||||
|
surface->current.height,
|
||||||
|
};
|
||||||
|
if (box.containsPoint(pos))
|
||||||
|
return &popup;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getWindowFromZWLRHandle(wl_resource* handle) {
|
CWindow* CCompositor::getWindowFromZWLRHandle(wl_resource* handle) {
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->isHidden() || !w->m_phForeignToplevel)
|
if (!w->m_bIsMapped || w->isHidden() || !w->m_phForeignToplevel)
|
||||||
|
|
|
@ -139,6 +139,7 @@ class CCompositor {
|
||||||
CWindow* vectorToWindowIdeal(const Vector2D&, CWindow* pIgnoreWindow = nullptr); // used only for finding a window to focus on, basically a "findFocusableWindow"
|
CWindow* vectorToWindowIdeal(const Vector2D&, CWindow* pIgnoreWindow = nullptr); // used only for finding a window to focus on, basically a "findFocusableWindow"
|
||||||
CWindow* vectorToWindowTiled(const Vector2D&);
|
CWindow* vectorToWindowTiled(const Vector2D&);
|
||||||
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<std::unique_ptr<SLayerSurface>>*, Vector2D*, SLayerSurface**);
|
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<std::unique_ptr<SLayerSurface>>*, Vector2D*, SLayerSurface**);
|
||||||
|
SIMEPopup* vectorToIMEPopup(const Vector2D& pos, std::list<SIMEPopup>* popups);
|
||||||
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
|
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
|
||||||
Vector2D vectorToSurfaceLocal(const Vector2D&, CWindow*, wlr_surface*);
|
Vector2D vectorToSurfaceLocal(const Vector2D&, CWindow*, wlr_surface*);
|
||||||
CWindow* windowFromCursor();
|
CWindow* windowFromCursor();
|
||||||
|
|
|
@ -271,6 +271,7 @@ void CConfigManager::setDefaultVars() {
|
||||||
|
|
||||||
configValues["xwayland:use_nearest_neighbor"].intValue = 1;
|
configValues["xwayland:use_nearest_neighbor"].intValue = 1;
|
||||||
configValues["xwayland:force_zero_scaling"].intValue = 0;
|
configValues["xwayland:force_zero_scaling"].intValue = 0;
|
||||||
|
configValues["xwayland:enabled"].intValue = 1;
|
||||||
|
|
||||||
configValues["autogenerated"].intValue = 0;
|
configValues["autogenerated"].intValue = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -754,10 +754,7 @@ std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
||||||
#ifdef LEGACY_RENDERER
|
#ifdef LEGACY_RENDERER
|
||||||
result += "legacyrenderer\n";
|
result += "legacyrenderer\n";
|
||||||
#endif
|
#endif
|
||||||
#ifndef NDEBUG
|
#ifndef ISDEBUG
|
||||||
result += "debug\n";
|
|
||||||
#endif
|
|
||||||
#ifdef HYPRLAND_DEBUG
|
|
||||||
result += "debug\n";
|
result += "debug\n";
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_XWAYLAND
|
#ifdef NO_XWAYLAND
|
||||||
|
@ -779,10 +776,7 @@ std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
||||||
#ifdef LEGACY_RENDERER
|
#ifdef LEGACY_RENDERER
|
||||||
result += "\"legacyrenderer\",";
|
result += "\"legacyrenderer\",";
|
||||||
#endif
|
#endif
|
||||||
#ifndef NDEBUG
|
#ifndef ISDEBUG
|
||||||
result += "\"debug\",";
|
|
||||||
#endif
|
|
||||||
#ifdef HYPRLAND_DEBUG
|
|
||||||
result += "\"debug\",";
|
result += "\"debug\",";
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_XWAYLAND
|
#ifdef NO_XWAYLAND
|
||||||
|
|
|
@ -101,8 +101,7 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
g_pCompositor->initServer();
|
g_pCompositor->initServer();
|
||||||
|
|
||||||
if (!getenv("HYPRLAND_NO_RT") || configStringToInt(std::string(getenv("HYPRLAND_NO_RT"))) == 0)
|
Init::gainRealTime();
|
||||||
Init::gainRealTime();
|
|
||||||
|
|
||||||
Debug::log(LOG, "Hyprland init finished.");
|
Debug::log(LOG, "Hyprland init finished.");
|
||||||
|
|
||||||
|
|
|
@ -641,11 +641,6 @@ void CKeybindManager::spawn(std::string args) {
|
||||||
args = args.substr(args.find_first_of(']') + 1);
|
args = args.substr(args.find_first_of(']') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pXWaylandManager->m_sWLRXWayland)
|
|
||||||
args = "WAYLAND_DISPLAY=" + std::string(g_pCompositor->m_szWLDisplaySocket) + " DISPLAY=" + std::string(g_pXWaylandManager->m_sWLRXWayland->display_name) + " " + args;
|
|
||||||
else
|
|
||||||
args = "WAYLAND_DISPLAY=" + std::string(g_pCompositor->m_szWLDisplaySocket) + " " + args;
|
|
||||||
|
|
||||||
const uint64_t PROC = spawnRaw(args);
|
const uint64_t PROC = spawnRaw(args);
|
||||||
|
|
||||||
if (!RULES.empty()) {
|
if (!RULES.empty()) {
|
||||||
|
@ -735,11 +730,10 @@ void CKeybindManager::clearKeybinds() {
|
||||||
void CKeybindManager::toggleActiveFloating(std::string args) {
|
void CKeybindManager::toggleActiveFloating(std::string args) {
|
||||||
CWindow* PWINDOW = nullptr;
|
CWindow* PWINDOW = nullptr;
|
||||||
|
|
||||||
if (args != "" && args != "active" && args.length() > 1) {
|
if (args != "" && args != "active" && args.length() > 1)
|
||||||
PWINDOW = g_pCompositor->getWindowByRegex(args);
|
PWINDOW = g_pCompositor->getWindowByRegex(args);
|
||||||
} else {
|
else
|
||||||
PWINDOW = g_pCompositor->m_pLastWindow;
|
PWINDOW = g_pCompositor->m_pLastWindow;
|
||||||
}
|
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
|
|
||||||
CHyprXWaylandManager::CHyprXWaylandManager() {
|
CHyprXWaylandManager::CHyprXWaylandManager() {
|
||||||
#ifndef NO_XWAYLAND
|
#ifndef NO_XWAYLAND
|
||||||
|
static auto* const XWAYLANDENABLED = &g_pConfigManager->getConfigValuePtr("xwayland:enabled")->intValue;
|
||||||
|
if (!*XWAYLANDENABLED)
|
||||||
|
return;
|
||||||
|
|
||||||
m_sWLRXWayland = wlr_xwayland_create(g_pCompositor->m_sWLDisplay, g_pCompositor->m_sWLRCompositor, 1);
|
m_sWLRXWayland = wlr_xwayland_create(g_pCompositor->m_sWLDisplay, g_pCompositor->m_sWLRCompositor, 1);
|
||||||
|
|
||||||
if (!m_sWLRXWayland) {
|
if (!m_sWLRXWayland) {
|
||||||
|
|
|
@ -233,10 +233,20 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
surfacePos = PMONITOR->vecPosition;
|
surfacePos = PMONITOR->vecPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
// overlay is above fullscreen
|
// overlay are above fullscreen
|
||||||
if (!foundSurface)
|
if (!foundSurface)
|
||||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface);
|
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface);
|
||||||
|
|
||||||
|
// also IME popups
|
||||||
|
if (!foundSurface) {
|
||||||
|
auto popup = g_pCompositor->vectorToIMEPopup(mouseCoords, &m_sIMERelay.m_lIMEPopups);
|
||||||
|
if (popup) {
|
||||||
|
foundSurface = popup->pSurface->surface;
|
||||||
|
surfacePos = Vector2D(popup->realX, popup->realY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// also top layers
|
||||||
if (!foundSurface)
|
if (!foundSurface)
|
||||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface);
|
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface);
|
||||||
|
|
||||||
|
@ -471,7 +481,6 @@ void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::processMouseRequest(wlr_seat_pointer_request_set_cursor_event* e) {
|
void CInputManager::processMouseRequest(wlr_seat_pointer_request_set_cursor_event* e) {
|
||||||
|
|
||||||
if (!e->surface)
|
if (!e->surface)
|
||||||
g_pHyprRenderer->m_bWindowRequestedCursorHide = true;
|
g_pHyprRenderer->m_bWindowRequestedCursorHide = true;
|
||||||
else
|
else
|
||||||
|
|
|
@ -418,7 +418,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
||||||
|
|
||||||
// if window is floating and we have a slide animation, clip it to its full bb
|
// if window is floating and we have a slide animation, clip it to its full bb
|
||||||
if (!ignorePosition && pWindow->m_bIsFloating && !pWindow->m_bIsFullscreen && PWORKSPACE->m_vRenderOffset.isBeingAnimated()) {
|
if (!ignorePosition && pWindow->m_bIsFloating && !pWindow->m_bIsFullscreen && PWORKSPACE->m_vRenderOffset.isBeingAnimated()) {
|
||||||
CRegion rg = pWindow->getFullWindowBoundingBox().translate(-pMonitor->vecPosition);
|
CRegion rg = pWindow->getFullWindowBoundingBox().translate(-pMonitor->vecPosition + PWORKSPACE->m_vRenderOffset.vec()).scale(pMonitor->scale);
|
||||||
rg.add(CBox{0, 0, pMonitor->vecSize.x, pMonitor->vecSize.y});
|
rg.add(CBox{0, 0, pMonitor->vecSize.x, pMonitor->vecSize.y});
|
||||||
g_pHyprOpenGL->m_RenderData.clipBox = rg.getExtents();
|
g_pHyprOpenGL->m_RenderData.clipBox = rg.getExtents();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue