wild-bind-task-x11 (empty) → 0.1.0.1
raw patch · 7 files changed
+188/−0 lines, 7 filesdep +basedep +textdep +transformerssetup-changed
Dependencies added: base, text, transformers, wild-bind, wild-bind-indicator, wild-bind-task-x11, wild-bind-x11
Files
- ChangeLog.md +5/−0
- LICENSE +30/−0
- README.md +9/−0
- Setup.hs +2/−0
- src/WildBind/Task/X11.hs +71/−0
- test/ImportTest.hs +20/−0
- wild-bind-task-x11.cabal +51/−0
+ ChangeLog.md view
@@ -0,0 +1,5 @@+# Revision history for wild-bind-task-x11++## 0.1.0.1 -- 2016-09-22++* First version. Released on an unsuspecting world.
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2016, Toshio Ito++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Toshio Ito nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,9 @@+# wild-bind-task-x11++Bundle package for WildBind in X11 environments.++See https://github.com/debug-ito/wild-bind for WildBind in general.++## Author++Toshio Ito <debug.ito@gmail.com>
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ src/WildBind/Task/X11.hs view
@@ -0,0 +1,71 @@+-- |+-- Module: WildBind.Task.X11+-- Description: Task to install and export everything you need to use WildBind in X11+-- Maintainer: Toshio Ito <debug.ito@gmail.com>+-- +-- This module exports everything you probably need to use WildBind in+-- X11 environments.+module WildBind.Task.X11+ ( -- * Execution+ wildNumPad,+ wildNumPad',+ -- * Re-exports+ module WildBind.Binding,+ module WildBind.Description,+ module WildBind.Input.NumPad,+ -- ** From basic modules+ module Control.Monad.IO.Class,+ module Control.Monad.Trans.State,+ module Data.Monoid,+ Text,+ -- ** From "WindBind.X11"+ Window, ActiveWindow, winInstance, winClass, winName,+ -- ** From "WildBind.Indicator"+ Indicator, NumPadPosition(..), updateDescription, getPresence, setPresence, togglePresence, quit+ ) where++import Control.Monad.IO.Class+import Control.Monad.Trans.State+import Data.Monoid+import Data.Text (Text)++import WildBind.Binding+import WildBind.Description+import WildBind.Input.NumPad+import WildBind.X11+ ( Window, ActiveWindow, winInstance, winClass, winName,+ withFrontEnd+ )+import WildBind.Indicator+ ( Indicator, NumPadPosition(..),+ updateDescription, getPresence, setPresence, togglePresence, quit,+ withNumPadIndicator, wildBindWithIndicator+ )+import WildBind.X11.Internal.Key (KeySymLike, ModifierLike)++-- | A convenient function to create an executable action with X11+-- 'FrontEnd' and 'Indicator' for a number pad.+--+-- > main :: IO ()+-- > main = wildNumPad $ binds $ do+-- > on NumCenter `run` putStrLn "You pushed center."+-- +-- Note that the executable must be compiled by ghc with+-- __@-threaded@ option enabled.__+--+-- With this function, the @"/"@ (divide) key on the numpad is bound+-- to toggling the 'Indicator', ignoring the binding you provide.+--+-- For the input type @i@, you can use 'NumPadUnlocked' or+-- 'NumPadLocked'.+wildNumPad :: (NumPadPosition i, KeySymLike i, ModifierLike i, Describable i, Ord i, Enum i, Bounded i)+ => Binding ActiveWindow i -> IO ()+wildNumPad orig_binding = wildNumPad' $ \ind -> orig_binding <> help_binds ind where+ help_binds ind = binding $ map (\input -> (input, Action "Toggle description" $ togglePresence ind)) help_likes+ help_likes = filter ((== NumLDivide) . toNumPad) $ enumFromTo minBound maxBound++-- | A more flexible version of 'wildNumPad'. It passes you an+-- 'Indicator', and uses the 'Binding' you return as-is.+wildNumPad' :: (NumPadPosition i, KeySymLike i, ModifierLike i, Describable i, Ord i, Enum i, Bounded i)+ => (Indicator ActiveWindow i -> Binding ActiveWindow i) -> IO ()+wildNumPad' create_binding = withNumPadIndicator $ \ind -> withFrontEnd $ wildBindWithIndicator ind (create_binding ind)
+ test/ImportTest.hs view
@@ -0,0 +1,20 @@+module Main (main) where++import WildBind.Task.X11+ ( wildNumPad, wildNumPad',+ Binding, Binding',+ NumPadUnlocked(..), NumPadLocked(..),+ ActiveWindow,+ Indicator,+ (<>)+ )++main :: IO ()+main = putStrLn "If it compiles, it's ok."++check_wildNumPad_unlocked :: Binding ActiveWindow NumPadUnlocked -> IO ()+check_wildNumPad_unlocked = wildNumPad++check_wildNumPad_locked :: Binding ActiveWindow NumPadLocked -> IO ()+check_wildNumPad_locked = wildNumPad+
+ wild-bind-task-x11.cabal view
@@ -0,0 +1,51 @@+name: wild-bind-task-x11+version: 0.1.0.1+author: Toshio Ito <debug.ito@gmail.com>+maintainer: Toshio Ito <debug.ito@gmail.com>+license: BSD3+license-file: LICENSE+synopsis: Task to install and export everything you need to use WildBind in X11+description: Task to install and export everything you need to use WildBind in X11. See <https://github.com/debug-ito/wild-bind>+category: UserInterface+cabal-version: >= 1.10+build-type: Simple+extra-source-files: README.md, ChangeLog.md+homepage: https://github.com/debug-ito/wild-bind+bug-reports: https://github.com/debug-ito/wild-bind/issues++library+ default-language: Haskell2010+ hs-source-dirs: src+ ghc-options: -Wall -fno-warn-unused-imports+ default-extensions: OverloadedStrings+ exposed-modules: WildBind.Task.X11+ -- other-modules:+ build-depends: base >=4.6 && <5.0,+ wild-bind >=0.1.0 && <0.2,+ wild-bind-x11 >=0.1.0 && <0.2,+ wild-bind-indicator >=0.1.0 && <0.2,+ text >=1.2.0 && <1.3,+ transformers >=0.3.0 && <0.6++-- executable wild-bind-task-x11+-- default-language: Haskell2010+-- hs-source-dirs: app+-- main-is: Main.hs+-- ghc-options: -Wall -fno-warn-unused-imports+-- -- other-modules: +-- -- other-extensions: +-- build-depends: base++test-suite import-test+ type: exitcode-stdio-1.0+ default-language: Haskell2010+ hs-source-dirs: test+ ghc-options: -Wall -fno-warn-unused-imports -fno-warn-unused-binds+ main-is: ImportTest.hs+ -- default-extensions: + -- other-modules: + build-depends: base, wild-bind-task-x11++source-repository head+ type: git+ location: https://github.com/debug-ito/wild-bind.git