-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from JJoeDev/dev
Dev
- Loading branch information
Showing
12 changed files
with
936 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,131 +1,89 @@ | ||
# MiBar | ||
|
||
![Header](./github_assets/github-header-image.png) | ||
|
||
(image generated with [github-profile-header-generator](https://github.com/leviarista/github-profile-header-generator?tab=readme-ov-file)) | ||
|
||
> [!WARNING] | ||
> | ||
> MiBar is under heavy development and should not be used yet. | ||
> MiBar is at a usable | ||
## Table of content | ||
[Intro](#intro) | ||
![Header_image](./github_assets/github-header-image.png) | ||
(image generated with [github-profile-header-generator](https://github.com/leviarista/github-profile-header-generator?tab=readme-ov-file)) | ||
|
||
[Current state](#current-state) | ||
MiBar is a simple Linux X11 status bar with Lua support | ||
|
||
[Current and future features](#features--planned) | ||
## Description | ||
|
||
[How to build, run & configure](#building-and-running) | ||
MiBar is a simple Linux X11 status bar built with the C++ programming language. The application uses 2 external libraries, XCB to interact with the X server, and sol2 to run user made lua scripts. | ||
|
||
- [Building](#building) | ||
MiBar is supposed to be customizable and easy to configure. This is the reason for using the Lua language for plugins as it makes it easy to develop for MiBar. | ||
|
||
- [Configuring](#configuration) | ||
## Getting Started | ||
|
||
- [Custom modules](#creating-custom-modules) | ||
Currently the only way to use MiBar is by building from source. | ||
|
||
[Dependencies](#dependencies) | ||
### Dependencies | ||
|
||
[Images](#images) | ||
* git | ||
* cmake | ||
* make | ||
* All xcb libraries | ||
* sol2 | ||
|
||
[Getting involved](#getting-involved) | ||
### Installing | ||
|
||
## Intro | ||
MiBar is a C++17 app designed to be a user-friendly and configurable status bar for the X11 window system on linux. The goal is to create a minimal and light weight status bar with easy customization and extendability so users can create their own bar components. | ||
MiBar can only be run by building from source until a future release. | ||
|
||
## Current state | ||
MiBar is in the early stages of development so components like configuration are not 100% in place and will have to take place in a C header file for now, this has the consequence of requireing the application to be recompiled every time the configuration file is modifed. | ||
But until then this is how you can use MiBar | ||
|
||
Custom components are also not implemented yet and neither is components like: time, volume, and so on. | ||
``` | ||
$ git clone https://github.com/JJoeDev/MiBar.git | ||
$ cd MiBar | ||
$ cmake -DCMAKE_BUILD_TYPE=Release . | ||
$ make | ||
``` | ||
|
||
## Features (+ planned) | ||
### Executing program | ||
|
||
*More features might be added in the future* | ||
Once MiBar has bin built from source the executable can be found in the bin directory | ||
``` | ||
$ ./bin/MiBar | ||
``` | ||
|
||
* (Basic Implementation) **Modules:** MiBar would like for users to be able to create their own modules for the bar to allow for even more customizability | ||
* (planned) **Configuration:** At some point in the future MiBar should move away from the C header file to a toml or json approach for configuration | ||
* (planned) **Fonts** Currently MiBar only supports X11 fonts (use xlsfonts to see all fonts) in the future we should switch to cairo | ||
## Configuring | ||
|
||
## Building and running | ||
The current version includes a config file in the form of a C header file located in ``miBar/src/general.config.h``. Each time this config file is modified a recompilation is required. | ||
Currently the bar uses a C header file for its configuration, when changing this file you will need to recompile the application again. | ||
|
||
### Building | ||
The configuration file can be found in [src/general.config.h](./src/general.config.h) | ||
|
||
Before you can build you need to make sure libxcb is installes and sol2 should also be installed | ||
## Images | ||
|
||
*On Arch linux* | ||
![Image_1](./github_assets/DemoBar.png) | ||
|
||
``` | ||
$ sudo pacman -S libxcb | ||
$ yay -S sol2 | ||
``` | ||
![Image_2](./github_assets/DemoBar2.png) | ||
|
||
*Building* | ||
![Image_3](./github_assets/DemoBarWLua.png) | ||
|
||
``` | ||
$ cd /Path/To/MiBar/CMakeLists.txt | ||
$ cmake . -DCMAKE_BUILD_TYPE=Release | ||
$ cmake --build . | ||
$ ./bin/MiBar | ||
``` | ||
## Plugin Development | ||
|
||
### Configuration | ||
The current method to configure the bar is to take a look in [general.config.h](./src/general.config.h) for configuration directly to the bar | ||
|
||
To get modules on the bar such as text or a clock you will have to find a lua script for MiBar and move it to ``$HOME/.config/MiBar/plugins`` | ||
|
||
[general.config.h](./src/general.config.h) | ||
```C | ||
#ifndef MIBAR_GENERAL_CONFIG_H | ||
#define MIBAR_GENERAL_CONFIG_H | ||
|
||
// Colors to use | ||
#define BACKGROUND 0x0A3632 | ||
#define FOREGROUND 0xC6EFEB | ||
#define COLOR1 0x115852 | ||
#define COLOR2 0x237E76 | ||
#define COLOR3 0x3CA99F | ||
|
||
// Monitor for MiBar to find | ||
#define TARGET_MONITOR "HDMI-0" | ||
|
||
// Bar configuration | ||
#define BAR_WIDTH 0 | ||
#define BAR_HEIGHT 40 | ||
#define BAR_X 0 | ||
#define BAR_Y 0 | ||
|
||
// Underline configuration | ||
#define ENABLE_UNDERLINE 1 | ||
#define UNDERLINE_HEIGHT 3 | ||
#define UNDERLINE_X_OFFSET -1 | ||
#define UNDERLINE_Y_OFFSET -10 | ||
|
||
// Currently only PADDING_TOP & PADDING_LEFT is in use | ||
#define PADDING_TOP 10 | ||
#define PADDING_RIGHT 0 | ||
#define PADDING_BOTTOM 0 | ||
#define PADDING_LEFT 5 | ||
|
||
#endif | ||
``` | ||
MiBar allowes for users to create their own bar by creating plugins that do what they want them to do. Lua is a simple and easy scripting language with tons of documentation online. | ||
|
||
## Creating custom modules | ||
At this point in time the bar only supports drawing text to the bar, all in the same spot. MiBar has exposed a function to lua called ``Draw()`` that only accepts a string as its argument. | ||
### Creating a Plugin | ||
|
||
```cpp | ||
void Draw(const std::string& str); | ||
``` | ||
* **Director:** Plugins should be located in ```~/.config/MiBar/plugins``` | ||
* **Available Functions** MiBar currently only exposes one function to the plugins, Here is an example of how to use it | ||
* * ```DrawString(text, alignment, x_position)```: This function draws a string to the status bar | ||
* * - ```text```: This is the string that will get displayed on the status bar | ||
* * - ```alignment```: This is an alignment option (``LEFT``, ``CENTER``, or ``RIGHT``) | ||
* * - ```x_position```: This is an added position on top of the alignment option | ||
|
||
## Dependencies | ||
[xcb](https://xcb.freedesktop.org/) is used to interact with the X11 server | ||
**Time.lua**: Time.lua is a simple plugin that simply displays the current time on the center of the bar | ||
|
||
[sol2](https://github.com/ThePhD/sol2) Is used to interact with lua | ||
```lua | ||
local time = os.date("%a %d / %H:%M") | ||
|
||
## Images | ||
![DemoImage](./github_assets/DemoBar.png) | ||
DrawString(time, Alignment.CENTER, 0) | ||
``` | ||
|
||
![DemoImage2](./github_assets/DemoBar2.png) | ||
For a visual example of this script take a look at the third [image](#images) | ||
|
||
## Getting involved | ||
## License | ||
|
||
Currently, the project is not actively seeking contributions. However, if you have any suggestions or find potential improvements, feel free to reach out. Well-explained pull requests with clear descriptions and code comments will be considered for future versions. | ||
This project is licensed under the GNU General Public License v3.0 License - see the [LICENSE](./LICENSE) file for details |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.