Skip to content

Commit

Permalink
Add fullscreen toggle to Xmonad
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Sep 15, 2023
1 parent 983b3fd commit d2cf3a7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions home/programs/xmonad/xmonad.hs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ in
pkgs.writeText "xmonad.hs" ''
import Control.Monad (join, when)
import Data.Maybe (maybeToList)
import qualified Data.Map as M
import XMonad
import XMonad.Actions.CycleWS (Direction1D(Next, Prev), moveTo, shiftTo, toggleWS', WSType(WSIs))
import XMonad.Actions.NoBorders (toggleBorder)
import XMonad.Hooks.EwmhDesktops (ewmh, ewmhFullscreen)
import XMonad.Hooks.ManageDocks (avoidStruts, docks, manageDocks)
Expand Down Expand Up @@ -161,6 +163,17 @@ pkgs.writeText "xmonad.hs" ''
ratio = 1/2 -- Default proportion of screen occupied by master pane
delta = 3/100 -- Percent of screen to increment by when resizing panes
toggleFull = withFocused (\windowId -> do {
floats <- gets (W.floating . windowset);
if windowId `M.member` floats
then do
withFocused $ toggleBorder
withFocused $ windows . W.sink
else do
withFocused $ toggleBorder
withFocused $ windows . (flip W.float $ W.RationalRect 0 0 1 1)
})
myKeys :: [(String, X ())]
myKeys =
[ ("M-S-<Delete>", spawn "${escapeHaskellString cfg.locker.lockCmd}")
Expand All @@ -170,6 +183,7 @@ pkgs.writeText "xmonad.hs" ''
, ("C-<Print>", unGrab *> spawn "${getExe pkgs.bash} ${escapeHaskellString cfg.screenshot.runCmdWindow}")
, ("C-S-<Print>", unGrab *> spawn "${getExe pkgs.bash} ${escapeHaskellString cfg.screenshot.runCmdSelect}")
, ("M-p", spawn "${escapeHaskellString cfg.launcherCmd}")
, ("M-f", toggleFull)
-- Cycling workspaces
, ("M-<Right>", moveTo Next nonNSP)
Expand Down

0 comments on commit d2cf3a7

Please sign in to comment.