diff --git a/quickinstall b/quickinstall index 8ac0967..a50fa12 100755 --- a/quickinstall +++ b/quickinstall @@ -53,7 +53,13 @@ if [[ -d $SRCDIR ]]; then echo "Compiling binaries..." echo "(This can take a while, please be patient)" newtmp - make -j 24 "$@" 2>$TMPFILE + # Find out how many cores the system has, for make + JOBS=$(getconf _NPROCESSORS_ONLN 2>/dev/null) + # Default to 2 jobs if something went wrong earlier + if [[ -z "$JOBS" ]]; then + JOBS=2 + fi + make -j "$JOBS" "$@" 2>$TMPFILE checkfail $? echo "" echo "Finished!" diff --git a/src/ckb-pinwheel/main.c b/src/ckb-pinwheel/main.c index 7c71b87..7580aca 100644 --- a/src/ckb-pinwheel/main.c +++ b/src/ckb-pinwheel/main.c @@ -12,6 +12,8 @@ void ckb_info(){ // Effect parameters CKB_PARAM_AGRADIENT("color", "Wheel color:", "", "ffffffff"); CKB_PARAM_DOUBLE("length", "Wheel size:", "%", 100, 1., 100.); + CKB_PARAM_DOUBLE("x_offset", "X offset:", "%", 0, -100, 100); + CKB_PARAM_DOUBLE("y_offset", "Y offset:", "%", 0, -100, 100); CKB_PARAM_BOOL("counter_clock", "Counter Clockwise", 0); CKB_PARAM_BOOL("symmetric", "Symmetric", 0); @@ -38,6 +40,7 @@ ckb_gradient animcolor = { 0 }; double animlength = 0.; int symmetric = 0; int counter_clock = 0; +double x_offset = 0, y_offset = 0; void ckb_parameter(ckb_runctx* context, const char* name, const char* value){ CKB_PARSE_AGRADIENT("color", &animcolor){} @@ -47,6 +50,8 @@ void ckb_parameter(ckb_runctx* context, const char* name, const char* value){ } CKB_PARSE_BOOL("symmetric", &symmetric){} CKB_PARSE_BOOL("counter_clock", &counter_clock){} + CKB_PARSE_DOUBLE("x_offset", &x_offset) {} + CKB_PARSE_DOUBLE("y_offset", &y_offset) {} } void ckb_init(ckb_runctx* context){ @@ -65,8 +70,8 @@ float x, y; void ckb_start(ckb_runctx* context, int state){ // Begin or end animation frame = state ? 0. : -1.; - x = context->width / 2.f; - y = context->height / 2.f; + x = (context->width + (context->width * x_offset * 0.01)) / 2.f; + y = (context->height - (context->height * y_offset * 0.01)) / 2.f; } void ckb_time(ckb_runctx* context, double delta){ @@ -83,11 +88,11 @@ int ckb_frame(ckb_runctx* context){ if(frame < 0.) return 0; // Color each key according to its angle from the center - float position; - if(counter_clock) + float position; + if(counter_clock) position = ANGLE(frame * M_PI * 2.); - else - position = ANGLE(-frame * M_PI * 2.); + else + position = ANGLE(-frame * M_PI * 2.); unsigned count = context->keycount; ckb_key* keys = context->keys; for(ckb_key* key = keys; key < keys + count; key++){ diff --git a/src/ckb-ripple/main.c b/src/ckb-ripple/main.c index c61258f..f429d7b 100644 --- a/src/ckb-ripple/main.c +++ b/src/ckb-ripple/main.c @@ -14,6 +14,8 @@ void ckb_info(){ // Effect parameters CKB_PARAM_AGRADIENT("color", "Ripple color:", "", "ffffffff"); CKB_PARAM_DOUBLE("length", "Ring length:", "%", 100, 1, 100); + CKB_PARAM_DOUBLE("x_offset", "X offset:", "%", 0, -100, 100); + CKB_PARAM_DOUBLE("y_offset", "Y offset:", "%", 0, -100, 100); CKB_PARAM_BOOL("symmetric", "Symmetric", 0); CKB_PARAM_BOOL("randomize", "Randomly select from gradient", 0); @@ -48,6 +50,7 @@ float kbsize = 0.f; ckb_gradient animcolor = { 0 }; int symmetric = 0, kprelease = 0, randomize = 0; double animlength = 0.; +double x_offset = 0, y_offset = 0; void ckb_init(ckb_runctx* context){ kbsize = sqrt(context->width * context->width / 4.f + context->height * context->height / 4.f); @@ -65,6 +68,8 @@ void ckb_parameter(ckb_runctx* context, const char* name, const char* value){ CKB_PARSE_BOOL("symmetric", &symmetric){} CKB_PARSE_BOOL("kprelease", &kprelease){} CKB_PARSE_BOOL("randomize", &randomize){} + CKB_PARSE_DOUBLE("x_offset", &x_offset) {} + CKB_PARSE_DOUBLE("y_offset", &y_offset) {} } #define ANIM_MAX (144 * 2) @@ -110,7 +115,7 @@ void ckb_keypress(ckb_runctx* context, ckb_key* key, int x, int y, int state){ void ckb_start(ckb_runctx* context, int state){ // Add or remove a ring in the center of the keyboard if(state) - anim_add(context->width / 2.f, context->height / 2.f, context->width, context->height); + anim_add((context->width + (context->width * x_offset * 0.01)) / 2.f, (context->height - (context->height * y_offset * 0.01)) / 2.f, context->width, context->height); else anim_remove(context->width / 2.f, context->height / 2.f); }