> Another issue is to shrink the client area available to the managed
> clients so that the keyboard does not cover the clients. Probably
> a meter of taste, but it is not nice to write to the client where the
> cursor is covered by the keyboard and you do not see what you are
> writing (that is on the Neo FreeRunner screen). There is a heuristic in
> dwm that if a client asks for a geometry equal to the dimensions of the
> screen it is considered to be asking for the fullscreen mode and it also
> covers dwm bar. One could use similar heuristic to detect an on screen
> keyboard -- if a not managed window has the geometry that covers the
> full width of the screen and extends exactly to the bottom of the screen
> than it is an on screen keyboard (or a bottom bar, but I care for the
> keyboard only) and then the client area would be shrank not to cover the
> keyboard.  But I have not prepared this patch yet.


Hi, this patch to svkbd was exactly what I wanted; I removed my previous
patch and added the following (its kinda hackish but should give you an
idea of what to do).  Works perfect.

In config.h add:

(1) static void set_bar_height(const Arg *arg);

(2) In keys[]:

        { ShiftMask|ControlMask,                                XK_F1,     
set_bar_height, {.i = 2}},
        { ShiftMask|ControlMask,                                XK_F2,     
set_bar_height, {.i = 52}},
        { ShiftMask|ControlMask,                                XK_F2,     
spawn,          SHCMD("dwmbar.sh")},
        { ShiftMask|ControlMask,                                XK_F2,     
togglebar,      {0}},
        { ShiftMask|ControlMask,                                XK_F2,     
spawn,          SHCMD("svkbd-small.sh")},
        { ShiftMask|ControlMask,                                XK_F3,     
set_bar_height, {.i = 202}},
        { ShiftMask|ControlMask,                                XK_F3,     
spawn,          SHCMD("dwmbar.sh")},
        { ShiftMask|ControlMask,                                XK_F3,     
togglebar,      {0}},
        { ShiftMask|ControlMask,                                XK_F3,     
spawn,          SHCMD("svkbd-normal.sh")},

(3) void
set_bar_height(const Arg *arg) {
  bh = dc.font.height + arg->i;
}

I have two svkbd's: svkbd-tiny (one line with up/down/left/right for
pdf reading) and svkbd-big (the normal keyboard).
My eee T91 has an acpi event on a button on the top which I press to call a
script that calls xdotools to call either F1, F2, or F3.  Here it is:

#!/bin/sh
# called from acpi event
# if svkbd-small, then launch the big
# if svkbd-big, then kill
# if nothing, launch the small

pid_small=$(pgrep svkbd-tiny)
pid_big=$(pgrep svkbd-big)

if [[ $pid_small == "" ]]; then
  if [[ $pid_big == "" ]]; then
#       echo "Nothing is running, launch small"
        DISPLAY=:0.0 xdotool key control+shift+F2
        exit;
  else
#   echo "Big is running, close it"
   DISPLAY=:0.0 xdotool key control+shift+F3
   DISPLAY=:0.0 xdotool key control+shift+F1 # reset the barheight to 2 (normal)
   exit;
  fi
else
#       echo "Small is running, close it, launch big"
        DISPLAY=:0.0 xdotool key control+shift+F2
        DISPLAY=:0.0 xdotool key control+shift+F3
        exit
fi

The dwmbar.sh runs xsetroot -name "some info i like".  It is optional.

Maybe others have a better way, but so far I'm pretty happy with this
solution.


> 
> Best,
> Łukasz
> 
> Fix svkbd to use override_redirect so dwm will not manage svkbd window:
> 
> diff -r 5a356042d49c svkbd.c
> --- a/svkbd.c Tue Aug 10 23:15:12 2010 +0200
> +++ b/svkbd.c Sat Jan 29 21:21:30 2011 +0100
> @@ -309,6 +309,7 @@
>  setup(void) {
>       int i;
>       XWMHints *wmh;
> +     XSetWindowAttributes wa;
>  
>       /* init screen */
>       screen = DefaultScreen(dpy);
> @@ -331,7 +332,12 @@
>       for(i = 0; i < LENGTH(keys); i++)
>               keys[i].pressed = 0;
>  
> -     win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0, dc.norm[ColFG], 
> dc.norm[ColBG]);
> +     wa.override_redirect = True;
> +     wa.border_pixel = dc.norm[ColFG];
> +     wa.background_pixel = dc.norm[ColBG];
> +     win = XCreateWindow(dpy, root, wx, wy, ww, wh, 0,
> +                         CopyFromParent, CopyFromParent, CopyFromParent,
> +                         CWOverrideRedirect | CWBorderPixel | 
> CWBackingPixel, &wa);
>       XSelectInput(dpy, win, StructureNotifyMask|ButtonReleaseMask|
>                       ButtonPressMask|ExposureMask|LeaveWindowMask);
>       wmh = XAllocWMHints();
> 

-- 
sic dicit magister P
PhD Candidate
Collaborative Programme in Ancient and Medieval Philosophy
University of Toronto
http://individual.utoronto.ca/peterjh

Reply via email to