diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-04-15 01:14:50 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-04-15 01:14:50 -0600 |
| commit | 588e87efb099927fda713380e5bf64e8c7f1fdcd (patch) | |
| tree | 979fe1f887b7e1c9ffd0f15fdee98279effcaef7 /src/Rahm/Desktop/History.hs | |
| parent | a14486b47a51e772a3b230bc82390cb667f2ecd5 (diff) | |
| download | rde-588e87efb099927fda713380e5bf64e8c7f1fdcd.tar.gz rde-588e87efb099927fda713380e5bf64e8c7f1fdcd.tar.bz2 rde-588e87efb099927fda713380e5bf64e8c7f1fdcd.zip | |
[WIP] - Window change hooks
Diffstat (limited to 'src/Rahm/Desktop/History.hs')
| -rw-r--r-- | src/Rahm/Desktop/History.hs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Rahm/Desktop/History.hs b/src/Rahm/Desktop/History.hs new file mode 100644 index 0000000..8aff845 --- /dev/null +++ b/src/Rahm/Desktop/History.hs @@ -0,0 +1,25 @@ +module Rahm.Desktop.History where + +import Data.IntMap (IntMap) +import qualified Data.IntMap as IntMap +import Data.Default + +import Rahm.Desktop.Hooks.WindowChange + +data History = History { + currentIndex :: Int + , history :: IntMap Location + } + +instance Default History where + def = History 0 IntMap.empty + +addToHistory :: Location -> History -> History +addToHistory loc (History currentIndex hist) = + let hist' = if currentIndex > 100 + then IntMap.delete (currentIndex - 100) hist + else hist + in History (currentIndex + 1 ) (IntMap.insert currentIndex loc hist) + +historyHook :: Location -> Location -> X () +historyHook = undefined |