Skip to content

Commit

Permalink
Merge pull request #1 from hyprwm/main
Browse files Browse the repository at this point in the history
install: Prepend ${DESTDIR} when creating hyprland symbolic link (fix…
  • Loading branch information
G1-Ctrl authored Aug 15, 2024
2 parents 511eea7 + 197f880 commit 4e1c066
Show file tree
Hide file tree
Showing 21 changed files with 91 additions and 68 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ gmon.out
PKGBUILD

src/version.h
hyprpm/Makefile
hyprctl/Makefile
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ install(
CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E create_symlink \
${CMAKE_INSTALL_FULL_BINDIR}/Hyprland \
${CMAKE_INSTALL_FULL_BINDIR}/hyprland
\"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/hyprland\" \
)")

# session file
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align = center>

<img src="https://raw.githubusercontent.com/vaxerski/Hyprland/main/assets/header.svg" width="750" height="300" alt="banner">
<img src="https://raw.githubusercontent.com/hyprwm/Hyprland/main/assets/header.svg" width="750" height="300" alt="banner">

<br>

Expand Down Expand Up @@ -125,7 +125,6 @@ easy IPC, much more QoL stuff than other compositors and more...

<!----------------------------------{ Images }--------------------------------->

[Stars Preview]: https://starchart.cc/vaxerski/Hyprland.svg
[Preview A]: https://i.ibb.co/C1yTb0r/falf.png
[Preview B]: https://linfindel.github.io/cdn/hyprland-preview-b.png
[Preview C]: https://i.ibb.co/B3GJg28/20221126-20h53m26s-grim.png
Expand Down
24 changes: 12 additions & 12 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions hyprctl/Makefile

This file was deleted.

5 changes: 5 additions & 0 deletions src/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ void CCompositor::initAllSignals() {
}

g_pConfigManager->m_bWantsMonitorReload = true;
g_pCursorManager->syncGsettings();
} else {
Debug::log(LOG, "Session got deactivated!");

Expand Down Expand Up @@ -552,6 +553,10 @@ void CCompositor::initManagers(eManagersInitStage stage) {

g_pConfigManager->init();
g_pWatchdog = std::make_unique<CWatchdog>(); // requires config
// wait for watchdog to initialize to not hit data races in reading config values.
while (!g_pWatchdog->m_bWatchdogInitialized) {
std::this_thread::yield();
}

Debug::log(LOG, "Creating the PointerManager!");
g_pPointerManager = std::make_unique<CPointerManager>();
Expand Down
17 changes: 13 additions & 4 deletions src/config/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,9 +822,6 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
if (!isFirstLaunch)
g_pHyprOpenGL->m_bReloadScreenShader = true;

if (!isFirstLaunch && *PENABLEEXPLICIT != prevEnabledExplicit)
g_pHyprError->queueCreate("Warning: You changed the render:explicit_sync option, this requires you to restart Hyprland.", CColor(0.9, 0.76, 0.221, 1.0));

// parseError will be displayed next frame

if (result.error)
Expand All @@ -837,6 +834,8 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
else if (std::any_cast<Hyprlang::INT>(m_pConfig->getConfigValue("autogenerated")) == 1)
g_pHyprError->queueCreate("Warning: You're using an autogenerated config! (config file: " + getMainConfigPath() + " )\nSUPER+Q -> kitty\nSUPER+M -> exit Hyprland",
CColor(1.0, 1.0, 70.0 / 255.0, 1.0));
else if (*PENABLEEXPLICIT != prevEnabledExplicit)
g_pHyprError->queueCreate("Warning: You changed the render:explicit_sync option, this requires you to restart Hyprland.", CColor(0.9, 0.76, 0.221, 1.0));
else
g_pHyprError->destroy();

Expand Down Expand Up @@ -925,14 +924,24 @@ void CConfigManager::init() {
}

std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::string& VALUE) {
const auto RET = m_pConfig->parseDynamic(COMMAND.c_str(), VALUE.c_str());
static const auto PENABLEEXPLICIT = CConfigValue<Hyprlang::INT>("render:explicit_sync");
static int prevEnabledExplicit = *PENABLEEXPLICIT;

const auto RET = m_pConfig->parseDynamic(COMMAND.c_str(), VALUE.c_str());

// invalidate layouts if they changed
if (COMMAND == "monitor" || COMMAND.contains("gaps_") || COMMAND.starts_with("dwindle:") || COMMAND.starts_with("master:")) {
for (auto& m : g_pCompositor->m_vMonitors)
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
}

if (COMMAND.contains("explicit")) {
if (*PENABLEEXPLICIT != prevEnabledExplicit)
g_pHyprError->queueCreate("Warning: You changed the render:explicit_sync option, this requires you to restart Hyprland.", CColor(0.9, 0.76, 0.221, 1.0));
else
g_pHyprError->destroy();
}

// Update window border colors
g_pCompositor->updateAllWindowsAnimatedDecorationValues();

Expand Down
16 changes: 8 additions & 8 deletions src/debug/HyprDebugOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ CHyprDebugOverlay::CHyprDebugOverlay() {
m_pTexture = makeShared<CTexture>();
}

void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
m_dLastRenderTimes.push_back(µs / 1000.f);
void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float durationUs) {
m_dLastRenderTimes.push_back(durationUs / 1000.f);

if (m_dLastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate)
m_dLastRenderTimes.pop_front();
Expand All @@ -17,8 +17,8 @@ void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
m_pMonitor = pMonitor;
}

void CHyprMonitorDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) {
m_dLastRenderTimesNoOverlay.push_back(µs / 1000.f);
void CHyprMonitorDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float durationUs) {
m_dLastRenderTimesNoOverlay.push_back(durationUs / 1000.f);

if (m_dLastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate)
m_dLastRenderTimesNoOverlay.pop_front();
Expand Down Expand Up @@ -188,12 +188,12 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
return posY - offset;
}

void CHyprDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
m_mMonitorOverlays[pMonitor].renderData(pMonitor, µs);
void CHyprDebugOverlay::renderData(CMonitor* pMonitor, float durationUs) {
m_mMonitorOverlays[pMonitor].renderData(pMonitor, durationUs);
}

void CHyprDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) {
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, µs);
void CHyprDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float durationUs) {
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, durationUs);
}

void CHyprDebugOverlay::frameData(CMonitor* pMonitor) {
Expand Down
8 changes: 4 additions & 4 deletions src/debug/HyprDebugOverlay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class CHyprMonitorDebugOverlay {
public:
int draw(int offset);

void renderData(CMonitor* pMonitor, float µs);
void renderDataNoOverlay(CMonitor* pMonitor, float µs);
void renderData(CMonitor* pMonitor, float durationUs);
void renderDataNoOverlay(CMonitor* pMonitor, float durationUs);
void frameData(CMonitor* pMonitor);

private:
Expand All @@ -33,8 +33,8 @@ class CHyprDebugOverlay {
public:
CHyprDebugOverlay();
void draw();
void renderData(CMonitor*, float µs);
void renderDataNoOverlay(CMonitor*, float µs);
void renderData(CMonitor*, float durationUs);
void renderDataNoOverlay(CMonitor*, float durationUs);
void frameData(CMonitor*);

private:
Expand Down
13 changes: 6 additions & 7 deletions src/helpers/Watchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ CWatchdog::CWatchdog() {
m_pWatchdog = std::make_unique<std::thread>([this] {
static auto PTIMEOUT = CConfigValue<Hyprlang::INT>("debug:watchdog_timeout");

while (1337) {
std::unique_lock lk(m_mWatchdogMutex);
m_bWatchdogInitialized = true;
while (!m_bExitThread) {
std::unique_lock<std::mutex> lk(m_mWatchdogMutex);

if (!m_bWillWatch)
m_cvWatchdogCondition.wait(lk, [this] { return m_bNotified; });
else {
if (m_cvWatchdogCondition.wait_for(lk, std::chrono::milliseconds((int)(*PTIMEOUT * 1000.0)), [this] { return m_bNotified; }) == false)
pthread_kill(m_iMainThreadPID, SIGUSR1);
}
m_cvWatchdogCondition.wait(lk, [this] { return m_bNotified || m_bExitThread; });
else if (m_cvWatchdogCondition.wait_for(lk, std::chrono::milliseconds((int)(*PTIMEOUT * 1000.0)), [this] { return m_bNotified || m_bExitThread; }) == false)
pthread_kill(m_iMainThreadPID, SIGUSR1);

if (m_bExitThread)
break;
Expand Down
14 changes: 8 additions & 6 deletions src/helpers/Watchdog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@ class CWatchdog {
CWatchdog();
~CWatchdog();

void startWatching();
void endWatching();
void startWatching();
void endWatching();

std::atomic<bool> m_bWatchdogInitialized{false};

private:
std::chrono::high_resolution_clock::time_point m_tTriggered;

pthread_t m_iMainThreadPID = 0;

bool m_bWatching = false;
bool m_bWillWatch = false;
std::atomic<bool> m_bWatching = false;
std::atomic<bool> m_bWillWatch = false;

std::unique_ptr<std::thread> m_pWatchdog;
std::mutex m_mWatchdogMutex;
bool m_bNotified = false;
bool m_bExitThread = false;
std::atomic<bool> m_bNotified = false;
std::atomic<bool> m_bExitThread = false;
std::condition_variable m_cvWatchdogCondition;
};

Expand Down
2 changes: 2 additions & 0 deletions src/layout/DwindleLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for

g_pHyprRenderer->damageWindow(PWINDOW);
}

PWINDOW->updateWindowDecos();
}

void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection direction) {
Expand Down
2 changes: 2 additions & 0 deletions src/layout/MasterLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,8 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {

g_pHyprRenderer->damageWindow(PWINDOW);
}

PWINDOW->updateWindowDecos();
}

bool CHyprMasterLayout::isWindowTiled(PHLWINDOW pWindow) {
Expand Down
6 changes: 5 additions & 1 deletion src/managers/CursorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,8 @@ bool CCursorManager::changeTheme(const std::string& name, const int size) {
updateTheme();

return true;
}
}

void CCursorManager::syncGsettings() {
m_pXcursor->syncGsettings();
}
3 changes: 2 additions & 1 deletion src/managers/CursorManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class CCursorManager {
void updateTheme();
SCursorImageData dataFor(const std::string& name); // for xwayland
void setXWaylandCursor();
void syncGsettings();

void tickAnimatedCursor();

Expand All @@ -75,4 +76,4 @@ class CCursorManager {
Hyprcursor::SCursorShapeData m_sCurrentCursorShapeData;
};

inline std::unique_ptr<CCursorManager> g_pCursorManager;
inline std::unique_ptr<CCursorManager> g_pCursorManager;
12 changes: 7 additions & 5 deletions src/managers/KeybindManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ uint32_t CKeybindManager::stringToModMask(std::string mods) {
}

uint32_t CKeybindManager::keycodeToModifier(xkb_keycode_t keycode) {
if (keycode == 0)
return 0;

switch (keycode - 8) {
case KEY_LEFTMETA: return HL_MODIFIER_META;
case KEY_RIGHTMETA: return HL_MODIFIER_META;
Expand Down Expand Up @@ -1163,6 +1166,8 @@ void CKeybindManager::fullscreenStateActive(std::string args) {
if (!PWINDOW)
return;

PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_SET_PROP);

int internalMode, clientMode;
try {
internalMode = std::stoi(ARGS[0]);
Expand All @@ -1181,18 +1186,15 @@ void CKeybindManager::fullscreenStateActive(std::string args) {
}

if (internalMode != -1 && clientMode == -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal) {
g_pCompositor->setWindowFullscreenState(PWINDOW, sFullscreenState{.internal = PWINDOW->m_sFullscreenState.client, .client = PWINDOW->m_sFullscreenState.client});
PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(true, PRIORITY_SET_PROP);
g_pCompositor->setWindowFullscreenState(PWINDOW, sFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_sFullscreenState.client});
return;
}

if (internalMode == -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.client == STATE.client) {
g_pCompositor->setWindowFullscreenState(PWINDOW, sFullscreenState{.internal = PWINDOW->m_sFullscreenState.internal, .client = PWINDOW->m_sFullscreenState.internal});
PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(true, PRIORITY_SET_PROP);
g_pCompositor->setWindowFullscreenState(PWINDOW, sFullscreenState{.internal = PWINDOW->m_sFullscreenState.internal, .client = FSMODE_NONE});
return;
}

PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_SET_PROP);
g_pCompositor->setWindowFullscreenState(PWINDOW, STATE);
}

Expand Down
1 change: 1 addition & 0 deletions src/managers/XCursorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <gio/gsettingsschema.h>
#include "config/ConfigValue.hpp"
#include "helpers/CursorShapes.hpp"
#include "../managers/CursorManager.hpp"
#include "debug/Log.hpp"
#include "XCursorManager.hpp"

Expand Down
4 changes: 2 additions & 2 deletions src/managers/XCursorManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ class CXCursorManager {

void loadTheme(const std::string& name, int size);
SP<SXCursors> getShape(std::string const& shape, int size);
void syncGsettings();

private:
SP<SXCursors> createCursor(std::string const& shape, XcursorImages* xImages);
std::unordered_set<std::string> themePaths(std::string const& theme);
std::string getLegacyShapeName(std::string const& shape);
std::vector<SP<SXCursors>> loadStandardCursors(std::string const& name, int size);
std::vector<SP<SXCursors>> loadAllFromDir(std::string const& path, int size);
void syncGsettings();

int lastLoadSize = 0;
std::string themeName = "";
SP<SXCursors> defaultCursor;
SP<SXCursors> hyprCursor;
std::vector<SP<SXCursors>> cursors;
};
};
Loading

0 comments on commit 4e1c066

Please sign in to comment.