napcok
January 9, 2025, 11:02am
1
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
muzqs
January 9, 2025, 11:31am
2
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.
napcok
January 9, 2025, 11:36am
3
It works similar to F12
or W-r
in our Openbox
Only does not hide window if active.
Never used jumpapp.
1 Like
muzqs
January 9, 2025, 2:05pm
4
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.
ps: login:: Mabox-labwc (experimental)
napcok
January 9, 2025, 2:58pm
5
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.
muzqs
January 9, 2025, 4:38pm
6
I run mabox now with qemu (mabox-labwc).
And yes i understand the session part.
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.
napcok
January 9, 2025, 4:45pm
7
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
Did you update packages? runraise and runraisehide were added this morning.
So:
yay -Syyu
should do the trick.
muzqs
January 9, 2025, 4:52pm
8
I found it.
I need to use full path in rc.xml to runraise.
~/bin/runraise firefox
Now the F1 is working.