class XDo::Search

Overview

Represents an XDo search query.

Queries can contain multiple conditions (such as matching both a window name and a process ID), as well as impose restrictions on the number of results returned, search depth, and extent of search (e.g., limiting the search to a single screen).

See XDo#search(query) for an example of using Search objects.

Defined in:

x_do/search.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new #

Create a new Search.

NOTE New Search instances contain no query criteria.


[View source]

Class Method Detail

def self.build(&) #

Builds a Search instance via a DSL.

# find no more than 3 windows that are both visible AND have the name "Firefox"
Search.build do
  require_all
  only_visible
  window_name "Firefox"
  limit 3
end

[View source]

Instance Method Detail

def desktop(desktop : Int32) #

Search for windows on desktop.


[View source]
def limit(limit : Int32) #

Limit the number of results returned. By default, no limit (0) is imposed.


[View source]
def mask : SearchMask #

[View source]
def max_depth(depth : Int32) #

Limit search to a depth of depth.

0 guarantees an empty search, 1 limits the search to toplevel windows only. By default, no limit (-1) is imposed.


[View source]
def only_visible #

Search only for windows that are currently visible.


[View source]
def pid(pid : Int32) #

Search for windows whose (_NET_WM_PID) are pid.


[View source]
def require_all #

Require all criteria to be met, not just one.

This is equivalent to requiring the AND of all conditions, rather than the OR (which is the default).


[View source]
def screen(screen : Int32) #

Search for windows on screen.


[View source]
def to_struct #

Converts the instance into a struct compatible with libxdo.

NOTE You should never have to interact with this method directly.


[View source]
def window_class(str : String) #

Search for windows whose class are str.


[View source]
def window_class_name(str : String) #

Search for windows whose class name are str.


[View source]
def window_name(str : String) #

Search for windows whose names are str.


[View source]