Giter Club home page Giter Club logo

peaclock's Introduction

Peaclock

A responsive and customizable clock, timer, and stopwatch for the terminal.

peaclock

Click the above image to view a video of Peaclock in action.

Contents

About

Peaclock is a responsive and customizable clock, timer, and stopwatch for the terminal.

The clock output changes depending on the selected mode and view. The mode determines the clock value, while the view determines how that value is presented. The clock, timer, and stopwatch modes can be displayed with an ascii, digital, or binary clock view. The clock can be customized, such as changing the width, height, colour, padding, and margin. When in auto size mode, the clock becomes responsive, filling up the full size of the terminal. The clock can also be set to conform to a specific aspect ratio, allowing the clock to auto resize without becoming stretched.

Features

  • clock, timer, and stopwatch modes
  • ascii, digital, and binary clock views
  • display a custom date string
  • execute a shell command upon timer completion
  • set a specific locale
  • set a specific timezone
  • auto size the clock to fit the width and height of the terminal
  • auto size the clock to conform to a specific aspect ratio
  • load settings from a configuration file
  • save and load the command history
  • fuzzy search the command history
  • toggle seconds display
  • toggle 12 or 24 hour time format
  • use 4-bit, 8-bit, and 24-bit colours to personalize the clock
  • use the built-in command prompt or a selection of keybindings to adjust and customize the clock while the program is running

Usage

View the usage and help output with the --help or -h flag, or ./doc/help.txt to view the help output as a plain text file.

Binary Clock

The following is a short guide explaining how to read the binary clock.

  |   |   | < 8
  | | | | | < 4
| | | | | | < 2
| | | | | | < 1
H H M M S S < Time Digit

Each column represents a single digit. The first two columns are the two hour digits, the next two are the minute digits, and the last two are the seconds digits.

The bottom row is the low-order bit, which makes it worth a value of 1. The next row up is worth 2, then 4, followed by 8. Adding up the on bits gives the value of the digit.

Terminal Compatibility

This program uses raw terminal control sequences to manipulate the terminal, such as moving the cursor, styling the output text, and clearing the screen. Although some of the control sequences used may not work as intended on all terminals, they should work fine on any modern terminal emulator.

Pre-Build

This section describes what environments this program may run on, any prior requirements or dependencies needed, and any third party libraries used.

Important

Any shell commands using relative paths are expected to be executed in the root directory of this repository.

Environments

  • Linux (supported)
  • BSD (supported)
  • macOS (supported)

Compilers

  • GCC >= 8.0.0 (supported)
  • Clang >= 7.0.0 (supported)
  • Apple Clang >= 11.0.0 (untested)

Dependencies

  • CMake >= 3.8
  • PThread
  • ICU >= 62.1

Linked Libraries

  • pthread (libpthread) POSIX threads library
  • icuuc (libicuuc) part of the ICU library
  • icui18n (libicui18n) part of the ICU library

Included Libraries

  • Parg: for parsing CLI args, modified and included as ./src/ob/parg.hh

macOS

Using a new version of GCC or Clang is required, as the default Apple Clang compiler does not support C++17 Standard Library features such as std::filesystem.

A new compiler can be installed through a third-party package manager such as Brew. Assuming you have Brew already installed, the following commands should install the latest GCC.

brew install gcc
brew link gcc

The following CMake argument will then need to be appended to the end of the line when running the shell script. Remember to replace the placeholder <path-to-g++> with the canonical path to the new g++ compiler binary.

./RUNME.sh build -- -DCMAKE_CXX_COMPILER='<path-to-g++>'

Build

The included shell script will build the project in release mode using the build subcommand:

./RUNME.sh build

Install

The included shell script will install the project in release mode using the install subcommand:

./RUNME.sh install

Configuration

Config Directory (DIR): ${HOME}/.peaclock
History Directory: DIR/history
Config File: DIR/config
Command History File: DIR/history/command

Use --config=<file> to override the default config file.
Use --config-dir=<dir> to override the default config directory.

The config directory and config file must be created by the user.

The config file in the config directory must be named config. It is a plain text file that can contain any of the commands listed in the Commands section of the --help output. Each command must be on its own line. Lines that begin with the # character are treated as comments.

If you want to permanently use a different config directory, such as ~/.config/peaclock, add the following line to your shell profile:

alias peaclock="peaclock --config-dir ~/.config/peaclock"

The following shell commands will create the config directory in the default location and copy over the example config file:

mkdir -pv ~/.peaclock
cp -uv ./cfg/default ~/.peaclock/config

Several config file examples can be found in the ./cfg directory.

default

default

octobanana

octobanana

digital

digital

digital-party

digital-party

binary

binary

binary-party

binary-party

binary-unicode

binary-unicode

License

This project is licensed under the MIT License.

Copyright (c) 2019 Brett Robinson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

peaclock's People

Contributors

cspiegel avatar ezrizhu avatar octobanana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

peaclock's Issues

Please don't ignore the supplied CXXFLAGS

This change is needed:

--- CMakeLists.txt.orig 2019-05-23 00:24:50 UTC
+++ CMakeLists.txt
@@ -13,7 +13,7 @@ endif (CCACHE_FOUND)
 set (CMAKE_CXX_STANDARD 17)
 set (CMAKE_CXX_STANDARD_REQUIRED ON)
 
-set (CMAKE_CXX_FLAGS "-std=c++17 -fdiagnostics-color=auto")
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fdiagnostics-color=auto")
 
 set (DEBUG_FLAGS "-g -Og -rdynamic -Wpedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused")
 set (DEBUG_LINK_FLAGS "-fprofile-arcs -ftest-coverage")

Clock is too small

The clock appears pretty small on my terminal. I'm not sure if this is intended behavior or not, still I'd like to know if there is a way to make it bigger other than changing my font size. Here's a screenshot of how it looks like, and my neofetch for reference.

Peaclock doesn't work on Windows

Hello,
I used MSYS2 with cmake and gcc to build peaclock. But when I execute it with

./peaclock

it outputs

Aborted (core dumped)

I looked in the peaclock.exe.stackdump file and found this:

Stack trace:
Frame        Function    Args
000FFFFBCC0  0018005D16C (00000000000, 00000000002, 000FFFFBED8, 000FFFFDE50)
000FFFFBD60  0018005E77B (00000000064, 00000000000, 00000000000, 00000000000)
000FFFFBFB0  00180123ACD (00000000000, 00000010000, 7FFFCCECC822, 00000000000)
00180010000  001801202AE (0000000008A, 00000000000, 00000000000, 000FFFFC6B0)
00526902560  00180120762 (0052689C0AD, 00000000219, 00000000219, 00000000006)
00526902560  001801209AA (005268A501D, 0052690F920, 00526856CBD, 00000000020)
00526902560  00180120C6F (005268FE7C2, 00000000038, 00000000038, 000FFFFC5D0)
00526902560  0018015A0C6 (000FFFFC5B8, 00600017E10, 00526901B50, 00000000000)
00526902560  001800BA8E3 (0052690E940, 0052690E898, 005268FE7C2, 00526911320)
00526902560  0018011BEDB (0052690E940, 0052690E898, 005268FE7C2, 00526911320)
00526902560  005268C5A4C (000FFFFC5D0, 000FFFFC518, 000FFFFC708, 000FFFFC638)
00000000001  005268C443A (0010041863B, 005269185A0, 0018011BEDB, 001004310A0)
00000000001  005268F1893 (00600017CA8, 00180142BC1, 00600017BB8, 00600017A18)
000FFFFC950  0010040FEA3 (00000000000, 000FFFFC848, 000FFFFC850, 000FFFFC870)
00000000000  001004025F2 (001800D8194, 00600000413, 000FFFFCA60, 000FFFFCA60)
000FFFFCCB0  0010042D861 (00000000020, 30001000000FF00, 00180047986, 00180046990)
End of stack trace (more stack frames may be present)

Config settings

Is there a config file somewhere or do I have to put in each command to get it to look how I want each time I open a window?

Error while building on Raspberry Pi

Hello! I just tried building peaclock for my Raspi to use it on a nice small display. I ran into an error during compilation. Sadly I have no clue about C++ and linking and all that stuff, so I just used my Google Fu and went with trial and error.

It was a error referencing some file system issues and the way I solved it was by adding link_libraries(stdc++fs) to the CMakeLists.txt. Source

Maybe you can make sense of it and fix it for the people coming after me. :)

Issues with icu4c on Mac

I installed all the pre-requisites and got the following with icu4c:

icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
For pkg-config to find icu4c you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

I proceeded to go through with the install and got the following error
Build type: release -- Building peaclock 0.4.3 in release mode: System: Darwin-19.5.0 CXX compiler: GNU 10.2.0 -- Configuring done -- Generating done -- Build files have been written to: /Users/ivan.blazic/workspace/peaclock/build/release [ 16%] Building CXX object CMakeFiles/peaclock.dir/src/ob/readline.cc.o [ 33%] Building CXX object CMakeFiles/peaclock.dir/src/main.cc.o In file included from /Users/ivan.blazic/workspace/peaclock/./src/ob/readline.hh:4, from /Users/ivan.blazic/workspace/peaclock/src/ob/readline.cc:1: /Users/ivan.blazic/workspace/peaclock/./src/ob/text.hh:6:10: fatal error: unicode/coll.h: No such file or directory 6 | #include <unicode/coll.h> | ^~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [CMakeFiles/peaclock.dir/src/ob/readline.cc.o] Error 1 make[2]: *** Waiting for unfinished jobs.... In file included from /Users/ivan.blazic/workspace/peaclock/./src/ob/rect.hh:5, from /Users/ivan.blazic/workspace/peaclock/./src/peaclock/peaclock.hh:5, from /Users/ivan.blazic/workspace/peaclock/src/peaclock/tui.hh:4, from /Users/ivan.blazic/workspace/peaclock/src/main.cc:10: /Users/ivan.blazic/workspace/peaclock/./src/ob/text.hh:6:10: fatal error: unicode/coll.h: No such file or directory 6 | #include <unicode/coll.h> | ^~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [CMakeFiles/peaclock.dir/src/main.cc.o] Error 1 make[1]: *** [CMakeFiles/peaclock.dir/all] Error 2 make: *** [all] Error 2

I can't seem to resolve it as I can't brew link icu4c even if I force it, and adding it to the PATH does not seem to work either.

Build Error

can anyone help me?
my system Linux deepneon 5.10.29-amd64-desktop #2 SMP Mon Apr 26 09:48:13 CST 2021 x86_64 GNU/Linux

deep@deepneon:~/Downloads/peaclock-0.4.3$ ./RUNME.sh build -- -DCMAKE_CXX_COMPILER=/usr/bin/g++
Build type: release
-- The CXX compiler identification is GNU 8.3.0
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building peaclock 0.4.3 in release mode:
     System: Linux-5.10.29-amd64-desktop
     CXX compiler: GNU 8.3.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/deep/Downloads/peaclock-0.4.3/build/release
Scanning dependencies of target peaclock
[ 33%] Building CXX object CMakeFiles/peaclock.dir/src/ob/string.cc.o
[ 33%] Building CXX object CMakeFiles/peaclock.dir/src/main.cc.o
[ 50%] Building CXX object CMakeFiles/peaclock.dir/src/ob/readline.cc.o
[ 83%] Building CXX object CMakeFiles/peaclock.dir/src/peaclock/tui.cc.o
[ 83%] Building CXX object CMakeFiles/peaclock.dir/src/peaclock/peaclock.cc.o
[100%] Linking CXX executable peaclock
/usr/bin/ld: /tmp/cc4aWbJQ.ltrans0.ltrans.o: in function `std::filesystem::__cxx11::path::path<char [5], std::filesystem::__cxx11::path>(char const (&) [5], std::filesystem::__cxx11::path::format) [clone .constprop.134]':
<artificial>:(.text+0x7d56): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: /tmp/cc4aWbJQ.ltrans2.ltrans.o: in function `Tui::command(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
<artificial>:(.text+0x35c): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: <artificial>:(.text+0x364): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
/usr/bin/ld: <artificial>:(.text+0x4c7): undefined reference to `std::filesystem::__cxx11::path::lexically_normal() const'
/usr/bin/ld: <artificial>:(.text+0x219c): undefined reference to `std::filesystem::__cxx11::path::lexically_normal() const'
/usr/bin/ld: <artificial>:(.text+0x3281): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
/usr/bin/ld: <artificial>:(.text+0x329e): undefined reference to `std::filesystem::__cxx11::path::lexically_normal() const'
/usr/bin/ld: <artificial>:(.text+0x3392): undefined reference to `std::filesystem::__cxx11::path::lexically_normal() const'
/usr/bin/ld: <artificial>:(.text+0x347f): undefined reference to `std::filesystem::__cxx11::path::lexically_normal() const'
/usr/bin/ld: /tmp/cc4aWbJQ.ltrans3.ltrans.o: in function `Tui::load_config(std::filesystem::__cxx11::path const&)':
<artificial>:(.text+0x6a05): undefined reference to `std::filesystem::__cxx11::path::compare(std::filesystem::__cxx11::path const&) const'
/usr/bin/ld: <artificial>:(.text+0x6a4a): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
/usr/bin/ld: /tmp/cc4aWbJQ.ltrans5.ltrans.o: in function `std::filesystem::__cxx11::path OB::Parg::get<std::filesystem::__cxx11::path, 0>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
<artificial>:(.text+0x8134): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: /tmp/cc4aWbJQ.ltrans9.ltrans.o: in function `std::filesystem::__cxx11::path::operator/=(std::filesystem::__cxx11::path const&)':
<artificial>:(.text+0x3960): undefined reference to `std::filesystem::__cxx11::path::has_root_directory() const'
/usr/bin/ld: <artificial>:(.text+0x3995): undefined reference to `std::filesystem::__cxx11::path::has_filename() const'
/usr/bin/ld: <artificial>:(.text+0x39b7): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: /tmp/cc4aWbJQ.ltrans7.ltrans.o: in function `main':
<artificial>:(.text.startup+0x784): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'
/usr/bin/ld: <artificial>:(.text.startup+0x83d): undefined reference to `std::filesystem::__cxx11::path::compare(std::filesystem::__cxx11::path const&) const'
/usr/bin/ld: <artificial>:(.text.startup+0x849): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
/usr/bin/ld: <artificial>:(.text.startup+0x41ba): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
/usr/bin/ld: <artificial>:(.text.startup+0x4257): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
/usr/bin/ld: <artificial>:(.text.startup+0x426e): undefined reference to `std::filesystem::create_directory(std::filesystem::__cxx11::path const&)'
/usr/bin/ld: <artificial>:(.text.startup+0x44ca): undefined reference to `std::filesystem::status(std::filesystem::__cxx11::path const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/peaclock.dir/build.make:144: peaclock] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/peaclock.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

macOS build problems

This is the log after I typed ./build on macOS Mojave. I have no understanding of C++/C, so can't help much sorry. Tell me if anything needed.

And exit code is 2 according to echo $?.

Setting Environment Variables

Building peaclock in release mode

Compiling peaclock
-- The C compiler identification is AppleClang 10.0.0.10001044
-- The CXX compiler identification is AppleClang 10.0.0.10001044
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMAKE_BUILD_TYPE is release
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Kutsan/Documents/peaclock/build/release
Scanning dependencies of target peaclock
[ 20%] Building CXX object CMakeFiles/peaclock.dir/src/main.cc.o
clang: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
[ 40%] Building CXX object CMakeFiles/peaclock.dir/src/ob/string.cc.o
clang: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
[ 60%] Building CXX object CMakeFiles/peaclock.dir/src/peaclock/peaclock.cc.o
clang: warning: argument unused during compilation: '-s' [-Wunused-command-line-argument]
/Users/Kutsan/Documents/peaclock/src/peaclock/peaclock.cc:205:20: error: call to 'wrap' is ambiguous
            buf << aec::wrap(_config.symbol, {_config.style.active, _config.style.bold});
                   ^~~~~~~~~
/Users/Kutsan/Documents/peaclock/./src/ob/term.hh:367:13: note: candidate function [with T = std::__1::basic_string<char>]
std::string wrap(T const val_, std::string const attr_, bool color_ = true)
            ^
/Users/Kutsan/Documents/peaclock/./src/ob/term.hh:387:13: note: candidate function [with T = std::__1::basic_string<char>]
std::string wrap(T const val_, std::vector<std::string> const attr_, bool color_ = true)
            ^
/Users/Kutsan/Documents/peaclock/src/peaclock/peaclock.cc:210:20: error: call to 'wrap' is ambiguous
            buf << aec::wrap(_config.symbol, {_config.style.inactive, _config.style.bold});
                   ^~~~~~~~~
/Users/Kutsan/Documents/peaclock/./src/ob/term.hh:367:13: note: candidate function [with T = std::__1::basic_string<char>]
std::string wrap(T const val_, std::string const attr_, bool color_ = true)
            ^
/Users/Kutsan/Documents/peaclock/./src/ob/term.hh:387:13: note: candidate function [with T = std::__1::basic_string<char>]
std::string wrap(T const val_, std::vector<std::string> const attr_, bool color_ = true)
            ^
/Users/Kutsan/Documents/peaclock/src/peaclock/peaclock.cc:245:18: error: call to 'wrap' is ambiguous
          buf << aec::wrap(_digital_clock.at(i), {_config.style.active, _config.style.bold});
                 ^~~~~~~~~
/Users/Kutsan/Documents/peaclock/./src/ob/term.hh:367:13: note: candidate function [with T = int]
std::string wrap(T const val_, std::string const attr_, bool color_ = true)
            ^
/Users/Kutsan/Documents/peaclock/./src/ob/term.hh:387:13: note: candidate function [with T = int]
std::string wrap(T const val_, std::vector<std::string> const attr_, bool color_ = true)
            ^
/Users/Kutsan/Documents/peaclock/src/peaclock/peaclock.cc:251:22: error: call to 'wrap' is ambiguous
              buf << aec::wrap(":", {_config.style.inactive, _config.style.bold});
                     ^~~~~~~~~
/Users/Kutsan/Documents/peaclock/./src/ob/term.hh:367:13: note: candidate function [with T = const char *]
std::string wrap(T const val_, std::string const attr_, bool color_ = true)
            ^
/Users/Kutsan/Documents/peaclock/./src/ob/term.hh:387:13: note: candidate function [with T = const char *]
std::string wrap(T const val_, std::vector<std::string> const attr_, bool color_ = true)
            ^
4 errors generated.
make[2]: *** [CMakeFiles/peaclock.dir/src/peaclock/peaclock.cc.o] Error 1
make[1]: *** [CMakeFiles/peaclock.dir/all] Error 2
make: *** [all] Error 2

real    0m5.431s
user    0m4.703s
sys     0m0.532s

clang-8 prints many warnings

/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:209:21: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  << "set date " << btos(_peaclock.cfg.date) << "\n"
                    ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:209:21: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:210:24: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  << "set seconds " << btos(_peaclock.cfg.seconds) << "\n"
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:210:24: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:211:24: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  << "set hour-24 " << btos(_peaclock.cfg.hour_24) << "\n"
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:211:24: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:212:26: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  << "set auto-size " << btos(_peaclock.cfg.auto_size) << "\n"
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:212:26: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:213:27: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  << "set auto-ratio " << btos(_peaclock.cfg.auto_ratio) << "\n"
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:213:27: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:493:44: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        set_status(true, "set hour-24 "s + btos(_peaclock.cfg.hour_24));
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:493:44: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:501:44: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        set_status(true, "set seconds "s + btos(_peaclock.cfg.seconds));
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:501:44: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:509:41: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        set_status(true, "set date "s + btos(_peaclock.cfg.date));
                                        ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:509:41: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:517:46: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        set_status(true, "set auto-size "s + btos(_peaclock.cfg.auto_size));
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:517:46: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:525:47: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        set_status(true, "set auto-ratio "s + btos(_peaclock.cfg.auto_ratio));
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:525:47: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2282:19: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    if (match_opt = OB::String::match(input,
        ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2282:19: note: place parentheses around the assignment to silence this warning
    if (match_opt = OB::String::match(input,
                  ^
        (
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2282:19: note: use '==' to turn this assignment into an equality comparison
    if (match_opt = OB::String::match(input,
                  ^
                  ==
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2289:52: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        return std::make_pair(true, "set date "s + btos(_peaclock.cfg.date));
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2289:52: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2301:24: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    else if (match_opt = OB::String::match(input,
             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2301:24: note: place parentheses around the assignment to silence this warning
    else if (match_opt = OB::String::match(input,
                       ^
             (
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2301:24: note: use '==' to turn this assignment into an equality comparison
    else if (match_opt = OB::String::match(input,
                       ^
                       ==
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2308:55: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        return std::make_pair(true, "set seconds "s + btos(_peaclock.cfg.seconds));
                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2308:55: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2320:24: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    else if (match_opt = OB::String::match(input,
             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2320:24: note: place parentheses around the assignment to silence this warning
    else if (match_opt = OB::String::match(input,
                       ^
             (
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2320:24: note: use '==' to turn this assignment into an equality comparison
    else if (match_opt = OB::String::match(input,
                       ^
                       ==
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2327:55: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        return std::make_pair(true, "set hour-24 "s + btos(_peaclock.cfg.hour_24));
                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2327:55: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2339:24: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    else if (match_opt = OB::String::match(input,
             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2339:24: note: place parentheses around the assignment to silence this warning
    else if (match_opt = OB::String::match(input,
                       ^
             (
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2339:24: note: use '==' to turn this assignment into an equality comparison
    else if (match_opt = OB::String::match(input,
                       ^
                       ==
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2346:57: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        return std::make_pair(true, "set auto-size "s + btos(_peaclock.cfg.auto_size));
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2346:57: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2358:24: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    else if (match_opt = OB::String::match(input,
             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2358:24: note: place parentheses around the assignment to silence this warning
    else if (match_opt = OB::String::match(input,
                       ^
             (
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2358:24: note: use '==' to turn this assignment into an equality comparison
    else if (match_opt = OB::String::match(input,
                       ^
                       ==
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2365:58: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        return std::make_pair(true, "set auto-ratio "s + btos(_peaclock.cfg.auto_ratio));
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2365:58: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^

Screen stutters for modern GPU acceleration based terminals like Alacritty, iTerm2, etc; use redraw with NOT_VALID

Modern GPU based terminals draw the entire frame on redraws. The way to avoid screen from stuttering is to use a different approach to redrawing screen.

The solution is mentioned in neovim/neovim#14225 (comment), and vim/vim#8002 (comment). The solution is to redraw with
NOT_VALID, which would redraw everything but not clear the screen.

This problem is similar to vim on GPU accelerated terminals also has the problem and plans to fix it: vim/vim#8002

Here's an example of screen stuttering in peaclock (I am not pressing any keys in the video):

screensutter.mp4

conky support?

Hi, loving this program. Would be very nice to have it on my desktop as well ๐Ÿ˜„
Right now, ${exec peaclock} doesn't work, it produces garbled output.

garbled

config examples?

So awesome project! I have one question. The main page says there are some config examples in config/ but it seems there's only 'default' one. Where can I find more? How can I get this for example?
Screenshot-2020-03-22T16:25:14-07:00

Feature Request: Use XDG Base Directory Specification

I humbly request for peaclock to adhere to the xdg base directory specification. I request this because it seems like an easy change and the xdg standard very commonly used.

This means nstead of having the default location of config files at $HOME/.peaclock, locate them at $XDG_CONFIG_HOME/peaclock (usually $HOME/.config/peaclock). I realize that there is an option to change the config directory, but it is kind of unwieldy to have to use: peaclock --config-dir=$XDG_CONFIG_HOME/peaclock --config=$XDG_CONFIG_HOME/peaclock/timer05m to for example use peaclock as a timer.

Many clang-8 warnings

/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:209:21: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  << "set date " << btos(_peaclock.cfg.date) << "\n"
                    ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:209:21: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:210:24: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  << "set seconds " << btos(_peaclock.cfg.seconds) << "\n"
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:210:24: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:211:24: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  << "set hour-24 " << btos(_peaclock.cfg.hour_24) << "\n"
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:211:24: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:212:26: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  << "set auto-size " << btos(_peaclock.cfg.auto_size) << "\n"
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:212:26: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:213:27: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
  << "set auto-ratio " << btos(_peaclock.cfg.auto_ratio) << "\n"
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:213:27: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:493:44: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        set_status(true, "set hour-24 "s + btos(_peaclock.cfg.hour_24));
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:493:44: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:501:44: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        set_status(true, "set seconds "s + btos(_peaclock.cfg.seconds));
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:501:44: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:509:41: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        set_status(true, "set date "s + btos(_peaclock.cfg.date));
                                        ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:509:41: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:517:46: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        set_status(true, "set auto-size "s + btos(_peaclock.cfg.auto_size));
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:517:46: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:525:47: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        set_status(true, "set auto-ratio "s + btos(_peaclock.cfg.auto_ratio));
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:525:47: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2282:19: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    if (match_opt = OB::String::match(input,
        ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2282:19: note: place parentheses around the assignment to silence this warning
    if (match_opt = OB::String::match(input,
                  ^
        (
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2282:19: note: use '==' to turn this assignment into an equality comparison
    if (match_opt = OB::String::match(input,
                  ^
                  ==
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2289:52: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        return std::make_pair(true, "set date "s + btos(_peaclock.cfg.date));
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2289:52: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2301:24: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    else if (match_opt = OB::String::match(input,
             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2301:24: note: place parentheses around the assignment to silence this warning
    else if (match_opt = OB::String::match(input,
                       ^
             (
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2301:24: note: use '==' to turn this assignment into an equality comparison
    else if (match_opt = OB::String::match(input,
                       ^
                       ==
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2308:55: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        return std::make_pair(true, "set seconds "s + btos(_peaclock.cfg.seconds));
                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2308:55: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2320:24: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    else if (match_opt = OB::String::match(input,
             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2320:24: note: place parentheses around the assignment to silence this warning
    else if (match_opt = OB::String::match(input,
                       ^
             (
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2320:24: note: use '==' to turn this assignment into an equality comparison
    else if (match_opt = OB::String::match(input,
                       ^
                       ==
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2327:55: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        return std::make_pair(true, "set hour-24 "s + btos(_peaclock.cfg.hour_24));
                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2327:55: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2339:24: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    else if (match_opt = OB::String::match(input,
             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2339:24: note: place parentheses around the assignment to silence this warning
    else if (match_opt = OB::String::match(input,
                       ^
             (
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2339:24: note: use '==' to turn this assignment into an equality comparison
    else if (match_opt = OB::String::match(input,
                       ^
                       ==
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2346:57: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        return std::make_pair(true, "set auto-size "s + btos(_peaclock.cfg.auto_size));
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2346:57: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2358:24: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    else if (match_opt = OB::String::match(input,
             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2358:24: note: place parentheses around the assignment to silence this warning
    else if (match_opt = OB::String::match(input,
                       ^
             (
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2358:24: note: use '==' to turn this assignment into an equality comparison
    else if (match_opt = OB::String::match(input,
                       ^
                       ==
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2365:58: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
        return std::make_pair(true, "set auto-ratio "s + btos(_peaclock.cfg.auto_ratio));
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                 ~~~~~~~~~^~~~~~~~
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:2365:58: note: use array indexing to silence this warning
/usr/ports/misc/peaclock/work/peaclock-0.4.0/src/peaclock/tui.cc:38:27: note: expanded from macro 'btos'
#define btos(x) ("off\0on"+4*!!(x))
                          ^
20 warnings generated.

Toggle hours/minutes?

Hello,

Thanks so much for sharing this program! I've created a wrapper script that uses peaclock as a pomodoro timer. With the pomodoro technique, I set timers for at the most 25 minutes and therefore no hours. I was wondering if there was a way to toggle the expression of hours in the digital clock view similar to how you can toggle seconds? Toggling minutes aren't necessary for me, but I figured for general purpose that might be useful to implement as well.

Easier stopwatch setting not in Help

The stopwatch is great, but it's a pain to have to type stopwatch --h:--m:--s everytime I want to reset it.
My initial plan was to make it easier myself, but after looking through the code I found that you're totally allowed to enter the fields seperately, it's just that the help system doesn't give you any indication of this.

Could you please edit the help file to let the rest of us know?
Also, could you write in an abbreviation to that command so we can type in sw instead?

error: non-constant-expression cannot be narrowed from type 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1> >::rep' (aka 'long long') to 'long' in initializer list

http://beefy17.nyi.freebsd.org/data/head-i386-default/p529299_s359382/logs/peaclock-0.4.1.log (IPv6 URL)

clang-8 errors:

/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:86:25: error: non-constant-expression cannot be narrowed from type 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1> >::rep' (aka 'long long') to 'long' in initializer list [-Wc++11-narrowing]
    long int const now {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:86:25: note: insert an explicit cast to silence this issue
    long int const now {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        static_cast<long>(                                                                   )
/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:108:26: error: non-constant-expression cannot be narrowed from type 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1> >::rep' (aka 'long long') to 'long' in initializer list [-Wc++11-narrowing]
    long int const diff {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:108:26: note: insert an explicit cast to silence this issue
    long int const diff {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         static_cast<long>(                                                                   )
/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:120:26: error: non-constant-expression cannot be narrowed from type 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1> >::rep' (aka 'long long') to 'long' in initializer list [-Wc++11-narrowing]
    long int const diff {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:120:26: note: insert an explicit cast to silence this issue
    long int const diff {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         static_cast<long>(                                                                   )
3 errors generated.

Instructions for corss-building

Ref: #22

It takes a long time to build the program on a Raspberry Pi. Would you mind add an instruction about cross-building?

I'm not familiar with CMake. Buinding and installing are all proxyed by the RUNME.sh script, so I have no idea how to modify the script.

std::optional::value unavailable on earlier macOS versions

@octobanana That problem is fixed, but the earlier MacOS versions face another problem:
error: call to unavailable member function 'value': introduced in macOS 10.14

A possible workaround is to remove the optional regex matches from string.cc and string.hh. Something like that:

-std::optional<std::vector<std::string>> match(std::string const& str, std::regex rx);
+std::vector<std::string> match(std::string const& str, std::regex rx);

The logic of the optional regex matches in peacock.cc should be refactored then, as there will be no more match_opt's.

I have tried it locally just now, but the result seems a bit strange. There were no errors during the compilation and the clock runs just fine, the digital numbers are changing, but the binary ones are all enabled. Maybe something else went wrong, or my changes were incorrect.

Originally posted by @Dluzhnevsky in #1 (comment)

Exit peaclock when timer is finished?

I might be missing it, but I wanted to know if its possible to set an option to exit peaclock when the timer finishes?
adding exit to the end of the config file exit peaclock immediately and adding exit to timer-exec doesn't seem to work

peaclock crashes on musl systems

Peaclock crashes on my Void Linux musl system with the error:

Error: locale::facet::_S_create_c_locale name is not valid

This is because on musl systems, there is no locale.

System info
peaclock 0.4.0, compiled from source.

EDIT: I was able to get it working by doing:

$ unset LANGUAGE
$ LC_ALL=C peaclock

Binary clock represents decimal digits instead of actual time

Currently the binary clock shows the binary equivalent of each digit in the decimal representation of the time. For instance, 12 is represented as 01 0010; first the 1 is converted, and then the 2, with the results shown side-by-side. This is akin to representing 0xFF as "15 15" in decimal.

A more accurate method would be to convert the number rather than its constituent digits, so that 12 would be represented as 01100 on a 24 hour clock.

Perhaps a configuration option could allow users to choose between binary conversion of the digits in the decimal representation of the time, and binary conversion of the numbers in the time?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.