Пример #1
0
// Read wmanager.conf and initialize an array that will be used later
void read_hotkeys_configuration()
{
    // All configurable hotkeys below - edit to add new keys
    static struct {
        char *name;	// as used in wmanager.conf file
        void (*func)(char *name);	// callback function for this key
        char *def_key;	// default hotkey
    } configurables[] = {
        {"PreviousWindow",	PreviousWindow,	"Alt+Tab"},
        {"NextWindow",	NextWindow,	"Alt+Shift+Tab"},
        {"Desktop1",	FKey_DeskNumber,	"Alt+F1"},
        {"Desktop2",	FKey_DeskNumber,	"Alt+F2"},
        {"Desktop3",	FKey_DeskNumber,	"Alt+F3"},
        {"Desktop4",	FKey_DeskNumber,	"Alt+F4"},
        {"Desktop5",	FKey_DeskNumber,	"Alt+F5"},
        {"Desktop6",	FKey_DeskNumber,	"Alt+F6"},
        {"Desktop7",	FKey_DeskNumber,	"Alt+F7"},
        {"Desktop8",	FKey_DeskNumber,	"Alt+F8"},
        {"PreviousDesktop",	PreviousDesk,	"Alt+Ctrl+Right"},
        {"NextDesktop",	NextDesk,	"Alt+Ctrl+Left"},
        {"FindUtil",	FindUtil,	"Ctrl+F3"},
        {"FastRun",	FastRun,	"Ctrl+F12"},
        {"CloseWindow",	CloseWindow,	"Ctrl+F4"},
        {"MinimizeWindow",	MinimizeWindow,	"Ctrl+F7"},
        {"MaximizeWindow",	MaximizeWindow,	"Ctrl+F8"},

        // Slots for user-defined applications and hotkeys
        // 12 ought to be enough :-)
        {"App1",LaunchApp,""},
        {"App2",LaunchApp,""},
        {"App3",LaunchApp,""},
        {"App4",LaunchApp,""},
        {"App5",LaunchApp,""},
        {"App6",LaunchApp,""},
        {"App7",LaunchApp,""},
        {"App8",LaunchApp,""},
        {"App9",LaunchApp,""},
        {"App10",LaunchApp,""},
        {"App11",LaunchApp,""},
        {"App12",LaunchApp,""},

        {"",NULL,""}
    };

    char buf[256];
    int j=0;

    Fl_Config wmconf(fl_find_config_file ("wmanager.conf",0));
    wmconf.set_section("Hotkeys");

    for (int i=0; configurables[i].name[0]; i++) {
        wmconf.read(configurables[i].name, buf, configurables[i].def_key, sizeof(buf));
        if (buf && buf[0]) {
            keybindings[j].key=parse_hotkey(buf);
            keybindings[j].name = strdup(configurables[i].name);
            keybindings[j++].func=configurables[i].func;
        }
    }
    keybindings[j].key = 0;
}
Пример #2
0
void WindowManager::read_configuration()
{
	Fl_String buf;

	Fl_Config wmconf(fl_find_config_file("wmanager.conf", 0));

	wmconf.set_section("TitleBar");

	wmconf.read("Active color", title_active_color, fl_rgb(0,0,128));
	wmconf.read("Normal color", title_normal_color, fl_rgb(192,192,192));

	wmconf.read("Active color text", title_active_color_text, fl_rgb(255,255,255));
	wmconf.read("Normal color text", title_normal_color_text, fl_rgb(0,0,128));

	wmconf.read("Box type", Titlebar::box_type, 0);
	wmconf.read("Height", Titlebar::default_height, 20);
	wmconf.read("Text align", Titlebar::label_align, 0);
	Titlebar::label_align = real_align(Titlebar::label_align);

	wmconf.set_section("Resize");
	wmconf.read("Opaque resize", Frame::do_opaque, false);
	wmconf.read("Animate", Frame::animate, true);
	wmconf.read("Animate Speed", Frame::animate_speed, 15);

	wmconf.set_section("Misc");

	bool theme = false;
	wmconf.read("Use theme", theme, false);
	if(theme)
	{
		wmconf.read("Theme path", buf, 0);
		Theme::instance()->load(buf);
		Theme::instance()->use(true);
	}
	else
	{
		Theme::instance()->unload();
		Theme::instance()->use(false);
	}

	notify_all();
	read_hotkeys_configuration();
}