Full-screen key for Xmonad
Posted
Friday, March 20th 2015 in
Programming -
Permalink
I’ve written a little bit of code to take the focused window and set it to a floating window that takes up the entire screen. This would be much more handy than switching to the fullscreen layout if you want to, e.g., watch a video in a video player.
The following function takes a window and sets it to floating and full screen:
import XMonad
import qualified XMonad.StackSet as SS
fullScreenFloat :: X ()
fullScreenFloat = do
withWindowSet (\stackset ->
case SS.peek stackset of
Just focused ->
windows (SS.float focused (SS.RationalRect 0 0 1 1))
Nothing -> return ())
You can add this new function to your existing keys as follows. This maps it to the f key.
import XMonad.Config.Desktop
import qualified Data.Map as M
myConfig = desktopConfig {
keys =
(keys desktopConfig)
<+> (\layout -> M.fromList $ [((modMask layout, xK_f), fullScreenFloat)])
}
I’ve added this code to a package that can be downloaded through SVN:
% svn checkout svn://colinrmitchell.com/Haskell/XMonad ./XMonad
% cd ./XMonad && cabal install
This will allow you use the code by importing the following in your xmonad.hs file:
import XMonad.Keys.ExtraKeys
|