mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-12-22 05:19:48 +01:00
debug: add --display arg
This commit is contained in:
parent
5e4eea379e
commit
dfd2f851da
3 changed files with 11 additions and 6 deletions
|
@ -7,8 +7,8 @@
|
|||
#include <sys/mman.h>
|
||||
#include <cuchar>
|
||||
|
||||
CHyprlock::CHyprlock() {
|
||||
m_sWaylandState.display = wl_display_connect(nullptr);
|
||||
CHyprlock::CHyprlock(const std::string& wlDisplay) {
|
||||
m_sWaylandState.display = wl_display_connect(wlDisplay.empty() ? nullptr : wlDisplay.c_str());
|
||||
if (!m_sWaylandState.display) {
|
||||
Debug::log(CRIT, "Couldn't connect to a wayland compositor");
|
||||
exit(1);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
class CHyprlock {
|
||||
public:
|
||||
CHyprlock();
|
||||
CHyprlock(const std::string& wlDisplay);
|
||||
|
||||
void run();
|
||||
|
||||
|
|
11
src/main.cpp
11
src/main.cpp
|
@ -2,7 +2,9 @@
|
|||
#include "config/ConfigManager.hpp"
|
||||
#include "core/hyprlock.hpp"
|
||||
|
||||
int main(int argc, char **argv, char **envp) {
|
||||
int main(int argc, char** argv, char** envp) {
|
||||
std::string wlDisplay;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
std::string arg = argv[i];
|
||||
|
||||
|
@ -11,12 +13,15 @@ int main(int argc, char **argv, char **envp) {
|
|||
|
||||
else if (arg == "--quiet" || arg == "-q")
|
||||
Debug::quiet = true;
|
||||
|
||||
else if (arg == "--display" && i + 1 < argc)
|
||||
wlDisplay = argv[i + 1];
|
||||
}
|
||||
|
||||
try {
|
||||
g_pConfigManager = std::make_unique<CConfigManager>();
|
||||
g_pConfigManager->init();
|
||||
} catch (const char *err) {
|
||||
} catch (const char* err) {
|
||||
Debug::log(CRIT, "ConfigManager threw: {}", err);
|
||||
std::string strerr = err;
|
||||
if (strerr.contains("File does not exist"))
|
||||
|
@ -24,7 +29,7 @@ int main(int argc, char **argv, char **envp) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
g_pHyprlock = std::make_unique<CHyprlock>();
|
||||
g_pHyprlock = std::make_unique<CHyprlock>(wlDisplay);
|
||||
g_pHyprlock->run();
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue