[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCHES] Add command 'query'
- To: herbstluftwm _minus_ devel _at_ lists _dot_ sourceforge _dot_ net
- Subject: [PATCHES] Add command 'query'
- From: Tyler Thomas Hart <tylerthomashart _at_ gmail _dot_ com>
- Date: Wed, 5 Dec 2012 17:46:03 -0800
Hello,
I've been working on a command called 'query'. It can query the state of the current layout, returning an integer, and either print the integer to stdout or compare the integer to another integer, given as an additional argument. From my man pages:
COMMANDS:
query QUERY [OPERATOR VALUE]
Evaluates the query QUERY and compares it to VALUE. If the comparison is TRUE, then "query" returns 0,
otherwise, it returns a nonzero. Valid comparison operators are:
o "eq": equal
o "ne": not equal
o "gt": greater than
o "lt": less than
o "ge": greater than or equal to
o "le": less than or equal to
If OPERATOR and VALUE are ommited, then "query" simply prints the value to stdout. For a list of queries,
see section below. Further explaination is also in that section.
QUERIES:
Queries check the state of the current tag, frame or window and return an integer value. Queries are
evaluated using the query command and can be used to allow decision trees to be created with and and or. They
also can be used in place of where parsing layout or dump is unneeded in a script.
Valid queries are:
nframes
returns the number of frames on the current tag.
nwindows
returns the number of windows on the current frame.
nwindows_all
returns the number of windows on the current tag.
ntags
returns the total number of tags.
I've made several (12) commits to this branch so far, so I can rebase if needed. Otherwise, the patches for each commit are attached to this email or alternatively available at
https://github.com/htylo/hlwm_patches/tree/master/query . Since adding new queries is pretty straight forward. I've mirrored my branch at
https://github.com/htylo/hlwm_query.git . I'll be pushing to there as soon as I add more queries (ones for window, tag, and monitor indexes are next), so if pulling/merging from there at stable heads is preferred, let me know. Otherwise I'll be flooding the mailing list for the next couple of weeks :) . As always, suggestions are welcome.
Tylo
Attachment:
0001-Added-cquery.patch
Description: Binary data
Attachment:
0002-Added-command-query.patch
Description: Binary data
Attachment:
0003-Added-documentation-for-the-last-2-commits.patch
Description: Binary data
Attachment:
0004-Changed-syntax-of-query-in-order-to-depreciate-cquer.patch
Description: Binary data
Attachment:
0005-Added-additional-documentation.patch
Description: Binary data
Attachment:
0006-Added-syntactical-suggestions-in-the-comments-for-qu.patch
Description: Binary data
Attachment:
0007-Unified-the-return-status-of-a-nonzero-query-compari.patch
Description: Binary data
Attachment:
0008-Updated-docs-to-reflect-change-of-query-nframe-to-nf.patch
Description: Binary data
Attachment:
0009-Fixed-newline-at-the-end-of-a-non-comparison-query.patch
Description: Binary data
Attachment:
0010-Added-query-for-number-of-tags.patch
Description: Binary data
Attachment:
0011-Removed-useless-arguments-to-each-query-command-by-c.patch
Description: Binary data
Attachment:
0012-Added-nwindows_all-query.-Added-documentation-for-nw.patch
Description: Binary data