-1

I am not that well versed with xorg and the xlib libraray.I am not a C programmer.I installed st-simple terminal.Heard the fact that we can run only a terminal or a browser in xorg server without a window manager in a online article and confirmed it on arch wiki. .So to try it I ran.

startx /usr/local/bin/st

st did start but it did not have focus.Though I could write in it.I just want a solution which tells me how to give st focus as the unfocused cursor puts me off.

Thanks in advance

  • Is this question about how to write code to change X behaviour? Or about how to use some utility? It isn't clear to me that this question involves programming. – Kevin Boone Sep 25 '20 at 12:33
  • It was about using simple terminal as the root window in xorg.But it was responding as if it had focus. – pratham powar Oct 02 '20 at 11:02

1 Answers1

1

That st thing probably doesn't believe in PointerRoot and focus-follows-mouse. Try giving it the focus explicitly with XSetInputFocus(3).

If you have a C compiler and the xorg -dev or -devel packages installed, try running this inside your st terminal:

echo '
#include <X11/Xlib.h>
#include <stdlib.h>
int main(){
    Display *dpy; char *ws; Window w;
    if((dpy = XOpenDisplay(0)) && (ws = getenv("WINDOWID")) && (w = strtoul(ws, 0, 0))){
        XSetInputFocus(dpy, w, RevertToPointerRoot, 0); XSync(dpy, False);
    }
}' | cc -Wall -lX11 -x c - -o getfocus && ./getfocus

There may be utilities like xdotool able to do that, but as far as I know they're not installed by default.

Even better would be to fix that "suckless" terminal emulator so it sucks less and not assume a window manager and a point-to-type interface.