2021-08-23 16:19:30 -04:00
|
|
|
# Positioning Rofi on the monitor
|
|
|
|
|
|
|
|
In the current theme format you set these properties on the `window` widget.
|
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
The first, location, determines where **rofi** is placed on the monitor, the
|
2021-08-23 16:19:30 -04:00
|
|
|
second what point of the **rofi** window connects there. This sounds
|
|
|
|
complicated, but it ain't.
|
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
## location setting
|
2021-08-23 16:19:30 -04:00
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
The location setting determines the place of the window on the monitor.
|
2021-08-23 16:19:30 -04:00
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
The location setting supports the following values:
|
2021-08-23 16:19:30 -04:00
|
|
|
|
|
|
|
* north
|
|
|
|
* northeast
|
|
|
|
* northwest
|
|
|
|
* south
|
|
|
|
* southeast
|
|
|
|
* southwest
|
|
|
|
* east
|
|
|
|
* west
|
|
|
|
* center
|
|
|
|
|
|
|
|
This is depicted in the diagram below:
|
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
![location](anchors.svg)
|
2021-08-23 16:19:30 -04:00
|
|
|
|
|
|
|
|
|
|
|
## anchor setting
|
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
The anchor sets what point of the **rofi** window is placed at the specified *location*.
|
2021-08-23 16:19:30 -04:00
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
The *anchor* settings supports the same values as the *location* setting.
|
2021-08-23 16:19:30 -04:00
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
If you want the middle of the **rofi** window to be always located at the center of the monitor set both *location* and
|
2021-08-23 16:19:30 -04:00
|
|
|
*anchor* to `center`.
|
|
|
|
|
|
|
|
If the **rofi** window resizes, its center will stay at the center.
|
|
|
|
If you set the *anchor* to `north` the top of the **rofi** window is at the center of the monitor, and the window will grow
|
|
|
|
down.
|
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
If you set the *anchor* and *location* to `south`, **rofi** is located at the bottom center and the window grows up.
|
2021-08-23 16:19:30 -04:00
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
> Note that if you set the *anchor* to `south` and the *location* to `north` the **rofi** window will be placed above
|
2021-08-23 16:19:30 -04:00
|
|
|
> the monitor and might not be visible.
|
|
|
|
|
|
|
|
|
|
|
|
> In another blog post we will explain how the dynamic sizing behaviour of **rofi** can be tweaked or disabled.
|
|
|
|
|
|
|
|
So the following theme setting will place the top of the **rofi** window in the center of the monitor:
|
|
|
|
|
|
|
|
```css
|
|
|
|
window {
|
2021-10-12 16:47:40 -04:00
|
|
|
location: center;
|
2021-08-23 16:19:30 -04:00
|
|
|
anchor: north;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-10-12 16:47:40 -04:00
|
|
|
As depicted here, RED is the location (center of screen), GREEN is the anchor on **rofi** window (north):
|
2021-08-23 16:19:30 -04:00
|
|
|
|
|
|
|
![positions](example-pos.png)
|
|
|
|
|
|
|
|
> Quick hint, if you want to quickly test out changes to the theme, without editing the file, run **rofi** like:
|
|
|
|
|
|
|
|
```bash
|
2021-10-12 16:47:40 -04:00
|
|
|
rofi -show run -theme-str "window { location: center; anchor: north;}"
|
2021-08-23 16:19:30 -04:00
|
|
|
```
|