Launcher: Support %f and %F

This commit is contained in:
o9000
2017-09-02 13:04:01 +02:00
parent 498b665c8a
commit d49adfdef3
6 changed files with 82 additions and 36 deletions

View File

@@ -96,6 +96,10 @@ void expand_exec(DesktopEntry *entry, const char *path)
q += strlen("''");
q += strlen(path);
q--; // To balance the q++ in the for
} else if (*p == 'f' || *p == 'F') {
sprintf(q, "%c%c", '%', *p);
q += 2;
q--; // To balance the q++ in the for
} else {
// We don't care about other expansions
q--; // Delete the last % from q

View File

@@ -385,7 +385,12 @@ void draw_launcher_icon(void *obj, cairo_t *c)
void launcher_icon_dump_geometry(void *obj, int indent)
{
LauncherIcon *launcherIcon = (LauncherIcon *)obj;
fprintf(stderr, "tint2: %*sIcon: w = h = %d, name = %s\n", indent, "", launcherIcon->icon_size, launcherIcon->icon_name);
fprintf(stderr,
"tint2: %*sIcon: w = h = %d, name = %s\n",
indent,
"",
launcherIcon->icon_size,
launcherIcon->icon_name);
}
Imlib_Image scale_icon(Imlib_Image original, int icon_size)
@@ -434,8 +439,21 @@ void launcher_action(LauncherIcon *icon, XEvent *evt, int x, int y)
launcher_reload_icon((Launcher *)icon->area.parent, icon);
launcher_reload_hidden_icons((Launcher *)icon->area.parent);
if (evt->type == ButtonPress || evt->type == ButtonRelease)
tint_exec(icon->cmd, icon->cwd, icon->icon_tooltip, evt->xbutton.time, &icon->area, x, y, icon->start_in_terminal, icon->startup_notification);
if (evt->type == ButtonPress || evt->type == ButtonRelease) {
GString *cmd = g_string_new(icon->cmd);
tint2_g_string_replace(cmd, "%f", "");
tint2_g_string_replace(cmd, "%F", "");
tint_exec(cmd->str,
icon->cwd,
icon->icon_tooltip,
evt->xbutton.time,
&icon->area,
x,
y,
icon->start_in_terminal,
icon->startup_notification);
g_string_free(cmd, TRUE);
}
}
// Populates the list_icons list from the list_apps list