xob is a very small project. There is no particular template for issues or pull requests. All reviews, expert wisdom, suggestions, and contributions are welcome.
Coding style is llvm with Allman indentation style and 4 spaces per indentation (use clang-format). See the .clang-format file.
There are three parts in this project:
mainparses the arguments, looks for a configuration file, and contains the main loop.parse_inputreads a value from the standard input and returns anInput_value: it contains the value itself, whether it is in normal or alternate mode (e.g. muted), and avalidboolean in case the provided input cannot be parsed.- Main loop After initialising a
Display_contextusing the informationstylefrom a configuration file, the program waits for input on stdin.selectis used to provide a timeout mechanism during this wait. This is in case the bar has been displayed enough time and needs to be hidden usinghide. If the bar is not on display, there is no timeout. When an input is available, it is parsed usingparse_input. If it is not a valid input (not a number followed or not by '!'), xob stops. If it is valid, the bar is displayed usingdisplay.
confparses a configuration file and generates a valid configuration.Styleis the structure for a style (or "configuration").conf.hdefinesDEFAULT_CONFIGURATIONthe default hard-coded configuration.parse_style_configbuilds a style from a configuration file reporting errors if need be.
displayhandles the X related stuff to construct, update, display, and hide the bar.- All information required to show, update, and hide a given bar is sumed-up as a
Display_contextvalue. initbuilds a display context corresponding to a given style.showdisplays the bar, given a value, maximum value, whether the display mode is normal or alternate (show_mode), and the prefered way to represent overflows (overflow_mode).hidehides the bar
- All information required to show, update, and hide a given bar is sumed-up as a
Do not hesitate to issue requests for additional information.