astier / xswm

Minimal X-window-manager with only one task. Open every window maximized. Zero configuration.
MIT License
19 stars 0 forks source link

Xterm takes a long time to launch and then instantly closes. #2

Closed DuckInTub closed 5 months ago

DuckInTub commented 6 months ago

Xterm doesn't behave properly in xswm. When launching Xterm from an application launcher like rofi (which uses the .desktop file in /usr/share/applications) Xterm takes a very long time to start, before appearing for just a moment and then instantly closing. This just appears as Xterm flashing past the screen a while after the launch was issued. There doesn't seem to be any errors from xterm itself. Launching xterm trough another terminal emulator (st) the command finishes silently after Xterm flashes by the screen. Starting Xterm from another tty or terminal emulator behaves similarly.

Info about packages and system:

The computer is running Void Linux x86_64 with kernel 6.8.6_1 xswm was built from the GitHub repository on 17th of April 2024. xterm version is: xterm-382_1 rofi is a bare install of version of: rofi-1.7.5_1. Note tough that launching xterm from tty or st behaves likewise.

Here is the xterm.desktop file (without comments), which was auto generated when xterm installed:

[Desktop Entry]
Name=XTerm
#GenericName=Terminal
Comment=standard terminal emulator for the X window system
Exec=xterm
Terminal=false
Type=Application
Encoding=UTF-8
Icon=xterm-color_48x48
Categories=System;TerminalEmulator;
Keywords=shell;prompt;command;commandline;cmd;
StartupWMClass=XTerm

Here is a video of what it looks like trying to launch xterm from rofi:

https://github.com/astier/xswm/assets/61461064/3a62fcab-e40a-437b-ba79-0e64fd3abf87

NOTE: Launching Xterm trough other methods like a tty or another terminal emulator like st, behaves the same. NOTE: St which also is a terminal emulator works fine and as expected. NOTE: Launching Xterm in another window manager behaves like expected.

astier commented 6 months ago

I can replicate this issue on my arch machine. I will look into it.

astier commented 5 months ago

The closing of the window is caused by https://github.com/astier/xswm/blob/c8118daae3d7d9b823b8ac5377efd488fff4d2dd/main.c#L110 xswm should first check if WM_TAKE_FOCUS is in the WM_PROTOCOLS property before sending the event. The send_event() function should check in general if the respective protocol is supported by the client. However, xterm still opens slowly with a delay which I will have to figure out why.

astier commented 5 months ago

fd225a6 should be the fix. However, as already mentioned xterm has a delay before opening. I will open a separate issue for this.

astier commented 5 months ago

Could you please confirm if it fixes the xterm-crash? If it fixes the crash then does it still take a long time to load?

astier commented 5 months ago

The delay should be fixed now too.