1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 04:17:33 +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 #ifdef BUILD_X11
" -a, --alignment=ALIGNMENT text alignment on screen, " " -a, --alignment=ALIGNMENT text alignment on screen, "
"{top,bottom,middle}_{left,right,middle}\n" "{top,bottom,middle}_{left,right,middle}\n"
" -f, --font=FONT font to use\n"
" -X, --display=DISPLAY X11 display 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 #ifdef OWN_WINDOW
" -o, --own-window create own window to draw\n" " -o, --own-window create own window to draw\n"
#endif #endif
@ -2805,7 +2806,7 @@ inline void reset_optind() {
static const char *getopt_string = static const char *getopt_string =
"vVqdDSs:t:u:i:hc:p:" "vVqdDSs:t:u:i:hc:p:"
#ifdef BUILD_X11 #ifdef BUILD_X11
"x:y:w:a:f:X:" "x:y:w:a:X:m:f:"
#ifdef OWN_WINDOW #ifdef OWN_WINDOW
"o" "o"
#endif #endif
@ -2825,8 +2826,8 @@ static const struct option longopts[] = {
#endif #endif
{"daemonize", 0, nullptr, 'd'}, {"daemonize", 0, nullptr, 'd'},
#ifdef BUILD_X11 #ifdef BUILD_X11
{"alignment", 1, nullptr, 'a'}, {"font", 1, nullptr, 'f'}, {"alignment", 1, nullptr, 'a'}, {"display", 1, nullptr, 'X'},
{"display", 1, nullptr, 'X'}, {"xinerama-head", 1, nullptr, 'm'}, {"font", 1, nullptr, 'f'},
#ifdef OWN_WINDOW #ifdef OWN_WINDOW
{"own-window", 0, nullptr, 'o'}, {"own-window", 0, nullptr, 'o'},
#endif #endif
@ -2913,6 +2914,13 @@ void initialisation(int argc, char **argv) {
state->pushstring(optarg); state->pushstring(optarg);
text_alignment.lua_set(*state); text_alignment.lua_set(*state);
break; 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': case 'X':
state->pushstring(optarg); state->pushstring(optarg);
display_name.lua_set(*state); display_name.lua_set(*state);

View File

@ -304,7 +304,7 @@ conky::simple_config_setting<alignment> text_alignment("alignment", BOTTOM_LEFT,
false); false);
conky::simple_config_setting<std::string> display_name("display", std::string(), conky::simple_config_setting<std::string> display_name("display", std::string(),
false); 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::out_to_x_setting out_to_x;
priv::colour_setting color[10] = {{"color0", 0xffffff}, {"color1", 0xffffff}, 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 priv::out_to_x_setting out_to_x;
extern conky::simple_config_setting<std::string> display_name; 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 color[10];
extern priv::colour_setting default_color; extern priv::colour_setting default_color;
extern priv::colour_setting default_shade_color; extern priv::colour_setting default_shade_color;