[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCHES] Add command 'query'
- To: Tyler Thomas Hart <tylerthomashart _at_ gmail _dot_ com>
- Subject: Re: [PATCHES] Add command 'query'
- From: Thorsten Wißmann <edu _at_ thorsten _minus_ wissmann _dot_ de>
- Date: Mon, 4 Mar 2013 03:09:04 +0100
Hi Tylo,
On Fri, Dec 07, 2012 at 11:57:36PM -0800, Tyler Thomas Hart wrote:
> > - query: I like the basic idea, but I don't like that we have to
> > implement each variable to query explicitly (ntags, nframes,...).
> > But I already planned to implement something more general in near
> > future. (It heavily will be inspired by KObjects known from the
> > linux kernel).
>
> I'm not sure what you mean by implementing each variable explicitly. If we
> DID let the user query just any old value in the running image, we'd still
> have to provide them with aliases to be able to access them, right?
You have a "query" for the number of frames on the current tag but there
is not change to get the number of frames on tag $X. If someone wants
that, it has to be implemented explicitly. I fear we have to add to many
"query_binds", so I implemented as much as possible at once. (And ended
up in much more code than you had in query.c...)
So here it is: The Object-Tree! It won't stay a tree; actually it has
the structure of a filesystem with symlinks. You can use the command
object_tree and attr to explore the objects:
$ hc attr tags.focus.
0 children.
7 attributes:
.---- type
| .-- writeable
V V
s w name = "vim"
b w floating = false
i - index = 1
i - frame_count = 2
i - client_count = 2
i - curframe_windex = 0
i - curframe_wcount = 1
Then you can "query" them with the compare command, e.g.:
$ hc and , compare tags.focus.index le 1 \
, echo I am on tag 0 or 1 \
, substitute X tags.focus.name \
echo its name is X
This tells if you are currently on the first or second tag. If yes it
also prints the name of the current tag. I think I implemented all your
"query_binds" as attributes of the suitable objects (e.g. ntags as
tags.count) and described them in the man page[1]. If you think there's
something missing, please ask.
Cheers,
Thorsten
[1] http://wwwcip.cs.fau.de/~re06huxa/herbstluftwm/herbstluftwm.html#OBJECTS