xmonad/xmonad

[ISSUE (?)] Toggle Gaps + Tab layout and sublayouts spacing isuue

Closed this issue · 8 comments

Problem Description

Toggling off spacing and gaps , having "Layout A" and "Layout B" , bot with tab sublayout :

  • If I set the Spacing Raw for each layout:
    I toggle off spacing on Layout A , then I switch to layout B : on Layout B the spacing is toggled on again , if I toggle on tabs the tabs looks OK, with no space between the tabs and the tabbed window

  • If I set the Spacing Raw for all the layouts I use , setting it in myLayouthook
    I toggle off spacing on Layout A , then I switch to layout B : on Layout B the spacing remains toggled off , if I toggle on tabs ,the tabs looks BAD, with the spacing between the tabs and the tabbed window

This happens also with full tabbed layuot

What I expected

I toggle off spacing on Layout A , then I switch to layout B : on Layout B the spacing remains toggled off , if I toggle on tabs, the tabs looks OK, with no space between the tabs and the tabbed window

Configuration File

I'm trying to report here the necessary points of my configuration , I have over 1200 lines on my xmonad.hs , I apologize if something may be missed


import XMonad.Layout.Tabbed
import XMonad.Layout.SubLayouts
import XMonad.Layout.Spacing
import XMonad.Layout.Gaps
.......
......
......
myDefaults =  def {
......
......
manageHook = myManageHook
}

-- Makes setting the spacingRaw simpler to write. The spacingRaw module adds a configurable amount of space around windows.
mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
mySpacing i = spacingRaw False (Border i i i i) True (Border i i i i) True
 grid           = renamed [Replace "grid"]
                   ............
                  $ addTabs shrinkText myTabTheme                              
                  $ subLayout [] (Simplest)                                     
                  $ mySpacing 5                -----> SPACING FOR THIS LAYOUT                          
                  $ GridRatio (3/2)                       
threeColMid    = renamed [Replace "threeColMid"]
                  $ avoidFloats                                                                 
                   ..........
                  $ addTabs shrinkText myTabTheme                                
                  $ subLayout [] (Simplest)                                       
                  $ mySpacing 5                 -----> SPACING FOR THIS LAYOUT  
                  $ ResizableThreeColMid 1 (3/100) (1/2)  []               

tabs           = renamed [Replace "tabs"]
                  $ avoidFloats                                            
                  .....
                  $ addTabs shrinkText myTabTheme                                
                  $ subLayout [] Simplest                                        
                  $ mySpacing 5                                                  
                  $ noBorders Simplest                                        

.......
.......
-- Layours common settings
myLayoutHook = avoidStruts                                           
               ......
  
            -- $ spacingRaw True (Border 0 5 5 5) True (Border 5 5 5 5) True  ( THIS IS COMMENTED AS I USE SPACING FOR EACH LAYOUT; FOR USE IT I UNCOMMENT THIS LINE AD I COMMENT mySpacing 5 IN ALL THE LAYOUTS, FOR HAVE THIS VARIABLE APPLIED TO ALL THE LAYOUTS)
            ......
            ......
            .......

-- Toggle spacing & gaps all windows                                      
  , ((modMask, xK_g), (sendMessage $ ToggleGaps) >> (sequence_ [(spawn $ "polybar-msg cmd toggle"), toggleScreenSpacingEnabled, toggleWindowSpacingEnabled]))  

....
-- Tabbed Sublayout Keys
  , ((controlMask .|. modMask, xK_m), withFocused (sendMessage . MergeAll))             -- merge all windows in tabs
  , ((controlMask .|. modMask, xK_u), withFocused (sendMessage . UnMerge))              -- unmerge focused window from tabs
  , ((controlMask .|. modMask, xK_v), withFocused (sendMessage . UnMergeAll))           -- merge all windows from tabs
--  
  , ((controlMask .|. modMask, xK_h), sendMessage $ pullGroup L)                        -- pull focused window in tabs on the left
  , ((controlMask .|. modMask, xK_l), sendMessage $ pullGroup R)                        -- pull focused window in tabs on the right
  , ((controlMask .|. modMask, xK_k), sendMessage $ pullGroup U)                        -- pull focused window in tabs up
  , ((controlMask .|. modMask, xK_j), sendMessage $ pullGroup D)                        -- pull focused window in tabs down
--

  

Checklist

  • [x ] I've read CONTRIBUTING.md

  • I tested my configuration

    • [x ] With xmonad version 0.17.1-105 (latest on arch)
    • [x ] With xmonad-contrib version 0.17.1-105 (latest on arch)

It sounds like something is wrong here, but not quite what you think: layout settings are per workspace, so toggling spacing off on a workspace should not affect any other workspace, including how tabs render on those workspaces.

It sounds like something is wrong here, but not quite what you think: layout settings are per workspace, so toggling spacing off on a workspace should not affect any other workspace, including how tabs render on those workspaces.

You ' re right.
I almost figure out how to set my config as the way I desire.
I've just one problem : I need to disable spacing only for my floating layout

I set my config like that


-- Makes setting the spacingRaw simpler to write. The spacingRaw module adds a configurable amount of space around windows.
mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
mySpacing i = spacingRaw False (Border i i i i) True (Border i i i i) True

 grid           = renamed [Replace "grid"]
                   ............
                  $ addTabs shrinkText myTabTheme                              
                  $ subLayout [] (Simplest)                                                           
                  $ GridRatio (3/2)                       
threeColMid    = renamed [Replace "threeColMid"]
                  $ avoidFloats                                                                 
                   ..........
                  $ addTabs shrinkText myTabTheme                                
                  $ subLayout [] (Simplest)                                       
                  $ ResizableThreeColMid 1 (3/100) (1/2)  []               

tabs           = renamed [Replace "tabs"]
                  $ avoidFloats                                            
                  .....
                  $ addTabs shrinkText myTabTheme                                
                  $ subLayout [] Simplest                                                                                      
                  $ noBorders Simplest                                        

simpleFloat    = renamed [Replace "simpleFloat"]                        
                  $ addTabs shrinkText myTabTheme                                  
                  $ smartBorders                                                  
                  $ subLayout [] Simplest                                                                                 
                  $ simplestFloat                                                

.......
.......
-- Layours common settings
myLayoutHook = avoidStruts                                           
               ......
  
         $ mySpacing 5                ----->   SPACING FOR ALL THE LAYOUTS   
            ......
            ......

Now , I need the defined variable mySpacing 5 to be excluded only for the simpleFloat layout

You need to remove it from the common settings and put it in the individual ones.

Alternately, and only if you are using something like onWorkspace, you can list the floating workspace(s) first, then spacing, then the settings for the other workspaces. See for example https://github.com/geekosaur/xmonad.hs/blob/skkukuk/xmonad.hs#L154-L155. This will only work if you have things set up that way, though; if this is a ||| rotation then your only option is to list spacing separately for each one it should apply to.

You need to remove it from the common settings and put it in the individual ones.

Alternately, and only if you are using something like onWorkspace, you can list the floating workspace(s) first, then spacing, then the settings for the other workspaces. See for example https://github.com/geekosaur/xmonad.hs/blob/skkukuk/xmonad.hs#L154-L155. This will only work if you have things set up that way, though; if this is a ||| rotation then your only option is to list spacing separately for each one it should apply to.

Thank you for your answer.
The solutions you propose do not give me the effect I wanted.
I think it can be useful having an option to override the common settings in some occasions
In this case, I think that SimpleFloat should have an option for disable spacing (something like noSpacing Simple Float). Spacing is not so useful with floating windows, by the way
Or also, it can be useful a layout modifier that disable spacing and/or gaps, overriding the common settings.
Can one or both of these thing be archived adding new features?

The way layouts work, the spacing has already been applied and can't be reversed at that point. (Layouts are functions, and the spacing function has already run by then.)

The way layouts work, the spacing has already been applied and can't be reversed at that point. (Layouts are functions, and the spacing function has already run by then.)

Considering what you said, the problem can be solved only by fix the way of tabbed layout and tabbed sublayout manage the spacing: when you apply spacing in the common setting, the spacing is also applied between windows and tabs , and that looks ugly:

Screenshot-2023-10-13-1697225715_screenshot_1920x1080

Can this be considered as an official request or should I open a specific request for this issue?

You can request it, but it'd require a complete redesign of Tabbed, which currently is based on Decoration whose windows are visible to and therefore subject to spacing. I don't think it's likely to happen at this point unless someone contributes a new version of Tabbed (or maybe Decoration).

You can request it, but it'd require a complete redesign of Tabbed, which currently is based on Decoration whose windows are visible to and therefore subject to spacing. I don't think it's likely to happen at this point unless someone contributes a new version of Tabbed (or maybe Decoration).

I'll open a request
Tabs and decoration should looks good even with common spacing , in my opinion
Thank you