Example #1
0
void WindowManager::read_configuration(void)
{
	ELOG("Reading config");
	Fl_Config conf(fl_find_config_file(WM_CONFIG_FILE, 0));
	conf.set_section("TitleBar");
	conf.read("Active color", wm_conf->title_active_color, fl_rgb(0, 0, 128));
	conf.read("Normal color", wm_conf->title_normal_color, fl_rgb(192, 192, 192));
	conf.read("Active color text", wm_conf->title_active_color_text, fl_rgb(255, 255, 255));
	conf.read("Normal color text", wm_conf->title_normal_color_text, fl_rgb(0, 0, 128));
	conf.read("Box type", wm_conf->title_box_type, 0);
	conf.read("Height", wm_conf->title_height, 20);

	int la;
	conf.read("Text align", la, 0);
	wm_conf->title_label_align = convert_align(la);

	conf.set_section("Resize");
	conf.read("Opaque resize", wm_conf->frame_do_opaque, false);
	conf.read("Animate", wm_conf->frame_animate, true);
	conf.read("Animate Speed", wm_conf->frame_animate_speed, 15);

	conf.set_section("Misc");
	conf.read("Use theme", wm_conf->use_theme);

	notify_clients();
}
Example #2
0
void WindowManager::read_xset_configuration(void)
{
	Fl_Config conf(fl_find_config_file(EDE_CONFIG_FILE, 1));
	int val1, val2, val3;
	Exset xset;

	conf.set_section("Mouse");
	conf.read("Accel", val1, 4);
	conf.read("Thress",val2, 4);
	xset.set_mouse(val1, val2);

	conf.set_section("Bell");
	conf.read("Volume", val1, 50);
	conf.read("Pitch", val2, 440);
	conf.read("Duration", val3, 200);
	xset.set_bell(val1, val2, val3);

	conf.set_section("Keyboard");
	conf.read("Repeat", val1, 1);
	conf.read("ClickVolume", val2, 50);
	xset.set_keybd(val1, val2);

	conf.set_section("Screen");
	conf.read("Delay", val1, 15);
	conf.read("Pattern",val2, 2);
	xset.set_pattern(val1, val2);

	conf.read("CheckBlank", val1, 1);
	xset.set_check_blank(val1);

	conf.read("Pattern", val1, 2);
	xset.set_blank(val1);
}
Example #3
0
void Desktop::update_bg()
{
    Fl_Renderer::system_init();

    if (wpaper) {
        delete wpaper;
        wpaper=0;
    }

    Fl_Config globalConfig(fl_find_config_file("ede.conf", 0), true, false);
    globalConfig.set_section("Desktop");
    globalConfig.read("Color", bg_color, (Fl_Color)fl_darker(FL_BLUE));
    globalConfig.read("Opacity", bg_opacity, 255);
    globalConfig.read("Mode", bg_mode, 0);
    globalConfig.read("Use", bg_use, 1);

    Fl_Image *im=0;

    if(!globalConfig.read("Wallpaper", bg_filename, 0)) {
        if(bg_use) { 
            im = Fl_Image::read(bg_filename, 0);
            if (im) im->system_convert();
        }
    } else {
        bg_filename.clear();
    }

    if(im) {
        wpaper = make_image(bg_color, im, Fl::w(), Fl::h(), bg_mode, bg_opacity);
        delete im;
    }
    redraw();
}
Example #4
0
void readKeysConfiguration()
{
	Fl_Config globalConfig(fl_find_config_file("wmanager.conf", 0), true, false);
	globalConfig.set_section("Hotkeys");
	
	for (int i=0; i<NR_HOTKEYS; i++) {
		Fl_String tmp;
		globalConfig.read(hotkeys[i].systemname, tmp, "");
		keycodes[i] = name_to_svalue(tmp);
	}

	globalConfig.set_section("Applications");
	for (int i=0; i<NR_HOTKEYS; i++) {
		Fl_String tmp;
		if ((strncmp(hotkeys[i].systemname,"App",3) == 0) && (keycodes[i] != 0)) {
			globalConfig.read(hotkeys[i].systemname, tmp, "");
			if (tmp != "") strncpy(hotkeys[i].command, tmp, 50);
			if (keycodes[i]>0 && tmp != "") strncpy(hotkeys[i].uiname, hotkeys[i].systemname, 20);
		}
	}

	globalConfig.set_section("ApplicationNames");
	for (int i=0; i<NR_HOTKEYS; i++) {
		Fl_String tmp;
		if ((strncmp(hotkeys[i].systemname,"App",3) == 0) && (keycodes[i] != 0)) {
			globalConfig.read(hotkeys[i].systemname, tmp, "");
			if (tmp != "") strncpy(hotkeys[i].uiname, tmp, 50);
		}
	}




}
Example #5
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;
}
Example #6
0
static void LaunchApp(char *name)
{
    Fl_Config conf(fl_find_config_file("wmanager.conf", false));
    Fl_String app;
    conf.get("Applications", name, app, NULL);
    if(! app.empty())
        fl_start_child_process(app, false);
}
Example #7
0
TaskBar::TaskBar()
: Fl_Group(0,0,0,0)
{
    m_max_taskwidth = 150;

    layout_align(FL_ALIGN_CLIENT);
    layout_spacing(2);
    
    Fl_Config pConfig(fl_find_config_file("ede.conf", true));
    pConfig.get("Panel", "VariableWidthTaskbar",variable_width,true);

    update();
    end();
}
Example #8
0
void readIconsConfiguration()
{
    Fl_Config globalConfig(fl_find_config_file("ede.conf", 0), true, false);

    globalConfig.set_section("IconManager");
    globalConfig.read("Label Background", label_background, 46848);
    globalConfig.read("Label Transparent", label_trans, false);
    globalConfig.read("Label Foreground", label_foreground, FL_WHITE);
    globalConfig.read("Label Fontsize", label_fontsize, 12);
    globalConfig.read("Label Maxwidth", label_maxwidth, 75);
    globalConfig.read("Gridspacing", label_gridspacing, 16);
    globalConfig.read("OneClickExec", one_click_exec, 0);
    globalConfig.read("AutoArrange", auto_arr, false);
}
Example #9
0
void bg_apply(Fl_Button *w, void *d)
{
    if(changed) {
        Fl_Config globalConfig(fl_find_config_file("ede.conf", 1), true, true);
        globalConfig.set_section("Desktop");
        globalConfig.write("Color", color);
        globalConfig.write("Opacity", int(opacity));
        globalConfig.write("Wallpaper", filename);
        globalConfig.write("Mode", mode);
        globalConfig.write("Use", use);
        globalConfig.flush();

        desktop->update_bg();
    }
    changed=false;
}
Example #10
0
void Icon::cb_execute_i()
{
    Fl_Config &iconfig = *cfg;
    iconfig.set_section("Desktop Entry");

    char *cmd=0;
    if(!iconfig.read("Exec", cmd, 0) && cmd)
    {
        char pRun[256];
        char browser[256];
        Fl_Config pGlobalConfig(fl_find_config_file("ede.conf", 0));
        pGlobalConfig.get("Web", "Browser", browser, 0, sizeof(browser));
        if(pGlobalConfig.error() && !browser) {
            strncpy(browser, "netscape", sizeof(browser));
        }

        char *location = cmd;
        char *prefix = strstr(location, ":");
        if(prefix) // it is internet resource
        {
            *prefix = '\0';
            if (!strcasecmp(location, "http") || !strcasecmp(location, "ftp") || !strcasecmp(location, "file"))
            {	snprintf(pRun, sizeof(pRun)-1, "%s %s &", browser, cmd);
            }
	    else if (!strcasecmp(location, "gg"))
	    {	snprintf(pRun, sizeof(pRun)-1, "%s http://www.google.com/search?q=\"%s\" &", browser, ++prefix);
	    }
	    else if (!strcasecmp(location, "leo"))
	    {	snprintf(pRun, sizeof(pRun)-1, "%s http://dict.leo.org/?search=\"%s\" &", browser, ++prefix);
	    }
	    else if (!strcasecmp(location, "av"))
	    {	snprintf(pRun, sizeof(pRun)-1, "%s http://www.altavista.com/sites/search/web?q=\"%s\" &", browser, ++prefix);
	    }
	    else  {
                snprintf(pRun, sizeof(pRun)-1, "%s %s &", browser, cmd);
            }
        }
	else // local executable
        {   snprintf(pRun, sizeof(pRun)-1, "%s &", cmd);
        }
        fl_start_child_process(pRun);

        free((char*)cmd);
    }
}
Example #11
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();
}
Example #12
0
void writeKeysConfiguration()
{
	Fl_Config globalConfig(fl_find_config_file("wmanager.conf", 1));
	globalConfig.set_section("Hotkeys");
	
	for (int i=0; i<NR_HOTKEYS; i++)
		globalConfig.write(hotkeys[i].systemname, Fl::key_name(keycodes[i]));
	
	globalConfig.set_section("Applications");
	for (int i=0; i<NR_HOTKEYS; i++)
		if ((strncmp(hotkeys[i].systemname,"App",3) == 0) 
			&& (strcmp(hotkeys[i].uiname,"") != 0)  
			&& (strcmp(hotkeys[i].command,"") != 0))
				globalConfig.write(hotkeys[i].systemname, hotkeys[i].command);

	globalConfig.set_section("ApplicationNames");
	for (int i=0; i<NR_HOTKEYS; i++)
		if ((strncmp(hotkeys[i].systemname,"App",3) == 0) 
			&& (strcmp(hotkeys[i].uiname,"") != 0)  
			&& (strcmp(hotkeys[i].command,"") != 0))
				globalConfig.write(hotkeys[i].systemname, hotkeys[i].uiname);
}
Example #13
0
void menu_cb(Fl_Menu_ *menu, void *)
{
    // try to read information how much window can be maximized
    Fl_Config wm_config(fl_find_config_file("wmanager.conf", true));

//pGlobalConfig.get("Panel", "RunHistory", historyString,"");
    Window win = TaskButton::pushed->argument();
    int ID = menu->item()->argument();
    int x, y, width, height, title_height;

     wm_config.get("TitleBar", "Height",title_height);

    switch(ID) {

    case CLOSE:
        if(Fl_WM::close_window(win))
            break;
        // Fallback to kill..

    case KILL:
        XKillClient(fl_display, win);
        break;

    case MIN:
        XIconifyWindow(fl_display, win, fl_screen);
        XSync(fl_display, True);
        TaskBar::active = 0;
        break;

    /*case MAX:
	   // This will come in next version
	   Fl_WM::get_workarea(x, y, width, height);

	   // y koord. poveca za title_height
	   y = y + title_height;

	   XMoveResizeWindow(fl_display, win, x, y, width, height);
	   XSync(fl_display, True);
        break;*/
/*
	case SET_SIZE:
	   {
        	Fl_Window *win = new Fl_Window(300, 110, _("Set Size"));
        	win->begin();

        	Fl_Box *b = new Fl_Box(_("Set size to window:"), 20);
        	b->label_font(b->label_font()->bold());
        	//b = new Fl_Box(menu_frame->label(), 20); //here goes title of window

        	Fl_Group *g = new Fl_Group("", 23);

        	Fl_Value_Input *w_width = new Fl_Value_Input(_("Width:"), 70, FL_ALIGN_LEFT, 60);
        	w_width->step(1);
        	Fl_Value_Input *w_height = new Fl_Value_Input(_("Height:"), 70, FL_ALIGN_LEFT, 60);
        	w_height->step(1);

        	g->end();

        	Fl_Divider *div = new Fl_Divider(10, 15);
        	div->layout_align(FL_ALIGN_TOP);

        	g = new Fl_Group("", 50, FL_ALIGN_CLIENT);

        	//Fl_Button *but = ok_button = new Fl_Button(40,0,100,20, _("&OK"));
        	//but->callback(real_set_size_cb);

        	but = new Fl_Button(155,0,100,20, _("&Cancel"));
        	//but->callback(close_set_size_cb);

        	g->end();

        	win->end();

    		//w_width->value(menu_frame->w());
    		//w_height->value(menu_frame->h());
    		//ok_button->user_data(menu_frame);

    		//win->callback(close_set_size_cb);
    		win->show();

    		}
	   break;*/


    case RESTORE:
        Fl_WM::set_active_window(win);
        break;
    }

    Fl::redraw();
}
Example #14
0
Fl_Button *mSoundMixer;
CPUMonitor *cpumon;
BatteryMonitor *batmon;

Fl_Input_Browser *runBrowser;

PanelMenu	 *mProgramsMenu;
PanelMenu	 *mWorkspace;
MainMenu	 *mSystemMenu;
KeyboardChooser	 *mKbdSelect;

Dock	*dock;
TaskBar *tasks;

Fl_Config pGlobalConfig(fl_find_config_file("ede.conf", true));

void		 updateStats(void *);


/////////////////////////////////////////////////////////////////////////////
// Fl_Update_Window is the name of Workpanel class


class Fl_Update_Window : public Fl_Window
{
public:
	Fl_Update_Window(int, int, int, int, char*);
	void setAutoHide(int a) { autoHide = a; }

	int handle(int event);
Example #15
0
void MainMenu::init_entries()
{
    // Update locale
    m_locale = setlocale(LC_ALL, NULL);
    int pos = m_locale.rpos('_');
    if(pos>0) m_locale.sub_delete(pos, m_locale.length()-pos);
    if(m_locale=="C" || m_locale=="POSIX") m_locale.clear();

    const char *file = fl_find_config_file("ede_mainmenu.xml", true);

    struct stat s;
    if(lstat(file, &s) == 0) {
        if(!m_modified) m_modified = s.st_mtime;
        if(m_modified != s.st_mtime) {
            //file has changed..
            m_modified = s.st_mtime;
            clear();
        }
    }

    if(children()>0) return;

    FILE *fp = fopen(file, "r");
    if(!fp) {
        Fl::warning("Menu not found, creating default..");
        try {
            Fl_Buffer buf;
            buf.append(default_menu, strlen(default_menu));
            buf.save_file(file);
        } catch(Fl_Exception &e) {
            Fl::warning(e.text());
        }
        fp = fopen(file, "r");
        if(!fp) Fl::fatal("Cannot write default menu.");
    }
    Fl_XmlLocator locator;

    Fl_XmlDoc *doc=0;
    if(fp) {
        try {
            doc = Fl_XmlParser::create_dom(fp, &locator, false);
        } catch(Fl_XmlException &exp) {
            Fl_String error(exp.text());
            error += "\n\n";
            error += Fl_XmlLocator::error_line(file, *exp.locator());
            error += '\n';
            Fl::warning(error);
        }
    }

	fclose(fp);

    if(!doc) {
        // One more try!
        try {
            Fl_Buffer buf;
            buf.append(default_menu, strlen(default_menu));
            doc = Fl_XmlParser::create_dom(buf.data(), buf.bytes(), &locator, false);
        } catch(Fl_Exception &e) {
            Fl::fatal("Cannot open menu! [%s]", e.text().c_str());
        }
    }

    if(doc) {
        begin();

        Fl_XmlNode *node = doc->root_node();
        if(node) {
            for(uint n=0; n<node->children(); n++) {
                Fl_XmlNode *np = node->child(n);
                if((np->is_element() || np->is_leaf()) && np->name()=="Item")
                    build_menu_item(np);
            }
        }

        end();
    }
}