A table of [types.dt_lua_image_t](../../types/dt_lua_image_t) on which the user expects UI actions to happen.
It is based on both the hovered image and the selection and is consistent with the way
darktable works.
It is recommended to use this table to implement Lua actions rather than [darktable.gui.hovered](#darktable.gui.hovered) or [darktable.gui.selection](#darktable.gui.selection) to be consistent with darktable's GUI.
# darktable.gui.hovered
`types.dt_lua_image_t`
The image under the cursor or nil if no image is hovered.
* **\[selection\]** - _table of [types.dt_lua_image_t](../../types/dt_lua_image_t)_ - A table of images which will define the selected images. If this parameter is not given
the selection will be untouched. If an empty table is given the selection will be emptied.
* **return** - _table of [types.dt_lua_image_t](../../types/dt_lua_image_t)_ - A table containing the selection as it was before the function was called.
# darktable.gui.current_view
```
function(
[view : types.dt_lua_view_t]
) : types.dt_lua_view_t
```
Get or change the current view.
* **\[view\]** - [_types.dt_lua_view_t](../../types/dt_lua_view_t)_ - The view to switch to. If empty the current view is unchanged
* **return** - [_types.dt_lua_view_t](../../types/dt_lua_view_t)_ - the current view
# darktable.gui.panel_visible
```
function(
panel : types.dt_ui_panel_t
) : boolean
```
Determines if the specified panel is visible.
* **panel** - _[types.dt_ui_panel_t](../../types/dt_ui_panel_t)_ - The panel to check.
* **return** - _boolean_ - true if the panel is visible, false if not
# darktable.gui.panel_hide
```
function(
panel : types.dt_ui_panel_t
)
```
Hides the specified panel.
* **panel** - _[types.dt_ui_panel_t](../../types/dt_ui_panel_t)_ - The panel to hide.
# darktable.gui.panel_show
```
function(
panel : types.dt_ui_panel_t
)
```
Shows the specified panel.
* **panel** - _[types.dt_ui_panel_t](../../types/dt_ui_panel_t)_ - The panel to show.
# darktable.gui.panel_hide_all
```
function(
)
```
Hide all panels.
# darktable.gui.panel_show_all
```
function(
)
```
Show all panels.
# darktable.gui.panel_get_size
```
function(
panel : types.dt_ui_panel_t
):int
```
Gets the size in pixels of the specified panel. This only works for the left, right, and bottom
panels.
* **panel** - _[types.dt_ui_panel_t](../../types/dt_ui_panel_t)_ - The panel to get the size of.
# darktable.gui.panel_set_size
```
function(
panel : types.dt_ui_panel_t
size : int
)
```
Sets the size in pixels of the specified panel. This only works for the left, right, and bottom
panels.
* **panel** - _[types.dt_ui_panel_t](../../types/dt_ui_panel_t)_ - The panel to set the size of.
* **size** - _int_ - The size to set the panel to.
# darktable.gui.create_job
```
function(
text : string,
[percentage : boolean],
[cancel_callback : function]
) : types.dt_lua_backgroundjob_t
```
Create a new progress_bar displayed in [darktable.gui.libs.backgroundjobs](#darktable.gui.libs.backgroundjobs)
* **text** - _string_ - The text to display in the job entry
* **\[percentage\]** - _boolean_ - Should a progress bar be displayed
* **\[cancel_callback\]** - _[function](#cancel_callback)_ - A function called when the cancel button for that job is pressed. Note: the job won't be destroyed automatically. You need to set [types.dt_lua_backgroundjob_t.valid](../../types/dt_lua_backgroundjob_t#valid) to false for that.
* **return** - _[types.dt_lua_backgroundjob_t](../../types/dt_lua_backgroundjob_t)_ - The newly created job object
## cancel_callback
```
function(
job : types.dt_lua_backgroundjob_t
)
```
* **job** - _[types.dt_lua_backgroundjob_t](../../types/dt_lua_backgroundjob_t)_ - The job who is being cancelled
[rules : array of types.dt_lib_collect_params_rule_t]
) : array oftypes.dt_lib_collect_params_rule_t
```
Get or change the list of visible images
Attributes:
* [implicit_yield](../Attributes#implicit_yield)
* **\[rules\]** - _array of [types.dt_lib_collect_params_rule_t](../../types/dt_lib_collect_params_rule_t)_ - A table of rules describing the filter. These rules will be applied after this call
* **return** - _array of [types.dt_lib_collect_params_rule_t](../../types/dt_lib_collect_params_rule_t)_ - The rules that were applied before this call.
### darktable.gui.libs.collect.new_rule
```
function(
) : types.dt_lib_collect_params_rule_t
```
Returns a newly created rule object
* **return** - _[types.dt_lib_collect_params_rule_t](../../types/dt_lib_collect_params_rule_t)_ - The newly created rule
Add a widget in the option expander of the import dialog
* **widget** - _[types.lua_widget](../../types/lua_widget)_ - The widget to add to the dialog. The reset callback of the widget will be called whenever the dialog is opened.
* **\[sort\]** - _[types.dt_collection_sort_t](../../types/dt_collection_sort_t)_ - The new field to sort by. If empty the current sort field is unchanged
* **return** - _[types.dt_collection_sort_t](../../types/dt_collection_sort_t)_ = The current sort field.
### darktable.gui.libs.filter.sort_order
```
function(
[order : types.dt_collection_sort_order_t]
) : types.dt_collection_sort_order_t
```
Change the collection sort order.
* **\[order\]** - _[types.dt_collection_sort_order_t](../../types/dt_collection_sort_order_t)_ - The order to sort by. If empty the current sort order is unchanged.
* **return** - _[types.dt_collection_sort_order_t](../../types/dt_collection_sort_order_t)_ - The current sort order.
### darktable.gui.libs.filter.rating
```
function(
[rating : types.dt_collection_filter_t]
) : types.dt_collection_filter_t
```
Change the collection rating filter.
* **\[rating\]** - _[types.dt_collection_filter_t](../../types/dt_collection_filter_t)_ - The new rating field to filter by. If empty the current rating field is unchanged.
* **return** - [types.dt_collection_filter_t](../../types/dt_collection_filter_t) - The current rating field.
* **\[comparator\]** - _[types.dt_collection_rating_comperator_t](../../types/dt_collection_rating_comperator_t)_ - The new comparison field to filter the rating by. If empty the current rating comparison field is unchanged
* **return** - _[types.dt_collection_rating_comperator_t](../../types/dt_collection_rating_comperator_t)_ - The current rating comparison field
Add a new button and call a callback when it is clicked
* **label** - _string_ - The label to display on the button
* **callback** - _function_ - The function to call when the button is pressed
* **\[tooltip\]** - _string_ - The tooltip to use on the new button
callback -
```
function(
event : string,
images : table oftypes.dt_lua_image_t
) : table oftypes.dt_lua_image_t
```
The function to call when the button is pressed
* **event** - _string_ - The name of the button that was pressed
* **images** - _table of [types.dt_lua_image_t](../../types/dt_lua_image_t)_ - The images in the current collection. This is the same content asdarktable.collection
* **return** - _table of [types.dt_lua_image_t](../../types/dt_lua_image_t)_ - The images to set the selection to
## darktable.gui.libs.colorlabels
The color buttons that allow to set labels on an image
* **\[layout\]** - _[types.dt_lighttable_layout_t](../../types/dt_lighttable_layout_t)_ - The layout to switch to. If empty the current layout is unchanged
* **return** - _[types.dt_lighttable_layout_t](../../types/dt_lighttable_layout_t)_ - the current layout
### darktable.gui.libs.lighttable_mode.zoom_level
```
function(
[level : int]
) : int
```
Change the lighttable zoom level.
* **\[level\]** - _int_ - The zoom level to switch to. If empty the current zoom level is unchanged