Beispiel #1
0
int main(int argc, char* argv[]) {
	if (!CheckPrivileges()) {
		MessageBox(nullptr, "This program must be run as administrator.", "Error", MB_ICONERROR | MB_OK);
		return 1;
	}

    QApplication app(argc, argv);
	
	auto lua = LuaOpen();
	PlatformInit(lua);
	FFXIVInit(lua);
	
	std::unordered_set<std::string> loaded;
	
	AttemptTOCLoad(lua, "interface", &loaded);
	
	if (auto dir = opendir("interface")) {
		while (auto ent = readdir(dir)) {
			if (*ent->d_name != '.') {
				AttemptTOCLoad(lua, (std::string("interface/") + ent->d_name).c_str(), &loaded);
			}
		}
		closedir(dir);
	}

    int ret = app.exec();

	LuaClose(lua);

	return ret;
}
Beispiel #2
0
internal void
KwmInit()
{
    if(!CheckPrivileges())
        Fatal("Could not access OSX Accessibility!");

    if (pthread_mutex_init(&KWMThread.Lock, NULL) != 0)
        Fatal("Could not create mutex!");

    if(KwmStartDaemon())
        pthread_create(&KWMThread.Daemon, NULL, &KwmDaemonHandleConnectionBG, NULL);
    else
        Fatal("Kwm: Could not start daemon..");

    signal(SIGSEGV, SignalHandler);
    signal(SIGABRT, SignalHandler);
    signal(SIGTRAP, SignalHandler);
    signal(SIGTERM, SignalHandler);
    signal(SIGKILL, SignalHandler);
    signal(SIGINT, SignalHandler);

    KWMScreen.SplitRatio = 0.5;
    KWMScreen.SplitMode = SPLIT_OPTIMAL;
    KWMScreen.PrevSpace = -1;
    KWMScreen.DefaultOffset = CreateDefaultScreenOffset();
    KWMScreen.MaxCount = 5;
    KWMScreen.ActiveCount = 0;

    KWMToggles.EnableTilingMode = true;
    KWMToggles.UseBuiltinHotkeys = true;
    KWMToggles.UseMouseFollowsFocus = true;
    KWMTiling.OptimalRatio = 1.618;
    KWMTiling.LockToContainer = true;
    KWMTiling.MonitorWindows = true;

    KWMMode.Space = SpaceModeBSP;
    KWMMode.Focus = FocusModeAutoraise;
    KWMMode.Cycle = CycleModeScreen;

    FocusedBorder.Radius = -1;
    MarkedBorder.Radius = -1;

    KWMPath.ConfigFile = "kwmrc";
    KWMPath.ConfigFolder = ".kwm";
    KWMPath.BSPLayouts = "layouts";
    KWMHotkeys.ActiveMode = GetBindingMode("default");

    GetKwmFilePath();
    KwmExecuteConfig();
    GetActiveDisplays();
    KwmExecuteInitScript();

    pthread_create(&KWMThread.WindowMonitor, NULL, &KwmWindowMonitor, NULL);
    pthread_create(&KWMThread.Hotkey, NULL, &KwmMainHotkeyTrigger, NULL);
    FocusWindowOfOSX();
}
Beispiel #3
0
internal void
KwmInit()
{
    if(!CheckPrivileges())
        Fatal("Error: Could not access OSX Accessibility!");

    signal(SIGCHLD, SIG_IGN);
#ifndef DEBUG_BUILD
    signal(SIGSEGV, SignalHandler);
    signal(SIGABRT, SignalHandler);
    signal(SIGTRAP, SignalHandler);
    signal(SIGTERM, SignalHandler);
    signal(SIGKILL, SignalHandler);
    signal(SIGINT, SignalHandler);
#else
    printf("Notice: Signal handlers disabled!\n");
#endif

    KWMSettings.SplitRatio = 0.5;
    KWMSettings.SplitMode = SPLIT_OPTIMAL;
    KWMSettings.DefaultOffset = CreateDefaultDisplayOffset();
    KWMSettings.OptimalRatio = 1.618;

    AddFlags(&KWMSettings,
            Settings_MouseFollowsFocus |
            Settings_StandbyOnFloat |
            Settings_CenterOnFloat |
            Settings_LockToContainer);

    KWMSettings.Space = SpaceModeBSP;
    KWMSettings.Focus = FocusModeAutoraise;
    KWMSettings.Cycle = CycleModeScreen;

    FocusedBorder.Radius = -1;
    FocusedBorder.Type = BORDER_FOCUSED;
    MarkedBorder.Radius = -1;
    MarkedBorder.Type = BORDER_MARKED;

    char *HomeP = std::getenv("HOME");
    if(HomeP)
    {
        KWMPath.EnvHome = HomeP;
        KWMPath.Home = KWMPath.EnvHome + "/.kwm";
        KWMPath.Include = KWMPath.Home;
        KWMPath.Layouts = KWMPath.Home + "/layouts";

        if(KWMPath.Config.empty())
            KWMPath.Config = KWMPath.Home + "/kwmrc";
    }
    else
    {
        Fatal("Error: Failed to get environment variable 'HOME'");
    }

    GetKwmFilePath();
}