xmonad / xmonad-contrib

Contributed modules for xmonad
https://xmonad.org
BSD 3-Clause "New" or "Revised" License
589 stars 274 forks source link

tabs persist after layout switch #635

Open ixzh opened 3 years ago

ixzh commented 3 years ago

Problem Description

I have a combined layout with tabbed as a sub-layout, and use PerWorkspace to have BSP on WS2. (see myLayout below)

When I rename WS 1 to 2, the layout changes to BSP as expected, but the the tabs persist (instead of disappearing). In effect, it appears on every workspace.

Steps to Reproduce

  1. myStartupHook have 7 terminal and 1 FF browser launched in a combined layout on WS1.
  2. rename WS 1 to 2.
  3. Layout changes to BSP, but the tabs persist on WS1, and every other workspaces.
  4. rename WS 2 back to 1, the layout changes back to the combined one, and tabs appear only on WS 1 (as expected)

Configuration File

import System.IO
import System.Exit

import XMonad hiding ( (|||) )

import XMonad.Layout.LayoutCombinators hiding ( (|||) )
import XMonad.Layout.Renamed
import XMonad.Layout.PerWorkspace
import XMonad.Layout.ShowWName

-- Theme for showWName which prints current workspace when you change workspaces.
myShowWNameTheme :: SWNConfig
myShowWNameTheme = def
    { 
    swn_font                = "xft:JetBrainsMono Nerd Font Mono:style=bold:size=36"
    , swn_fade              = 0.5
    , swn_bgcolor           = "#1c1f24"
    , swn_color             = "#ffffff"
    }

myStartupHook = do
    startupHook myBaseConfig
    spawnNOnOnce 7 "1" "alacritty"
    spawnOnOnce "1" "firefox"
    adjustEventInput 

myBaseConfig = desktopConfig

myLayout = 
           showWName' myShowWNameTheme .
           onWorkspaces ["2","3"] myBSP $
           myDefaultLayout
    where
           myDefaultLayout = tmsCombineTwo True 1 (3/100) (1/3) layout1 layout2
           layout1 = tall   
           layout2 = tmsCombineTwo False 3 (3/100) (1/2) layout3 layout4
           layout3 =
               mySpiral 
           layout4 =
               tab
           mySpiral     =   renamed [Replace "spiral"] $ 
                            spiral (6/7)
           tab          =   renamed [Replace "tab"] $ tabbed shrinkText tabConfig

tabConfig = def {
    fontName = "xft:Sarasa UI SC:10"
    , activeColor         = "#46d9ff"
    , inactiveColor       = "#313846"
    , activeBorderColor   = "#46d9ff"
    , inactiveBorderColor = "#282c34"
    , activeTextColor     = "#282c34"
    , inactiveTextColor   = "#d0d0d0"
}

myWorkspaces = ["1","2","3","4","5","6","7","8","9","10"]

myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $ [
   ((modMask .|. shiftMask, xK_r), renameWorkspace myXPConfig)
  ]

main :: IO ()
main = do
    xmonad $
            myBaseConfig {
                startupHook = myStartupHook 
, layoutHook = myLayout
, workspaces = myWorkspaces
, keys = myKeys
} 

Checklist

ixzh commented 3 years ago

After rename WS 1 to 2, tabs persist behind the BSP layout:

WS 2 WS 2

WS 8 WS 8 tabs persist on every other workspaces

rename WS 2 back to 1, back to normal, and tabs disappear from other workspaces: WS 1 WS 1

slotThe commented 3 years ago

I guess tabbed doesn't clean up after itself—sounds like one of the reasons we now broadcast ReleaseResources, right? Admittedly, I haven't looked into all of this too deeply but perhaps @liskin knows more

liskin commented 3 years ago

It's not tabbed not cleaning up after itself, it's PerWorkspace not telling it to clean up when it switches to the other layout. It's a known issue (#75) affecting several layouts. I guess I might want to prioritize #582 after all and deal with these issues at the same time.