Xmonad vertical resizable tiles hides panel xfce - xmonad

I'm trying to have vertically resizable windows using xmonads and xfce. The problem is that once I change my configuration file to effect this using Xmonad.Layout.ResizableTile the windows cover my panel. How can I fix this?
Here is my xmonad.hs:
import XMonad
import XMonad.Config.Xfce
import XMonad.Layout.ResizableTile
import qualified Data.Map as M
myLayout = tall ||| Mirror tall ||| Full
where
tall = ResizableTall 1 (3/100) (1/2) []
myKeys conf#(XConfig {XMonad.modMask = modm}) = M.fromList
[ ((modm, xK_a), sendMessage MirrorShrink),
((modm, xK_z), sendMessage MirrorExpand)
]
newKeys x = myKeys x `M.union` keys xfceConfig x
main = xmonad $ xfceConfig
{ layoutHook = myLayout,
keys = newKeys
}
Can someone at least explain why this configuration hides the panel? Thanks!

Edit:
I answered too quick, it seems below answer isn't sufficient. I haven't got XFCE installed to test, but here and here is more information about using XMonad and XFCE.
Sorry for not giving the definite answer...
Using avoidStruts should do the trick.
import XMonad.Hooks.ManageDocks
...
myLayout = avoidStruts (tall ||| Mirror tall ||| Full)
where tall = ResizableTall 1 (3/100) (1/2) []
If this should only be applied to certain layouts, use it like
myLayout = (myTall ||| myFull)
where myTall = avoidStruts $ ResizableTall 1 (3/100) (1/2) []
myFull = Full

Related

XMonad tabbed layout hides XMobar in Arch linux

Xmonad hides xmobar and tabs on tabbed layouts. What is wrong with config?
I am using xmonad with xmobar for long time. But last time when I migrated back to Arch linux all layouts from XMonad.Layout.Tabbed show windows on full screen. No xmobar or any tab on the screen. Windows switching and anything else works as well.
Here is three screenshots from my three layouts:
Grid:
Spiral:
Tabbed:
xmonad.hs:
import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
import System.Directory (getHomeDirectory)
import System.FilePath.Posix (joinPath)
import Graphics.X11.Xlib
import Graphics.X11.ExtraTypes.XF86
--import IO (Handle, hPutStrLn)
import qualified System.IO
import XMonad.Actions.CycleWS (nextScreen,prevScreen)
import Data.List
-- Prompts
import XMonad.Prompt
import XMonad.Prompt.Shell
-- Actions
import XMonad.Actions.MouseGestures
import XMonad.Actions.UpdatePointer
import XMonad.Actions.GridSelect
import XMonad.Actions.CycleWS
-- Utils
import XMonad.Util.Run (spawnPipe, safeSpawn)
import XMonad.Util.Loggers
import XMonad.Util.EZConfig
import XMonad.Util.Scratchpad
import XMonad.Util.NamedWindows
import qualified XMonad.StackSet as W
-- Hooks
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.Place
import XMonad.Hooks.EwmhDesktops
-- Layouts
import XMonad.Layout.NoBorders
import XMonad.Layout.Fullscreen
import XMonad.Layout.LayoutCombinators hiding ((|||))
import XMonad.Layout.Grid
import XMonad.Layout.Spiral
import XMonad.Layout.Tabbed
import Data.Ratio ((%))
import XMonad.Layout.ToggleLayouts
import XMonad.Layout.Spacing
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.Gaps
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.SetWMName
defaults = defaultConfig {
terminal = "xterm"
, workspaces = myWorkSpaces
, modMask = mod4Mask
, layoutHook = myLayoutHook
-- , manageHook = myManageHook
, startupHook = myStartupHook
, borderWidth = 2
, normalBorderColor = "#303030"
, focusedBorderColor = "#A0A0A0"
} `additionalKeys` myKeys
myKeys = [
((mod4Mask, xK_g), goToSelected defaultGSConfig)
, ((mod4Mask, xK_s), spawnSelected defaultGSConfig ["vivaldi","idea","robo3t","thunderbird","postman","easyhg","renoise","telegram-desktop"])
, ((mod4Mask, xK_c), spawn "ps -eo pcpu,pid,user,args | sort -r | head -5 >> ~/cpu-report")
, ((mod4Mask, xK_grave), nextWS)
, ((0, xF86XK_AudioRaiseVolume), spawn "amixer -D pulse sset Master 3%+ && ~/.xmonad/getvolume.sh >> /tmp/.volume-pipe")
, ((0, xF86XK_AudioLowerVolume), spawn "amixer -D pulse sset Master 3%- && ~/.xmonad/getvolume.sh >> /tmp/.volume-pipe")
, ((0, xF86XK_AudioMute), spawn "amixer -D pulse sset Master toggle && ~/.xmonad/getvolume.sh >> /tmp/.volume-pipe")
, ((0, xK_Print), spawn "scrot")
]
myWorkSpaces :: [String]
myWorkSpaces = [
"<action=`xdotool key Super_L+1`> |1| </action>"
, "<action=`xdotool key Super_L+2`> |2| </action>"
, "<action=`xdotool key Super_L+3`> |3| </action>"
, "<action=`xdotool key Super_L+4`> |4| </action>"
, "<action=`xdotool key Super_L+5`> |5| </action>"
, "<action=`xdotool key Super_L+6`> |6| </action>"
, "<action=`xdotool key Super_L+7`> |7| </action>"
, "<action=`xdotool key Super_L+8`> |8| </action>"
, "<action=`xdotool key Super_L+9`> |9| </action>"
]
-- tab theme default
myTabConfig = defaultTheme {
activeColor = "#666666"
, activeBorderColor = "#000000"
, inactiveColor = "#666666"
, inactiveBorderColor = "#000000"
, decoHeight = 10
}
xmobarTitleColor = "#FFB6B0"
xmobarCurrentWorkspaceColor = "#FFB6B0"
xmobarUrgentWorkspaceColor = "#45A5F5"
xmobarHiddenNoWindowsColor = "#A4A19F"
myStartupHook = do
startupHook defaultConfig
setWMName "LG3D"
spawn "~/.xmonad/getvolume.sh >> /tmp/.volume-pipe"
myLayoutHook =
avoidStruts $
spacing 6 $
gaps [(U,15)] $
toggleLayouts (noBorders Full) $
smartBorders $ Grid ||| spiral (6/7) ||| tabbedAlways shrinkText defaultTheme
myManageHook = manageDocks <+> manageHook defaultConfig
data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show)
instance UrgencyHook LibNotifyUrgencyHook where
urgencyHook LibNotifyUrgencyHook w = do
name <- getName w
safeSpawn "notify-send" [show name]
main = do
xmproc <- spawnPipe "/usr/bin/xmobar ~/.xmonad/xmobar.hs"
xmonad $ withUrgencyHook LibNotifyUrgencyHook $ fullscreenSupport $ defaults {
logHook = dynamicLogWithPP $ defaultPP {
ppOutput = System.IO.hPutStrLn xmproc
, ppTitle = xmobarColor xmobarTitleColor "" . shorten 65
, ppCurrent = xmobarColor xmobarCurrentWorkspaceColor "" . wrap "" ""
, ppUrgent = xmobarColor xmobarUrgentWorkspaceColor "" . wrap "" ""
, ppHiddenNoWindows = xmobarColor xmobarHiddenNoWindowsColor {-"#7e7c7a"-} "" . wrap "" ""
, ppSep = " "
, ppWsSep = ""
, ppLayout = (\ x -> case x of
"Spacing Grid" -> "[ Grid ]"
"Spacing Spiral" -> "[Spiral]"
_ -> x )
}
}
xmobar.hs:
Config {
font = "xft:DejaVu Sans Mono:size=9:bold:antialias=true",
bgColor = "#000000",
fgColor = "#fcf9f4",
alpha = 125,
position = Static { xpos = 0, ypos = 0, width = 1920, height = 18 },
lowerOnStart = True,
commands = [
Run Memory ["-t","mem: <usedbar>", "-n", "#45a5f5", "-L", "0", "-H", "100"] 10
,Run Date "%d.%m.%Y %a %H:%M:%S" "date" 10
,Run MultiCpu [ "--template" , "cpu: <autovbar>"
, "--Low" , "50" -- units: %
, "--High" , "85" -- units: %
, "--low" , "gray"
, "--normal" , "darkorange"
, "--high" , "darkred"
, "-c" , ""
, "-w" , "1"
] 3
,Run Com "/home/laniakea/.xmonad/getinet.sh" [] "inet" 10
,Run UnsafeStdinReader
,Run PipeReader "/tmp/.volume-pipe" "vol"
,Run Kbd [("us", "US"),("ru", "RU")]
,Run Battery ["-t", "<acstatus> <left>%", "--", "-o", "<fc=#f7c2ba>Off</fc>", "-O", "<fc=#45a5f5>On</fc>", "-i", "<fc=#fcf9f4>Idle</fc>"] 10
],
sepChar = "%",
alignSep = "}{",
template = " %UnsafeStdinReader% }{%vol% | %multicpu% | %memory% | %battery% | %inet% | %kbd% | <fc=#f7c2ba>%date%</fc> "
}
I expect on tabbed layout I still can see xmobar with all info and tabs if I have several windows opened on workspace. Thank you.
I might be answering this question late but this happened for me too. For me I tested the same thing using Xephyr this gave me a clue as to what caused the issue. The issue for me was all about the fonts. So I fixed it in this manner.
myLayout = tabs ||| ...
where
tabs = tabbed shrinkText myTabConf
myTabConf :: Theme
myTabConf = def {
fontName = "xft:Source Code Pro:size=8:antialias=true"
}
If you notice the error generated while using xephyr(user error (createFontSet)), and research a bit on it you will find this.

XMonad: How to use manageHook?

I'm following the instructions Here to make a program (wicd-gtk) always run in a floating window.
Here are the relevant sections from my xmonad.hs:
myManageHook = composeAll
[ className =? "wicd-gtk" --> doFloat
, className =? "stalonetray" --> doIgnore
, manageDocks
]
main = do
xmproc <- spawnPipe "~/.local/bin/xmobar ~/.xmobarrc"
xmonad $ dynamicProjects projects $ docks def
{ layoutHook = avoidStruts $ myLayoutHook
, manageHook = myManageHook <+> manageHook def
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppLayout = (\x -> drop 10 x)
, ppTitle = xmobarColor "green" "" . shorten 150
}
, modMask = mod4Mask
, keys = myKeys
, workspaces = myWorkspaces
, normalBorderColor = myNormalBorderColor
, focusedBorderColor = myFocusedBorderColor
}
I don't get any errors when I recompile but wicd-gtk does not load as a floating window. I also previously tried using doShift to force firefox into a specific window but that did not work as well.
Any ideas what I am doing wrong?
If anyone else was stuck on this, it turns out manageHooks takes the xprop classname not the program name. You can read all about it here: https://wiki.haskell.org/Xmonad/Frequently_asked_questions#I_need_to_find_the_class_title_or_some_other_X_property_of_my_program

Haskell curly brace parse error

Running Manjaro and trying to get XMonad to work I encountered a parse error on input '{' with the following xmonad.hs:
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ defaultConfig
{ manageHook = manageDocks <+> manageHook defaultConfig
, layoutHook = avoidStruts $ layoutHook defaultConfig
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, pptitle = xmobarColor "green" "" . shorten 50
}
, modMask = mod4Mask -- rebind Mod to the windows key
} `additionalKeys`
[ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock; xset dmps force off")
, ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
, ((0, xK_Print), spawn "scrot")
]
I have found this solution on su.sx and took my xmonad.hs from readthedocs.io.
For getting started I would like to use that config file, I do not know however how to apply the solution to this. If somebody proficient could explain why that error appears and how to fix it, I'd really appreciate it since I just recently started with Haskell and it's really bending my mind to an unknown extent... :D
Indent everything after the xmonad $ defaultConfig line further to the right (it seems some of the indentation was lost when you pasted the example):
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ defaultConfig
{ manageHook = manageDocks <+> manageHook defaultConfig
, layoutHook = avoidStruts $ layoutHook defaultConfig
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
}
, modMask = mod4Mask -- Rebind Mod to the Windows key
} `additionalKeys`
[ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock; xset dpms force off")
, ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
, ((0, xK_Print), spawn "scrot")
]
Lines at the "parent" indentation level in a do-block are parsed as separate statements, which is not appropriate here.

How to generate this kind of xmonad tiling

How can I generate this kind of tiling with xmonad?
http://xmonad.org/images/screen-ejt-spiral-dzen.png
I know you can increase/decrease the number of windows in the master pane with mod-comma, and use mod-space mod-h and mod-l to change the layout. But it seems like just those set of commands cannot reproduce the kind of tiling in the above link.
In particular, there are two things I just don't know how to do that the link above does:
The larger tile on the right is not split horizontally in the middle, but is actually longer. I can only increase/decrease the master pane like that using mod-h and mod-l
The smaller tile on the right is split into two subtiles. I have no idea how you would even go about this with xmonad
You need to create a new layout in your .xmonad/xmonad.hs
For this you need to have a little experience with haskell.
I've created a fullscreen Layout which can be used by pressing a specific key combination here's an example:
import the following:
import XMonad.Layout.Spacing
import XMonad.Layout.LayoutCombinators hiding ( (|||) )
import XMonad.Layout.Fullscreen
import XMonad.Layout.NoBorders
import XMonad.Layout.Reflect
import XMonad.Layout.Combo
import XMonad.Layout.TwoPane
import XMonad.Layout.Tabbed
import XMonad.Layout.PerWorkspace
import XMonad.Layout.IM
import XMonad.Layout.ThreeColumns
And then you could do something like this:
sPx = 1
verticalLayout = spacing sPx $ avoidStruts $ reflectHoriz $ Tall 1 0.03 0.5
verticalLayoutLargeScreen = spacing sPx $ avoidStruts $ ThreeCol 1 0.03 0.5
horizontalLayout = spacing sPx $ avoidStruts $ Mirror $ Tall 1 0.03 0.5
webdevLayout = spacing sPx $ avoidStruts $ Tall 1 0.03 0.63
fullscreenLayout = noBorders $ fullscreenFull $ Full
myLayout =
onWorkspace "2:web" (webdevLayout ||| fullscreenLayout) $
(verticalLayout ||| horizontalLayout ||| fullscreenLayout)
After this define a mapping for your key combo:
myAdditionalKeys = [
-- Switch to next layout:
((mod4Mask .|. shiftMask, xK_m), sendMessage NextLayout),
]
and then do not forget to add your layout and your key Mapping to the config, could look like this:
main = do
xmonad $ defaultConfig
{ manageHook = manageSpawn <+> myManageHook <+> manageDocks,
layoutHook = myLayout,
logHook = dynamicLogWithPP xmobarPP {
ppOutput = hPutStrLn xmproc,
ppLayout = (\ x -> ""),
ppTitle = xmobarColor "#b2ed00" ""
} >> updatePointer (Relative 0.99 0.99),
modMask = mod4Mask,
borderWidth = 4,
normalBorderColor = "#777777",
focusedBorderColor = "#ccff00",
workspaces = myWorkspaces,
focusFollowsMouse = True,
terminal = "x-terminal-emulator"
}
`removeKeys` myRemoveKeys
`additionalKeys` myAdditionalKeys

XMobar is hidden on first XMonad workspace

I installed XMonad and XMobar with configured settings. When I start XMonad a XMobar on any without first workspace is dock and opened programs have place below XMobar, but on first workspace when I open any program XMobar become hidden.
These are my XMonad and XMobar configs:
--XMonad:
import XMonad
import XMonad.Util.Run(spawnPipe)
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
main = do
xmproc <- spawnPipe "xmobar ~/.xmobarrc"
xmonad $ defaultConfig
{ manageHook = manageDocks <+> manageHook defaultConfig
, layoutHook = avoidStruts $ layoutHook defaultConfig
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
}
, borderWidth = 2
, terminal = "terminator"
, normalBorderColor = "#cccccc"
, focusedBorderColor = "#cd8b00"
}
--XMobar:
Config { font = "-misc-fixed-*-*-*-*-33-*-*-*-*-*-*-*"
, bgColor = "black"
, fgColor = "grey"
, position = TopW L 90
, commands = [ Run Cpu ["-L","3","-H","50",
"--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Swap [] 10
, Run Com "uname" ["-s","-r"] "" 36000
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
, Run Com "~/.xmonad/batt" [] "" 300
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %cpu% | %memory% | %.xmonad/batt% | <fc=#ee9a00>%date%</fc>"
}
I had the same issue with xmobar v0.24 and xmonad v0.12. I also experienced the problem on all workspaces when quickly recompiling twice (meta-q). I fixed this by setting overrideRedirect to False in my .xmobarrc.
overrideRedirect
If you're running xmobar in a tiling window manager, you might need to set this option to False so that it behaves as a docked application. Defaults to True.

Resources