Notes |
- This table should be an array of tables, with each table in the array specifying a service type.
- Changes to this variable will be reflected the next time the BonjourLauncher chooser window is shown -- if it is currently visible when changes are made, the new changes will NOT be reflected in the currently open chooser.
- Each service type table entry should contain one or more of the following keys:
type - a required string specifying the type of advertisement to search for with this entry. Example service types can be seen in hs.bonjour.serviceTypes .
label - an optional string, defaulting to the value for type , specifying the label for the toolbar item under which these advertised services are collected in the BonjourLauncher chooser window. May or may not be displayed if you have customized the toolbar's visual properties. Note that this field is used for internally identifying different template views, so it must be unique among the template entries where disabled is false or undefined.
image - an optional hs.image object specifying the image to display for the toolbar item under which these advertised services are collected in the BonjourLauncher chooser window. May or may not be displayed if you have customized the toolbar's visual properties.
text - an optional string, defaulting to "%name%", specifying the text to be displayed for each advertised service listed in this collection in the BonjourLauncher chooser window.
subText - an optional string, specifying the sub-text to be displayed for each advertised service listed in this collection in the BonjourLauncher chooser window.
filter - an optional function which can be used to filter out advertised services which you do not wish to include in the chooser window. The function should expect two parameters, the hs.bonjour.service object for the discovered service and a table containing all of the key-value pairs of the service template with values expanded to describe what is known about this specific service. The filter function should return true if the service is to be included or false if the service is to be omitted.
fn - The function to invoke. This function should expect two arguments, the hs.bonjour.service object for the selected service and a table containing all of the key-value pairs of the service template with values expanded to describe what is known about this specific service. Any return value for the function is ignored. If this is present, url and cmd will be ignored by the default handler, though they may be accessed through the second argument to the function.
url - The url to open with hs.urlevent.openURL . If this is present, cmd is ignored.
cmd - The command to execute with hs.execute .
hidden - an optional boolean, default false, that can be used to specify that the service list should not be displayed in the toolbar by default. You can still access these service types by specifying them as arguments to the BonjourLauncher:show or BonjourLauncher:toggle methods, or by creating a psuedo-key for the service type with BonjourLauncher:bindHotkeys. If the user customizes the toolbar by right-clicking on it, they can add this service to the toolbar, but it won't be in the default list.
disabled - an optional boolean, default false, specifying that this service should be skipped entirely is not available for viewing by any means.
textColor - an optional color table as defined in the hs.drawing.color module documentation to be used for the text displayed for each discovered service when this template is being displayed in the BonjourLauncher chooser. If not present, the color specified for BonjourLauncher.textColor will be used.
subTextColor - an optional color table as defined in the hs.drawing.color module documentation to be used for the sub-text displayed for each discovered service when this template is being displayed in the BonjourLauncher chooser. If not present, the color specified for BonjourLauncher.subTextColor will be used.
- Additional key-value pairs do not have special meaning for this spoon but kay-value pairs with a string for the value will be included in the second argument passwd to
fn , if present.
- Note that only
type and one of url , cmd , or fn must be provided -- everything else is optional.
- For all keys, except for
type and label , in the template definition which have string values, the following substring patterns will be matched and replaced as described below:
%address% - Will be replaced with the first address discovered for the service when it is resolved.
%address4% - Variant of %address% which is replaced with the first IPv4 address or "n/a" if one cannot be found or has not been discovered yet.
%address6% - Variant of %address% which is replaced with the first IPv6 address or "n/a" if one cannot be found or has not been discovered yet.
%domain% - Will be replaced with the domain the service was found in, usually "local."
%hostname% - Will be replaced with the hostname on which the service is being offered
%name% - Will be replaced with the name of the advertised service.
%port% - Will be replaced with the port number on the machine that the service is provided on.
%txt:<key>% - Will be replaced with the value for the specified <key> of the text records associated with the service, or an empty string if no such key is present. To see the list of text record key-value pairs for a specific service, you can right click on it while it is being displayed in the BonjourLauncher chooser window (press the escape key to clear it).
|