Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coordinates on multi monitor #8

Closed
GideonWolfe opened this issue Jul 29, 2020 · 12 comments
Closed

coordinates on multi monitor #8

GideonWolfe opened this issue Jul 29, 2020 · 12 comments
Labels
enhancement New feature or request

Comments

@GideonWolfe
Copy link
Contributor

So this is a nitpick but I figured I would ask anyways.

Currently I have a button on my bar that triggers xmenu to my cursor location. This works great because I have three monitors, and no matter which bar I click on, I will get the menu by my mouse.

The only problem I have with this is that since it goes to my cursor position, it overlaps and obscures the bar when the menu is open.

I have tries setting the coordinates as per the docs, but I suspect that this works differently for multi monitors because I used the coordinate 0x0 assuming that would be in the top left, but I could not see where it launched to at all.

So is there a way I can tell xmenu to spawn at a specific location on every monitor? Basically in the top left but with enough top padding not to obscure my bar.

@phillbush
Copy link
Owner

phillbush commented Jul 29, 2020

For X, all monitors make up a single rectangular screen. So the coordinates 0x0 is the top left corner of this virtual screen, not the top left of a monitor. Some regions of this virtual screen are not assigned to any monitor. You can use a software like slop to get the coordinates of a particular region on the screen.

For now, xmenu is unaware of the existence of monitors, its coordinates are based on this virtual screen.

But I'm going to add support to multi monitors (just wait an hour and a half).
I'll add the option -m NUMBER that makes the position be relative to the monitor NUMBER, not to the virtual screen. I'll also make -m -1 (with negative NUMBER, or some other argument) to make the position be relative to the monitor the mouse is currently in.

Edit: I didn't added the -m option, instead I made the choice of the monitor be specified as another argument of -p, since specifying the monitor only makes sense when also specifying a position with -p.

@GideonWolfe
Copy link
Contributor Author

Wow, this is fantastic. I can easily have three almost identical xmenu scripts that launch on a specific monitor. Thanks again for keeping these features rolling out!

@phillbush
Copy link
Owner

phillbush commented Jul 29, 2020

Done (it took more time than I imagined).

I embedded the monitor information within the -p option , if you run xmenu -p 0x0:0 it will open at position 0x0 of the monitor 0 (Monitor counts from 0 to number of monitors - 1). And if you run xmenu -p 0x0:cursor it will open at position 0x0 of the monitor where the cursor is in.

Can you test to see if the changes work for you? (I don't have a spare monitor rn).

@GideonWolfe
Copy link
Contributor Author

I'll give it a shot!

@GideonWolfe
Copy link
Contributor Author

Remembering to git pull this time, I switched my menu to invoke xmenu with xmenu -i -p 1x1:0.

The output of that is

xmenu: improper position: 1x1:0

@GideonWolfe
Copy link
Contributor Author

Ok, this time I forgot to recompile... The compiler is giving me

/usr/bin/ld: xmenu.o: in function `initmonitor':
xmenu.c:(.text+0x7bf): undefined reference to `XineramaQueryScreens'
collect2: error: ld returned 1 exit status
make: *** [Makefile:9: xmenu] Error 1

@phillbush
Copy link
Owner

I forgot to git add config.mk.
Now it should compile.

@GideonWolfe
Copy link
Contributor Author

Works fantastic! I'll finish getting working on all three monitors and let you know if I run into anything else!

@phillbush phillbush added the enhancement New feature or request label Jul 29, 2020
@GideonWolfe
Copy link
Contributor Author

2020-07-29-143047_5560x1920_scrot

The fruits of your labors have paid off, this is looking slick.

@phillbush
Copy link
Owner

Looks awesome!

@Spuxy
Copy link

Spuxy commented Mar 11, 2022

how about oposite side ? I mean in the right top corner instead of left top corner :) ?

@phillbush
Copy link
Owner

how about oposite side ? I mean in the right top corner instead of left top corner :) ?

Then you should write a script to do some math with the output of xrandr(1) or other program to get the width of the monitor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants