Run or Raise script for Labwc

A simple, inconspicuous script, when used properly - can speed up and facilitate your work incredibly.

The script comes from the official Labwc website

The script below launches an application if it is not already running, or focuses the application’s most recently opened window if it is already running:

#!/bin/sh

if test -z "$1"; then
    echo "Usage: runraise app_id [executable]"
    exit 1
fi

app_id=$1
executable=$2
test -z "$executable" && executable=$app_id

if ! wlrctl window focus "$app_id"; then
    $executable &
    disown
fi

What is it about?

Choose three of your most frequently used applications and assign them to a single key.

For example:

  • webbrowser F1 (firefox)
  • editor F2 (geany)
  • filemanager F3 (doublecmd)

Assign programs to keys in ~/.config/labwc/rc.xml

<keybind key="F1" name.action="Execute" command.action="runraise firefox"/>
<keybind key="F2" name.action="Execute" command.action="runraise geany"/>
<keybind key="F3" name.action="Execute" command.action="runraise doublecmd"/>

See also: Run Raise or Hide

I’m trying to figure out how this behaves (similar to jumpapp for X11?).

Let’s say I have two Firefox windows open, and I press F1.
Would this action open a new Firefox window, or would it switch between the two existing ones?

Not running labwc at the moment, for testing.
:bird:

It works similar to F12 or W-r in our Openbox :slight_smile:
Only does not hide window if active.
Never used jumpapp.

1 Like

How come the difference in syntax for rc.xml.

From labwc template.

<keybind key="W-Return"><action name="Execute" command="foot" /></keybind>

Your version keybind: runraise for firefox.

<keybind key="F1" name.action="Execute" command.action="runraise firefox"/>

Just plain copy paste the lines is not working.

For the check what config Dir do you use.
1e.

~/.config/labwc/*

or
2e.

~/.config/mabox-labwc/*

The Tutorial uses the first.

When i know more about why the keybind is not functioning yet. I let you know.

F1 worked for a moment. When that worked i was editing the mabox-labwc version.

A bit vage post maybe. Will be more clear after some more testing.

:bird:
ps: login:: Mabox-labwc (experimental)

Both lines are valid and allowed in Labwc.

Which rc.xml to edit depends on which session you are using:
labwc or mabox-labwc.
This is the purpose of having two sessions configured differently.

:+1:

I run mabox now with qemu (mabox-labwc).
And yes i understand the session part. :wink:
I got mixed up mabox-labwc and the tutorial path.

I am not in luck with the keybinding part, yet.
Keybinding not working.

Dubble check. This can be used to reload labwc?

labwc -r

I now logout to be sure.

:bird:

Yes labwc -r is for reloading configuration, you can reload from the click-on-desktop menu also.
Labwc man pages are a great source of information:

man labwc
man labwc-actions
man labwc-config
man labwc-menu
man labwc-theme

I haven’t read such a fascinating book in a long time :wink:

Did you update packages? runraise and runraisehide were added this morning.
So:

yay -Syyu

should do the trick.

I found it.

I need to use full path in rc.xml to runraise.

~/bin/runraise firefox

Now the F1 is working.

:bird: