nyyManni / dmenu-wayland

dmenu for wayland-compositors
MIT License
197 stars 22 forks source link

dmenu must appear on the currently focused monitor #6

Open cyberhuman opened 5 years ago

cyberhuman commented 5 years ago

Hi! I've been looking for a replacement for dmenu to run under sway, and found your project. But there are a few annoying issues in my setup.

When I invoke dmenu-wl_run instead of dmenu, it now appears on the first monitor, not on the focused monitor. I think it should appear on the focused output instead.

e.g.

$ swaymsg -t get_outputs | jq 'map({name,focused})'
[
  {
    "name": "DP-1",
    "focused": false
  },
  {
    "name": "DP-5",
    "focused": true
  },
  {
    "name": "DP-6",
    "focused": false
  }
]

I press Alt+F2, and menu appears on DP-1.

Thanks for your work!

nyyManni commented 5 years ago

This one seems to be a bit trickier than it sounds.

Based on a quick look at the protocol definition the "focused"-attribute isn't part of the xdg-output protocol. I will investigate if there's a way to determine indirectly, which one of the monitors is currently active.

A suitable workaround here would be for example a python-wrapper which would get the index (or the name when I get that ticket out of the way) with swaymsg and give it to dmenu-wl as an argument.

cyberhuman commented 5 years ago

Thanks! Yes, I'm currently using a shell wrapper as a work around, but it would be nice to have this functionality out of the box.

cyberhuman commented 5 years ago

FTR to get the index of the currently focused output, I use:

swaymsg -t get_outputs | jq -r 'map(.focused) | index(true)'

To get the name, the command would be:

swaymsg -t get_outputs | jq -r '.[map(.focused) | index(true)].name'
emersion commented 4 years ago

Pass a NULL wl_output when creating the layer surface. Please don't use Sway-specific solutions.

nyyManni commented 4 years ago

Thanks for the hint, I had completely missed that paragraph of the documentation.

The sway-specific solutions here are wrappers living outside dmenu in sway's configuration file, so I don't see a problem in using them.

Anyways, I'll try out the NULL output, if it works those wrappers are no longer needed.

markstos commented 2 years ago

@nyyManni Did it work to pass a NULL wl_output?

fabianscode commented 9 months ago

It does work, but theres currently no closing the program without another tty