2025-06-11 12:15:47 +02:00
# include <iostream>
2025-06-10 14:16:44 +02:00
# include "../include/HyprlandService.h"
2025-06-10 14:09:56 +02:00
2026-01-06 16:16:14 +01:00
void help ( char * execPath ) {
std : : cerr < < " Usage: " < < execPath < < " <config_file_path> (-q) \n \n " ;
std : : cerr < < " -q: \t Query current windowing mode, don't change anything. \n \t Returns Hyprland window rule active on current workspace. \n \t If no rule is active, returns a default tiled rule. \n " ;
2025-06-11 12:15:47 +02:00
exit ( 1 ) ;
2026-01-06 16:16:14 +01:00
}
int main ( int argc , char * * argv ) {
if ( argc < 2 ) {
help ( argv [ 0 ] ) ;
2025-06-11 12:15:47 +02:00
}
HyprlandService : : setConfigFilePath ( argv [ 1 ] ) ;
2026-01-06 16:16:14 +01:00
if ( argc = = 3 & & argv [ 2 ] = = std : : string ( " -q " ) ) {
WindowRule rule = HyprlandService : : getActiveWorkspaceRule ( ) ;
std : : cout < < rule . toString ( ) < < std : : endl ;
2025-06-10 15:45:25 +02:00
}
2026-01-06 16:16:14 +01:00
else if ( argc = = 2 ) {
if ( HyprlandService : : isFloatingRulePresent ( ) ) {
for ( auto & c : HyprlandService : : getClientsOnActiveWorkspace ( ) ) {
HyprlandService : : setClientTiled ( c ) ;
}
HyprlandService : : setFloatingRule ( false ) ;
} else {
for ( auto & c : HyprlandService : : getClientsOnActiveWorkspace ( ) ) {
HyprlandService : : setClientFloating ( c ) ;
}
HyprlandService : : setFloatingRule ( true ) ;
}
}
else ( help ( argv [ 0 ] ) ) ;
exit ( 0 ) ;
2025-06-10 15:45:25 +02:00
}