hy3/src/main.cpp

77 lines
2.4 KiB
C++
Raw Normal View History

#include <hyprland/src/Compositor.hpp>
2023-06-07 03:22:17 -07:00
#include <hyprland/src/plugins/PluginAPI.hpp>
#include <hyprland/src/version.h>
2023-10-27 04:08:07 -07:00
#include "SelectionHook.hpp"
2023-06-28 21:36:08 -07:00
#include "dispatchers.hpp"
2023-04-17 00:53:02 -07:00
#include "globals.hpp"
2023-06-07 03:22:17 -07:00
APICALL EXPORT std::string PLUGIN_API_VERSION() { return HYPRLAND_API_VERSION; }
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
#ifndef HY3_NO_VERSION_CHECK
if (GIT_COMMIT_HASH != std::string(__hyprland_api_get_hash())) {
HyprlandAPI::addNotification(
PHANDLE,
"[hy3] hy3 was compiled for a different version of hyprland; refusing to load.",
CColor {1.0, 0.2, 0.2, 1.0},
10000
);
throw std::runtime_error("[hy3] target hyprland version mismatch");
}
#endif
selection_hook::init();
2023-07-31 23:00:25 -07:00
#define CONF(NAME, TYPE, VALUE) \
2024-02-14 22:33:07 -08:00
HyprlandAPI::addConfigValue( \
PHANDLE, \
"plugin:hy3:" NAME, \
Hyprlang::CConfigValue((Hyprlang::TYPE) VALUE) \
)
2023-07-31 23:00:25 -07:00
// general
2024-02-14 22:33:07 -08:00
CONF("no_gaps_when_only", INT, 0);
CONF("node_collapse_policy", INT, 2);
CONF("group_inset", INT, 10);
CONF("tab_first_window", INT, 0);
2023-07-31 23:00:25 -07:00
// tabs
2024-02-14 22:33:07 -08:00
CONF("tabs:height", INT, 15);
CONF("tabs:padding", INT, 5);
CONF("tabs:from_top", INT, 0);
CONF("tabs:rounding", INT, 3);
CONF("tabs:render_text", INT, 1);
CONF("tabs:text_center", INT, 0);
CONF("tabs:text_font", STRING, "Sans");
CONF("tabs:text_height", INT, 8);
CONF("tabs:text_padding", INT, 3);
CONF("tabs:col.active", INT, 0xff32b4ff);
CONF("tabs:col.urgent", INT, 0xffff4f4f);
CONF("tabs:col.inactive", INT, 0x80808080);
CONF("tabs:col.text.active", INT, 0xff000000);
CONF("tabs:col.text.urgent", INT, 0xff000000);
CONF("tabs:col.text.inactive", INT, 0xff000000);
2023-07-31 23:00:25 -07:00
2023-08-01 01:00:56 -07:00
// autotiling
2024-02-14 22:33:07 -08:00
CONF("autotile:enable", INT, 0);
CONF("autotile:ephemeral_groups", INT, 1);
CONF("autotile:trigger_height", INT, 0);
CONF("autotile:trigger_width", INT, 0);
CONF("autotile:workspaces", STRING, "all");
2023-08-01 01:00:56 -07:00
2023-07-31 23:00:25 -07:00
#undef CONF
2023-04-17 00:53:02 -07:00
g_Hy3Layout = std::make_unique<Hy3Layout>();
HyprlandAPI::addLayout(PHANDLE, "hy3", g_Hy3Layout.get());
2023-06-28 21:36:08 -07:00
registerDispatchers();
return {"hy3", "i3 like layout for hyprland", "outfoxxed", "0.1"};
}
APICALL EXPORT void PLUGIN_EXIT() {}