-1

openbox 用のアイコン マネージャー アプリを開発していますが、再起動時に同じアイコンに復元するためにアイコンが作成される特定の仮想デスクトップを知る必要があります。

現在の仮想デスクトップの情報を特定できる標準的な方法はありますか?

4

1 に答える 1

1

ウィンドウ マネージャーが EWMH に準拠している場合は、次のプロパティを使用できます。

http://standards.freedesktop.org/wm-spec/1.4/ar01s03.html

特に、_NET_NUMBER_OF_DESKTOPSおよび_NET_DESKTOP_NAMES


このサイトのコードを変更すると、使用可能なすべての仮想デスクトップが一覧表示されます。wmctrl -d* で示される現在の virt.desktop を含むリストを返すパイプを開きます。

#include <stdio.h>
#include <stdlib.h>

#ifdef WIN32
FILE *popen ( const char* command, const char* flags) {return _popen(command,flags);}
int pclose ( FILE* fd) { return _pclose(fd);}
#endif

int main(int argc, char* argv[])
{
    char psBuffer[4096];
    FILE *iopipe;

    if( (iopipe = popen( "wmctrl -d", "r" )) == NULL )
        exit( 1 );

    while( !feof( iopipe ) )
    {
        if( fgets( psBuffer, 4095, iopipe ) != NULL )
            printf( psBuffer );
    }

    printf( "\nProcess returned %d\n", pclose( iopipe ) );
    return 0;
}

キャプチャされた出力は次のようになります: (説明のための man wmctrl)

0  * DG: 1680x1050  VP: 0,0  WA: 36,36 3564x1044  (Unnamed desktop)
1  - DG: 1680x1050  VP: 0,0  WA: 36,36 3564x1044  desktop 2
2  - DG: 1680x1050  VP: 0,0  WA: 36,36 3564x1044  desktop 3
3  - DG: 1680x1050  VP: 0,0  WA: 36,36 3564x1044  desktop 4
4  - DG: 1680x1050  VP: 0,0  WA: 36,36 3564x1044  desktop 5
5  - DG: 1680x1050  VP: 0,0  WA: 36,36 3564x1044  desktop 6
于 2011-12-20T13:24:11.380 に答える