clients/desktop-shell: Add a displayname= option for launchers
Signed-off-by: n3rdopolis <bluescreen_avenger@verizon.net>
This commit is contained in:
parent
89587db3cb
commit
8e2c67c317
@ -142,6 +142,7 @@ struct panel_launcher {
|
||||
cairo_surface_t *icon;
|
||||
int focused, pressed;
|
||||
char *path;
|
||||
char *displayname;
|
||||
struct wl_list link;
|
||||
struct wl_array envp;
|
||||
struct wl_array argv;
|
||||
@ -277,7 +278,7 @@ panel_launcher_motion_handler(struct widget *widget, struct input *input,
|
||||
{
|
||||
struct panel_launcher *launcher = data;
|
||||
|
||||
widget_set_tooltip(widget, basename((char *)launcher->path), x, y);
|
||||
widget_set_tooltip(widget, launcher->displayname, x, y);
|
||||
|
||||
return CURSOR_LEFT_PTR;
|
||||
}
|
||||
@ -579,6 +580,7 @@ panel_destroy_launcher(struct panel_launcher *launcher)
|
||||
wl_array_release(&launcher->envp);
|
||||
|
||||
free(launcher->path);
|
||||
free(launcher->displayname);
|
||||
|
||||
cairo_surface_destroy(launcher->icon);
|
||||
|
||||
@ -678,7 +680,7 @@ load_icon_or_fallback(const char *icon)
|
||||
}
|
||||
|
||||
static void
|
||||
panel_add_launcher(struct panel *panel, const char *icon, const char *path)
|
||||
panel_add_launcher(struct panel *panel, const char *icon, const char *path, const char *displayname)
|
||||
{
|
||||
struct panel_launcher *launcher;
|
||||
char *start, *p, *eq, **ps;
|
||||
@ -687,6 +689,7 @@ panel_add_launcher(struct panel *panel, const char *icon, const char *path)
|
||||
launcher = xzalloc(sizeof *launcher);
|
||||
launcher->icon = load_icon_or_fallback(icon);
|
||||
launcher->path = xstrdup(path);
|
||||
launcher->displayname = xstrdup(displayname);
|
||||
|
||||
wl_array_init(&launcher->envp);
|
||||
wl_array_init(&launcher->argv);
|
||||
@ -1447,7 +1450,7 @@ static void
|
||||
panel_add_launchers(struct panel *panel, struct desktop *desktop)
|
||||
{
|
||||
struct weston_config_section *s;
|
||||
char *icon, *path;
|
||||
char *icon, *path, *displayname;
|
||||
const char *name;
|
||||
int count;
|
||||
|
||||
@ -1459,9 +1462,12 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)
|
||||
|
||||
weston_config_section_get_string(s, "icon", &icon, NULL);
|
||||
weston_config_section_get_string(s, "path", &path, NULL);
|
||||
weston_config_section_get_string(s, "displayname", &displayname, NULL);
|
||||
if (displayname == NULL)
|
||||
displayname = xstrdup(basename(path));
|
||||
|
||||
if (icon != NULL && path != NULL) {
|
||||
panel_add_launcher(panel, icon, path);
|
||||
panel_add_launcher(panel, icon, path, displayname);
|
||||
count++;
|
||||
} else {
|
||||
fprintf(stderr, "invalid launcher section\n");
|
||||
@ -1469,6 +1475,7 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)
|
||||
|
||||
free(icon);
|
||||
free(path);
|
||||
free(displayname);
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
@ -1477,7 +1484,8 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)
|
||||
/* add default launcher */
|
||||
panel_add_launcher(panel,
|
||||
name,
|
||||
BINDIR "/weston-terminal");
|
||||
BINDIR "/weston-terminal",
|
||||
"Terminal");
|
||||
free(name);
|
||||
}
|
||||
}
|
||||
|
@ -461,6 +461,9 @@ There can be multiple launcher sections, one for each launcher.
|
||||
.BI "icon=" icon
|
||||
sets the path to icon image (string). Svg images are not currently supported.
|
||||
.TP 7
|
||||
.BI "displayname=" displayname
|
||||
sets the display name of the launcher that appears in the tooltip.
|
||||
.TP 7
|
||||
.BI "path=" program
|
||||
sets the path to the program that is run by clicking on this launcher (string).
|
||||
It is possible to pass arguments and environment variables to the program. For
|
||||
|
@ -24,18 +24,22 @@ startup-animation=fade
|
||||
[launcher]
|
||||
icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
|
||||
path=/usr/bin/gnome-terminal
|
||||
displayname=Gnome Terminal
|
||||
|
||||
[launcher]
|
||||
icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
|
||||
path=@bindir@/weston-terminal
|
||||
displayname=Weston Terminal
|
||||
|
||||
[launcher]
|
||||
icon=/usr/share/icons/hicolor/24x24/apps/google-chrome.png
|
||||
path=/usr/bin/google-chrome
|
||||
displayname=Google Chome
|
||||
|
||||
[launcher]
|
||||
icon=/usr/share/icons/gnome/24x24/apps/arts.png
|
||||
path=@bindir@/weston-flower
|
||||
displayname=Weston Flower
|
||||
|
||||
[input-method]
|
||||
path=@libexecdir@/weston-keyboard
|
||||
|
Loading…
Reference in New Issue
Block a user