On Wed, Jul 25, 2018 at 12:55:48PM +0200, Claudio Jeker wrote:
> On Wed, Jul 25, 2018 at 12:27:29PM +0200, Sebastien Marie wrote:
> > On Mon, Jul 16, 2018 at 11:37:41AM +0200, Sebastien Marie wrote:
> >
> > > xidle(1) seems great for such purpose. But I didn't found a way to just
> > > use timeout and not also an active area (a corner where the program is
> > > launched if pointer stays inside few seconds).
> > >
> > > The following diff tries to implement a way to disable the active area
> > > without being too intrusive.
> > >
> > > For that, I used the `delay' parameter ("Specify the number of seconds
> > > the pointer has to be in the given position before running the
> > > program."), to allow value -1, and make it to discard the event.
> > >
> > > Does it make sens ? Or any proposition to more straighfull approch ?
> > >
>
> I would love to be able to use xidle without active area but I have to say
> that your approach with -1 as delay seems a bit like a hack. Wouldn't it
> be better to add a -no option to disable the corners all together? Maybe
> even make that the default instead of -nw?
>
the "-delay -1" approch was taken to avoid too instrusive change that
would clash with upstream (but are we upstream ? I didn't found xidle under
www.x.org). Anyway, the approch with -no option seems to not be too
intrusive neither and it is better for user point of vue.
So below a new diff with -no option.
When used, the -no flag that sets `position' variable to `none'. The
active area window is still created (its avoid to manage a new case
where `xi->win' could be NULL), but the window isn't mapper and no
event asked for EnterWindow.
Sending USR1 still work as intented.
I didn't change the default value for the position, but it could be
easily done (one line change in xidle.c and xidle.1).
--
Sebastien Marie
Index: xidle.1
===================================================================
RCS file: /cvs/xenocara/app/xidle/xidle.1,v
retrieving revision 1.4
diff -u -p -r1.4 xidle.1
--- xidle.1 9 Nov 2017 19:13:03 -0000 1.4
+++ xidle.1 25 Jul 2018 11:54:13 -0000
@@ -35,7 +35,7 @@
.Op Fl area Ar pixels
.Op Fl delay Ar secs
.Op Fl display Ar display
-.Op Fl nw | ne | sw | se
+.Op Fl no | nw | ne | sw | se
.Op Fl program Ar path
.Op Fl timeout Ar secs
.Ek
@@ -66,8 +66,8 @@ The default is 2 seconds.
.It Fl display Ar display
This argument allows you to specify the server to connect to; see
.Xr X 7 .
-.It Fl nw | ne | sw | se
-Set the position to one of northwest, northeast, southwest, or southeast,
+.It Fl no | nw | ne | sw | se
+Set the position to one of none, northwest, northeast, southwest, or southeast,
respectively.
If no position is specified,
the default is northwest.
@@ -100,7 +100,9 @@ Specify the number of seconds to wait be
.Fl delay
option.
.It Sy position No (class Sy Position )
-Set the position to one of: "nw", "ne", "sw", or "se"; see descriptions of the
+Set the position to one of: "no", "nw", "ne", "sw", or "se"; see descriptions
+of the
+.Fl no ,
.Fl nw ,
.Fl ne ,
.Fl sw ,
Index: xidle.c
===================================================================
RCS file: /cvs/xenocara/app/xidle/xidle.c,v
retrieving revision 1.5
diff -u -p -r1.5 xidle.c
--- xidle.c 20 Aug 2017 16:43:25 -0000 1.5
+++ xidle.c 25 Jul 2018 11:59:40 -0000
@@ -53,7 +53,8 @@ enum {
north = 0x01,
south = 0x02,
east = 0x04,
- west = 0x08
+ west = 0x08,
+ none = 0x10,
};
enum { XIDLE_LOCK = 1, XIDLE_DIE = 2 };
@@ -84,6 +85,7 @@ static XrmOptionDescRec opts[] = {
{ "-program", ".program", XrmoptionSepArg, (caddr_t)NULL },
{ "-timeout", ".timeout", XrmoptionSepArg, (caddr_t)NULL },
+ { "-no", ".position", XrmoptionNoArg, (caddr_t)"no" },
{ "-ne", ".position", XrmoptionNoArg, (caddr_t)"ne" },
{ "-nw", ".position", XrmoptionNoArg, (caddr_t)"nw" },
{ "-se", ".position", XrmoptionNoArg, (caddr_t)"se" },
@@ -108,7 +110,7 @@ usage()
{
fprintf(stderr, "Usage:\n%s %s\n", __progname,
"[-area pixels] [-delay secs] [-display host:dpy] "
- "[-ne | -nw | -se | -sw]\n [-program path] [-timeout secs]");
+ "[-no | -ne | -nw | -se | -sw]\n [-program path] [-timeout
secs]");
exit(1);
}
@@ -133,12 +135,14 @@ init_x(struct xinfo *xi, int position, i
xi->coord_x, xi->coord_y, area, area, 0, 0, InputOnly,
CopyFromParent, CWOverrideRedirect, &attr);
- XSelectInput(dpy, xi->win, EnterWindowMask|StructureNotifyMask
+ if (position != none) {
+ XSelectInput(dpy, xi->win, EnterWindowMask|StructureNotifyMask
#if 0
|VisibilityChangeMask
#endif
- );
- XMapWindow(dpy, xi->win);
+ );
+ XMapWindow(dpy, xi->win);
+ }
/*
* AFAICT, we need the event number for ScreenSaverNotify
@@ -228,6 +232,7 @@ str2pos(const char *src)
{ "nw", north|west },
{ "se", south|east },
{ "sw", south|west },
+ { "no", none },
{ NULL, 0 }
}, *s;