mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
Add new module XMonad.Hooks.WindowedFullscreenFix
This commit is contained in:
parent
b963c3cf9d
commit
3d553ad5e0
@ -46,12 +46,16 @@
|
|||||||
|
|
||||||
### New Modules
|
### New Modules
|
||||||
|
|
||||||
|
* `XMonad.Hooks.WindowedFullscreenFix`
|
||||||
|
|
||||||
|
Provides a handleEventHook that fixes the rendering behaviour
|
||||||
|
of some (mostly chromium based) applications when in windowed fullscreen.
|
||||||
|
|
||||||
* `XMonad.Util.ActionCycle`
|
* `XMonad.Util.ActionCycle`
|
||||||
|
|
||||||
A module providing a simple way to implement "cycling" `X` actions,
|
A module providing a simple way to implement "cycling" `X` actions,
|
||||||
useful for things like alternating toggle-style keybindings.
|
useful for things like alternating toggle-style keybindings.
|
||||||
|
|
||||||
|
|
||||||
* `XMonad.Actions.RotateSome`
|
* `XMonad.Actions.RotateSome`
|
||||||
|
|
||||||
Functions for rotating some elements around the stack while keeping others
|
Functions for rotating some elements around the stack while keeping others
|
||||||
|
@ -575,6 +575,10 @@ Here is a list of the modules found in @XMonad.Hooks@:
|
|||||||
* "XMonad.Hooks.WorkspaceHistory":
|
* "XMonad.Hooks.WorkspaceHistory":
|
||||||
Keeps track of workspace viewing order.
|
Keeps track of workspace viewing order.
|
||||||
|
|
||||||
|
* "XMonad.Hooks.WindowedFullscreenFix":
|
||||||
|
Provides a handleEventHook that fixes the rendering behaviour
|
||||||
|
of some (mostly chromium based) applications when in windowed fullscreen.
|
||||||
|
|
||||||
* "XMonad.Hooks.WindowSwallowing"
|
* "XMonad.Hooks.WindowSwallowing"
|
||||||
A handleEventHook that implements window swallowing:
|
A handleEventHook that implements window swallowing:
|
||||||
Hide parent windows like terminals when opening other programs (like image viewers) from within them,
|
Hide parent windows like terminals when opening other programs (like image viewers) from within them,
|
||||||
|
60
XMonad/Hooks/WindowedFullscreenFix.hs
Normal file
60
XMonad/Hooks/WindowedFullscreenFix.hs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- |
|
||||||
|
-- Module : XMonad.Hooks.WindowedFullscreenFix
|
||||||
|
-- Copyright : (c) 2020 Leon Kowarschick
|
||||||
|
-- License : BSD3-style (see LICENSE)
|
||||||
|
--
|
||||||
|
-- Maintainer : Leon Kowarschick. <thereal.elkowar@gmail.com>
|
||||||
|
-- Stability : unstable
|
||||||
|
-- Portability : unportable
|
||||||
|
--
|
||||||
|
-- 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 noral 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 module 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.
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
module XMonad.Hooks.WindowedFullscreenFix
|
||||||
|
( -- * Usage
|
||||||
|
-- $usage
|
||||||
|
windowedFullscreenFixEventHook
|
||||||
|
) where
|
||||||
|
|
||||||
|
|
||||||
|
import XMonad
|
||||||
|
import Data.Monoid (All(All))
|
||||||
|
import Control.Monad (when)
|
||||||
|
|
||||||
|
|
||||||
|
-- $usage
|
||||||
|
-- Use this module by importing
|
||||||
|
--
|
||||||
|
-- > import XMonad.Hooks.WindowedFullscreenFix
|
||||||
|
--
|
||||||
|
-- and then registering the provided eventHook in your handleEventHook:
|
||||||
|
--
|
||||||
|
-- > handleEventHook = handleEventHook def <+> windowedFullscreenFixEventHook
|
||||||
|
--
|
||||||
|
|
||||||
|
-- | 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.
|
||||||
|
windowedFullscreenFixEventHook :: Event -> X All
|
||||||
|
windowedFullscreenFixEventHook (ClientMessageEvent _ _ _ dpy win typ (_:dats)) = do
|
||||||
|
wmstate <- getAtom "_NET_WM_STATE"
|
||||||
|
fullscreen <- getAtom "_NET_WM_STATE_FULLSCREEN"
|
||||||
|
when (typ == wmstate && fromIntegral fullscreen `elem` dats) $ do
|
||||||
|
withWindowAttributes dpy win $ \attrs ->
|
||||||
|
liftIO $ resizeWindow dpy win (fromIntegral $ wa_width attrs - 1) (fromIntegral $ wa_height attrs)
|
||||||
|
withWindowAttributes dpy win $ \attrs ->
|
||||||
|
liftIO $ resizeWindow dpy win (fromIntegral $ wa_width attrs + 1) (fromIntegral $ wa_height attrs)
|
||||||
|
return $ All True
|
||||||
|
windowedFullscreenFixEventHook _ = return $ All True
|
@ -192,6 +192,7 @@ library
|
|||||||
XMonad.Hooks.WallpaperSetter
|
XMonad.Hooks.WallpaperSetter
|
||||||
XMonad.Hooks.WorkspaceByPos
|
XMonad.Hooks.WorkspaceByPos
|
||||||
XMonad.Hooks.WorkspaceHistory
|
XMonad.Hooks.WorkspaceHistory
|
||||||
|
XMonad.Hooks.WindowedFullscreenFix
|
||||||
XMonad.Hooks.WindowSwallowing
|
XMonad.Hooks.WindowSwallowing
|
||||||
XMonad.Hooks.XPropManage
|
XMonad.Hooks.XPropManage
|
||||||
XMonad.Layout.Accordion
|
XMonad.Layout.Accordion
|
||||||
|
Loading…
x
Reference in New Issue
Block a user