diff --git a/README.md b/README.md index 0ee6416..f79e59b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # xkcdlock -A wrapper around screen lockers to display xkcd images +A wrapper around screen lockers to display xkcd images +Currently supported are i3lock and swaylack Depending on the given arguments xkcdlock shows a random image, the latest image or an image of choice. @@ -9,11 +10,8 @@ If the download fails it falls back to a specific hard-coded image Builtin is a function to download all images. -Dependencies: rbash, i3lock, xrandr, awk, curl, - convert (from imagick) +## Dependencies +rbash, xrandr, awk, curl, convert (from imagick) -Use 'xkcdlock -h' to show the command help. - -In order to use the xkcd font for the image number overlay, -you need to download it from here: https://github.com/ipython/xkcd-font -and put the xkcd.otf in your font path, e.g. /usr/share/fonts +## Usage +Use ```'xkcdlock -h``` to show the command help. diff --git a/xkcdlock b/xkcdlock index b3620df..7073bef 100755 --- a/xkcdlock +++ b/xkcdlock @@ -22,9 +22,6 @@ # Thanks to Michael Stapelberg for an awesome window manager - i3 # # TODO: -# - Make sure we do not exceed screen boundaries in x and y -# - Improve tooltip text border overflow prevention -# wrt display resolution (and font size?) # - Add support for other screen lockers # - Parallelize downloads @@ -48,6 +45,9 @@ BG_COLOUR="white" # Break tooltip every x char to prevent border overflow TOOLTIP_MAX_LINE_LEN=100 +# git rev-list --count HEAD +VERSION=19 + # Reduce image size by x pixels in x and y dimension # so that the tooltip does not overlay image IMAGE_PADDING_PX=100 @@ -83,16 +83,22 @@ get_script_path() { } show_help() { - printf "\n xkcd_lock v1\n\n\ + printf "\n xkcdlock ${VERSION}\n\n\ Available options are:\n\n \ -d download images to current working directory\n \ -h show this help\n \ -i show specific image file - overrides '-m'\n \ -l lock program: one of i3lock/swaylock\n \ -m latest|random default: random\n \ - -v be verbose\n\n" + -v be verbose\n \ + -V show version\n\n" } +show_version() { + printf "\n xkcdlock ${VERSION}\n\n" +} + + check_dependencies() { for i in "${DEPS[@]}" do @@ -324,7 +330,7 @@ main() { local locker=$(which $LOCK_BIN) local OPTIND - while getopts "h?i:l:vm:dy" opt; do + while getopts "h?i:l:vVm:dy" opt; do case "$opt" in d) printf "%s${DOWNLOAD_DISCLAIMER}" @@ -353,6 +359,10 @@ main() { v) VERBOSE=1 ;; + V) + show_version + exit 0 + ;; y) r=$(xkcd_get_all_images) exit 0