mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 22:05:59 +01:00
Comments in configs folder and template handler function
This commit is contained in:
parent
b03f41efec
commit
0c68eaf99f
10 changed files with 400 additions and 206 deletions
|
@ -1,4 +1,3 @@
|
|||
#include <cctype>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <cstdio>
|
||||
|
@ -10,7 +9,6 @@
|
|||
#include <sys/un.h>
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
#include <ranges>
|
||||
#include <algorithm>
|
||||
#include <csignal>
|
||||
#include <format>
|
||||
|
@ -22,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <deque>
|
||||
#include <filesystem>
|
||||
#include <cstdarg>
|
||||
#include <regex>
|
||||
#include <sys/socket.h>
|
||||
#include <hyprutils/string/String.hpp>
|
||||
|
|
|
@ -1,48 +1,89 @@
|
|||
#pragma once
|
||||
#include "../defines.hpp"
|
||||
#include "../helpers/varlist/VarList.hpp"
|
||||
#include <vector>
|
||||
#include <hyprutils/string/VarList.hpp>
|
||||
|
||||
/**
|
||||
* @enum eConfigValueDataTypes
|
||||
* @brief Enumerates the possible data types for configuration values.
|
||||
*/
|
||||
enum eConfigValueDataTypes {
|
||||
CVD_TYPE_INVALID = -1,
|
||||
CVD_TYPE_GRADIENT = 0,
|
||||
CVD_TYPE_CSS_VALUE = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* @class ICustomConfigValueData
|
||||
* @brief Abstract base class for custom configuration value data.
|
||||
*/
|
||||
class ICustomConfigValueData {
|
||||
public:
|
||||
/** @brief Virtual destructor. */
|
||||
virtual ~ICustomConfigValueData() = 0;
|
||||
|
||||
/**
|
||||
* @brief Get the data type of the custom configuration value.
|
||||
* @return The data type.
|
||||
*/
|
||||
virtual eConfigValueDataTypes getDataType() = 0;
|
||||
|
||||
/**
|
||||
* @brief Convert the custom configuration value to a string.
|
||||
* @return The string representation of the value.
|
||||
*/
|
||||
virtual std::string toString() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class CGradientValueData
|
||||
* @brief Represents gradient configuration value data.
|
||||
*/
|
||||
class CGradientValueData : public ICustomConfigValueData {
|
||||
public:
|
||||
CGradientValueData(){};
|
||||
/** @brief Default constructor. */
|
||||
CGradientValueData() {};
|
||||
|
||||
/**
|
||||
* @brief Constructor with initial color.
|
||||
* @param col Initial color.
|
||||
*/
|
||||
CGradientValueData(CColor col) {
|
||||
m_vColors.push_back(col);
|
||||
};
|
||||
virtual ~CGradientValueData(){};
|
||||
|
||||
/** @brief Destructor. */
|
||||
virtual ~CGradientValueData() {};
|
||||
|
||||
/**
|
||||
* @brief Get the data type of the gradient value.
|
||||
* @return The data type (CVD_TYPE_GRADIENT).
|
||||
*/
|
||||
virtual eConfigValueDataTypes getDataType() {
|
||||
return CVD_TYPE_GRADIENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset the gradient with a single color.
|
||||
* @param col The color to reset the gradient to.
|
||||
*/
|
||||
void reset(CColor col) {
|
||||
m_vColors.clear();
|
||||
m_vColors.emplace_back(col);
|
||||
m_fAngle = 0;
|
||||
}
|
||||
|
||||
/* Vector containing the colors */
|
||||
/** @brief Vector containing the colors */
|
||||
std::vector<CColor> m_vColors;
|
||||
|
||||
/* Float corresponding to the angle (rad) */
|
||||
/** @brief Float representing the angle (in radians). */
|
||||
float m_fAngle = 0;
|
||||
|
||||
//
|
||||
/**
|
||||
* @brief Equality operator for comparing gradient values.
|
||||
* @param other The other gradient value to compare with.
|
||||
* @return True if equal, false otherwise.
|
||||
*/
|
||||
bool operator==(const CGradientValueData& other) const {
|
||||
if (other.m_vColors.size() != m_vColors.size() || m_fAngle != other.m_fAngle)
|
||||
return false;
|
||||
|
@ -54,6 +95,10 @@ class CGradientValueData : public ICustomConfigValueData {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert the gradient value to a string.
|
||||
* @return The string representation of the gradient value.
|
||||
*/
|
||||
virtual std::string toString() {
|
||||
std::string result;
|
||||
for (auto& c : m_vColors) {
|
||||
|
@ -65,13 +110,44 @@ class CGradientValueData : public ICustomConfigValueData {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @class CCssGapData
|
||||
* @brief Represents CSS gap configuration value data.
|
||||
*/
|
||||
class CCssGapData : public ICustomConfigValueData {
|
||||
public:
|
||||
CCssGapData() : top(0), right(0), bottom(0), left(0){};
|
||||
CCssGapData(int64_t global) : top(global), right(global), bottom(global), left(global){};
|
||||
CCssGapData(int64_t vertical, int64_t horizontal) : top(vertical), right(horizontal), bottom(vertical), left(horizontal){};
|
||||
CCssGapData(int64_t top, int64_t horizontal, int64_t bottom) : top(top), right(horizontal), bottom(bottom), left(horizontal){};
|
||||
CCssGapData(int64_t top, int64_t right, int64_t bottom, int64_t left) : top(top), right(right), bottom(bottom), left(left){};
|
||||
/** @brief Default constructor. */
|
||||
CCssGapData() : top(0), right(0), bottom(0), left(0) {};
|
||||
|
||||
/**
|
||||
* @brief Constructor with global gap size.
|
||||
* @param global The global gap size.
|
||||
*/
|
||||
CCssGapData(int64_t global) : top(global), right(global), bottom(global), left(global) {};
|
||||
|
||||
/**
|
||||
* @brief Constructor with vertical and horizontal gap sizes.
|
||||
* @param vertical The vertical gap size.
|
||||
* @param horizontal The horizontal gap size.
|
||||
*/
|
||||
CCssGapData(int64_t vertical, int64_t horizontal) : top(vertical), right(horizontal), bottom(vertical), left(horizontal) {};
|
||||
|
||||
/**
|
||||
* @brief Constructor with top, horizontal, and bottom gap sizes.
|
||||
* @param top The top gap size.
|
||||
* @param horizontal The horizontal gap size.
|
||||
* @param bottom The bottom gap size.
|
||||
*/
|
||||
CCssGapData(int64_t top, int64_t horizontal, int64_t bottom) : top(top), right(horizontal), bottom(bottom), left(horizontal) {};
|
||||
|
||||
/**
|
||||
* @brief Constructor with top, right, bottom, and left gap sizes.
|
||||
* @param top The top gap size.
|
||||
* @param right The right gap size.
|
||||
* @param bottom The bottom gap size.
|
||||
* @param left The left gap size.
|
||||
*/
|
||||
CCssGapData(int64_t top, int64_t right, int64_t bottom, int64_t left) : top(top), right(right), bottom(bottom), left(left) {};
|
||||
|
||||
/* Css like directions */
|
||||
int64_t top;
|
||||
|
@ -79,7 +155,11 @@ class CCssGapData : public ICustomConfigValueData {
|
|||
int64_t bottom;
|
||||
int64_t left;
|
||||
|
||||
void parseGapData(CVarList varlist) {
|
||||
/**
|
||||
* @brief Parses gap data from a variable list.
|
||||
* @param varlist The variable list to parse.
|
||||
*/
|
||||
void parseGapData(Hyprutils::String::CVarList varlist) {
|
||||
switch (varlist.size()) {
|
||||
case 1: {
|
||||
*this = CCssGapData(std::stoi(varlist[0]));
|
||||
|
@ -105,6 +185,10 @@ class CCssGapData : public ICustomConfigValueData {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset the gaps to a global size.
|
||||
* @param global The global gap size.
|
||||
*/
|
||||
void reset(int64_t global) {
|
||||
top = global;
|
||||
right = global;
|
||||
|
@ -112,10 +196,18 @@ class CCssGapData : public ICustomConfigValueData {
|
|||
left = global;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the data type of the CSS gap value.
|
||||
* @return The data type (CVD_TYPE_CSS_VALUE).
|
||||
*/
|
||||
virtual eConfigValueDataTypes getDataType() {
|
||||
return CVD_TYPE_CSS_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert the CSS gap value to a string.
|
||||
* @return The string representation of the CSS gap value.
|
||||
*/
|
||||
virtual std::string toString() {
|
||||
return std::format("{} {} {} {}", top, right, bottom, left);
|
||||
}
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
|
||||
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
|
||||
#include "config/ConfigDataValues.hpp"
|
||||
#include "helpers/varlist/VarList.hpp"
|
||||
#include "../protocols/LayerShell.hpp"
|
||||
#include "config/defaultConfig.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <hyprlang.hpp>
|
||||
#include <hyprutils/string/VarList.hpp>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
|
@ -27,6 +29,12 @@ using namespace Hyprutils::String;
|
|||
|
||||
extern "C" char** environ;
|
||||
|
||||
/**
|
||||
* @brief Parses a gradient configuration value and sets it to the provided data.
|
||||
* @param VALUE The string representation of the gradient value.
|
||||
* @param data Pointer to the gradient data.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult configHandleGradientSet(const char* VALUE, void** data) {
|
||||
std::string V = VALUE;
|
||||
|
||||
|
@ -81,11 +89,21 @@ static Hyprlang::CParseResult configHandleGradientSet(const char* VALUE, void**
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Destroys the gradient configuration data.
|
||||
* @param data Pointer to the gradient data.
|
||||
*/
|
||||
static void configHandleGradientDestroy(void** data) {
|
||||
if (*data)
|
||||
delete reinterpret_cast<CGradientValueData*>(*data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parses a gap configuration value and sets it to the provided data.
|
||||
* @param VALUE The string representation of the gap value.
|
||||
* @param data Pointer to the gap data.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult configHandleGapSet(const char* VALUE, void** data) {
|
||||
std::string V = VALUE;
|
||||
|
||||
|
@ -106,209 +124,204 @@ static Hyprlang::CParseResult configHandleGapSet(const char* VALUE, void** data)
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Destroys the gap configuration data.
|
||||
* @param data Pointer to the gap data.
|
||||
*/
|
||||
static void configHandleGapDestroy(void** data) {
|
||||
if (*data)
|
||||
delete reinterpret_cast<CCssGapData*>(*data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Template function to handle command parsing and execution.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @param handler Function pointer to the specific handler in the ConfigManager.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
template <typename Handler>
|
||||
static Hyprlang::CParseResult handleCommand(const char* c, const char* v, Handler handler) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = (g_pConfigManager.get()->*handler)(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* @brief Handles raw execution commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleRawExec(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleRawExec(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleRawExec);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles exec-once commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleExecOnce(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleExecOnce(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleExecOnce);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles monitor commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleMonitor(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleMonitor(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleMonitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles Bezier curve commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleBezier(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleBezier(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleBezier);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles animation commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleAnimation(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleAnimation(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleAnimation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles keybind commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleBind(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleBind(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleBind);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles unbind commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleUnbind(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleUnbind(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleUnbind);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles window rule commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleWindowRule(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleWindowRule(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleWindowRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles layer rule commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleLayerRule(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleLayerRule(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleLayerRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles window rule version 2 commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleWindowRuleV2(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleWindowRuleV2(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleWindowRuleV2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles blur layer shell commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleBlurLS(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleBlurLS(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleBlurLS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles workspace rule commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleWorkspaceRules(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleWorkspaceRules(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleWorkspaceRules);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles submap commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleSubmap(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleSubmap(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleSubmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles source commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleSource(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleSource(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles environment variable commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handleEnv(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handleEnv(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handleEnv);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles plugin commands from the configuration.
|
||||
* @param c The command.
|
||||
* @param v The value.
|
||||
* @return CParseResult object indicating the success or failure of the operation.
|
||||
*/
|
||||
static Hyprlang::CParseResult handlePlugin(const char* c, const char* v) {
|
||||
const std::string VALUE = v;
|
||||
const std::string COMMAND = c;
|
||||
|
||||
const auto RESULT = g_pConfigManager->handlePlugin(COMMAND, VALUE);
|
||||
|
||||
Hyprlang::CParseResult result;
|
||||
if (RESULT.has_value())
|
||||
result.setError(RESULT.value().c_str());
|
||||
return result;
|
||||
return handleCommand(c, v, &CConfigManager::handlePlugin);
|
||||
}
|
||||
|
||||
/** @brief Constructs a CConfigManager object, initializes configuration settings, and sets default values. */
|
||||
CConfigManager::CConfigManager() {
|
||||
const auto ERR = verifyConfigExists();
|
||||
|
||||
configPaths.emplace_back(getMainConfigPath());
|
||||
configPaths.emplace_back(getMainConfigPath()); // Add the main configuration path to configPaths
|
||||
|
||||
// Initialize the m_pConfig object with the main config path and configuration options
|
||||
m_pConfig = std::make_unique<Hyprlang::CConfig>(configPaths.begin()->c_str(), Hyprlang::SConfigOptions{.throwAllErrors = true, .allowMissingConfig = true});
|
||||
|
||||
// Add general configuration values
|
||||
m_pConfig->addConfigValue("general:sensitivity", {1.0f});
|
||||
m_pConfig->addConfigValue("general:apply_sens_to_raw", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("general:border_size", Hyprlang::INT{1});
|
||||
|
@ -325,6 +338,7 @@ CConfigManager::CConfigManager() {
|
|||
m_pConfig->addConfigValue("general:allow_tearing", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("general:resize_corner", Hyprlang::INT{0});
|
||||
|
||||
// Add miscellaneous configuration values
|
||||
m_pConfig->addConfigValue("misc:disable_hyprland_logo", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("misc:disable_splash_rendering", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("misc:col.splash", Hyprlang::INT{0x55ffffff});
|
||||
|
@ -355,6 +369,7 @@ CConfigManager::CConfigManager() {
|
|||
m_pConfig->addConfigValue("misc:initial_workspace_tracking", Hyprlang::INT{1});
|
||||
m_pConfig->addConfigValue("misc:middle_click_paste", Hyprlang::INT{1});
|
||||
|
||||
// Add group-related configuration values
|
||||
m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
|
||||
m_pConfig->addConfigValue("group:focus_removed_window", Hyprlang::INT{1});
|
||||
m_pConfig->addConfigValue("group:groupbar:enabled", Hyprlang::INT{1});
|
||||
|
@ -368,6 +383,7 @@ CConfigManager::CConfigManager() {
|
|||
m_pConfig->addConfigValue("group:groupbar:text_color", Hyprlang::INT{0xffffffff});
|
||||
m_pConfig->addConfigValue("group:groupbar:stacked", Hyprlang::INT{0});
|
||||
|
||||
// Add debug configuration values
|
||||
m_pConfig->addConfigValue("debug:int", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("debug:log_damage", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("debug:overlay", Hyprlang::INT{0});
|
||||
|
@ -384,6 +400,7 @@ CConfigManager::CConfigManager() {
|
|||
m_pConfig->addConfigValue("debug:disable_scale_checks", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("debug:colored_stdout_logs", Hyprlang::INT{1});
|
||||
|
||||
// Add decoration-related configuration values
|
||||
m_pConfig->addConfigValue("decoration:rounding", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("decoration:blur:enabled", Hyprlang::INT{1});
|
||||
m_pConfig->addConfigValue("decoration:blur:size", Hyprlang::INT{8});
|
||||
|
@ -554,7 +571,7 @@ CConfigManager::CConfigManager() {
|
|||
m_pConfig->addConfigValue("group:groupbar:col.locked_active", Hyprlang::CConfigCustomValueType{&configHandleGradientSet, configHandleGradientDestroy, "0x66ff5500"});
|
||||
m_pConfig->addConfigValue("group:groupbar:col.locked_inactive", Hyprlang::CConfigCustomValueType{&configHandleGradientSet, configHandleGradientDestroy, "0x66775500"});
|
||||
|
||||
// devices
|
||||
// Devices
|
||||
m_pConfig->addSpecialCategory("device", {"name"});
|
||||
m_pConfig->addSpecialConfigValue("device", "sensitivity", {0.F});
|
||||
m_pConfig->addSpecialConfigValue("device", "accel_profile", {STRVAL_EMPTY});
|
||||
|
@ -590,7 +607,7 @@ CConfigManager::CConfigManager() {
|
|||
m_pConfig->addSpecialConfigValue("device", "active_area_position", Hyprlang::VEC2{0, 0}); // only for tablets
|
||||
m_pConfig->addSpecialConfigValue("device", "active_area_size", Hyprlang::VEC2{0, 0}); // only for tablets
|
||||
|
||||
// keywords
|
||||
// Keywords
|
||||
m_pConfig->registerHandler(&::handleRawExec, "exec", {false});
|
||||
m_pConfig->registerHandler(&::handleExecOnce, "exec-once", {false});
|
||||
m_pConfig->registerHandler(&::handleMonitor, "monitor", {false});
|
||||
|
@ -627,6 +644,11 @@ CConfigManager::CConfigManager() {
|
|||
g_pHyprError->queueCreate(ERR.value(), CColor{1.0, 0.1, 0.1, 1.0});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves the configuration directory path.
|
||||
* @return The absolute path to the configuration directory.
|
||||
* @throws std::runtime_error if neither HOME nor XDG_CONFIG_HOME is set.
|
||||
*/
|
||||
std::string CConfigManager::getConfigDir() {
|
||||
static const char* xdgConfigHome = getenv("XDG_CONFIG_HOME");
|
||||
|
||||
|
@ -641,6 +663,10 @@ std::string CConfigManager::getConfigDir() {
|
|||
return home + std::string("/.config");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves the main configuration file path.
|
||||
* @return The absolute path to the main configuration file.
|
||||
*/
|
||||
std::string CConfigManager::getMainConfigPath() {
|
||||
if (!g_pCompositor->explicitConfigPath.empty())
|
||||
return g_pCompositor->explicitConfigPath;
|
||||
|
@ -648,6 +674,10 @@ std::string CConfigManager::getMainConfigPath() {
|
|||
return getConfigDir() + "/hypr/" + (ISDEBUG ? "hyprlandd.conf" : "hyprland.conf");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves concatenated string contents of all configuration files specified in `configPaths`.
|
||||
* @return A string containing concatenated contents of all configuration files.
|
||||
*/
|
||||
const std::string CConfigManager::getConfigString() {
|
||||
std::string configString;
|
||||
std::string currFileContent;
|
||||
|
@ -667,10 +697,15 @@ const std::string CConfigManager::getConfigString() {
|
|||
return configString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves the current configuration errors as a string.
|
||||
* @return A string containing current configuration errors.
|
||||
*/
|
||||
std::string CConfigManager::getErrors() {
|
||||
return m_szConfigErrors;
|
||||
}
|
||||
|
||||
/** @brief Reloads the configuration. */
|
||||
void CConfigManager::reload() {
|
||||
EMIT_HOOK_EVENT("preConfigReload", nullptr);
|
||||
setDefaultAnimationVars();
|
||||
|
@ -680,6 +715,7 @@ void CConfigManager::reload() {
|
|||
postConfigReload(ERR);
|
||||
}
|
||||
|
||||
/** @brief Initializes default animation variables if it's the first launch. */
|
||||
void CConfigManager::setDefaultAnimationVars() {
|
||||
if (isFirstLaunch) {
|
||||
INITANIMCFG("global");
|
||||
|
@ -1082,7 +1118,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(PHLWINDOW pWindow, boo
|
|||
if (!valid(pWindow))
|
||||
return std::vector<SWindowRule>();
|
||||
|
||||
// if the window is unmapped, don't process exec rules yet.
|
||||
// Adjust shadowExec based on window mapping status
|
||||
shadowExec = shadowExec || !pWindow->m_bIsMapped;
|
||||
|
||||
std::vector<SWindowRule> returns;
|
||||
|
@ -1092,11 +1128,11 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(PHLWINDOW pWindow, boo
|
|||
|
||||
Debug::log(LOG, "Searching for matching rules for {} (title: {})", appidclass, title);
|
||||
|
||||
// since some rules will be applied later, we need to store some flags
|
||||
// Since some rules will be applied later, we need to store some flags
|
||||
bool hasFloating = pWindow->m_bIsFloating;
|
||||
bool hasFullscreen = pWindow->m_bIsFullscreen;
|
||||
|
||||
// local tags for dynamic tag rule match
|
||||
// Local tags for dynamic tag rule match
|
||||
auto tags = pWindow->m_tags;
|
||||
|
||||
for (auto& rule : m_dWindowRules) {
|
||||
|
|
|
@ -3,32 +3,31 @@
|
|||
#define CONFIG_MANAGER_H
|
||||
|
||||
#include <map>
|
||||
#include "../debug/Log.hpp"
|
||||
#include <unordered_map>
|
||||
#include "../defines.hpp"
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <algorithm>
|
||||
#include <regex>
|
||||
#include <optional>
|
||||
#include <functional>
|
||||
#include <xf86drmMode.h>
|
||||
#include "../helpers/WLClasses.hpp"
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../helpers/varlist/VarList.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
|
||||
#include "defaultConfig.hpp"
|
||||
#include "ConfigDataValues.hpp"
|
||||
|
||||
#include <hyprlang.hpp>
|
||||
|
||||
// Macros for initializing and creating animation configurations
|
||||
#define INITANIMCFG(name) animationConfig[name] = {}
|
||||
#define CREATEANIMCFG(name, parent) animationConfig[name] = {false, "", "", 0.f, -1, &animationConfig["global"], &animationConfig[parent]}
|
||||
|
||||
#define HANDLE void*
|
||||
|
||||
/**
|
||||
* @struct SWorkspaceRule
|
||||
* @brief Configuration rules for workspaces.
|
||||
*/
|
||||
struct SWorkspaceRule {
|
||||
std::string monitor = "";
|
||||
std::string workspaceString = "";
|
||||
|
@ -48,6 +47,10 @@ struct SWorkspaceRule {
|
|||
std::map<std::string, std::string> layoutopts;
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct SMonitorAdditionalReservedArea
|
||||
* @brief Reserved areas for monitors.
|
||||
*/
|
||||
struct SMonitorAdditionalReservedArea {
|
||||
int top = 0;
|
||||
int bottom = 0;
|
||||
|
@ -55,6 +58,10 @@ struct SMonitorAdditionalReservedArea {
|
|||
int right = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct SAnimationPropertyConfig
|
||||
* @brief Configuration for animation properties.
|
||||
*/
|
||||
struct SAnimationPropertyConfig {
|
||||
bool overridden = true;
|
||||
|
||||
|
@ -67,22 +74,38 @@ struct SAnimationPropertyConfig {
|
|||
SAnimationPropertyConfig* pParentAnimation = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct SPluginKeyword
|
||||
* @brief Stores plugin keyword information.
|
||||
*/
|
||||
struct SPluginKeyword {
|
||||
HANDLE handle = 0;
|
||||
std::string name = "";
|
||||
Hyprlang::PCONFIGHANDLERFUNC fn = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct SPluginVariable
|
||||
* @brief Stores plugin variable information.
|
||||
*/
|
||||
struct SPluginVariable {
|
||||
HANDLE handle = 0;
|
||||
std::string name = "";
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct SExecRequestedRule
|
||||
* @brief Stores rules requested with exec.
|
||||
*/
|
||||
struct SExecRequestedRule {
|
||||
std::string szRule = "";
|
||||
uint64_t iPid = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class CConfigManager
|
||||
* @brief Manages configuration settings.
|
||||
*/
|
||||
class CConfigManager {
|
||||
public:
|
||||
CConfigManager();
|
||||
|
@ -147,7 +170,7 @@ class CConfigManager {
|
|||
void handlePluginLoads();
|
||||
std::string getErrors();
|
||||
|
||||
// keywords
|
||||
// Keywords
|
||||
std::optional<std::string> handleRawExec(const std::string&, const std::string&);
|
||||
std::optional<std::string> handleExecOnce(const std::string&, const std::string&);
|
||||
std::optional<std::string> handleMonitor(const std::string&, const std::string&);
|
||||
|
@ -171,14 +194,14 @@ class CConfigManager {
|
|||
private:
|
||||
std::unique_ptr<Hyprlang::CConfig> m_pConfig;
|
||||
|
||||
std::deque<std::string> configPaths; // stores all the config paths
|
||||
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
|
||||
std::deque<std::string> configPaths; // Stores all the config paths
|
||||
std::unordered_map<std::string, time_t> configModifyTimes; // Stores modify times
|
||||
|
||||
std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values
|
||||
std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // Stores all the animations with their set values
|
||||
|
||||
std::string m_szCurrentSubmap = ""; // For storing the current keybind submap
|
||||
|
||||
std::vector<SExecRequestedRule> execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty
|
||||
std::vector<SExecRequestedRule> execRequestedRules; // Rules requested with exec, e.g. [workspace 2] kitty
|
||||
|
||||
std::vector<std::string> m_vDeclaredPlugins;
|
||||
std::vector<SPluginKeyword> pluginKeywords;
|
||||
|
@ -196,10 +219,10 @@ class CConfigManager {
|
|||
bool m_bManualCrashInitiated = false;
|
||||
std::deque<std::string> firstExecRequests;
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
|
||||
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // For plugin values of unloaded plugins
|
||||
std::string m_szConfigErrors = "";
|
||||
|
||||
// internal methods
|
||||
// Internal methods
|
||||
void setAnimForChildren(SAnimationPropertyConfig* const);
|
||||
void updateBlurredLS(const std::string&, const bool);
|
||||
void setDefaultAnimationVars();
|
||||
|
|
|
@ -3,24 +3,36 @@
|
|||
#include <string>
|
||||
#include <typeindex>
|
||||
#include <hyprlang.hpp>
|
||||
#include "../debug/Log.hpp"
|
||||
#include "../macros.hpp"
|
||||
#include "ConfigManager.hpp"
|
||||
|
||||
/**
|
||||
* @class CConfigValue
|
||||
* @brief A template class to handle configuration values.
|
||||
*
|
||||
* This class provides a type-safe way to access configuration values.
|
||||
* It supports custom types defined in Hyprlang.
|
||||
*
|
||||
* @tparam T Type of the configuration value.
|
||||
*/
|
||||
template <typename T>
|
||||
class CConfigValue {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor that initializes the configuration value.
|
||||
* @param val The key to look up the configuration value.
|
||||
*/
|
||||
CConfigValue(const std::string& val) {
|
||||
const auto PVHYPRLANG = g_pConfigManager->getHyprlangConfigValuePtr(val);
|
||||
|
||||
p_ = PVHYPRLANG->getDataStaticPtr();
|
||||
|
||||
#ifdef HYPRLAND_DEBUG
|
||||
// verify type
|
||||
// Verify type during debug mode
|
||||
const auto ANY = PVHYPRLANG->getValue();
|
||||
const auto TYPE = std::type_index(ANY.type());
|
||||
|
||||
// exceptions
|
||||
// Handle specific type exceptions
|
||||
const bool STRINGEX = (typeid(T) == typeid(std::string) && TYPE == typeid(Hyprlang::STRING));
|
||||
const bool CUSTOMEX = (typeid(T) == typeid(Hyprlang::CUSTOMTYPE) && (TYPE == typeid(Hyprlang::CUSTOMTYPE*) || TYPE == typeid(void*) /* dunno why it does this? */));
|
||||
|
||||
|
@ -28,44 +40,82 @@ class CConfigValue {
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns a pointer to the configuration value.
|
||||
* @return Pointer to the configuration value.
|
||||
*/
|
||||
T* ptr() const {
|
||||
return *(T* const*)p_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Dereference operator to access the configuration value.
|
||||
* @return The configuration value.
|
||||
*/
|
||||
T operator*() const {
|
||||
return *ptr();
|
||||
}
|
||||
|
||||
private:
|
||||
void* const* p_ = nullptr;
|
||||
void* const* p_ = nullptr; //< Pointer to the configuration value.
|
||||
};
|
||||
|
||||
// Specializations for std::string
|
||||
|
||||
/**
|
||||
* @brief Specialization of ptr() for std::string.
|
||||
* @return nullptr since this implementation is not supported.
|
||||
*/
|
||||
template <>
|
||||
inline std::string* CConfigValue<std::string>::ptr() const {
|
||||
RASSERT(false, "Impossible to implement ptr() of CConfigValue<std::string>");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Specialization of operator* for std::string.
|
||||
* @return The configuration value as std::string.
|
||||
*/
|
||||
template <>
|
||||
inline std::string CConfigValue<std::string>::operator*() const {
|
||||
return std::string{*(Hyprlang::STRING*)p_};
|
||||
}
|
||||
|
||||
// Specializations for Hyprlang::STRING
|
||||
|
||||
/**
|
||||
* @brief Specialization of ptr() for Hyprlang::STRING.
|
||||
* @return Pointer to the Hyprlang::STRING configuration value.
|
||||
*/
|
||||
template <>
|
||||
inline Hyprlang::STRING* CConfigValue<Hyprlang::STRING>::ptr() const {
|
||||
return (Hyprlang::STRING*)p_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Specialization of operator* for Hyprlang::STRING.
|
||||
* @return The Hyprlang::STRING configuration value.
|
||||
*/
|
||||
template <>
|
||||
inline Hyprlang::STRING CConfigValue<Hyprlang::STRING>::operator*() const {
|
||||
return *(Hyprlang::STRING*)p_;
|
||||
}
|
||||
|
||||
// Specializations for Hyprlang::CUSTOMTYPE
|
||||
|
||||
/**
|
||||
* @brief Specialization of ptr() for Hyprlang::CUSTOMTYPE.
|
||||
* @return Pointer to the Hyprlang::CUSTOMTYPE configuration value.
|
||||
*/
|
||||
template <>
|
||||
inline Hyprlang::CUSTOMTYPE* CConfigValue<Hyprlang::CUSTOMTYPE>::ptr() const {
|
||||
return *(Hyprlang::CUSTOMTYPE* const*)p_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Specialization of operator* for Hyprlang::CUSTOMTYPE.
|
||||
* @return The Hyprlang::CUSTOMTYPE configuration value.
|
||||
*/
|
||||
template <>
|
||||
inline Hyprlang::CUSTOMTYPE CConfigValue<Hyprlang::CUSTOMTYPE>::operator*() const {
|
||||
RASSERT(false, "Impossible to implement operator* of CConfigValue<Hyprlang::CUSTOMTYPE>, use ptr()");
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "LayerSurface.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../events/Events.hpp"
|
||||
#include "../protocols/LayerShell.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../managers/SeatManager.hpp"
|
||||
|
@ -367,12 +366,12 @@ void CLayerSurface::applyRules() {
|
|||
} else if (rule.rule == "dimaround") {
|
||||
dimAround = true;
|
||||
} else if (rule.rule.starts_with("xray")) {
|
||||
CVarList vars{rule.rule, 0, ' '};
|
||||
Hyprutils::String::CVarList vars{rule.rule, 0, ' '};
|
||||
try {
|
||||
xray = configStringToInt(vars[1]);
|
||||
} catch (...) {}
|
||||
} else if (rule.rule.starts_with("animation")) {
|
||||
CVarList vars{rule.rule, 2, 's'};
|
||||
Hyprutils::String::CVarList vars{rule.rule, 2, 's'};
|
||||
animationStyle = vars[1];
|
||||
}
|
||||
}
|
||||
|
@ -398,7 +397,7 @@ void CLayerSurface::startAnimation(bool in, bool instant) {
|
|||
|
||||
int force = -1;
|
||||
|
||||
CVarList args(ANIMSTYLE, 0, 's');
|
||||
Hyprutils::String::CVarList args(ANIMSTYLE, 0, 's');
|
||||
if (args.size() > 1) {
|
||||
const auto ARG2 = args[1];
|
||||
if (ARG2 == "top")
|
||||
|
|
|
@ -1019,7 +1019,7 @@ void CHyprDwindleLayout::alterSplitRatio(PHLWINDOW pWindow, float ratio, bool ex
|
|||
}
|
||||
|
||||
std::any CHyprDwindleLayout::layoutMessage(SLayoutMessageHeader header, std::string message) {
|
||||
const auto ARGS = CVarList(message, 0, ' ');
|
||||
const auto ARGS = Hyprutils::String::CVarList(message, 0, ' ');
|
||||
if (ARGS[0] == "togglesplit") {
|
||||
toggleSplit(header.pWindow);
|
||||
} else if (ARGS[0] == "swapsplit") {
|
||||
|
|
|
@ -1096,7 +1096,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
|||
g_pInputManager->m_pForcedFocus.reset();
|
||||
};
|
||||
|
||||
CVarList vars(message, 0, ' ');
|
||||
Hyprutils::String::CVarList vars(message, 0, ' ');
|
||||
|
||||
if (vars.size() < 1 || vars[0].empty()) {
|
||||
Debug::log(ERR, "layoutmsg called without params");
|
||||
|
@ -1376,7 +1376,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
|||
}
|
||||
|
||||
// If vars is null, we use the default list
|
||||
void CHyprMasterLayout::runOrientationCycle(SLayoutMessageHeader& header, CVarList* vars, int direction) {
|
||||
void CHyprMasterLayout::runOrientationCycle(SLayoutMessageHeader& header, Hyprutils::String::CVarList* vars, int direction) {
|
||||
std::vector<eOrientation> cycle;
|
||||
if (vars != nullptr)
|
||||
buildOrientationCycleVectorFromVars(cycle, *vars);
|
||||
|
@ -1416,7 +1416,7 @@ void CHyprMasterLayout::buildOrientationCycleVectorFromEOperation(std::vector<eO
|
|||
}
|
||||
}
|
||||
|
||||
void CHyprMasterLayout::buildOrientationCycleVectorFromVars(std::vector<eOrientation>& cycle, CVarList& vars) {
|
||||
void CHyprMasterLayout::buildOrientationCycleVectorFromVars(std::vector<eOrientation>& cycle, Hyprutils::String::CVarList& vars) {
|
||||
for (size_t i = 1; i < vars.size(); ++i) {
|
||||
if (vars[i] == "top") {
|
||||
cycle.push_back(ORIENTATION_TOP);
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
|
||||
#include "IHyprLayout.hpp"
|
||||
#include "../desktop/DesktopTypes.hpp"
|
||||
#include "../config/ConfigManager.hpp"
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <any>
|
||||
|
||||
enum eFullscreenMode : int8_t;
|
||||
|
@ -77,9 +75,9 @@ class CHyprMasterLayout : public IHyprLayout {
|
|||
|
||||
bool m_bForceWarps = false;
|
||||
|
||||
void buildOrientationCycleVectorFromVars(std::vector<eOrientation>& cycle, CVarList& vars);
|
||||
void buildOrientationCycleVectorFromVars(std::vector<eOrientation>& cycle, Hyprutils::String::CVarList& vars);
|
||||
void buildOrientationCycleVectorFromEOperation(std::vector<eOrientation>& cycle);
|
||||
void runOrientationCycle(SLayoutMessageHeader& header, CVarList* vars, int next);
|
||||
void runOrientationCycle(SLayoutMessageHeader& header, Hyprutils::String::CVarList* vars, int next);
|
||||
eOrientation getDynamicOrientation(PHLWORKSPACE);
|
||||
int getNodesOnWorkspace(const int&);
|
||||
void applyNodeDataToWindow(SMasterNodeData*);
|
||||
|
|
|
@ -861,7 +861,7 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
|||
keeb.get());
|
||||
|
||||
keeb->keyboardEvents.keymap.registerStaticListener(
|
||||
[this](void* owner, std::any data) {
|
||||
[](void* owner, std::any data) {
|
||||
auto PKEEB = ((IKeyboard*)owner)->self.lock();
|
||||
const auto LAYOUT = PKEEB->getActiveLayout();
|
||||
|
||||
|
@ -1173,7 +1173,7 @@ void CInputManager::setPointerConfigs() {
|
|||
} else if (ACCELPROFILE == "flat") {
|
||||
libinput_device_config_accel_set_profile(LIBINPUTDEV, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
|
||||
} else if (ACCELPROFILE.starts_with("custom")) {
|
||||
CVarList accelValues = {ACCELPROFILE, 0, ' '};
|
||||
Hyprutils::String::CVarList accelValues = {ACCELPROFILE, 0, ' '};
|
||||
|
||||
try {
|
||||
double accelStep = std::stod(accelValues[1]);
|
||||
|
@ -1185,7 +1185,7 @@ void CInputManager::setPointerConfigs() {
|
|||
const auto CONFIG = libinput_config_accel_create(LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM);
|
||||
|
||||
if (!SCROLLPOINTS.empty()) {
|
||||
CVarList scrollValues = {SCROLLPOINTS, 0, ' '};
|
||||
Hyprutils::String::CVarList scrollValues = {SCROLLPOINTS, 0, ' '};
|
||||
try {
|
||||
double scrollStep = std::stod(scrollValues[0]);
|
||||
std::vector<double> scrollPoints;
|
||||
|
@ -1624,8 +1624,7 @@ void CInputManager::newSwitch(wlr_input_device* pDevice) {
|
|||
|
||||
Debug::log(LOG, "New switch with name \"{}\" added", pDevice->name);
|
||||
|
||||
PNEWDEV->hyprListener_destroy.initCallback(
|
||||
&pDevice->events.destroy, [&](void* owner, void* data) { destroySwitch((SSwitchDevice*)owner); }, PNEWDEV, "SwitchDevice");
|
||||
PNEWDEV->hyprListener_destroy.initCallback(&pDevice->events.destroy, [&](void* owner, void* data) { destroySwitch((SSwitchDevice*)owner); }, PNEWDEV, "SwitchDevice");
|
||||
|
||||
const auto PSWITCH = wlr_switch_from_input_device(pDevice);
|
||||
|
||||
|
|
Loading…
Reference in a new issue