BSPWM, laptop has 1920x1080 resolution, external screen has 1680x1050. xrandr --output DP-1 1680x1050 cuts image, if I change resolution to 1920x1080, I get “full” image, but quality is just bad. I have another machine with XFCE, it’s display utility does the trick and I wonder can I achieve smth similar on BSPWM with some simple console command?

  • questionAskerOP
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    So I played around arandr and resolved initial issue…but got another one (as always). I added script to my bspwmrc file:

    if [[ $(xrandr -q | grep "DP-1 disconnected") ]];
    then
        xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --off
        bspc monitor eDP-1 -d 1 2 3 4 5
    else
        xrandr --output eDP-1 --off --output DP-1 --mode 1680x1050 --pos 0x0 --rotate normal --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --off
        bspc monitor DP-1 -d  1 2 3 4 5
    fi
    

    So if i plug external monitor and reload bspwm (which also reloads polybar), it adds second pane to my polybar (1 2 3 4 5 1 2 3 4 5), but works.

    Now smth interesting, when I unplug external monitor and then again reload bspwm, it switches to internal one but now cuts window for every application.

    • Question 1: how to get rid of multiple workspaces on polybar when I toggle external monitor?
    • Question 2: how to force bspwm respect resolution after switching resolutions?
    • Great! Looks like progress.

      I do suggest looking at autorandr (or similar). autorandr stores your X geometry as profiles, and can detect changes and run scripts.

      I haven’t used bspwm in a long while; I ended up preferring herbstluftwm, but IIRC you have to tell bspwm to configure each screen and delete unused workspaces when you change. It felt more fussy to me, which is why I landed on hlwm.

      Anyway, try adding a line to tell bspwm to “remove” the monitors you aren’t using. It doesn’t detect and remove these itself. Add the lines (after your desktop DP-1 -d setting:

      bspc monitor eDP-1 -r
      bspc wm -o
      

      Swap out eDP-1 with DP-1 when going in the other direction.

      The bspc wm -o is pretty important; it tells bspwm to re-lay everything out (or, at least, that’s what I guess it’s doing). In any case, it fixed a lot of issues when I ran it when changing layouts.

      I found the bspwm community to be largely unhelpful, and containing some caustic people. It very much has a “give a man a fish” mentality. Given how fussy the wm itself is, even after quite an amount of time scripting it, I still felt as if I were casting about most of the time, getting things right only by trial and error, and not being able to reliably predict how my commands would affect the wm.

      If you find yourself in this situation, try herbstluftwm. The community is more helpful, and the WM itself seems more intuitive. For instance, while it allows you to define virtual monitors, it does require fewer commands to deal with physical monitor change events. You still get the “all configuration is done with commands”, but it seems more… sane and consistent. It’s just my opinion, but I appreciate the WM, whereas with bspwm I just felt like I was fighting it all the time.

      • questionAskerOP
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        1 year ago

        Sir, you are magician, addition to script did the trick!

        Will definitely play with autorandr, because if I understood you correctly, it can automatically reload bspwm listening to certain events.

        Right now I’m trying master (or understand, at least) QEMU, can you recommend me some combination with sane defaults (for ex mint + installer for herb) I can play on vm?

        Thank you!

          • questionAskerOP
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            Yes.

            It’s easy way to learn things without fear to break something, can herbstluftwm use sxhkd?

            Easily but why?