labwc which is a wayland version of openbox supports the foreign toplevel interface
which provides a list of the open applications and lets you perform actions on the windows
using wlrctl you can list the open windows and use the output in a script
wlrctl list windows
list of windows
use awk to grab the application name
list of applications
activate window by application name
simple script that gets a list of the open application and displays the list with tofi
which a wayland version of rofi and then switches to the application using wlrctl
so rather than use keybinding to switch to a workspace
eg super + 1 switches to workspace 1
i press a keyboard shortcut to display list of applications with tofi and just type the name of the application
and automatically switch to that workspace
labwc rc.xml
labwc doesnt have independent workspaces
if you have mpv playing a video on your second monitor on workspace 1
and you switch to workspace 2 on the first display the second display also switches to workspace 2
you can use window rules to match windows and specify an option called ToggleOmnipresent
which sets the window to be displayed on all workspaces
in the examples below i match chromium, firefox picture in picture windows and mpv
and set them to be displayed on all workspace so when they are on the second display
and i switch workspaces on the first display the window is still displayed on the second display
window rules
which provides a list of the open applications and lets you perform actions on the windows
using wlrctl you can list the open windows and use the output in a script
Code:
sudo pkg install wlrctl
wlrctl list windows
Code:
wlrctl toplevel list
list of windows
Code:
firefox: Post thread | The FreeBSD Forums — Mozilla Firefox
emacs: window-switcher - GNU Emacs at pollux
Alacritty: tmux
chromium-browser: Never the Twain - Series 1 - Episode 4 - ITVX - Chromium
use awk to grab the application name
Code:
wlrctl toplevel list | awk -F: '{print $1}'
list of applications
Code:
firefox
emacs
Alacritty
chromium-browser
activate window by application name
Code:
wlrctl toplevel activate app_id:emacs
simple script that gets a list of the open application and displays the list with tofi
Code:
sudo pkg install tofi
which a wayland version of rofi and then switches to the application using wlrctl
so rather than use keybinding to switch to a workspace
eg super + 1 switches to workspace 1
i press a keyboard shortcut to display list of applications with tofi and just type the name of the application
and automatically switch to that workspace
Code:
#!/bin/sh
input=$(wlrctl toplevel list | awk -F: '{print $1}' | tofi)
wlrctl toplevel activate app_id:"${input}"
labwc rc.xml
labwc doesnt have independent workspaces
if you have mpv playing a video on your second monitor on workspace 1
and you switch to workspace 2 on the first display the second display also switches to workspace 2
you can use window rules to match windows and specify an option called ToggleOmnipresent
which sets the window to be displayed on all workspaces
in the examples below i match chromium, firefox picture in picture windows and mpv
and set them to be displayed on all workspace so when they are on the second display
and i switch workspaces on the first display the window is still displayed on the second display
window rules
Code:
<!-- window rules -->
<windowRules>
<!-- chromium -->
<windowRule identifier="chromium-browser" matchOnce="true">
<skipTaskbar>no</skipTaskbar>
<skipWindowSwitcher>no</skipWindowSwitcher>
<action name="ToggleOmnipresent"/>
</windowRule>
<!-- firefox pip -->
<windowRule identifier="firefox" title="Picture-in-Picture" matchOnce="false">
<skipTaskbar>no</skipTaskbar>
<skipWindowSwitcher>no</skipWindowSwitcher>
<action name="ToggleOmnipresent"/>
</windowRule>
<!-- mpv -->
<windowRule identifier="mpv" matchOnce="true">
<skipTaskbar>no</skipTaskbar>
<skipWindowSwitcher>no</skipWindowSwitcher>
<action name="ToggleOmnipresent"/>
</windowRule>
</windowRules>