diff --git a/README b/README index 6f08a59d..20e07cf1 100644 --- a/README +++ b/README @@ -64,6 +64,8 @@ gNxM = make terminal NxM chars in size (if possible). e.g. g80x48 g40x20. If just one number is provided, it will use the following shortcuts: g0=80x24; g1=80x40; g2=80x60; g3=80x80; g4=120x24; g5=120x40; g6=120x60; g7=120x80; g8=120x120 +b = reset the background (no media) +bPATH = set the background media to an absolute file PATH Mouse controls: diff --git a/src/bin/termcmd.c b/src/bin/termcmd.c index fb64014f..05acbb71 100644 --- a/src/bin/termcmd.c +++ b/src/bin/termcmd.c @@ -119,6 +119,31 @@ _termcmd_grid_size(Evas_Object *obj, Evas_Object *win __UNUSED__, Evas_Object *b return EINA_TRUE; } +static Eina_Bool +_termcmd_background(Evas_Object *obj, Evas_Object *win __UNUSED__, Evas_Object *bg __UNUSED__, const char *cmd) +{ + Config *config = termio_config_get(obj); + + if (!config) return EINA_TRUE; + + if (cmd[0] == 0) + { + config->temporary = EINA_TRUE; + eina_stringshare_replace(&(config->background), NULL); + main_media_update(config); + } + else if (ecore_file_can_read(cmd)) + { + config->temporary = EINA_TRUE; + eina_stringshare_replace(&(config->background), cmd); + main_media_update(config); + } + else + ERR("Background file cannot be read: %s", cmd); + + return EINA_TRUE; +} + // called as u type Eina_Bool termcmd_watch(Evas_Object *obj, Evas_Object *win, Evas_Object *bg, const char *cmd) @@ -141,6 +166,8 @@ termcmd_do(Evas_Object *obj, Evas_Object *win, Evas_Object *bg, const char *cmd) return _termcmd_font_size(obj, win, bg, cmd + 1); if ((cmd[0] == 'g') || (cmd[0] == 'G')) return _termcmd_grid_size(obj, win, bg, cmd + 1); + if ((cmd[0] == 'b') || (cmd[0] == 'B')) + return _termcmd_background(obj, win, bg, cmd + 1); return EINA_FALSE; obj = win = bg = NULL;