penrose icon indicating copy to clipboard operation
penrose copied to clipboard

Invisible window tiled after closing discord

Open beaumccartney opened this issue 2 years ago • 0 comments

Describe the bug

After closing a discord window, tiling behaves as if there's still a window, though its invisible.

The invisible window can be cycled to, gets a border, and makes my bar (default polybar) say "Discord" when I hover it.

Killing all discord processes makes this "invisible window" go away.

Not killing discord (for notifications and the like) would be preferable.

EDIT: This happens for any window that you close without killing the process. In summary, a window is tiled until its backing process dies (I think).

To Reproduce

Steps to reproduce the behavior:

  1. Log in to penrose with side_stack layout
  2. Open a terminal and discord client window
  3. Close the discord client window
  4. Terminal window still tiled next to an invisible window - adding more terminals (or other windows) shows much the same

Expected behavior

No invisible window messing with the tiling.

Screenshots

Before closing discord window temp

After closing discord window temp0

After running pkill Discord temp1

Versions & OS Details

  • OS: linux
  • Distribution: Arch
  • Version: Linux 5.18.5-zen1-1-zen with nvidia-open-dkms (latest version, updated five mins before this writing)
  • Penrose Version: 21c708f7fad94b090fb648a68ff8413d39b81c07 (most recent development commit at the time of writing)

Additional context

// main.rs
#[macro_use]
extern crate penrose;

use penrose::{
    core::{
        // bindings::KeyEventHandler,
        config::Config,
        helpers::index_selectors,
        // manager::WindowManager,
        layout::{side_stack, monocle, Layout, LayoutConf}
    },
    logging_error_handler,
    xcb::new_xcb_backed_window_manager,
    Backward, Forward, Less, More, Selector
};

// imports from lib.rs
use penrose_config::*;

use simplelog::{LevelFilter, SimpleLogger};

fn main() -> penrose::Result<()> {
    // Initialise the logger (use LevelFilter::Debug to enable debug logging)
    if let Err(e) = SimpleLogger::init(LevelFilter::Info, simplelog::Config::default()) {
        panic!("unable to set log level: {}", e);
    };
    
    // run startup script
    spawn!("/home/beaum/.config/startup.sh")?;

    let config = Config::default()
        .builder()
        .workspaces(["1", "2", "3", "4", "5", "6", "7", "8", "9"])
        .layouts(vec![
            Layout::new(TILE_SYMBOL, LayoutConf::default(), side_stack, N_MAIN, RATIO),
            Layout::new(MONO_SYMBOL, LayoutConf::default(), monocle, N_MAIN, RATIO),
            Layout::floating(FLOAT_SYMBOL),
        ])
        .show_bar(true)
        .bar_height(40)
        .build()
        .expect("built config successfully");
    
    let key_bindings = gen_keybindings! {
        "M-semicolon" => run_external!(LAUNCHER);
        "M-Return" => run_external!(TERMINAL);
        
        // Exit Penrose (important to remember this one!)
        "M-S-Q" => run_internal!(exit);

        // client management
        "M-j" => run_internal!(cycle_client, Forward);
        "M-k" => run_internal!(cycle_client, Backward);
        "M-S-j" => run_internal!(drag_client, Forward);
        "M-S-k" => run_internal!(drag_client, Backward);
        "M-f" => run_internal!(toggle_client_fullscreen, &Selector::Focused);
        "M-q" => run_internal!(kill_client);
        
        // screen cycle
        "M-h" => run_internal!(cycle_screen, Backward);
        "M-l" => run_internal!(cycle_screen, Forward);

        // workspace management
        "M-Tab" => run_internal!(toggle_workspace);
        "M-period" => run_internal!(cycle_workspace, Forward);
        "M-comma" => run_internal!(cycle_workspace, Backward);

        // Layout management
        // TODO: pick specific layout keybinds
        "M-grave" => run_internal!(cycle_layout, Forward);
        "M-S-grave" => run_internal!(cycle_layout, Backward);
        "M-i" => run_internal!(update_max_main, More);
        "M-d" => run_internal!(update_max_main, Less);
        "M-S-h" => run_internal!(update_main_ratio, More);
        "M-S-l" => run_internal!(update_main_ratio, Less);

        map: { "1", "2", "3", "4", "5", "6", "7", "8", "9" } to index_selectors(9) => {
            "M-{}" => focus_workspace (REF);
            "M-S-{}" => client_to_workspace (REF);
        };
    };

    let mut wm = new_xcb_backed_window_manager(config, vec![], logging_error_handler())?;
    wm.grab_keys_and_run(key_bindings, map!{})
}
// lib.rs
// configuration constants
pub const TERMINAL: &str = env!("TERMINAL");
pub const LAUNCHER: &str = "dmenu_run";
pub const N_MAIN: u32 = 1;
pub const RATIO: f32 = 0.6;

// layout symbols
pub const TILE_SYMBOL: &str = "[tile]";
pub const MONO_SYMBOL: &str = "[mono]";
pub const FLOAT_SYMBOL: &str = "[----]";

My .xinitrc (please note that I have dash symlinked to /bin/sh - still POSIX compliant tho)

#/bin/sh
#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then

    xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then


    xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

nvidia-settings --load-config-only # load brightness settings

discord --start-minimized &

# execute the debug build of my penrose config
# the suggested syntax of &> isn't actually posix compliant afaik so that's why i'm doing stdout and stderr seperately
exec "$SOURCE_INSTALLS"/penrose_config/target/debug/penrose_config 2> /tmp/penrose.log 1> /tmp/penrose.log

Output of cat /tmp/penrose.log:

18:53:27 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:27 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:28 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:28 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:31 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:31 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:31 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:31 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:44 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:44 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:44 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:44 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:47 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:53:47 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:54:37 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:54:37 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:54:37 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:54:37 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:55:26 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:55:26 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:55:26 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:55:26 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:55:32 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:55:32 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:55:32 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:55:32 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:57:26 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:57:26 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:57:26 [ERROR] error=xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }
18:57:26 [ERROR] xcb::ReplyError: xcb::Error { response_type: 0, error_code: 3 }

beaumccartney avatar Jun 22 '22 19:06 beaumccartney