segunda-feira, 20 de outubro de 2008

Launch application in a specific work area - Compiz Community Forums

Launch application in a specific work area - Compiz Community Forums

Reply
Thread Tools Display Modes
#1
Old September 23rd, 2008, 09:20 AM
IacopoDeeNosee IacopoDeeNosee is offline
Junior Member
Join Date: Sep 2008
Rendering Method: ATI/AiGLX
Distribution: ubuntu
Posts: 2
Send a message via Skype™ to IacopoDeeNosee
Question Launch application in a specific work area

hi everyone, i need some help with my little application,i want lauch a application in a specific work area,i write it in C and using the libwnck library for changing the active desktop.This is a code:
Code:
//-----------------------------------//
//--------Include libraries----------//
//-----------------------------------//

#include
#include
#include
#include
#include
#include
#include

//to compile use this command:
// gcc -Wall ChangeWorkSpace.c -o ChangeWorkSpace `pkg-config --cflags --libs glib-2.0 libwnck-1.0 gdk`


//-----------------------------------//
//------------Main function----------//
//-----------------------------------//

int main(int argc, char *argv[], char *envp[])
{
int i, j;
WnckScreen *screen;
WnckWorkspace *workspace;
int num;
GTimeVal timestamp;

g_print("- ARGOMENTI PASSATI -\n\n");
for (i = 0; i < argc; i++)
g_print("%s\n", argv[i]);

g_print("\n\n- VARIABILI DI AMBIENTE -\n\n");
for (j = 0; envp[j] !='\0'; j++) {
g_print("%s\n", envp[j]);
}

/* Initialise GDK */
gdk_init(&argc, &argv);

num = 0;

screen = wnck_screen_get_default();

int Num_Screens = gdk_display_get_n_screens (gdk_display_get_default());
g_print("numero di screens : %d \n",Num_Screens);

int Num_Workspace = wnck_screen_get_workspace_count(screen);
g_print("numero di workspace : %d \n",Num_Workspace);

//workspace = wnck_screen_get_workspace(screen, num);

workspace = wnck_screen_get_active_workspace(screen);

if (!workspace)
{
g_print("Workspace number %d does not exist\n", num);
}

g_get_current_time(&timestamp);
wnck_workspace_activate(workspace, timestamp.tv_sec);

system("gedit");

return 0;
}
it not finished but now it can change desktop and launch gedit,it work good with the metacity VM but not work with compiz VM,why?
i execute the appication with metacity it recognize 4 work area.
i execute the appication with compiz it recognize 0 work area.
where mistake?
BYE
Reply With Quote
#2
Old September 23rd, 2008, 02:55 PM
gourgi gourgi is offline
Member
Join Date: Dec 2007
Rendering Method: nVidia/XGL
Posts: 40
Default Re: Launch application in a specific work area

there is already a compiz plugin for placing applications to different viewports, it is called 'Place'.
Reply With Quote
#3
Old September 24th, 2008, 07:54 AM
maniac maniac is offline
Senior Member
Fusion Developer
Core Developer
Moderator
Join Date: Nov 2006
Rendering Method: nVidia
Distribution: Fedora 9
Location: Germany
Posts: 696
Default Re: Launch application in a specific work area

Quote:
Originally Posted by IacopoDeeNosee View Post
hi everyone, i need some help with my little application,i want lauch a application in a specific work area,i write it in C and using the libwnck library for changing the active desktop.This is a code:
it not finished but now it can change desktop and launch gedit,it work good with the metacity VM but not work with compiz VM,why?
i execute the appication with metacity it recognize 4 work area.
i execute the appication with compiz it recognize 0 work area.
where mistake?
BYE
Besides the fact that gourgi is completely right, compiz is using viewports instead of virtual desktops. See wnck_screen_move_viewport.

At some time point, libwnck maintainer intended to abstract viewports and desktops to some general term, but seemingly he didn't have time to do so yet.
Reply With Quote
#4
Old September 24th, 2008, 12:17 PM
IacopoDeeNosee IacopoDeeNosee is offline
Junior Member
Join Date: Sep 2008
Rendering Method: ATI/AiGLX
Distribution: ubuntu
Posts: 2
Send a message via Skype™ to IacopoDeeNosee
Default Re: Launch application in a specific work area

i just know "place window" plug-in but it block the window always in one desktop when the application is started and i need something more dynamic.
i'll try to use wnck_screen_move_viewport function,thanks for the advice.
BYE
Reply With Quote
Reply

  • Submit Thread to Digg Digg
  • Submit Thread to del.icio.us del.icio.us
  • Submit Thread to StumbleUpon StumbleUpon
  • Submit Thread to Google Google
  • Bookmarks


    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT +1. The time now is 11:53 PM.

    Nenhum comentário: