xmonad-contrib-0.17.0: Community-maintained extensions extensions for xmonad
Copyright(c) 2020 Leon Kowarschick
LicenseBSD3-style (see LICENSE)
MaintainerLeon Kowarschick. <thereal.elkowar@gmail.com>
Stabilityunstable
Portabilityunportable
Safe HaskellNone
LanguageHaskell2010

XMonad.Util.Hacks

Description

This module is a collection of random fixes, workarounds and other functions that rely on somewhat hacky implementations which may have unwanted side effects and/or are small enough to not warrant a separate module.

Import this module as qualified like so:

import qualified XMonad.Util.Hacks as Hacks

and then use the functions you want as described in their respective documentation.

Synopsis

Windowed fullscreen

Windowed fullscreen describes the behaviour in which XMonad, by default, does not automatically put windows that request being fullscreened into actual fullscreen, but keeps them constrained to their normal window dimensions, still rendering them in fullscreen.

With chromium based applications like Chrome, Discord and others this can cause issues, where the window does not correctly see the size of the window when displaying the fullscreen content, thus cutting off the window content.

This function works around that issue by forcing the window to recalculate their dimensions after initiating fullscreen, thus making chrome-based applications behave properly when in windowed fullscreen.

The following gif shows the behaviour of chrome (left) without this fix compared to firefox, which already behaves as expected by default:

Using this function, chrome will now behave as expected as well:

Usage: add to handleEventHook as follows:

handleEventHook = handleEventHook def <+> Hacks.windowedFullscreenFixEventHook

windowedFullscreenFixEventHook :: Event -> X All Source #

Fixes fullscreen behaviour of chromium based apps by quickly applying and undoing a resize. This causes chromium to recalculate the fullscreen window dimensions to match the actual "windowed fullscreen" dimensions.

Java Hack

Some java Applications might not work with xmonad. A common workaround would be to set the environment variable _JAVA_AWT_WM_NONREPARENTING to 1. The function javaHack does exactly that. Example usage:

main = xmonad $ Hacks.javaHack (def {...})

javaHack :: XConfig l -> XConfig l Source #

Fixes Java applications that don't work well with xmonad, by setting _JAVA_AWT_WM_NONREPARENTING=1

Stacking trays (trayer) above panels (xmobar)

Placing trayer on top of xmobar is somewhat tricky:

  • they both should be lowered to the bottom of the stacking order to avoid overlapping fullscreen windows
  • the tray needs to be stacked on top of the panel regardless of which happens to start first

trayerAboveXmobarEventHook (and the more generic trayAbovePanelEventHook) is an event hook that ensures the latter: whenever the tray lowers itself to the bottom of the stack, it checks whether there are any panels above it and lowers these again.

To ensure the former, that is having both trayer and xmobar lower themselves, which is a necessary prerequisite for this event hook to trigger:

  • set lowerOnStart = True and overrideRedirect = True in ~/.xmobarrc
  • pass -l to trayer

Usage:

handleEventHook = … <> Hacks.trayerAboveXmobarEventHook

trayAbovePanelEventHook Source #

Arguments

:: Query Bool

tray

-> Query Bool

panel

-> Event -> X All

event hook

Whenever a tray window lowers itself to the bottom of the stack, look for any panels above it and lower these.