Skip to content

Commit

Permalink
conky.cc: add --xinerama-head command-line option (brndnmtthws#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-fg authored and brndnmtthws committed Aug 16, 2018
1 parent 99e4407 commit a4cb740
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/conky.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/x11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
1 change: 1 addition & 0 deletions src/x11.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a4cb740

Please sign in to comment.