ubuntuusers.de

.desktop File in Script ausführen

Status: Gelöst | Ubuntu-Version: Ubuntu 9.10 (Karmic Koala)
Antworten |

filou.linux

Avatar von filou.linux

Anmeldungsdatum:
5. Oktober 2006

Beiträge: 44

Wohnort: Zürich

Hallo zusammen.

Ich möchte in einem Skript ein .desktop File (http://library.gnome.org/admin/system-admin-guide/stable/menustructure-desktopentry.html.en) ausführen. Im stil von:

source script.sh
#oder
. script.sh

Konkret benutze ich Awesome als WM und möchte beim Start alle .desktop Einträge aus ~/.config/autostart/* ausführen, um die gleichen Programme wie in der gnome-session zu starten.

Danke und Gruss Filou

sdx23

Anmeldungsdatum:
19. August 2008

Beiträge: 154

Und wo genau ist das Problem?

Gruß

filou.linux

(Themenstarter)
Avatar von filou.linux

Anmeldungsdatum:
5. Oktober 2006

Beiträge: 44

Wohnort: Zürich

Hi

Wie gesagt möchte ich auf diesem Weg aber keine Shell-Scripts ausführen, sonder .desktop Files. Beispiel wie es NICHT geht:

digi@digi-laptop:~$ source .config/autostart/conky.desktop 
[Desktop: command not found
X-GNOME-Autostart-enabled=true: command not found
No command 'Monitor' found, did you mean:
 Command 'monitor' from package 'dmucs' (universe)
Monitor: command not found
No command 'Monitor' found, did you mean:
 Command 'monitor' from package 'dmucs' (universe)
Monitor: command not found

Statt 'source' suche ich einen Befehl wie 'xdg-exec' oder so.

YEPHENAS

Anmeldungsdatum:
8. Juni 2009

Beiträge: 352

filou.linux schrieb:

Hi

Wie gesagt möchte ich auf diesem Weg aber keine Shell-Scripts ausführen, sonder .desktop Files. Beispiel wie es NICHT geht:

digi@digi-laptop:~$ source .config/autostart/conky.desktop 
[Desktop: command not found
X-GNOME-Autostart-enabled=true: command not found
No command 'Monitor' found, did you mean:
 Command 'monitor' from package 'dmucs' (universe)
Monitor: command not found
No command 'Monitor' found, did you mean:
 Command 'monitor' from package 'dmucs' (universe)
Monitor: command not found

Statt 'source' suche ich einen Befehl wie 'xdg-exec' oder so.

Ich kann dir ein C-Programm anbieten:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <gio/gdesktopappinfo.h>

int main (int argc, char *argv[])
{
	GDesktopAppInfo *appinfo;

	g_type_init ();

	if (argc < 2) {
		fprintf (stderr, "Not enough arguments\n");
		return 1;
	}

	appinfo = g_desktop_app_info_new_from_filename (argv[1]);
	if (appinfo == NULL) {
		fprintf (stderr, "Could not load '%s'\n", argv[1]);
		return 1;
	}

	if (!g_app_info_launch (G_APP_INFO (appinfo), NULL, NULL, NULL)) {
		fprintf (stderr, "Could not launch '%s'\n", argv[1]);
		return 1;
	}

	return 0;
}

Zum Kompilieren brauchst du die Pakete gcc und libglib2.0-dev:

gcc xdg-exec.c -o xdg-exec `pkg-config gio-unix-2.0 --libs --cflags`

filou.linux

(Themenstarter)
Avatar von filou.linux

Anmeldungsdatum:
5. Oktober 2006

Beiträge: 44

Wohnort: Zürich

Hey Yepehnas

Danke, genau das habe ich gesucht. Ich bin aber davon ausgegangen, dass bei den grossen DEs schon so ein Tool mit an Bord ist. Hat jedenfalls reibungslos funktioniert.

Vielen Dank und freundliche Grüsse Filou

Antworten |