cmd: Add more info to --version.

Now that modeline are supported, they will affect the content of
version. This commits only adds the new information. `--version` has
to be the last command line argument and the modeline isn't parsed
yet.

Another commit will make sure --version parses the modeline and
finishes to process the command line arguments in case it isn't
last. Please note that luarocks also affects data points such as
the LGI version. It should be smarter and check if `rc.lua` has
`require("luarocks")`. This commit does *not* do it.
This commit is contained in:
Emmanuel Lepage Vallee 2020-02-02 20:36:20 -05:00
parent e0b982fa1a
commit d58b4c3d96
3 changed files with 25 additions and 6 deletions

View File

@ -21,6 +21,7 @@
#include "config.h"
#include "common/version.h"
#include "globalconf.h"
#include "awesome-version-internal.h"
#include <stdlib.h>
@ -67,16 +68,28 @@ eprint_version(void)
printf("awesome %s (%s)\n"
" • Compiled against %s (running with %s)\n"
" • API level: %d\n"
" • D-Bus support: %s\n"
" • xcb-errors support: %s\n"
" • execinfo support: %s\n"
" • xcb-randr version: %d.%d\n"
" • LGI version: %s\n",
AWESOME_VERSION, AWESOME_RELEASE,
LUA_RELEASE, lua_tostring(L, -2),
has_dbus, has_xcb_errors, has_execinfo,
XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION,
lua_tostring(L, -1));
" • LGI version: %s\n"
" • Transparency enabled: %s\n"
" • Custom search paths: %s\n",
/* version */ AWESOME_VERSION,
/* release */ AWESOME_RELEASE,
/* Lua linked */ LUA_RELEASE,
/* Lua runtime */ lua_tostring(L, -2),
/* API Level */ globalconf.api_level,
/* DBus */ has_dbus,
/* XCB Error */ has_xcb_errors,
/* Execinfo */ has_execinfo,
/* XRandR major */ XCB_RANDR_MAJOR_VERSION,
/* XRandR minor */ XCB_RANDR_MINOR_VERSION,
/* LGI version */ lua_tostring(L, -1),
/* ARGB support */ globalconf.had_overriden_depth ? "no" : "yes",
/* Search path */ globalconf.have_searchpaths ? "yes" : "no"
);
lua_close(L);
exit(EXIT_SUCCESS);

View File

@ -126,6 +126,10 @@ typedef struct
bool have_xkb;
/** Check for XFixes extension */
bool have_xfixes;
/** Custom searchpaths are present, the runtime is tinted */
bool have_searchpaths;
/** When --no-argb is used in the modeline or command line */
bool had_overriden_depth;
uint8_t event_base_shape;
uint8_t event_base_xkb;
uint8_t event_base_randr;

View File

@ -428,9 +428,11 @@ options_check_args(int argc, char **argv, int *init_flags, string_array_t *paths
break;
case 's':
globalconf.have_searchpaths = true;
string_array_append(paths, a_strdup(optarg));
break;
case 'a':
globalconf.had_overriden_depth = true;
(*init_flags) &= ~INIT_FLAG_ARGB;
break;
case 'r':