[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCHES] Add command 'query'



Hi,

I've realized that there are a lot of unncessesary delarations. Patch 0014 fixes this. 

Patch 0013 adds queries for monitor, tag, and window index. 


Patch 0014 also adds completion for queries. However, it seems that something isn't working in a higher-scoped completion function. I built from my master, and tab-completing settings and directions returns completions for commands instead of settings and directions. Is this the behavoiur for anyone else? Or did I bork my main branch (haven't touched it, besides occasionally pulling) and need to reclone?

Thanks,
Tylo

On Wed, Dec 5, 2012 at 5:46 PM, Tyler Thomas Hart <tylerthomashart _at_ gmail _dot_ com> wrote:
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: 0013-Added-queries-for-the-monitor-tag-and-window-index-i.patch
Description: Binary data

Attachment: 0014-Making-progress-on-command-completion-for-queries.patch
Description: Binary data