1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

conky.cc: add --xinerama-head command-line option (#613)

This commit is contained in:
Mike Kazantsev 2018-08-17 03:40:34 +05:00 committed by Brenden Matthews
parent 99e4407a45
commit a4cb740508
3 changed files with 14 additions and 5 deletions

View File

@ -2772,8 +2772,9 @@ static void print_help(const char *prog_name) {
#ifdef BUILD_X11
" -a, --alignment=ALIGNMENT text alignment on screen, "
"{top,bottom,middle}_{left,right,middle}\n"
" -f, --font=FONT font to use\n"
" -X, --display=DISPLAY X11 display to use\n"
" -m, --xinerama-head=N Xinerama monitor index (0=first)\n"
" -f, --font=FONT font to use\n"
#ifdef OWN_WINDOW
" -o, --own-window create own window to draw\n"
#endif
@ -2805,7 +2806,7 @@ inline void reset_optind() {
static const char *getopt_string =
"vVqdDSs:t:u:i:hc:p:"
#ifdef BUILD_X11
"x:y:w:a:f:X:"
"x:y:w:a:X:m:f:"
#ifdef OWN_WINDOW
"o"
#endif
@ -2825,8 +2826,8 @@ static const struct option longopts[] = {
#endif
{"daemonize", 0, nullptr, 'd'},
#ifdef BUILD_X11
{"alignment", 1, nullptr, 'a'}, {"font", 1, nullptr, 'f'},
{"display", 1, nullptr, 'X'},
{"alignment", 1, nullptr, 'a'}, {"display", 1, nullptr, 'X'},
{"xinerama-head", 1, nullptr, 'm'}, {"font", 1, nullptr, 'f'},
#ifdef OWN_WINDOW
{"own-window", 0, nullptr, 'o'},
#endif
@ -2913,6 +2914,13 @@ void initialisation(int argc, char **argv) {
state->pushstring(optarg);
text_alignment.lua_set(*state);
break;
case 'm':
state->pushinteger(strtol(optarg, &conv_end, 10));
if (*conv_end != 0) {
CRIT_ERR(nullptr, nullptr, "'%s' is a wrong xinerama-head index", optarg);
}
head_index.lua_set(*state);
break;
case 'X':
state->pushstring(optarg);
display_name.lua_set(*state);

View File

@ -304,7 +304,7 @@ conky::simple_config_setting<alignment> text_alignment("alignment", BOTTOM_LEFT,
false);
conky::simple_config_setting<std::string> display_name("display", std::string(),
false);
static conky::simple_config_setting<int> head_index("xinerama_head", 0, true);
conky::simple_config_setting<int> head_index("xinerama_head", 0, true);
priv::out_to_x_setting out_to_x;
priv::colour_setting color[10] = {{"color0", 0xffffff}, {"color1", 0xffffff},

View File

@ -220,6 +220,7 @@ class colour_setting
extern priv::out_to_x_setting out_to_x;
extern conky::simple_config_setting<std::string> display_name;
extern conky::simple_config_setting<int> head_index;
extern priv::colour_setting color[10];
extern priv::colour_setting default_color;
extern priv::colour_setting default_shade_color;