[XMonad] Disable fading on specific screen

This commit is contained in:
Ivan Malison 2016-11-30 13:09:15 -06:00
parent 66a141c666
commit c71f77a2d2
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -10,9 +10,10 @@ import Data.Aeson
import qualified Data.ByteString.Lazy as B
import Data.List
import qualified Data.Map as M
import qualified Data.MultiMap as MM
import Data.Maybe
import qualified Data.MultiMap as MM
import Graphics.X11.ExtraTypes.XF86
import Network.HostName
import System.Directory
import System.FilePath.Posix
import System.Taffybar.Hooks.PagerHints
@ -151,7 +152,20 @@ transmissionCommand = "transmission-gtk"
-- Startup hook
myStartup = spawn "systemctl --user start wm.target"
tvScreenId :: ScreenId
tvScreenId = 0
disableTVFading = setFading (Just tvScreenId) False
hostNameToAction =
M.fromList [ ("imalison-arch", disableTVFading)
, ("imalison-uber-loaner", return ())
]
myStartup = do
spawn "systemctl --user start wm.target"
hostName <- io getHostName
M.findWithDefault (return ()) hostName hostNameToAction
-- Manage hook
@ -345,17 +359,18 @@ fadeEnabledFor query =
fadeEnabledForWindow = fadeEnabledFor ask
fadeEnabledForWorkspace = fadeEnabledFor getWindowWorkspace
fadeEnabledForScreen = fadeEnabledFor getWindowScreen
getScreens = withWindowSet $ return . W.screens
getWindowWorkspace' = W.findTag <$> ask <*> liftX (withWindowSet return)
getWindowWorkspace = flip fromMaybe <$> getWindowWorkspace' <*> pure "1"
getWorkspaceToScreen = M.fromList . mapP' (W.tag . W.workspace) W.screen <$> getScreens
getWindowScreen = M.lookup <$> getWindowWorkspace <*> liftX getWorkspaceToScreen
getCurrentScreen = join (withFocusedD Nothing (runQuery getWindowScreen))
toggleFadeInactiveLogHook =
fadeOutLogHook .
fadeIf (isUnfocused <&&> fadeEnabledForWindow <&&> fadeEnabledForWorkspace)
fadeIf (isUnfocused <&&> fadeEnabledForWindow <&&> fadeEnabledForWorkspace <&&> fadeEnabledForScreen)
toggleFadingForActiveWindow = withWindowSet $
maybe (return ()) toggleFading . W.peek
@ -363,6 +378,8 @@ toggleFadingForActiveWindow = withWindowSet $
toggleFadingForActiveWorkspace =
withWindowSet $ \ws -> toggleFading $ W.currentTag ws
toggleFadingForActiveScreen = getCurrentScreen >>= toggleFading
toggleFading w = setFading' $ toggleInMap w
setFading w f = setFading' $ M.insert w f
@ -603,6 +620,7 @@ addKeys conf@XConfig {modMask = modm} =
-- Hyper bindings
, ((mod3Mask, xK_1), toggleFadingForActiveWindow)
, ((mod3Mask .|. shiftMask, xK_1), toggleFadingForActiveWorkspace)
, ((mod3Mask .|. controlMask, xK_1), toggleFadingForActiveScreen)
, ((mod3Mask, xK_e), moveTo Next EmptyWS)
, ((mod3Mask, xK_v), spawn "copyq_rofi.sh")
, ((mod3Mask, xK_p), spawn "system_password.sh")