Exemple #1
0
void XDesktopContainer::exeCurrentAction(XIcon * icon)
{
			
	if (actionConfig->getReload()->isOccuring(currentAction)){
		app->restartIdesk();
	}
    
    if (actionConfig->getLock()->isOccuring(currentAction))
    {
        toggleLock();
        DesktopConfig * dConfig = dynamic_cast<DesktopConfig *>(config);
        dConfig->saveLockState(locked); 
    }
    
    if (icon) //make sure icon is not NULL
    {
        if (actionConfig->getDrag()->isOccuring(currentAction)
            && !isLocked()
            && !icon->isDragging() ) //only start drag if not already occuring
            icon->dragButtonPress(event);
        else if (actionConfig->getEndDrag()->isOccuring(currentAction))
            icon->dragButtonRelease(event);

        for (int i = 0; i < icon->getCommandArray().size() &&
                        i < actionConfig->getExecuteActions().size();
                        i++)
		if (actionConfig->getExecuteAction(i)->isOccuring(currentAction)){
#ifdef HAVE_STARTUP_NOTIFICATION
			if (sn_display != NULL)
			{
			  sn_context = sn_launcher_context_new (sn_display, DefaultScreen (display));
			  if ((sn_context != NULL) && !sn_launcher_context_get_initiated (sn_context))
			  {
			   sn_launcher_context_set_name (sn_context, icon->getCommand(i).c_str());
			   sn_launcher_context_set_description (sn_context, icon->getCommand(i).c_str());
		           sn_launcher_context_set_binary_name (sn_context, icon->getCommand(i).c_str());
                           sn_launcher_context_set_icon_name(sn_context, icon->getCommand(i).c_str());
			   
			   sn_launcher_context_initiate (sn_context,
					   icon->getCommand(i).c_str(),
					   icon->getCommand(i).c_str(),	      
					   event.xproperty.time);
			  }
			}
#endif  /*HAVE_STARTUP_NOTIFICATION */
			runCommand(icon->getCommand(i));
		}
    }

}
Exemple #2
0
void sn_setup_spawn_environment(const gchar *program, const gchar *name,
                                const gchar *icon_name, const gchar *wmclass,
                                gint desktop)
{
    gchar *desc;
    const char *id;

    desc = g_strdup_printf(_("Running %s"), program);

    if (sn_launcher_context_get_initiated(sn_launcher)) {
        sn_launcher_context_unref(sn_launcher);
        sn_launcher = sn_launcher_context_new(sn_display, ob_screen);
    }

    sn_launcher_context_set_name(sn_launcher, name ? name : program);
    sn_launcher_context_set_description(sn_launcher, desc);
    sn_launcher_context_set_icon_name(sn_launcher, icon_name ?
                                      icon_name : program);
    sn_launcher_context_set_binary_name(sn_launcher, program);
    if (wmclass) sn_launcher_context_set_wmclass(sn_launcher, wmclass);
    if (desktop >= 0 && (unsigned) desktop < screen_num_desktops)
        sn_launcher_context_set_workspace(sn_launcher, (signed) desktop);
    sn_launcher_context_initiate(sn_launcher, "openbox", program,
                                 event_time());
    id = sn_launcher_context_get_startup_id(sn_launcher);

    /* 20 second timeout for apps to start */
    sn_launcher_context_ref(sn_launcher);
    obt_main_loop_timeout_add(ob_main_loop, 20 * G_USEC_PER_SEC,
                              sn_launch_wait_timeout, sn_launcher,
                              g_direct_equal,
                              (GDestroyNotify)sn_launcher_context_unref);

    setenv("DESKTOP_STARTUP_ID", id, TRUE);

    g_free(desc);
}