diff --git a/Examples/test_script_mode_color.sh b/Examples/test_script_mode_color.sh new file mode 100755 index 00000000..4b0b19db --- /dev/null +++ b/Examples/test_script_mode_color.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +if [ "$*" = "quit" ] +then + exit 0 +fi + +if [ "$@" ] +then + # Override the previously set prompt. + echo -en "\0theme\x1felement-text { background-color: "$@";}\n" + echo "red" + echo "lightgreen" + echo "lightblue" + echo "lightyellow" + echo "quit" +else + echo -en "\x00prompt\x1ftesting\n" + echo -en "\0urgent\x1f0,2\n" + echo -en "\0active\x1f1\n" + echo -en "\0message\x1fSpecial boldmessage\n" + + echo "red" + echo "lightgreen" + echo "lightblue" + echo "lightyellow" + echo "quit" +fi diff --git a/source/modes/script.c b/source/modes/script.c index 182ea3f2..994e3b97 100644 --- a/source/modes/script.c +++ b/source/modes/script.c @@ -138,6 +138,11 @@ static void parse_header_entry(Mode *sw, char *line, ssize_t length) { } else if (strcasecmp(line, "data") == 0) { g_free(pd->data); pd->data = g_strdup(value); + } else if (strcasecmp(line, "theme") == 0) { + if (rofi_theme_parse_string((const char *)value)) { + g_warning("Failed to parse: '%s'", value); + rofi_clear_error_messages(); + } } } }