xmonad-extras 0.17.0 → 0.17.1
raw patch · 3 files changed
+77/−3 lines, 3 filesdep +dbusnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: dbus
API changes (from Hackage documentation)
+ XMonad.Actions.Invert: inversionStatus :: Display -> Window -> X Bool
+ XMonad.Actions.Invert: invert :: Display -> Window -> Bool -> X ()
Files
- CHANGELOG.md +4/−0
- XMonad/Actions/Invert.hs +63/−0
- xmonad-extras.cabal +10/−3
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.17.1++* Add window inversion module.+ # 0.17.0 * Appropriate modifications to MPD.hs to make it compatible with
+ XMonad/Actions/Invert.hs view
@@ -0,0 +1,63 @@+{-# LANGUAGE OverloadedStrings #-}+-- | Invert individual window contents via compton/picom compositing manager.+--+-- @since 0.17.1+module XMonad.Actions.Invert + ( -- * Usage:+ -- $usage+ inversionStatus+ , invert+ ) where++import DBus+import DBus.Client+import Data.Maybe+import Data.Word+import Graphics.X11.Xlib.Display+import XMonad++-- $usage+-- To use, first import this module into your @~\/.xmonad\/xmonad.hs@ file:+--+-- > import XMonad.Actions.Invert+--+-- Then add an appropriate mouse binding:+--+-- > , ((modm, xK_i), withDisplay $ \dpy -> withFocused $ \w -> inversionStatus dpy w >>= \status -> invert dpy w $ not status)+--+-- For detailed instructions on editing your mouse bindings, see+-- "XMonad.Doc.Extending#Editing_mouse_bindings".++dpyName :: Display -> String+dpyName dpy = map replace $ displayString dpy where+ replace ':' = '_'+ replace '.' = '_'+ replace c = c++-- | Ask compton/picom the inverted status of the specified window+inversionStatus :: Display -> Window -> X Bool+inversionStatus dpy w =+ let mc = (methodCall "/" "com.github.chjj.compton" "win_get")+ { methodCallDestination = Just $ busName_ $ "com.github.chjj.compton." ++ dpyName dpy+ , methodCallBody = [toVariant (fromIntegral w :: Word32)+ , toVariant ("invert_color_force" :: String)+ ]+ }+ in io $ do client <- connectSession+ status <- call_ client mc+ disconnect client+ return $ (/= 0) $ fromJust $ (fromVariant :: Variant -> Maybe Word32) $ head $ methodReturnBody status++-- | Tell compton/picom to set the inverted status of the specified window+invert :: Display -> Window -> Bool -> X ()+invert dpy w status =+ let mc = (methodCall "/" "com.github.chjj.compton" "win_set")+ { methodCallDestination = Just $ busName_ $ "com.github.chjj.compton." ++ dpyName dpy+ , methodCallBody = [toVariant (fromIntegral w :: Word32)+ , toVariant ("invert_color_force" :: String)+ , toVariant ((if status then 1 else 0) :: Word32)+ ]+ }+ in io $ do client <- connectSession+ callNoReply client mc+ disconnect client
xmonad-extras.cabal view
@@ -1,5 +1,5 @@ name: xmonad-extras-version: 0.17.0+version: 0.17.1 homepage: https://github.com/xmonad/xmonad-extras synopsis: Third party extensions for xmonad with wacky dependencies description: Various modules for xmonad that cannot be added to xmonad-contrib@@ -32,6 +32,9 @@ flag with_template_haskell description: Build modules depending on template haskell. +flag with_dbus+ description: Build modules depending on dbus.+ flag with_brightness description: Build module for brightness control. default: True@@ -61,7 +64,7 @@ -- XMonad.Hooks.EvalServer if flag(with_mpd)- build-depends: libmpd >= 0.9, bytestring >= 0.9 && < 0.11+ build-depends: libmpd >= 0.9, bytestring >= 0.9 && < 0.12 exposed-modules: XMonad.Prompt.MPD if flag(with_regex_posix)@@ -69,7 +72,7 @@ exposed-modules: XMonad.Util.WindowPropertiesRE if flag(with_brightness)- build-depends: bytestring >= 0.9 && < 0.11+ build-depends: bytestring >= 0.9 && < 0.12 exposed-modules: XMonad.Util.Brightness if flag(with_template_haskell) && flag(with_hlist)@@ -81,6 +84,10 @@ XMonad.Config.Alt.QQ other-modules: XMonad.Config.Alt.Types++ if flag(with_dbus)+ build-depends: dbus >= 1.2 && < 1.3+ exposed-modules: XMonad.Actions.Invert exposed-modules: XMonad.Hooks.PerWindowKbdLayout