Skip to content

BarProps

Used as entrypoint for monitor:attach

Example

monitor = hitokage.monitor.get_primary()

---@type BarProps
bar_props = {
    children = {
         { Workspace = { halign = "Start", item_height = 24, item_width = 24 } },
         { Box = {} },
         { Clock = { format = "%a %b %u %r", halign = "End" } },
     },
     homogeneous = true,
}

monitor:attach(bar_props)

The mounted API is documented here: Bar

Attributes:

attr children

children: table<number, WrapBatteryProps|WrapBoxProps|WrapClockProps|WrapCpuProps|WrapIconProps...(+4)>?

Type: tableWrapBoxProps\|\WrapClockProps\|\WrapCpuProps\|WrapIconProps...(+4)>?

An arrray of children and properties. See ComponentProps

Example

children = {
  { Box = {} },
  { Workspace = { halign = "Center", item_height = 22, item_width = 22 } },
  { Clock = { format = "%a %b %u %r", halign = 'End' } },
},

attr class

class: (string|table<number, string>)?

Type: (string|table<number, string>?

Optional css class names. Either space-delimited classes, or an array of class names. Built-in hitokage components will always contain their type as a class name.

Example

class = "red blue green"
or
class = {"red", "blue", "green"}

View gtk4 documentation

attr halign

halign: ('Baseline'|'Center'|'End'|'Fill'|'Start'...(+1))?

Type: ('Baseline'|'Center'|'End'|'Fill'|'Start'...(+1))?

Sets the horizontal alignment of widget. Defaults to 'Fill'

View gtk4 documentation

attr height

height: integer?

Type: integer?

attr height_request

height_request: integer?

Type: integer?

Override for height request of the widget. If this is -1, the natural request will be used.

View gtk4 documentation

attr hexpand

hexpand: boolean?

Type: boolean?

Whether to expand horizontally. Defaults to false

View gtk4 documentation

attr homogeneous

homogeneous: boolean?

Type: boolean?

Whether the children should all be the same size.

View gtk4 documentation

attr id

id: string?

Type: string?

A unique identifier.

This is not enforced or checked by hitokage, it is simply used in utility methods such as Bar:get_child_by_id or Box:get_child_by_id.

attr offset

offset: BarOffset?

Type: BarOffset?

attr valign

valign: ('Baseline'|'Center'|'End'|'Fill'|'Start'...(+1))?

Type: ('Baseline'|'Center'|'End'|'Fill'|'Start'...(+1))?

Sets the vertical alignment of widget. Defaults to 'Fill'.

View gtk4 documentation

attr vexpand

vexpand: boolean?

Type: boolean?

Whether to expand vertically. Defaults to false

View gtk4 documentation

attr widgets

widgets: table<number, WrapBatteryProps|WrapBoxProps|WrapClockProps|WrapCpuProps|WrapIconProps...(+4)>?

Type: tableWrapBoxProps\|\WrapClockProps\|\WrapCpuProps\|WrapIconProps...(+4)>?

Danger

Use children instead

Example

widgets = {
  { Box = {} },
  { Workspace = { halign = "Center", item_height = 22, item_width = 22 } },
  { Clock = { format = "%a %b %u %r", halign = 'End' } },
},

attr width

width: integer?

Type: integer?

attr width_request

width_request: integer?

Type: integer?

Override for width request of the widget. If this is -1, the natural request will be used.

View gtk4 documentation