-
Notifications
You must be signed in to change notification settings - Fork 27
ScrollingTextBlock
This block displays text that scrolls horizontally if it is longer than a maximum width. Always renders text in one long line -- no line breaks.
Name | Type | Description | Example |
---|---|---|---|
padding |
Padding |
Padding around the block, which is applied before hooking. | padding: Padding(left: 7.0, right: 7.0, top: 7.0, bottom: 7.0 |
text |
string |
Text to display in this text block. %s will be substituted with the summary text, %b with the body text, and a few more. See the Text Markup wiki page for full details. |
text: "%s" text: "%t(%H:%M %P)"
|
font |
string |
Font description string for the desired font, in the format of "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE] [VARIATIONS]" .For more information on font descriptions, see pango documentation. > To find a font family's name, try fc-list in a terminal.
|
font: "Arial Bold 10" |
color |
Color |
Text color. | color: Color(hex: "#ebdbb2") |
width |
MinMax |
Specifies the minimum and maximum width of the block (in pixels). See notes below for more information on this behavior. |
width: (min: 150, max: 250) |
scroll_speed |
float |
Scroll speed of the text, when it does scroll. | scroll_speed: 0.1 |
lhs_dist |
float |
The distance from the left hand side (in pixels) that the text should scroll to before it bounces. See notes below for more information on this behavior. |
lhs_dist: 35.0 |
rhs_dist |
float |
The distance from the right hand side (in pixels) that the text should scroll to before it bounces. See notes below for more information on this behavior. |
rhs_dist: 35.0 |
scroll_t |
float |
Decides where the text should begin scrolling from, where a value of 1.0 would start the text at the lhs_dist and scroll left, and a value of 0.0 would start the text at the rhs_dist and scroll right. |
scroll_t: 1.0 |
Name | Type | Description | Example |
---|---|---|---|
color_hovered |
Color |
The text color that should be used while the mouse is hovered over this block. Default: use color
|
color_hovered: Color(hex: "#fbf1c7") |
width_image_hint |
MinMax |
Desired width when an image of type hint is present. Default: use width
|
width_image_hint: (min: 150, max: 250) |
width_image_app |
MinMax |
Desired width when an image of type app is present. Default: use width
|
width_image_app: (min: 150, max: 250) |
width_image_both |
MinMax |
Desired width when both app image and hint image is present. Default: use width
|
width_image_both: (min: 150, max: 250) |
backtrack_scroll_pos |
bool |
Whether or not to re-calculate the scroll position when a notification is replaced. Default: false
|
backtrack_scroll_pos: true |
The width*
properties have no affect on the actual text that is rendered. The whole string will always be present. It instead affects the clipping area of the text; i.e. how much text should be shown at one time. The below image indicates the clipping area in red.
The lhs_dist
and rhs_dist
properties can be visualized by thinking of them as extra padding to either the left or right of the text, respectively. These are useful for the practicality of scrolling notifications: if you want a notification that scrolls from right to left initially, then it's useful to have a small margin on the left side, or you might miss some initial portion of the text before you get time to look at it.
// TODO: diagram
This option was designed to fix one specific issue. When a notification is replaced, it will re-draw from fresh, and its scroll position and direction will be reset. This can be annoying when updating things that don't affect the text at all, e.g. a progress bar.
The way we calculate this is quite stubborn, and if you don't care, then this option should be left alone. We basically run update
on the block at a fixed interval until we catch up to where we were. That can be quite a few iterations, depending on poll_interval
-- luckily, the work is trivial.
Actively looking for ways to work around this / do it more efficiently.