Solved Sway starts but Unable to Run Applications

How to get Sway to show menu and respond to keyboard input?

Sway starts (Picture of tree leaning in the breeze shows) but, instead of a menu, it has a grey bar at the top with a bunch of white outlines. in it.

I have not been able to start any applications. I tried COMMAND + ENTER, ALT + ENTER, COMMAND + D, ALT + D.

Using FreeBSD 14.2-RELEASE on fresh install

Install & Start sway:
Code:
# add user to video group
pw groupmod video -m [username]

# Kernel Module for Intel Integrated GPU
kldload i915kms

# Install packages are recommended in the handbook
pkg install wayland seatd sway swayidle swaylock-effects alacritty dmenu-wayland dmenu

# as user
screen -D -R one
seatd-launch -l debug sway


Errors:
Code:
Here I see error: "swaybar/tray/tray.c:42 Failed to connect to user bus: No such file or directory"

So then I tried launching a different way:

Code:
dbus-run-session sway

and got errors:

Code:
seatd/seat.c:332 Could not revoke drm master on device fd: Invalid argument
seatd/seat.c:550 Could not deactivate /dev/drm/0: Invalid argument
 
I have had dmenu running in sway with the following packages installed: dmenu, dmenu-wayland, wmenu . I have also had dbus and seatd services enabled in /etc/rc.conf . Have you modified your ~/.config/sway for your preferred menu, terminal emulator, etc.?
 
In ~/.config/sway/config I have set:

Code:
set $term alacritty

Also I see this (I have not edited):
Code:
set $menu dmenu_path | wmenu | xargs swaymsg exec --

Now installing wmenu:
Code:
pkg install wmenu

Effect is still the same. Menu appears with white rectangular outlines instead of text.

This time I tried ALT + D and notices that the very top row of pixels changed a little bit. So I assume dmenu_path had launched. I tried the command alacritty, and the screen went blank. Unable to switch to another virtual console. Rebooting...
 
Managed to get a new/different error.

Started sway: seatd-launch sway

Pressed ALT + ENTER, and it dumped me back into the virtual console but these two error messages were present:

Code:
[common/terminal.c:209] Could not set VT mode to enable process switching: Operation not permitted
[swaybar/tray/tray.c:42] Failed to connect to user bus: No such file or directory
 
I have limited experience with wayland, but I could get sway and wayfire to work following the instructions in the Handbook. Could you please confirm that you have installed and enabled the relevant video driver, dbus, seatd, etc. and have the needed software installed as recommended in the Handbook? Do you have Xorg working on this computer?
 
Could you please confirm that you have installed and enabled the relevant video driver, dbus, seatd, etc. and have the needed software installed as recommended in the Handbook?

this machine is using the i915kms kernel module, as it has integrated intel graphics.

since the background artwork displays, this I take to mean that graphics are working.

Code:
# /etc/rc.conf
...
seatd_enable="YES"
dbus_enable="YES"
 
Could you please try launching sway with sway -c ~/.config/sway/config instead?; you have modified configuration in ~/.config/sway/config based on your previous post.
Confirmed that sway is already referencing ~/.config/sway/config without my specifying it. (Added garbage to the file and noted that red boxes appeared on the screen when I ran sway again.) 😁
 
  • Like
Reactions: drr
Noticed this just now. Do you have fonts installed? I used to get rectangular outlines and crashes in Xcfe when fonts were not installed. Installing a good set of fonts fixes this issue.
without xorg installed, installing fonts pkg install urwfonts indeed resolves one of the issues. It does not make the menus appear correctly, but it does make it so that alacritty can start inside sway when I press MOD + ENTER. 👍
 
  • Like
Reactions: drr
For what it's worth, NapoleonWils0n has some youtube videos and various things on this forum about dwl. (I think sway is more like i3, dwl is more like dwm). So, if what you want is a tiling window manager and you're ok with using something besides an i3 type, it might be helpful. Here's one of his youtube vids on setting it up.
 
What's your $XDG_RUNTIME_DIR? I don't set it since the system auto set it to /var/run/xdg/$USER after FreeBSD 14.x. And you can try GTK/QT based terminal emulators like x11/gnome-terminal to check whether the keyboard responds, sometimes alacritty just cannot start. x11/fuzzel works fine for menu. WLR_NO_HARDWARE_CURSORS=1 will show you the mouse cursor. For reference, I use a script to start sway.

#!/bin/sh
export QT_QPA_PLATFORMTHEME=qt5ct
export QT_AUTO_SCREEN_SCALE_FACTOR=1
export CLUTTER_BACKEND=wayland
export WLR_NO_HARDWARE_CURSORS=1
export LANG=en_US.UTF-8

export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export GDK_BACKEND=wayland

export LIBVA_DRIVER_NAME=nvidia
export XDG_SESSION_TYPE=wayland
export XDG_CURRENT_DESKTOP=sway
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia

export MOZ_ENABLE_WAYLAND=1

export GTK_THEME=Flat-Remix-GTK-Violet-Dark
export XCURSOR_THEME=Bibata-Modern-Classic
export XCURSOR_SIZE=24
export WLR_RENDERER=vulkan

dbus-run-session sway --unsupported-gpu
 
In hindsight this thread could have been called "How to run Sway without installing Xorg" since I've discovered that running pkg install xorg resolves the issue.

Still working to get actual text to show up in the menu without xorg installed.
 
  • Like
Reactions: drr
hi mate

xorg isnt needed to run a wayland wlroots compositor like sway, wayfire, labwc or dwl

there are only a couple of things to get set up

1 - enable seatd and dbus
which you have done

2 - add yourself to the video and wheel groups

i see you have added yourself to the video group,
is you user in the wheel group as well

3 - enable i915kms

using sysrc

Code:
sudo sysrc kld_list+="i915kms"

or manually edit the file an editor

Code:
sudo vi /etc/rc.conf

then add the following code

Code:
kld_list="i915kms"

4 - XDG_RUNTIME_DIR
should be set

the wayland socket in created in the XDG_RUNTIME_DIR directory

you are running Freebsd 14.2 so the XDG_RUNTIME_DIR is automatically created
and its location is exported, so you dont need to export it in your shell config

run printenv

Code:
printenv

it should list the XDG_RUNTIME_DIR and the path
where username is your username

Code:
XDG_RUNTIME_DIR=/var/run/xdg/username

5 - check you have the required packages installed

these are the packages i used to install dwl and labwc

Code:
sudo pkg install wlroots wayland wayland-protocols seatd qt5ct qt5-wayland

6 - starting sway

Code:
exec dbus-launch --exit-with-session sway

you may be missing some fonts that get install by xorg
thats my guess

but you dont need xorg installed to run wayland wlroots compositor

see if that helps, give me a nudge if you get stuck
 
SOLVED!!! (If you are an admin, please mark this thread as SOLVED)

Fonts were what was missing. Installing xorg adds lots of fonts (among other things). But taking drr 's recommendation is much cleaner/simpler:
Code:
pkg install noto-basic

This gets text to display in dmenu, and allows alacritty to start. And xorg is no longer installed!!
 
  • Thanks
Reactions: drr
Reading the OP's first post my first reaction is: Install fonts.

If Sway (or any other Wayland compositor) comes up, then you've got graphics support, and the user has access (belongs to video group)

Typically, Wayland compositor packages do not include any fonts. Not being able to launch applications, notably a terminal (which requires fonts be installed), is the give away.

A reasonable starting point may include:
cantarell-fonts
droid-fonts-ttf
font-awesome
liberation-fonts-ttf
nerd-fonts
roboto-fonts-ttf
source-code-pro
webfonts
 
hi mate

you also want to install

Code:
noto-emoji

for emojis

i dont use emojis but you they are used in a lot of titles for youtube videos
and if you dont have an emoji font installed you will get an empty square box in the youtube title

another note

you made the right choice installing noto-basic
if you install the noto metaport its about 2 gig
 
Code:
noto-emoji

for emojis
...
you made the right choice installing noto-basic
if you install the noto metaport its about 2 gig
I do include those as well; sadly a simple grep of `pkg info` for fonts will be incomplete due to the varying naming used for fonts. Artifacts of many years of existence.
 
  • Like
Reactions: drr
Back
Top