Код: Выделить всё
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
При этом
Код: Выделить всё
WM_WINDOW_ROLE
Модератор: Модераторы разделов
Код: Выделить всё
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
Код: Выделить всё
WM_WINDOW_ROLE
Код: Выделить всё
import Graphics.X11
setAtom :: Window -> String -> String -> X ()
setAtom w name value = withDisplay (io . setAtom')
where setAtom' d = do
a <- internAtom d name False
rw <- rootWindow d $ defaultScreen d
setTextProperty d w value a
setAtom w "WM_WINDOW_CLASS" "myclass"
Код: Выделить всё
manageHook=myManageHook <+> manageDocks <+> placeHook myPlacement <+> manageMenus <+> manageDialogs <+> myManageHook2 <+> myManageHook3
myManageHook3 = composeAll
[ className =? "Dolphin" <&&> role /=? "Dolphin#1" --> doFloat
]
where
role = stringProperty "WM_WINDOW_ROLE"
Код: Выделить всё
myLayout = smartBorders $
onWorkspace "work" (magicFocus (OneBig obWidth obHeight) ||| Full ||| magicFocus (ThreeColMid nmaster delta ratio)) $
onWorkspace "write" (Full ||| Mirror (TwoPane delta (1/2)) ||| magicFocus (OneBig obWidth obHeight)) $
onWorkspace "read" (magicFocus (OneBig obWidth obHeight) ||| Full ||| magicFocus (ThreeColMid nmaster delta ratio)) $
onWorkspace "internet" (Full ||| Mirror (TwoPane delta (1/2))) $
onWorkspace "communication" ( Full ||| magicFocus (OneBig obWidth obHeight) $
onWorkspace "media" (Full ||| magicFocus (ThreeColMid nmaster delta ratio)) $
onWorkspace "system" (Grid ||| magicFocus (OneBig obWidth obHeight)) $
Full
where
nmaster = 1
ratio = 2/3
delta = 3/100
obHeight = 3/4
obWidth = 3/4
Код: Выделить всё
$xmonad --version
xmonad 0.10
Код: Выделить всё
[ className =? "Ark" <&&> textname /=? "Ark" --> doFloat
]
where
textname = stringProperty "WM_NAME"
Код: Выделить всё
....
import XMonad.Layout.Fullscreen
mylayout = avoidStruts $ smartBorders (tall ||| Mirror tall ||| Full ||| fullscreen)
where
tall = Tall 1 (3/100) (1/2)
fullscreen = (fullscreenFull Full)
....
Код: Выделить всё
mylayout = avoidStruts (tall ||| Mirror tall ||| Full) ||| noBorders (fullscreenFull Full)
where
tall = Tall 1 (3/100) (1/2)
xscreensaver -nosplash & exec xmobar /home/user/.xmonad/.xmobarrc & exec ck-launch-session dbus-launch --sh-syntax --exit-with-session xmonad > ~/.xmonad/pipe
#> ~/.xmonad/pipe
trayer --edge bottom --align right --SetDockType true --SetPartialStrut true --expand true --widthtype percent --width 5 --transparent true --tint 0x000000 --height 12 &
Код: Выделить всё
* Package: x11-wm/xmonad-contrib-0.11.2
* Repository: gentoo-haskell
* Maintainer: haskell@gentoo.org
* USE: abi_x86_64 amd64 elibc_glibc kernel_linux userland_GNU xft
* FEATURES: preserve-libs sandbox userpriv usersandbox
* Applying xmonad-contrib-0.11.2-ghc-7.8.patch ...
[ ok ]
* Using cabal-1.18.1.2.
* Prepending /usr/lib64/ghc-7.6.3 to LD_LIBRARY_PATH
/usr/bin/ghc -package Cabal-1.18.1.2 --make /var/tmp/portage/x11-wm/xmonad-contrib-0.11.2/work/xmonad-contrib-0.11.2/Setup.lhs -dynamic -o setup
[1 of 1] Compiling Main ( /var/tmp/portage/x11-wm/xmonad-contrib-0.11.2/work/xmonad-contrib-0.11.2/Setup.lhs, /var/tmp/portage/x11-wm/xmonad-contrib-0.11.2/work/xmonad-contrib-0.11.2/Setup.o )
Linking setup ...
./setup configure --ghc --prefix=/usr --with-compiler=/usr/bin/ghc --with-hc-pkg=/usr/bin/ghc-pkg --prefix=/usr --libdir=/usr/lib64 --libsubdir=xmonad-contrib-0.11.2/ghc-7.6.3 --datadir=/usr/share/ --datasubdir=xmonad-contrib-0.11.2/ghc-7.6.3 --ghc-option=-optl-Wl,-O1 --ghc-option=-optl-Wl,--as-needed --disable-executable-stripping --docdir=/usr/share/doc/xmonad-contrib-0.11.2 --verbose --sysconfdir=/etc --flags=-testing --flags=use_xft
Configuring xmonad-contrib-0.11.2...
Flags chosen: testing=False, use_xft=True, small_base=True
Dependency X11 >=1.6.1 && <1.7: using X11-1.6.1.1
Dependency X11-xft >=0.2: using X11-xft-0.3.1
Dependency base >=3 && <5: using base-4.6.0.1
Dependency containers -any: using containers-0.5.0.0
Dependency directory -any: using directory-1.2.0.1
Dependency extensible-exceptions -any: using extensible-exceptions-0.1.1.4
Dependency mtl >=1 && <3: using mtl-2.1.2
Dependency old-locale -any: using old-locale-1.0.0.5
Dependency old-time -any: using old-time-1.1.0.1
Dependency process -any: using process-1.1.0.2
Dependency random -any: using random-1.0.1.1
Dependency unix -any: using unix-2.6.0.1
Dependency utf8-string -any: using utf8-string-0.3.8
Dependency xmonad ==0.11.*: using xmonad-0.11
setup: The following installed packages are broken because other packages they
depend on are missing. These broken packages must be rebuilt before they can
be used.
package X11-xft-0.3.1 is broken due to missing package
utf8-string-0.3.7-1d0990243cdcebf03df4fdedfb179fd3
* ghc-pkg check: 'checking for other broken packages:'
There are problems in package xmonad-contrib-0.11.2:
Warning: haddock-interfaces: /usr/share/doc/xmonad-contrib-0.11.2/html/xmonad-contrib.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/xmonad-contrib-0.11.2/html doesn't exist or isn't a directory
dependency "utf8-string-0.3.7-1d0990243cdcebf03df4fdedfb179fd3" doesn't exist
dependency "xmonad-0.11-a1ddddae82b975c6544dfeed22a03086" doesn't exist
There are problems in package X11-xft-0.3.1:
Warning: haddock-interfaces: /usr/share/doc/x11-xft-0.3.1/html/X11-xft.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/x11-xft-0.3.1/html doesn't exist or isn't a directory
dependency "utf8-string-0.3.7-1d0990243cdcebf03df4fdedfb179fd3" doesn't exist
The following packages are broken, either because they have a problem
listed above, or because they depend on a broken package.
xmonad-contrib-0.11.2
X11-xft-0.3.1
* Detected broken packages: X11-xft-0.3.1 xmonad-contrib-0.11.2
* ERROR: x11-wm/xmonad-contrib-0.11.2::gentoo-haskell failed (configure phase):
* //==-- Please, run 'haskell-updater' to fix broken packages --==//
*
* Call stack:
* ebuild.sh, line 93: Called src_configure
* environment, line 2896: Called haskell-cabal_src_configure '--flags=-testing' '--flags=use_xft'
* environment, line 2022: Called cabal-configure '--flags=-testing' '--flags=use_xft'
* environment, line 642: Called cabal-show-brokens-and-die 'setup configure failed'
* environment, line 736: Called cabal-show-brokens
* environment, line 732: Called cabal-die-if-nonempty 'broken' 'X11-xft-0.3.1' 'xmonad-contrib-0.11.2'
* environment, line 664: Called die
* The specific snippet of code:
* die "//==-- Please, run 'haskell-updater' to fix ${breakage_type} packages --==//"
*
* If you need support, post the output of `emerge --info '=x11-wm/xmonad-contrib-0.11.2::gentoo-haskell'`,
* the complete build log and the output of `emerge -pqv '=x11-wm/xmonad-contrib-0.11.2::gentoo-haskell'`.
* The complete build log is located at '/var/tmp/portage/x11-wm/xmonad-contrib-0.11.2/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/x11-wm/xmonad-contrib-0.11.2/temp/environment'.
* Working directory: '/var/tmp/portage/x11-wm/xmonad-contrib-0.11.2/work/xmonad-contrib-0.11.2'
* S: '/var/tmp/portage/x11-wm/xmonad-contrib-0.11.2/work/xmonad-contrib-0.11.2'
Код: Выделить всё
, ((modm .|. shiftMask), layoutScreens 1 (fixedLayout [Rectangle 1280 0 1920 1080]))
Код: Выделить всё
, startupHook = layoutScreens 2 (fixedLayout [Rectangle 0 0 640 480, Rectangle 641 481 1040 570])
Код: Выделить всё
, manageHook = liftX $ layoutScreens 2 (fixedLayout [Rectangle 0 0 640 480, Rectangle 641 481 1040 570]) >> return (Endo id)
Код: Выделить всё
onScreenChange :: Event -> X All
onScreenChange (ConfigureEvent {ev_window = w}) = do
whenX (isRoot w) $ do
n <- countScreens
if (n > 1)
then do
layoutScreens 2 (fixedLayout [Rectangle 0 0 640 480, Rectangle 641 481 1040 570])
else rescreen
return (All True)
onScreenChange _ = return (All True)
-- From: XMonad.Layout.IndependentScreens .
countScreens :: (MonadIO m, Integral i) => m i
countScreens = liftM genericLength . liftIO $ openDisplay "" >>= liftA2 (<*) getScreenInfo closeDisplay
Код: Выделить всё
xmonad initxmc = do
...
forever $ prehandle =<< io (nextEvent dpy e >> getEvent e)
where
...
prehandle e = let ... in local (\c -> ...) (handleWithHook e)
...
handleWithHook :: Event -> X ()
handleWithHook e = do
evHook <- asks (handleEventHook . config)
whenX (userCodeDef True $ getAll `fmap` evHook e) (handle e)
...
handle :: Event -> X ()
-- configuration changes in the root may mean display settings have changed
handle (ConfigureEvent {ev_window = w}) = whenX (isRoot w) rescreen
Код: Выделить всё
...
, manageHook = liftX $ onTwoScreens
...
onTwoScreens :: X (Endo WindowSet)
onTwoScreens = do
n <- countScreens
if (n > 1)
then do
layoutScreens 2 (fixedLayout [Rectangle 0 0 640 480, Rectangle 641 481 1040 570])
else rescreen
return (Endo id)
Код: Выделить всё
{-# LANGUAGE DeriveDataTypeable #-}
import qualified XMonad.Util.ExtensibleState as XS
...
, manageHook = liftX $ onTwoScreens
, handleEventHook = onScreenChange
...
onTwoScreens :: X (Endo WindowSet)
onTwoScreens = do
NScreens n <- XS.get
if (n > 1)
then do
layoutSplitScreen 2 (fixedLayout [Rectangle 0 0 640 480, Rectangle 641 481 1040 570])
else rescreen
return (Endo id)
newtype NScreens = NScreens Int
deriving (Show, Read, Typeable)
instance ExtensionClass NScreens where
initialValue = NScreens 1
extensionType = PersistentExtension
onScreenChange :: Event -> X All
onScreenChange (ConfigureEvent {ev_window = w}) = do
whenX (isRoot w) $ countScreens >>= XS.put . NScreens
return (All True)
onScreenChange _ = return (All True)
-- From: XMonad.Layout.IndependentScreens .
countScreens :: (MonadIO m, Integral i) => m i
countScreens = liftM genericLength . liftIO $ openDisplay "" >>= liftA2 (<*) getScreenInfo closeDisplay
sgfault писал(а): ↑28.02.2015 17:32Вообще, я не совсем понял первоначальную задачу: вы хотите использовать XMonad.Layout.PerWorkspace (для 10-го workspace), а также сделать невозможным переключение на 10-й workspace, когда вы находитесь на (допустим) 1-ом Screen-е (те, возможно, XMonad.Layout.IndependentScreens) ? Если так, то не совсем понятно зачем вам вообще XMonad.Layout.LayoutScreens .
Код: Выделить всё
import Data.Monoid
import Control.Applicative
import XMonad
import qualified XMonad.StackSet as W
Код: Выделить всё
-- Move all elements, matching predicate, to the head of list.
riseElems :: (a -> Bool) -> [a] -> [a]
--riseElems p xs = filter p xs ++ filter (not . p) xs
riseElems p = liftA2 (++) (filter p) (filter (not . p))
Код: Выделить всё
XConfig
{
..
, workspaces = riseElems (`elem` ["2", "7"]) $ map show [1..9]
..
}
Код: Выделить всё
startupDefaultWorkspaces :: [WorkspaceId] -> X ()
startupDefaultWorkspaces ts = windows $ \ws ->
let xs = zip ts (map (W.tag . W.workspace) . W.screens $ ws)
in foldr (\(x, y) zws -> W.view x . W.view y $ zws) ws xs
Код: Выделить всё
defaultWorkspaces :: [WorkspaceId] -> X ()
defaultWorkspaces ts = windows $ \ws@(W.StackSet {W.hidden = hs }) ->
ws {W.hidden = riseElems ((`elem` ts) . W.tag) hs}
-- Move specified workspaces to the head of `hidden` workspace list at Screen
-- change event. Then `rescreen` (from XMonad/Operations.hs), run by default
-- ConfigureEvent handler (`handle` from XMonad/Main.hsc), will choose first
-- ones from them for displaying on new Screen.
handleDefaultWorkspaces :: [WorkspaceId] -> Event -> X All
handleDefaultWorkspaces ts (ConfigureEvent {ev_window = w}) = do
whenX (isRoot w) (defaultWorkspaces ts)
trace "ConfigureEvent"
return (All True)
handleDefaultWorkspaces _ _ = return (All True)
Код: Выделить всё
XConfig
{
..
, startupHook = startupDefaultWorkspaces ["2", "7"]
..
}
Код: Выделить всё
XConfig
{
..
, handleEventHook = handleDefaultWorkspaces ["2", "7"]
..
}