diff --git a/doc/manual.html b/doc/manual.html
index ff2ef27..72a66c4 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -199,7 +199,7 @@ pre {
-TINT2
NAME
tint2 - lightweight panel/taskbar
SYNOPSIS
tint2 [-c path_to_config_file]
DESCRIPTION
tint2 is a simple panel/taskbar made for modern X window managers.
+
TINT2
NAME
tint2 - lightweight panel/taskbar
DESCRIPTION
tint2 is a simple panel/taskbar made for modern X window managers.
It was specifically made for Openbox but it should also work with other window managers (GNOME, KDE, XFCE etc.).
Features:
- Panel with taskbar, system tray, clock and launcher icons;
@@ -214,7 +214,7 @@ It was specifically made for Openbox but it should also work with other window m
- Follow the freedesktop.org specifications;
- Make certain workflows, such as multi-desktop and multi-monitor, easy to use.
-OPTIONS
-c path_to_config_file- Specifies which configuration file to use instead of the default.
CONFIGURATION
Table of contents
+SYNOPSIS
tint2 [OPTION...]
OPTIONS
-c path_to_config_file- Specifies which configuration file to use instead of the default.
-v, --version- Prints version information and exits.
-h, --help- Display this help and exits.
CONFIGURATION
Table of contents
Introduction
Backgrounds and borders
diff --git a/doc/tint2.1 b/doc/tint2.1
index c0ba377..7180945 100644
--- a/doc/tint2.1
+++ b/doc/tint2.1
@@ -2,9 +2,6 @@
.SH NAME
.PP
tint2 \- lightweight panel/taskbar
-.SH SYNOPSIS
-.PP
-\fB\fCtint2 [\-c path_to_config_file]\fR
.SH DESCRIPTION
.PP
tint2 is a simple panel/taskbar made for modern X window managers.
@@ -33,10 +30,19 @@ Follow the freedesktop.org specifications;
.IP \(bu 2
Make certain workflows, such as multi\-desktop and multi\-monitor, easy to use.
.RE
+.SH SYNOPSIS
+.PP
+\fB\fCtint2 [OPTION...]\fR
.SH OPTIONS
.TP
\fB\fC\-c path_to_config_file\fR
Specifies which configuration file to use instead of the default.
+.TP
+\fB\fC\-v, \-\-version\fR
+Prints version information and exits.
+.TP
+\fB\fC\-h, \-\-help\fR
+Display this help and exits.
.SH CONFIGURATION
.SS Table of contents
.RS
diff --git a/doc/tint2.md b/doc/tint2.md
index ae7a590..9b86201 100644
--- a/doc/tint2.md
+++ b/doc/tint2.md
@@ -3,9 +3,6 @@
## NAME
tint2 - lightweight panel/taskbar
-## SYNOPSIS
-`tint2 [-c path_to_config_file]`
-
## DESCRIPTION
tint2 is a simple panel/taskbar made for modern X window managers.
It was specifically made for Openbox but it should also work with other window managers (GNOME, KDE, XFCE etc.).
@@ -24,10 +21,20 @@ Goals:
* Follow the freedesktop.org specifications;
* Make certain workflows, such as multi-desktop and multi-monitor, easy to use.
+## SYNOPSIS
+`tint2 [OPTION...]`
+
## OPTIONS
`-c path_to_config_file`
Specifies which configuration file to use instead of the default.
+`-v, --version`
+ Prints version information and exits.
+
+`-h, --help`
+ Display this help and exits.
+
+
## CONFIGURATION
### Table of contents
diff --git a/get_version.sh b/get_version.sh
index 8eb3649..9421dd4 100755
--- a/get_version.sh
+++ b/get_version.sh
@@ -3,7 +3,45 @@
MAJOR=0.14
DIRTY=""
-VERSION=0.14
+if git status 1>/dev/null 2>/dev/null
+then
+ git update-index -q --ignore-submodules --refresh
+ # Disallow unstaged changes in the working tree
+ if ! git diff-files --quiet --ignore-submodules --
+ then
+ if [ "$1" = "--strict" ]
+ then
+ echo >&2 "Error: there are unstaged changes."
+ git diff-files --name-status -r --ignore-submodules -- >&2
+ exit 1
+ else
+ DIRTY="-dirty"
+ fi
+ fi
+
+ # Disallow uncommitted changes in the index
+ if ! git diff-index --cached --quiet HEAD --ignore-submodules --
+ then
+ if [ "$1" = "--strict" ]
+ then
+ echo >&2 "Error: there are uncommitted changes."
+ git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2
+ exit 1
+ else
+ DIRTY="-dirty"
+ fi
+ fi
+ VERSION=$(git describe --exact-match 2>/dev/null || echo "$MAJOR-git$(git show -s --pretty=format:%ci | cut -d ' ' -f 1 | tr -d '-').$(git show -s --pretty=format:%h)")$DIRTY
+else
+ VERSION=$(head -n 1 ChangeLog | cut -d ' ' -f 2)
+ if [ $VERSION = "master" ]
+ then
+ VERSION=$VERSION-$(head -n 1 ChangeLog | cut -d ' ' -f 1)
+ fi
+fi
+
+
+VERSION=$(echo "$VERSION" | sed 's/^v//')
echo '#define VERSION_STRING "'$VERSION'"' > version.h
echo $VERSION
diff --git a/src/tint.c b/src/tint.c
index 15fd259..ec4e7e6 100644
--- a/src/tint.c
+++ b/src/tint.c
@@ -374,6 +374,20 @@ void x11_io_error(Display *display)
handle_crash("X11 I/O error");
}
+void print_usage()
+{
+ printf("Usage: tint2 [OPTION...]\n"
+ "\n"
+ "Options:\n"
+ " -c path_to_config_file Loads the configuration file from a\n"
+ " custom location.\n"
+ " -v, --version Prints version information and exits.\n"
+ " -h, --help Display this help and exits.\n"
+ "\n"
+ "For more information, run `man tint2` or visit the project page\n"
+ ".\n");
+}
+
void init(int argc, char *argv[])
{
// Make stdout/stderr flush after a newline (for some reason they don't even if tint2 is started from a terminal)
@@ -400,7 +414,7 @@ void init(int argc, char *argv[])
for (int i = 1; i < argc; ++i) {
int error = 0;
if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
- printf("Usage: tint2 [[-c] ]\n");
+ print_usage();
exit(0);
} else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) {
printf("tint2 version %s\n", VERSION_STRING);
@@ -438,7 +452,7 @@ void init(int argc, char *argv[])
error = 1;
}
if (error) {
- printf("Usage: tint2 [[-c] ]\n");
+ print_usage();
exit(1);
}
}
@@ -1641,8 +1655,8 @@ start:
if (!config_read()) {
fprintf(stderr,
- "Could not read config file.\n"
- "Usage: tint2 [[-c] ]\n");
+ "Could not read config file.\n");
+ print_usage();
cleanup();
exit(1);
}