jordansissel / keynav

retire your mouse.
Other
586 stars 96 forks source link

GRID-NAV navigation with letters: moves the cursor immediately #81

Open denisdamata opened 6 hours ago

denisdamata commented 6 hours ago

The grid-nav (letter navigation) seemed interesting to me when used in combination with mouseless (or xmouseless). I move the cursor by typing the two letters and then finish with mouseless.

I just want the cursor to be immediately positioned after the second letter of the letter combination is pressed. In more detail, when I type the two letters, the green square shrinks, and then I have to press SPACE (my click 1) to position the cursor in the area I want. The difference is that I want the cursor to be moved as soon as the letter combination is pressed.

denisdamata commented 4 hours ago

You can achieve this behavior by making the following workaround in the function void updategrid at line ~660:

...
    nclip_rectangles = rects;
    clip_rectangles = realloc(clip_rectangles, nclip_rectangles * sizeof(XRectangle));
  }
}

static int call_count = 0; // INCUDE THIS!!!

void updategrid(Window win, struct wininfo *info, int apply_clip, int draw) {

     if (draw && apply_clip) { // INCUDE THIS!!!

        call_count++; // INCUDE THIS!!!
        if (call_count == 4){ // INCUDE THIS!!!
          cmd_warp(NULL); // INCUDE THIS!!!
          cmd_end(NULL);  // INCUDE THIS!!!
        return; // INCUDE THIS!!!
        }// INCUDE THIS!!!
    }// INCUDE THIS!!!

  double w = info->w;
  double h = info->h;
  double cell_width;
  ...

Uninstall and install the program for the changes to take effect:

  killall keynav; sudo make uninstall; sudo make install

Thanks Claude AI and ChatGPT.