mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-04 19:43:03 +00:00
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;
|
cairo_surface_t *icon;
|
||||||
int focused, pressed;
|
int focused, pressed;
|
||||||
char *path;
|
char *path;
|
||||||
|
char *displayname;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
struct wl_array envp;
|
struct wl_array envp;
|
||||||
struct wl_array argv;
|
struct wl_array argv;
|
||||||
|
@ -277,7 +278,7 @@ panel_launcher_motion_handler(struct widget *widget, struct input *input,
|
||||||
{
|
{
|
||||||
struct panel_launcher *launcher = data;
|
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;
|
return CURSOR_LEFT_PTR;
|
||||||
}
|
}
|
||||||
|
@ -579,6 +580,7 @@ panel_destroy_launcher(struct panel_launcher *launcher)
|
||||||
wl_array_release(&launcher->envp);
|
wl_array_release(&launcher->envp);
|
||||||
|
|
||||||
free(launcher->path);
|
free(launcher->path);
|
||||||
|
free(launcher->displayname);
|
||||||
|
|
||||||
cairo_surface_destroy(launcher->icon);
|
cairo_surface_destroy(launcher->icon);
|
||||||
|
|
||||||
|
@ -678,7 +680,7 @@ load_icon_or_fallback(const char *icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
struct panel_launcher *launcher;
|
||||||
char *start, *p, *eq, **ps;
|
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 = xzalloc(sizeof *launcher);
|
||||||
launcher->icon = load_icon_or_fallback(icon);
|
launcher->icon = load_icon_or_fallback(icon);
|
||||||
launcher->path = xstrdup(path);
|
launcher->path = xstrdup(path);
|
||||||
|
launcher->displayname = xstrdup(displayname);
|
||||||
|
|
||||||
wl_array_init(&launcher->envp);
|
wl_array_init(&launcher->envp);
|
||||||
wl_array_init(&launcher->argv);
|
wl_array_init(&launcher->argv);
|
||||||
|
@ -1447,7 +1450,7 @@ static void
|
||||||
panel_add_launchers(struct panel *panel, struct desktop *desktop)
|
panel_add_launchers(struct panel *panel, struct desktop *desktop)
|
||||||
{
|
{
|
||||||
struct weston_config_section *s;
|
struct weston_config_section *s;
|
||||||
char *icon, *path;
|
char *icon, *path, *displayname;
|
||||||
const char *name;
|
const char *name;
|
||||||
int count;
|
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, "icon", &icon, NULL);
|
||||||
weston_config_section_get_string(s, "path", &path, 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) {
|
if (icon != NULL && path != NULL) {
|
||||||
panel_add_launcher(panel, icon, path);
|
panel_add_launcher(panel, icon, path, displayname);
|
||||||
count++;
|
count++;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "invalid launcher section\n");
|
fprintf(stderr, "invalid launcher section\n");
|
||||||
|
@ -1469,6 +1475,7 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)
|
||||||
|
|
||||||
free(icon);
|
free(icon);
|
||||||
free(path);
|
free(path);
|
||||||
|
free(displayname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
|
@ -1477,7 +1484,8 @@ panel_add_launchers(struct panel *panel, struct desktop *desktop)
|
||||||
/* add default launcher */
|
/* add default launcher */
|
||||||
panel_add_launcher(panel,
|
panel_add_launcher(panel,
|
||||||
name,
|
name,
|
||||||
BINDIR "/weston-terminal");
|
BINDIR "/weston-terminal",
|
||||||
|
"Terminal");
|
||||||
free(name);
|
free(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -461,6 +461,9 @@ There can be multiple launcher sections, one for each launcher.
|
||||||
.BI "icon=" icon
|
.BI "icon=" icon
|
||||||
sets the path to icon image (string). Svg images are not currently supported.
|
sets the path to icon image (string). Svg images are not currently supported.
|
||||||
.TP 7
|
.TP 7
|
||||||
|
.BI "displayname=" displayname
|
||||||
|
sets the display name of the launcher that appears in the tooltip.
|
||||||
|
.TP 7
|
||||||
.BI "path=" program
|
.BI "path=" program
|
||||||
sets the path to the program that is run by clicking on this launcher (string).
|
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
|
It is possible to pass arguments and environment variables to the program. For
|
||||||
|
|
|
@ -24,18 +24,22 @@ startup-animation=fade
|
||||||
[launcher]
|
[launcher]
|
||||||
icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
|
icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
|
||||||
path=/usr/bin/gnome-terminal
|
path=/usr/bin/gnome-terminal
|
||||||
|
displayname=Gnome Terminal
|
||||||
|
|
||||||
[launcher]
|
[launcher]
|
||||||
icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
|
icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
|
||||||
path=@bindir@/weston-terminal
|
path=@bindir@/weston-terminal
|
||||||
|
displayname=Weston Terminal
|
||||||
|
|
||||||
[launcher]
|
[launcher]
|
||||||
icon=/usr/share/icons/hicolor/24x24/apps/google-chrome.png
|
icon=/usr/share/icons/hicolor/24x24/apps/google-chrome.png
|
||||||
path=/usr/bin/google-chrome
|
path=/usr/bin/google-chrome
|
||||||
|
displayname=Google Chome
|
||||||
|
|
||||||
[launcher]
|
[launcher]
|
||||||
icon=/usr/share/icons/gnome/24x24/apps/arts.png
|
icon=/usr/share/icons/gnome/24x24/apps/arts.png
|
||||||
path=@bindir@/weston-flower
|
path=@bindir@/weston-flower
|
||||||
|
displayname=Weston Flower
|
||||||
|
|
||||||
[input-method]
|
[input-method]
|
||||||
path=@libexecdir@/weston-keyboard
|
path=@libexecdir@/weston-keyboard
|
||||||
|
|
Loading…
Reference in a new issue