-
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add options to draw indicator as polygon #258
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -444,6 +444,20 @@ Sets the number of minibars to draw on each screen. | |
.B \-\-bar\-total\-width | ||
The total width of the bar. Can be an expression. | ||
|
||
.TP | ||
.B \-\-polygon\-sides | ||
Draw the indicator as a regular polygon instead of a circle. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should document the required arg (number of sides, in addition to current info here) |
||
|
||
.TP | ||
.B \-\-polygon\-rotation=degrees\-as\-double | ||
The angle to rotate the indicator polygon by. | ||
|
||
.TP | ||
.B \-\-polygon\-highlight={0, 1, 2} | ||
Sets the highlight mode when drawing the indicator as a polygon. 0 highlights a | ||
random edge on each keypress, 1 highlights consecutive edges clockwise, 2 highlights | ||
counterclockwise. Highlights reverse direction while backspacing. | ||
|
||
.TP | ||
.B \-\-redraw\-thread | ||
Starts a separate thread for redrawing the screen. Potentially worse from a | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -294,6 +294,11 @@ char bar_width_expr[32] = ""; // empty string means full width based on bar orie | |
bool bar_bidirectional = false; | ||
bool bar_reversed = false; | ||
|
||
// Polygon indicator | ||
int polygon_sides = 0; | ||
double polygon_rotation = 0; | ||
int polygon_highlight = 0; | ||
|
||
/* isutf, u8_dec © 2005 Jeff Bezanson, public domain */ | ||
#define isutf(c) (((c)&0xC0) != 0x80) | ||
|
||
|
@@ -1493,6 +1498,9 @@ int main(int argc, char *argv[]) { | |
{"indicator", no_argument, NULL, 401}, | ||
{"radius", required_argument, NULL, 402}, | ||
{"ring-width", required_argument, NULL, 403}, | ||
{"polygon-sides", required_argument, NULL, 404}, | ||
{"polygon-rotation", required_argument, NULL, 405}, | ||
{"polygon-highlight", required_argument, NULL, 406}, | ||
|
||
// alignment | ||
{"time-align", required_argument, NULL, 500}, | ||
|
@@ -1810,6 +1818,28 @@ int main(int argc, char *argv[]) { | |
fprintf(stderr, "ring-width must be a positive float; ignoring...\n"); | ||
ring_width = 7.0; | ||
} | ||
break; | ||
case 404: | ||
arg = optarg; | ||
if (sscanf(arg, "%d", &polygon_sides) != 1) | ||
errx(EXIT_FAILURE, "polygon-sides must be a number\n"); | ||
if (polygon_sides < 3) | ||
errx(EXIT_FAILURE, "polygon-sides must be greater then 2 or 0\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't be 0 either |
||
break; | ||
case 405: | ||
arg = optarg; | ||
if (sscanf(arg, "%lf", &polygon_rotation) != 1) | ||
errx(1, "polygon-rotation must be a number\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use EXIT_FAILURE |
||
polygon_rotation = polygon_rotation * (M_PI / 180); | ||
break; | ||
case 406: | ||
arg = optarg; | ||
if (sscanf(arg, "%d", &polygon_highlight) != 1) | ||
errx(1, "polygon-highlight must be a number\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use EXIT_FAILURE |
||
if (polygon_highlight < 0 || polygon_highlight > 2) { | ||
fprintf(stderr, "polygon-highlight must be between 0 and 2; ignoring...\n"); | ||
polygon_highlight = 0; | ||
} | ||
break; | ||
|
||
// Alignment stuff | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed this