Modifying XMonad configuration on Fedora-like distro - haskell

I'm on a Fedora-derived distribution where XMonad plays nicely with the windowing environment. The main assignment within my ~/.xmonad.xmonad.hs looks something like
main = do
session <- getEnv "DESKTOP_SESSION"
xmonad $ maybe desktopConfig desktop session
desktop "gnome" = gnomeConfig
desktop "kde" = kde4Config
desktop "xfce" = xfceConfig
desktop "xmonad-gnome" = gnomeConfig
desktop _ = desktopConfig
I see all these slick modifications I could make a la
xmonad $ desktopConfig {
manageHook = myManageHook <+> manageHook desktopConfig
, layoutHook = simpleTabbed ||| layoutHook desktopConfig
}
at places like http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Config-Desktop.html.
I am a complete Haskell noob. How can I cleanly modify the
xmonad $ maybe desktopConfig desktop session
line to permit adding these goodies in a fashion that doesn't break the windowing environment dispatch?

main = do
session <- getEnv "DESKTOP_SESSION"
let config = maybe desktopConfig desktop session
xmonad $ config{ manageHook = myManageHook <+> manageHook config, ... }

Related

How to remove borders in Xmonad for only one application

This is my xmonad config:
import XMonad
import XMonad.Config.Desktop
main = xmonad desktopConfig
{ terminal = "termite"
, modMask = mod4Mask
, borderWidth = 2
, focusedBorderColor = "#0080FF"
, normalBorderColor = "#000000"
}
How to remove borders when only one application is running? When there are already two applications in one window, the borders are needed.
http://hackage.haskell.org/package/xmonad-contrib-0.15/docs/XMonad-Layout-NoBorders.html#v:smartBorders
You need to set that as your layoutHook.
If I understand the question correctly (you say application but I assume you mean window).

XMonad: Overview of All Currently Opened Windows

In XMonad is there any way to see an overview of all the currently used workspaces including their current windows at a time?
I think it's a very practical piece of software but I have not found any extension that does something like this. Unless you do remember on which workspace you put all your windows, you end up cycling through the workspaces in order to find one particular window.
I'm thinking for instance of one extra workspace (maybe accessed by MOD-0) which gives you the overview. It could maybe even include some thumbnails of the open workspaces. But for the start a text based summary of the window titles would be ok. Does anybody know if this is existing? Or - if not - could anybody give me a rough direction where to start developing an extension/module doing this, maybe another extension that could be used as a point of departure or so.
You could use xmobar for this purpose, if right configured, it shows your current workspace(s) and all workspaces that have open windows or programs in it.
Looks like this:
And this is the config for it:
xmonad.hs:
main = do
xmproc <- spawnPipe "/usr/bin/xmobar /home/svoelkl/.xmobarrc"
status <- spawnPipe myDzenStatus
conky <- spawnPipe myDzenConky
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
.xmobarrc:
Config { position = TopSize L 90 24
, lowerOnStart = True
, bgColor = "black"
, fgColor = "grey"
, commands = [ Run Date "%a %_d %l:%M" "date" 10
, Run StdinReader
, Run BatteryP ["BAT0"]
["-t", "<acstatus><watts> (<left>%)",
"-L", "10", "-H", "80", "-p", "3",
"--", "-O", "<fc=#b2ed00>On</fc> -", "-o", "",
"-L", "-15", "-H", "-5",
"-l", "red", "-m", "blue", "-h", "green"]
600
]
, template = "%StdinReader% }{ %battery% <fc=#ee9a00>%date%</fc>"
}
XMonad is only a windows manager. You'll need something like xmobar/tint2/dzen to display the currently running applications.
An example of tint2:
You can use XMonad.Actions.GridSelect from xmonad-contrib. It will provide you with simple pop-up menu, similar to alt-tab menu in more 'traditional' GUI enviroinments.
Just add that keybinding
((modm, xK_g), goToSelected defaultGSConfig)
as explained in the link above.
Also check out XMonad.Actions.TreeSelect, this might be closer to what you want.

custom key binding in xmonad without affecting other bindings

I am using xmonad, and wanted a nice way to lock the screen. So I installed slock (apt-get install slock), and it works great.
Then I wanted an easy key sequence to trigger slock, so I defined this new function in xmonad.hs:
import qualified Data.Map as M
myKeys conf#(XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((modMask .|. controlMask, xK_l),
spawn "slock")
]
and added keys = myKeys in the main function.
This enabled me to nicely lock the screen using Ctrl+Alt+l, but then none of the other xmonad shortcuts would work!
Is there a way for me to add a single new key binding, but without altering any of the existing bindings?
As you've probably guessed, by setting keys = myKeys in the main function, what you've done is to override the default settings. You can add your keys using the additionalKeys operator, like so:
main =
xmonad $ desktopConfig `additionalKeys` myKeys
Or, if you have some other customisations to desktopConfig,
main =
xmonad $ desktopConfig
{
-- other customisations
} `additionalKeys` myKeys

Same Xmonad.hs configuration breaks under the same version on different computers

I have the exact same Xmonad.hs configuration on two different Linux installations, and while it's working fine on the computer I installed it to the first time, it is causing errors on the second installation. Here is the configuration file:
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import System.IO
main = do
xmproc <- spawnPipe "~/.cabal/bin/xmobar ~/.xmobarrc"
xmonad $ defaultConfig
{ manageHook = manageDocks <+> manageHook defaultConfig
, layoutHook = avoidStruts $ layoutHook defaultConfig
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 80
}
, terminal = "urxvt"
, modMask = mod1Mask
, borderWidth = 1 --was "3"
, focusedBorderColor = "#4099FF"
, normalBorderColor = "#474747"
}
And here is the error that it results in on the second computer(mirrored at nacr.us/media/xmonad.errors):
xmonad.hs:11:20:
Couldn't match expected type `ManageHook'
with actual type `xmonad-0.10:XMonad.Core.ManageHook'
In the first argument of `(<+>)', namely `manageDocks'
In the `manageHook' field of a record
In the second argument of `($)', namely
`defaultConfig
{manageHook = manageDocks <+> manageHook defaultConfig,
layoutHook = avoidStruts $ layoutHook defaultConfig,
logHook = dynamicLogWithPP
(xmobarPP
{ppOutput = hPutStrLn xmproc,
ppTitle = xmobarColor "green" "" . shorten 80}),
terminal = "urxvt", modMask = mod1Mask, borderWidth = 1,
focusedBorderColor = "#4099FF", normalBorderColor = "#474747"}'
Additionally, both installations of xmonad are on identical versions of Ubuntu 12.04, and the installed versions of xmonad are identical (according to apt-cache show xmonad).
Is there something that I'm forgetting about this? I cannot for the life of me figure out what is the problem.
Additionally, here's my dotfiles repo with all the relevant files: https://github.com/lelandbatey/configDebDev
I suspect that you have two versions of xmonad installed (xmonad-0.10 plus some other version), and they are conflicting for some reason. You might try ghc-pkg check to verify that you don't have any broken packages. Next, I would remove xmonad and reinstall it, using your package manager (apt-get?).

No menubar in Xmonad with Ubuntu Unity

when I use xmonad in ubuntu, I follow the tutorial of Xmonad, but there's no app menubar.
How can I solve this problem?
my configure file is here:
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
--import XMonad.Config.Gnome
import XMonad.Layout.Gaps
myLayouts = gaps [(U, 24)] -- $ layoutHook gnomeConfig
main = do
-- xmproc <- spawnPipe "/usr/bin/xmobar ~/.xmobarrc"
xmonad $ defaultConfig
{manageHook = composeAll [
-- other hooks,
manageDocks
, className =? "Unity-2d-panel" --> doIgnore
--, className =? "Unity-2d-launcher" --> doIgnore
-- more hooks
]
-- for gnome begin
--manageDocks <+> manageHook defaultConfig
-- for gnome end
, layoutHook = avoidStruts $ layoutHook defaultConfig
--, logHook = dynamicLogWithPP xmobarPP
-- { ppOutput = hPutStrLn xmproc
-- , ppTitle = xmobarColor "green" "" . shorten 50
-- }
, modMask = mod4Mask -- Rebind Mod to the Windows key
}
Looks like you want to remove global appmenu bar, indicator-appmenu.
You can remove it using apt-get:
sudo apt-get remove indicator-appmenu
then logout/login. Note that this is global so all accounts will loose the global appmenu.
XMonad does not have a menubar, but there are plenty bar's out there. If you have a Gnome installed, you could use the gnome-panel as a first start.
Other menubar's that work well with XMonad are:
xmobar
dzen
conky

Resources