add --no-fractional arg

This commit is contained in:
vaxerski 2023-01-29 16:38:48 +00:00
parent 577c9297c3
commit 0c2386861a
3 changed files with 10 additions and 3 deletions

View file

@ -37,6 +37,7 @@ public:
bool m_bIPCEnabled = true;
std::string m_szExplicitConfigPath;
bool m_bNoFractionalScale = false;
void removeOldHyprpaperImages();
void preloadAllWallpapersFromConfig();

View file

@ -121,7 +121,7 @@ void Events::handleGlobal(void *data, struct wl_registry *registry, uint32_t nam
g_pHyprpaper->createSeat((wl_seat*)wl_registry_bind(registry, name, &wl_seat_interface, 1));
} else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
g_pHyprpaper->m_sLayerShell = (zwlr_layer_shell_v1*)wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, 1);
} else if (strcmp(interface, wp_fractional_scale_manager_v1_interface.name) == 0) {
} else if (strcmp(interface, wp_fractional_scale_manager_v1_interface.name) == 0 && !g_pHyprpaper->m_bNoFractionalScale) {
g_pHyprpaper->m_sFractionalScale = (wp_fractional_scale_manager_v1*)wl_registry_bind(registry, name, &wp_fractional_scale_manager_v1_interface, 1);
} else if (strcmp(interface, wp_viewporter_interface.name) == 0) {
g_pHyprpaper->m_sViewporter = (wp_viewporter*)wl_registry_bind(registry, name, &wp_viewporter_interface, 1);

View file

@ -7,14 +7,19 @@ int main(int argc, char** argv, char** envp) {
// parse some args
std::string configPath;
bool noFractional = false;
for (int i = 1; i < argc; ++i) {
if ((!strcmp(argv[i], "-c") || !strcmp(argv[i], "--config")) && argc >= i + 2) {
configPath = std::string(argv[++i]);
Debug::log(LOG, "Using config location %s.", configPath.c_str());
} else if (!strcmp(argv[i], "--no-fractional") || !strcmp(argv[i], "-n")) {
noFractional = true;
Debug::log(LOG, "Disabling fractional scaling support!");
} else {
std::cout << "Hyprpaper usage: hyprpaper [arg [...]].\n\nArguments:\n" <<
"--help -h | Show this help message\n" <<
"--config -c | Specify config file to use\n";
"--help -h | Show this help message\n" <<
"--config -c | Specify config file to use\n" <<
"--no-fractional -n | Disable fractional scaling support\n";
return 1;
}
}
@ -22,6 +27,7 @@ int main(int argc, char** argv, char** envp) {
// starts
g_pHyprpaper = std::make_unique<CHyprpaper>();
g_pHyprpaper->m_szExplicitConfigPath = configPath;
g_pHyprpaper->m_bNoFractionalScale = noFractional;
g_pHyprpaper->init();
return 0;