You are not logged in.

#1 2024-05-08 07:59:00

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,640

[solved]menu.xml and grim / labwc

I have extended the menu.xml provided by @malm in labwc with the screenshot tool 'grim / slurp' to take screenshots from the left-click menu. The corresponding section looks like this:

<menu id="root-menu">
  <item label="Screenshot">
    <action name="Execute" command="grim" />
  </item>
  <item label="screenclip">
    <action name="Execute" command="slurp | grim -g -" />
  </item>
  <item label="Web browser">
    <action name="Execute" command="vieb" />
  </item>
  <item label="Terminal">
    <action name="Execute" command="foot" />
  </item>
  <item label="Thunar">
    <action name="Execute" command="thunar" />
  </item>
  <item label="Conky">
    <action name="Execute" command="conky -c ~/.conky/rcmus_conkyrc10" />
  </item>
  <item label="killConky">
    <action name="Execute" command="killall conky" />
  </item>
  <item label="Reconfigure">
    <action name="Reconfigure" />
  </item>
  <item label="Logout">
    <action name="Exit" />
  </item>
    <item label="Suspend">
    <action name="Execute" command="systemctl -i suspend" />
  </item>
    <item label="Reboot">
    <action name="Execute" command="systemctl -i reboot" />
  </item>
  <item label="Poweroff">
    <action name="Execute" command="systemctl -i poweroff" />
  </item>
</menu>

This also works wonderfully wink
But I want 'grim' to wait 5 seconds with the screen. It does this perfectly in the terminal:

sleep 5 ; grim

Unfortunately this does not work in the .xml file. I have consulted manpages etc. I'm running out of ideas.

grim -help
Usage: grim [options...] [output-file]

  -h              Show help message and quit.
  -s <factor>     Set the output image scale factor. Defaults to the
                  greatest output scale factor.
  -g <geometry>   Set the region to capture.
  -t png|ppm|jpeg Set the output filetype. Defaults to png.
  -q <quality>    Set the JPEG filetype quality 0-100. Defaults to 80.
  -l <level>      Set the PNG filetype compression level 0-9. Defaults to 6.
  -o <output>     Set the output name to capture.
  -c              Include cursors in the screenshot.
slurp -help
Usage: slurp [options...]

  -h           Show help message and quit.
  -d           Display dimensions of selection.
  -b #rrggbbaa Set background color.
  -c #rrggbbaa Set border color.
  -s #rrggbbaa Set selection color.
  -B #rrggbbaa Set option box color.
  -F s         Set the font family for the dimensions.
  -w n         Set border weight.
  -f s         Set output format.
  -o           Select a display output.
  -p           Select a single point.
  -r           Restrict selection to predefined boxes.
  -a w:h       Force aspect ratio.

Maybe someone of you has an idea?
Thank you!

Last edited by unklar (2024-05-09 09:43:45)

Offline

#2 2024-05-08 09:34:09

micko01
void main()
From: Queensland, Australia
Registered: 2024-04-07
Posts: 492
Website

Re: [solved]menu.xml and grim / labwc

Hi @unklar

The shorthand syntax won't work, however the `xml` is adaptable wink

This syntax works:

<?xml version="1.0" ?>

<openbox_menu>
<menu id="root-menu" label="">
  <item label="Run Program"><action name="Execute" command="tofi-drun" /></item>
  <item label="Screenshot">
    <action name="Execute">
      <command>bash -c "sleep 5; grim -g \"`slurp`\""</command>
    </action>
  </item>
  <item label="File Manager"><action name="Execute" command="thunar" /></item>
  <item label="Web Browser"><action name="Execute" command="netsurf" /></item>
  <item label="Terminal"><action name="Execute" command="lxterminal" /></item>
  <item label="Reconfigure"><action name="Reconfigure" /></item>
  <item label="Exit"><action name="Execute" command="blw-exit" /></item>
</menu>

</openbox_menu>

Just be careful to escape quotes. You can use

\"$(prog)\"

syntax if you prefer.

HTH


#!/bin/sh
echo '#include <stdio.h>\nvoid main() { printf("Hi, bunsenlabs\\n"); return; }' > bunsen.c
gcc bunsen.c -o bunsen
./bunsen

Offline

#3 2024-05-08 17:09:38

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: [solved]menu.xml and grim / labwc

What I find interesting is how OpenBox changes from time to time.

between

<item label="Thunar">
	<action name="Execute">
		<execute>thunar</execute>
	</action>
</item>

and

<item label="Thunar">
	<action name="Execute">
		<command>thunar</command>
	</action>
</item>

And now I see a section of unklar's OB menu:

  <item label="Thunar">
    <action name="Execute" command="thunar" />
  </item>

I'm just glad it works!
{koff koff} when it works.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#4 2024-05-08 18:06:57

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,640

Re: [solved]menu.xml and grim / labwc

micko01 wrote:

Hi @unklar

The shorthand syntax won't work, however the `xml` is adaptable wink

This syntax works:

<?xml version="1.0" ?>

<openbox_menu>
<menu id="root-menu" label="">
  <item label="Run Program"><action name="Execute" command="tofi-drun" /></item>
  <item label="Screenshot">
    <action name="Execute">
      <command>bash -c "sleep 5; grim -g \"`slurp`\""</command>
    </action>
  </item>
  <item label="File Manager"><action name="Execute" command="thunar" /></item>
  <item label="Web Browser"><action name="Execute" command="netsurf" /></item>
  <item label="Terminal"><action name="Execute" command="lxterminal" /></item>
  <item label="Reconfigure"><action name="Reconfigure" /></item>
  <item label="Exit"><action name="Execute" command="blw-exit" /></item>
</menu>

</openbox_menu>

Just be careful to escape quotes. You can use

\"$(prog)\"

syntax if you prefer.

HTH

BINGO!  @micko01
Many thanks for your tip. It works.  Grim waits 5 sec. with the picture. So I can show the menu wink


467031406_20240508_19h50m28s_grim.png


@Sector11,

in reality I have no idea about the openbox menu. I can't get to you!   smile

Offline

#5 2024-05-09 14:00:08

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: [solved]menu.xml and grim / labwc

unklar wrote:

@Sector11,

in reality I have no idea about the openbox menu. I can't get to you!   smile

Quite possibly a change due to Wayland.  big_smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#6 2024-05-10 03:06:10

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,550
Website

Re: [solved]menu.xml and grim / labwc

There is no openbox on Wayland. I think @malm's labwc uses a very similar menu though.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Online

#7 2024-05-10 03:27:07

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,032
Website

Re: [solved]menu.xml and grim / labwc

^ https://github.com/labwc/labwc?tab=read … cification

I haven't done it, but you can compare the defaults with Openbox if you care too...

https://github.com/labwc/labwc/blob/mas … rc.xml.all


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#8 2024-05-10 03:59:17

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,550
Website

Re: [solved]menu.xml and grim / labwc

Yes that's rc.xml which does look a lot like openbox's. I think menu.xml too.

I've grown to like jgmenu so much though, I won't enjoy coming back to openbox-style xml menu configs.

Especially if it will mean having to cludge artificial keystrokes to bring up a custom menu from a script. And of course there's no xdotool on Wayland. roll

...although there are a lot more tools for working with xml than csv.

Sector11 wrote:

...how OpenBox changes from time to time.

<item label="Thunar">
	<action name="Execute">
		<command>thunar</command>
	</action>
</item>

And now I see a section of unklar's OB menu:

  <item label="Thunar">
    <action name="Execute" command="thunar" />
  </item>

That's a difference between how labwc does the menu and how openbox itself does it. In labwc "command" is an attribute of the <action> tag while in openbox it's a <command> tag inside <action>. I'm sure @malm had a reason for making that change.

Last edited by johnraff (2024-05-10 04:44:52)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Online

#9 2024-05-10 12:03:12

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: [solved]menu.xml and grim / labwc

OOOOOHHH!  My OOPS!  I did not realize there was no OB on Wayland.

I'll be losing the two of best things of what I like about Linux, conky v9 and Openbox


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#10 2024-05-10 12:50:16

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,611

Re: [solved]menu.xml and grim / labwc

johnraff wrote:

I've grown to like jgmenu so much though, I won't enjoy coming back to openbox-style xml menu configs.

jgmenu works on Wayland. I've used it with sway, river, and labwc.

johnraff wrote:

And of course there's no xdotool on Wayland.

as well as numlockx, wmctrl, etc ... Wayland has some catching up to do to get tools like these available.


You must unlearn what you have learned.
    -- yoda

Offline

#11 2024-05-11 02:06:55

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,550
Website

Re: [solved]menu.xml and grim / labwc

PackRat wrote:
johnraff wrote:

I've grown to like jgmenu so much though, I won't enjoy coming back to openbox-style xml menu configs.

jgmenu works on Wayland. I've used it with sway, river, and labwc.

Great news!
Is that on xwayland?

I read this in 2022 about porting jgmenu to wayland:

malm wrote:

This would be pretty hard and messy.

The replacement menu he referrred to is still a WIP: https://github.com/johanmalm/trappist
Still no pipemenus it seems.

Last edited by johnraff (2024-05-11 02:18:24)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Online

#12 2024-05-11 07:50:38

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,640

Re: [solved]menu.xml and grim / labwc

johnraff wrote:

Is that on xwayland?

With certainty, yes.  smile

Offline

#13 2024-05-11 10:00:22

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,611

Re: [solved]menu.xml and grim / labwc

johnraff wrote:
PackRat wrote:
johnraff wrote:

I've grown to like jgmenu so much though, I won't enjoy coming back to openbox-style xml menu configs.

jgmenu works on Wayland. I've used it with sway, river, and labwc.

Great news!
Is that on xwayland?

I read this in 2022 about porting jgmenu to wayland:

malm wrote:

This would be pretty hard and messy.

The replacement menu he referrred to is still a WIP: https://github.com/johanmalm/trappist
Still no pipemenus it seems.

Most likely, as unklar pointed out. And I don't do anything fancy with it.


You must unlearn what you have learned.
    -- yoda

Offline

#14 2024-05-12 10:24:54

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,640

Re: [solved]menu.xml and grim / labwc

PackRat wrote:
johnraff wrote:
PackRat wrote:

jgmenu works on Wayland. I've used it with sway, river, and labwc.

Great news!
Is that on xwayland?

I read this in 2022 about porting jgmenu to wayland:

malm wrote:

This would be pretty hard and messy.

The replacement menu he referrred to is still a WIP: https://github.com/johanmalm/trappist
Still no pipemenus it seems.

Most likely, as unklar pointed out. And I don't do anything fancy with it.

I had two installations:

- the pure Wayland (sway)
- the Xwayland (labwc + sway)

After a long time and a lot of frustration, I decided to install Xwayland on top of sway with the pure wayland.

People need a little comfort  wink

Offline

#15 2024-05-13 01:05:26

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,550
Website

Re: [solved]menu.xml and grim / labwc

unklar wrote:

I had two installations:
- the pure Wayland (sway)
- the Xwayland (labwc + sway)
After a long time and a lot of frustration, I decided to install Xwayland on top of sway with the pure wayland.
People need a little comfort

For a user, I think that's exactly right.

As developers, I think it would be good for BL to push as hard as possible for a pure Wayland version, and at the end, when we've done as much as we can, at that point to add xwayland so our users can have some comfort. smile


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Online

#16 2024-05-17 01:38:55

DeepDayze
Like sands through an hourglass...
From: In Linux Land
Registered: 2017-05-28
Posts: 1,897

Re: [solved]menu.xml and grim / labwc

johnraff wrote:
unklar wrote:

I had two installations:
- the pure Wayland (sway)
- the Xwayland (labwc + sway)
After a long time and a lot of frustration, I decided to install Xwayland on top of sway with the pure wayland.
People need a little comfort

For a user, I think that's exactly right.

As developers, I think it would be good for BL to push as hard as possible for a pure Wayland version, and at the end, when we've done as much as we can, at that point to add xwayland so our users can have some comfort. smile

I guess as Wayland is the future. X11 still will hang around until Wayland becomes feature complete and mature, if ever.


Real Men Use Linux

Offline

#17 2024-05-17 09:45:54

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,550
Website

Re: [solved]menu.xml and grim / labwc

^...if ever.

Well, probably Wayland will be complete some day, unless yet another windowing system comes in before then.

Meanwhile, devs have their own opinions but I don't see BunsenLabs Carbon as being anything other than X11 based. But we might be able to put out something minimal for the more adventurous users alongside that. A lot of interesting work is being done round here (not by me though).

But as for Nitrogen, who knows?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Online

#18 2024-05-17 12:16:36

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,640

Re: [solved]menu.xml and grim / labwc

Maybe I'm getting something wrong...

From what I've read about Wayland so far, Wayland is actually 'finished'.
What is not 'finished' are the many, many applications that only 'can' use the previous X server and do not 'understand' wayland. That's why Xwayland was invented as an interim solution so that these applications can 'communicate' again. Unfortunately, this does not apply to ALL applications.

A good example in this context is my problem labwc + flameshot. If there was a dbus for wayland, flameshot would have no problems with the display. But then it wouldn't be wayland.  wink

Offline

#19 2024-05-18 03:38:20

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,550
Website

Re: [solved]menu.xml and grim / labwc

I suppose many people when they say "Wayland" mean "a Wayland-powered desktop".
By that meaning, a "feature-complete Wayland" would imply that all - or at least most - of the functionality that current users of X11-based desktops expect, would be available.

We have to wait for either:
1) most of the applications we use on X11 become usable on Wayland
or
2) alternative applications become available for most of those functions


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Online

#20 2024-05-18 16:02:16

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: [solved]menu.xml and grim / labwc

Calvin and Hobbs are pondering what to do.
2024-05-18-125734.jpg
The forum makes the image larger that it is.  Hmmmm

We now return you to the topic at hand.

Personally I don't even want to think about Wayland yet.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

Board footer

Powered by FluxBB