mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-26 09:41:52 -07:00
replace "name" in NamedWindow with a Show instance.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
module XMonadContrib.NamedWindows ( NamedWindow, getName, withNamedWindow, unName, name ) where
|
module XMonadContrib.NamedWindows ( NamedWindow, getName, withNamedWindow, unName ) where
|
||||||
|
|
||||||
-- This module allows you to associate the X titles of windows with
|
-- This module allows you to associate the X titles of windows with
|
||||||
-- them. See XMonadContrib.Mosaic for an example of its use.
|
-- them. See XMonadContrib.Mosaic for an example of its use.
|
||||||
@@ -18,6 +18,8 @@ instance Eq NamedWindow where
|
|||||||
(NW s _) == (NW s' _) = s == s'
|
(NW s _) == (NW s' _) = s == s'
|
||||||
instance Ord NamedWindow where
|
instance Ord NamedWindow where
|
||||||
compare (NW s _) (NW s' _) = compare s s'
|
compare (NW s _) (NW s' _) = compare s s'
|
||||||
|
instance Show NamedWindow where
|
||||||
|
show (NW n _) = n
|
||||||
|
|
||||||
getName :: Window -> X NamedWindow
|
getName :: Window -> X NamedWindow
|
||||||
getName w = asks display >>= \d -> do n <- maybe "" id `fmap` io (fetchName d w)
|
getName w = asks display >>= \d -> do n <- maybe "" id `fmap` io (fetchName d w)
|
||||||
@@ -26,9 +28,6 @@ getName w = asks display >>= \d -> do n <- maybe "" id `fmap` io (fetchName d w)
|
|||||||
unName :: NamedWindow -> Window
|
unName :: NamedWindow -> Window
|
||||||
unName (NW _ w) = w
|
unName (NW _ w) = w
|
||||||
|
|
||||||
name :: NamedWindow -> String
|
|
||||||
name (NW n _) = n
|
|
||||||
|
|
||||||
withNamedWindow :: (NamedWindow -> X ()) -> X ()
|
withNamedWindow :: (NamedWindow -> X ()) -> X ()
|
||||||
withNamedWindow f = do ws <- gets windowset
|
withNamedWindow f = do ws <- gets windowset
|
||||||
whenJust (W.peek ws) $ \w -> getName w >>= f
|
whenJust (W.peek ws) $ \w -> getName w >>= f
|
||||||
|
Reference in New Issue
Block a user