packages feed

hbro 0.6.0 → 0.6.1

raw patch · 4 files changed

+19/−51 lines, 4 files

Files

Hbro/Core.hs view
@@ -13,7 +13,6 @@ import qualified Data.Map as Map import qualified Data.Set as Set ---import Graphics.UI.Gtk.Abstract.IMContext import Graphics.UI.Gtk.Abstract.Widget import Graphics.UI.Gtk.General.General import Graphics.UI.Gtk.Gdk.EventM@@ -89,38 +88,14 @@     let keyBindings = importKeyBindings (mKeys configuration)      -- On new window request-    --newWindowWebView <- webViewNew     _ <- on webView createWebView $ \frame -> do         newUri <- webFrameGetUri frame         putStrLn "NEW WINDOW"         case newUri of             Just uri -> webViewLoadUri webView uri-            --Just uri -> runExternalCommand $ "hbro " ++ uri             Nothing  -> return ()         return webView---         return newWindowWebView ---     _ <- on newWindowWebView loadCommitted $ \frame -> do---         getUri <- (webViewGetUri newWindowWebView)---         case getUri of ---             Just uri -> runExternalCommand $ "hbro \"" ++ uri ++ "\""---             _        -> return ()---    -- Key bindings---     imContext <- get webView webViewImContext---     _ <- on webView keyPressEvent $ do---         value      <- eventKeyVal---         modifiers  <- eventModifier----         let keyString = keyToString value---         ---         case keyString of---             Just "<Escape>" -> do---                 liftIO $ imContextFocusIn imContext---                 return True---             _               -> return False-     _ <- after webView keyPressEvent $ do         value      <- eventKeyVal         modifiers  <- eventModifier@@ -135,22 +110,6 @@             _ -> return ()          return False----     imContextFilterKeypress imContext $ do---         value      <- eventKeyVal---         modifiers  <- eventModifier----         let keyString = keyToString value---         putStrLn keyString---- --         case keyString of --- --             Just string -> do --- --                 case Map.lookup (Set.fromList modifiers, string) keyBindings of--- --                     Just callback   -> liftIO $ callback gui--- --                     _               -> liftIO $ putStrLn string --- --             _ -> return ()----         return False      -- Connect and show.     _ <- onDestroy (mWindow gui) mainQuit
Hbro/Extra.hs view
@@ -15,6 +15,7 @@ import Graphics.UI.Gtk.Display.Label import Graphics.UI.Gtk.Entry.Entry import Graphics.UI.Gtk.Gdk.EventM+import Graphics.UI.Gtk.General.Clipboard import Graphics.UI.Gtk.Misc.Adjustment import Graphics.UI.Gtk.Scrolling.ScrolledWindow import Graphics.UI.Gtk.WebKit.WebView@@ -153,26 +154,34 @@ -- }}}  -- {{{ Copy/paste-copyUri, copyTitle, loadURIFromClipBoard :: Browser -> IO()+copyUri, copyTitle, loadURIFromClipboard :: Browser -> IO ()  -- | Copy current URI in clipboard. copyUri browser = do     getUri <- webViewGetUri (mWebView $ mGUI browser)+    primaryClip <- widgetGetClipboard (mWindow $ mGUI browser) selectionPrimary+     case getUri of-        Just u -> runCommand ("echo -n " ++ u ++ " | xclip") >> return ()+        Just u -> clipboardSetText primaryClip u         _      -> return ()  -- | Copy current page title in clipboard. copyTitle browser = do-    getTitle <- webViewGetTitle (mWebView $ mGUI browser)+    getTitle    <- webViewGetTitle (mWebView $ mGUI browser)+    primaryClip <- widgetGetClipboard (mWindow $ mGUI browser) selectionPrimary+     case getTitle of-        Just t -> runCommand ("echo -n " ++ t ++ " | xclip") >> return ()+        Just t -> clipboardSetText primaryClip t         _      -> return ()  -- | Load URI from clipboard. Does not work for now...-loadURIFromClipBoard browser = do-    uri <- readProcess "xclip" ["-o"] []-    loadURL uri browser+loadURIFromClipboard browser = do+    primaryClip <- widgetGetClipboard (mWindow $ mGUI browser) selectionPrimary++    _ <- clipboardRequestText primaryClip $ \x -> case x of+        Just uri -> putStrLn ("Loading URI from clipboard: " ++ uri) >> loadURL uri browser+        _        -> putStrLn "Loading URI from clipboard: empty clipboard."+    return () -- }}}  -- {{{ Others
examples/hbro.hs view
@@ -90,11 +90,11 @@     -- Copy/paste     (([Control],        "y"),           copyUri),     (([Control, Shift], "Y"),           copyTitle),-    --(([],           "p"),           loadURIFromClipboard), -- /!\ UNSTABLE, can't see why...+    (([Control],        "p"),           loadURIFromClipboard),      -- Others     (([Control],        "i"),           showWebInspector),-    (([Control],        "p"),           printPage),+    (([Alt],            "p"),           printPage),     (([Control],        "t"),           newWindow)     ] -- }}}
hbro.cabal view
@@ -1,5 +1,5 @@ Name:                hbro-Version:             0.6.0+Version:             0.6.1 Synopsis:            A suckless minimal KISSy browser -- Description:          Homepage:            http://projects.haskell.org/hbro/