diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-11-23 00:30:20 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-11-23 00:30:20 -0700 |
| commit | 901f50f904bfea282c9cb1c8575d3da14a49f256 (patch) | |
| tree | 5bfb8152e1db8f8c3e4af6053140ae304ac630a0 /src/Rahm/Desktop | |
| parent | 1f25484605881af1a8e1475565d2ceb20b88ea85 (diff) | |
| download | rde-901f50f904bfea282c9cb1c8575d3da14a49f256.tar.gz rde-901f50f904bfea282c9cb1c8575d3da14a49f256.tar.bz2 rde-901f50f904bfea282c9cb1c8575d3da14a49f256.zip | |
Remove NoPersist.hs. It is redundant to ExtensionClass.
Diffstat (limited to 'src/Rahm/Desktop')
| -rw-r--r-- | src/Rahm/Desktop/Logger.hs | 1 | ||||
| -rw-r--r-- | src/Rahm/Desktop/NoPersist.hs | 22 | ||||
| -rw-r--r-- | src/Rahm/Desktop/RebindKeys.hs | 10 |
3 files changed, 4 insertions, 29 deletions
diff --git a/src/Rahm/Desktop/Logger.hs b/src/Rahm/Desktop/Logger.hs index 89df42e..9e4012a 100644 --- a/src/Rahm/Desktop/Logger.hs +++ b/src/Rahm/Desktop/Logger.hs @@ -2,7 +2,6 @@ module Rahm.Desktop.Logger where import Control.Monad (forM_, join, when) import Data.Time.LocalTime (getZonedTime) -import Rahm.Desktop.NoPersist () import System.IO () import Text.Printf (PrintfArg, PrintfType, printf) import XMonad diff --git a/src/Rahm/Desktop/NoPersist.hs b/src/Rahm/Desktop/NoPersist.hs deleted file mode 100644 index 744f034..0000000 --- a/src/Rahm/Desktop/NoPersist.hs +++ /dev/null @@ -1,22 +0,0 @@ --- Module for not persisting XMonad state. To be used with ExtensibleState --- for data types that cannot be persisted. -module Rahm.Desktop.NoPersist where - -import Data.Default (Default, def) -import Data.Typeable -import XMonad (ExtensionClass (..)) - -newtype NoPersist a = NoPersist a - deriving (Typeable) - -instance Show (NoPersist a) where - show (NoPersist _) = show () - -instance (Default a) => Read (NoPersist a) where - readsPrec i s = map (\(_, s) -> (NoPersist def, s)) (readsPrec i s :: [((), String)]) - -instance (Default a) => Default (NoPersist a) where - def = NoPersist def - -instance (Default a, Typeable a) => ExtensionClass (NoPersist a) where - initialValue = NoPersist def diff --git a/src/Rahm/Desktop/RebindKeys.hs b/src/Rahm/Desktop/RebindKeys.hs index 6e8d212..b77b328 100644 --- a/src/Rahm/Desktop/RebindKeys.hs +++ b/src/Rahm/Desktop/RebindKeys.hs @@ -16,7 +16,6 @@ import qualified Data.Map as Map ) import Data.Monoid (All (..)) import Rahm.Desktop.Logger () -import Rahm.Desktop.NoPersist (NoPersist (..)) import Text.Printf () import XMonad ( Default (def), @@ -55,10 +54,10 @@ import qualified XMonad.Util.ExtensibleState as XS (get, modify) type WindowHook = Query () newtype InterceptState - = InterceptState (NoPersist (Map (KeyMask, KeySym) (X ()))) + = InterceptState (Map (KeyMask, KeySym) (X ())) newtype RemapState - = RemapState (NoPersist (Map (Window, (KeyMask, KeySym)) (X ()))) + = RemapState (Map (Window, (KeyMask, KeySym)) (X ())) instance ExtensionClass InterceptState where initialValue = InterceptState def @@ -68,7 +67,7 @@ instance ExtensionClass RemapState where remapHook :: Event -> X All remapHook event = do - RemapState (NoPersist map) <- XS.get + RemapState map <- XS.get case event of KeyEvent {ev_window = win, ev_event_type = typ, ev_keycode = code, ev_state = m} @@ -118,9 +117,8 @@ remapKey keyFrom action = do XConf {display = disp, theRoot = rootw} <- ask doGrab disp window keyFrom - XS.modify $ \(RemapState (NoPersist keyMap)) -> + XS.modify $ \(RemapState keyMap) -> RemapState $ - NoPersist $ Map.insert (window, keyFrom) action keyMap -- sendKey, but as a query. |