Positioning - bakkeby/dmenu GitHub Wiki

Positioning, or placement if you prefer, refers to where on the screen dmenu opens.

This involves several features, but it makes sense to group them together as they all affect where dmenu spawns.

There are three primary placement options:

  • dmenu spawns at the top of the screen
  • dmenu spawns at the bottom of the screen and
  • dmenu spawns in the center of the screen

Which one of the above is the default placement is controlled via functionality toggles in config.h.

The Centered functionality, if enabled, takes precedence and will make dmenu appear in the center of the screen.

The TopBar functionality, if enabled, will make dmenu appear at the top of the screen. If disabled then dmenu will appear at the bottom of the screen.

Command line arguments

Where dmenu spawns can also be controlled via the command line arguments. For a list of options refer to the dmenu man page or dmenu --help.

Placement options:
   -t                            dmenu is shown at the top of the screen (default)
   -b                            dmenu is shown at the bottom of the screen
   -c                            dmenu is shown in the center of the screen
   -e <windowid>                 embed into the given window ID
   -ea                           embed into the currently focused (active) window
   -m <monitor>                  specifies the monitor index to place dmenu on (starts at 0)
   -x <offset>                   specifies the x position relative to monitor
   -y <offset>                   specifies the y position relative to monitor
   -w <width>                    specifies the width of dmenu

The -t, -b and -c options controls the primary placement options as already outlined.

The -e option allows for dmenu to be embedded into another window such as tabbed as an example. Note that this option differs from the upstream suckless dmenu which uses the -w flag for embed.

The -ea option allows for dmenu to be embedded into the currently focused window without having to provide the window ID. The window to embed into is identified by the _NET_ACTIVE_WINDOW property of the root window.

By default dmenu will spawn on the monitor that is active and the -m option allows for dmenu to be spawned on a specified monitor. This assumes that dmenu has been compiled with the Xinerama library.

The -x, -y and -w options allows for the position and width of dmenu to be specified. If dmenu is compiled with Xinerama support then the x and y offsets will be relative to the monitor. If dmenu is compiled without Xinerama support then the x and y offsets will be absolute.

The -w option can also be used to control the width of dmenu when centered.

All -x, -y and -w options support percentage values. E.g. the following will spawn dmenu in the dead centre of the screen with a width of one fifth of the screen (20%).

$ ls | dmenu -x 50% -y 50% -w 20%

The -x and -y percentage positions are relative to the width and size of dmenu. For example using -x 100% will place dmenu as far right as it can go (e.g. the right side of the menu will be at the monitor border).

On top of this there is vertical and horizontal side padding that adds an artificial boundary between the dmenu window and the monitor edge. This is in similar fashion to the barpadding patch for dwm and it is there to allow dmenu to be placed directly on top of a dwm bar that has such padding applied.

Refer to the vertpad and sidepad settings in config.h for more details on this.

Back to Features.

⚠️ **GitHub.com Fallback** ⚠️