You are not logged in.

#1 2015-10-10 22:25:06

damo
....moderator....
Registered: 2015-08-20
Posts: 6,732

Have both root-menu and dmenu in screenshot?

I'd like to have both dmenu and the main menu appear in the same screenshot, but one excludes the other.

Is there a way to show the root-menu from a shell command, or alternatively to be able to have dmenu release the keyboard or mouse?

I suspect the answer is either blindingly obvious, or impossible, because extensive googling hasn't helped!


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#2 2015-10-10 23:00:04

twoion
一期一会
Registered: 2015-08-10
Posts: 3,399

Re: Have both root-menu and dmenu in screenshot?

You could use xdotool to 'right-click' somewhere on the desktop after spawning dmenu from a subshell, I imagine.

Offline

#3 2015-10-11 00:44:41

damo
....moderator....
Registered: 2015-08-20
Posts: 6,732

Re: Have both root-menu and dmenu in screenshot?

twoion wrote:

You could use xdotool to 'right-click' somewhere on the desktop after spawning dmenu from a subshell, I imagine.

That is effectively what I have been trying to do, but perhaps I have the subshell syntax wrong. Whatever - one or the other grabs the keyboard. I have tried various combinations of starting one before the other. If dmenu starts first, the main menu doesn't show; if the desktop click is first I get a "cannot grab keyboard" error message in the terminal.

This is the last code I tried (snippet from a test script):

wmctrl -k on    #show desktop
xdotool mousemove --sync $posX $posy

(xdotool click 3 && sleep 2 && xdotool click 1) &    # "click" on desktop
(.config/dmenu/dmenu-bind.sh) &

sleep 2s && xdotool key Escape    # close dmenu

I can run a scrot command after starting one or the other, so I guess it must be because only one process can have the keyboard at any one time.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#4 2015-10-11 02:06:04

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: Have both root-menu and dmenu in screenshot?

It would be interesting to know whether x considers the windows for both as dialogs as well, since dialogs traditionally grab focus. Of course, both are designed to lose focus as soon as a command is selected. Reason I am saying this, is because if you could convince one or the other to temporarily act as a window, that would at least be part of the battle solved.

Last edited by tknomanzr (2015-10-11 02:06:36)

Offline

#5 2015-10-11 06:34:11

woodape
Member
Registered: 2015-09-29
Posts: 38

Re: Have both root-menu and dmenu in screenshot?

Maybe make a pipemenu that calls dmenu? As you scroll over the entry dmenu pops up and the root menu shouldn't go away. I can't test this because I'm not in openbox right now.

<menu id="dmenu" label="Show dmenu" execute="dmenu" />

Offline

#6 2015-10-11 11:05:47

Unia
Octo-portal-pussy
From: Stockholm, Sweden
Registered: 2015-09-17
Posts: 355
Website

Re: Have both root-menu and dmenu in screenshot?

Ugly solution: change dmenu's source code to not grab the keyboard. It will lose focus right away so you'll have to pipe into it whatever you want to show in the scrot when you spawn it, and you'll have to kill it with `killall` or whatever you prefer to use to kill stuff.

diff --git a/dmenu.c b/dmenu.c
old mode 100644
new mode 100755
index 0c53e59..ae02e77
--- a/dmenu.c
+++ b/dmenu.c
@@ -113,12 +113,12 @@ main(int argc, char *argv[]) {
 	initfont(dc, font ? font : DEFAULTFN);
 
 	if(fast) {
-		grabkeyboard();
+		/*grabkeyboard();*/
 		readstdin();
 	}
 	else {
 		readstdin();
-		grabkeyboard();
+		/*grabkeyboard();*/
 	}
 	setup();
 	run();

If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#7 2015-10-11 11:35:36

damo
....moderator....
Registered: 2015-08-20
Posts: 6,732

Re: Have both root-menu and dmenu in screenshot?

Thanks for the imaginative replies smile

The reason for wanting it is to script a screenshot of a user's set up, with a representative appearance. Which means no fiddling with dmenu source code, or changing the menu.

If it was just for me I would take 2 scrots and merge them with gimp wink


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#8 2015-10-11 11:39:12

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,402
Website

Re: Have both root-menu and dmenu in screenshot?

There is probably a way to automate this by using two or three scrots,

a. empty
b. with rootmenu
c. with dmenu

and doing some sort of empty + diff:rootmenu + diff:dmenu > final

stuff.

http://www.imagemagick.org/script/compare.php

(Have not test this personally)

Last edited by brontosaurusrex (2015-10-11 11:41:54)

Offline

#9 2015-10-11 11:45:32

damo
....moderator....
Registered: 2015-08-20
Posts: 6,732

Re: Have both root-menu and dmenu in screenshot?

brontosaurusrex wrote:

There is probably a way to automate this by using two or three scrots,

a. empty
b. with rootmenu
c. with dmenu

and doing some sort of empty + diff:rootmenu + diff:dmenu > final

stuff.

http://www.imagemagick.org/script/compare.php

(Have not test this personally)

It had also occurred to me to use IM in this way, but I decided to put it off until it is a last resort!


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#10 2015-10-11 11:57:06

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,402
Website

Re: Have both root-menu and dmenu in screenshot?

Doing some quick tests, but its not even remotely doing what I want.

Offline

#11 2015-10-11 18:24:22

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,497

Re: Have both root-menu and dmenu in screenshot?

@damo - how are you starting the root menu and dmenu?

In fluxbox, I use key bindings to activate the menu or dmenu. I can get both in a screenshot if I -

1. Open a terminal and start scrot with a time delay - you can minimize the terminal if you don't want it in the shot.
2. Open root menu
3. Open dmenu

Wait for scrot to finish.

Does the openbox menu automatically close if the mouse is moved off / loses focus? I don't have it installed so I cant't check that.

edit - dmenu steals keyboard in fluxbox as well

Last edited by PackRat (2015-10-11 19:48:55)


You must unlearn what you have learned.
    -- yoda

Offline

#12 2015-10-11 18:40:52

damo
....moderator....
Registered: 2015-08-20
Posts: 6,732

Re: Have both root-menu and dmenu in screenshot?

In Openbox I haven't yet found a way to open both at the same time. either by scripting, terminal commands or keys. The menu disappears when it loses focus, and dmenu grabs the keyboard when it runs.

They are mutually exclusive it seems sad


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#13 2015-10-11 19:20:19

Snap
Member
Registered: 2015-10-02
Posts: 465

Re: Have both root-menu and dmenu in screenshot?

In Fluxbox it's easy. Left click and drag on any menu/submenu title will hold it visible until you press Esc even if you launch menu items. I've never heard of a similar feature in OB.

Offline

#14 2015-10-11 19:22:16

mrneilypops
The BL Scrot.Moe Guy
From: luxembourg
Registered: 2015-09-30
Posts: 577
Website

Re: Have both root-menu and dmenu in screenshot?

As PackRat says;
...and I am assuming that you have 2 or more desktops available;

1. From desktop #1 set up dmenu and main menu and decoration as you like.
2. From desktop #2 invoke 'scrot -d 5' (this will give a 5 second delay to switch back to your nicely configured 'pre-screenshot' on desktop #1
3. ...wait
4. You should have a nice scrot of your desired desktop... wink

Offline

#15 2015-10-11 19:56:51

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,497

Re: Have both root-menu and dmenu in screenshot?

In Openbox I haven't yet found a way to open both at the same time.

But you can take a screenshot when either one is open by itself, correct?

1. Take one screenshot with dmenu open.
2. Set the screenshot as your wallpaper
3. Take second screenshot with root menu open.


You must unlearn what you have learned.
    -- yoda

Offline

#16 2015-10-11 20:33:20

damo
....moderator....
Registered: 2015-08-20
Posts: 6,732

Re: Have both root-menu and dmenu in screenshot?

@mrneilypops & @PackRat

Dontcha just love ingenious workarounds!

I should be able to script that, and clean things up afterwards.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

Board footer

Powered by FluxBB