aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorne_mene <[email protected]>2026-03-02 11:42:31 +0100
committerne_mene <[email protected]>2026-03-02 11:42:31 +0100
commit07ac385fd9959d55590076bba49798e542e0b238 (patch)
tree2d0de6f7da6a81f885c4dfc2adee1aa62ce61e17
parente98200154c99323f7683f59491914e17608ce07f (diff)
readme and config flag change
-rw-r--r--README.md60
-rwxr-xr-xexamplebar.sh10
-rw-r--r--src/bardata.c12
3 files changed, 71 insertions, 11 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b8c6db5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,60 @@
+# Description
+A suckless statusbar for X11.
+
+It can draw text on the left, center and right part of the screen.
+Text and background color of each component may be set individually.
+
+Only updates when you give it new data.
+
+# Installation
+Run:
+```
+git clone https://codeberg.org/iamcheeseman/tsarbar
+cd tsarbar
+sudo make install
+```
+To uninstall run:
+```
+sudo make uninstall
+```
+
+# Usage
+Run the bar with `tsarbar`.
+
+You might notice it's not showing up, thats because we need to give it something to render.
+This is done using `tsarc`, tsarc is a script that forwards data to tsarbar.
+```
+tsarc [command] [args]
+```
+
+Available commands:
+```
+# Variable is any of {text, foreground/fg, background/bg}
+tsarc set [component] -[variable] [value]
+
+# Variable is any of {height, font, gap, padding, foreground/fg, background/bg}
+tsarc config -[variable] [value]
+
+# Side is any of {left, center, right}
+# Components 1 2 ... n are any components you previously set to
+tsarc layout -[side] [component 1 2 ... n] -[side] [component 1 2 ... n] ...
+```
+
+# Quick examples:
+
+This will set the text value of the component `label` to `"Lorem ipsum"`.
+Since that component doesnt exist yet, it will also implicitly create it.
+```
+tsarc set label -text "Lorem ipsum"
+```
+
+This will configure the font to use Liberation mono regular with a size of 9px.
+```
+tsarc config -font "Liberation Mono:style=Regular:size=9"
+```
+
+This will set the layout of the bar.
+On the right, left and center there will be a previously set `label` component.
+```
+tsarc layout -left label -center label -right label
+```
diff --git a/examplebar.sh b/examplebar.sh
index 28f8d0c..9a6f163 100755
--- a/examplebar.sh
+++ b/examplebar.sh
@@ -1,11 +1,11 @@
#! /bin/sh
# Put any monospace font here
-tsarc config font "Liberation Mono:style=Regular:size=9"
-tsarc config height 16
-tsarc config padding 4
-tsarc config bg #FFFFFF
-tsarc config bg #FF0000
+tsarc config -font "Liberation Mono:style=Regular:size=9"
+tsarc config -height 16
+tsarc config -padding 4
+tsarc config -foreground #FFFFFF
+tsarc config -background #000000
tsarc set test_comp -text "Testing spaces"
tsarc set sep -text " | "
diff --git a/src/bardata.c b/src/bardata.c
index 7929201..307f7ae 100644
--- a/src/bardata.c
+++ b/src/bardata.c
@@ -111,7 +111,7 @@ void set_layout(char argv[MAX_ARGS][MAX_ARG_LEN], int argc) {
void set_config(char argv[MAX_ARGS][MAX_ARG_LEN], int argc) {
char *var = argv[1];
- if (strcmp(var, "height") == 0) {
+ if (strcmp(var, "-height") == 0) {
int new_bar_height = atoi(argv[2]);
if (new_bar_height <= 0) {
fprintf(stderr, "invalid bar height %d\n", new_bar_height);
@@ -120,19 +120,19 @@ void set_config(char argv[MAX_ARGS][MAX_ARG_LEN], int argc) {
bar_height = new_bar_height;
return;
}
- if (strcmp(var, "font") == 0) {
+ if (strcmp(var, "-font") == 0) {
load_font(argv[2]);
return;
}
- if (strcmp(var, "gap") == 0) {
+ if (strcmp(var, "-gap") == 0) {
comp_gap = atoi(argv[2]);
return;
}
- if (strcmp(var, "padding") == 0) {
+ if (strcmp(var, "-padding") == 0) {
padding = atoi(argv[2]);
return;
}
- if (strcmp(var, "background") == 0 || strcmp(var, "bg") == 0) {
+ if (strcmp(var, "-background") == 0 || strcmp(var, "-bg") == 0) {
default_bg = parse_color(argv[2]);
XSetWindowAttributes win_attr = {
.background_pixel = default_bg.pixel,
@@ -140,7 +140,7 @@ void set_config(char argv[MAX_ARGS][MAX_ARG_LEN], int argc) {
XChangeWindowAttributes(display, win, CWBackPixel, &win_attr);
return;
}
- if (strcmp(var, "foreground") == 0 || strcmp(var, "fg") == 0) {
+ if (strcmp(var, "-foreground") == 0 || strcmp(var, "-fg") == 0) {
default_fg = parse_color(argv[2]);
XftColorFree(
display,