tianbar 0.2.1.0 → 0.2.2.0
raw patch · 3 files changed
+60/−14 lines, 3 files
Files
- scripts/time.js +4/−3
- src/System/Tianbar/WebKit.hs +55/−10
- tianbar.cabal +1/−1
scripts/time.js view
@@ -5,10 +5,11 @@ * The only exposed property, 'format', determines the * format (see Moment.js documentation) to display time and date. *- * The plugin requires 'jquery', 'moment' and 'moment/lang' to be- * available through RequireJS.+ * The plugin requires 'jquery' and 'moment' to be available through+ * RequireJS. For localization, 'moment' must include language data+ * (this can be done by providing 'moment-with-langs.js' as 'moment'). */-define(['jquery', 'moment', 'moment/lang'], function ($, moment) {+define(['jquery', 'moment'], function ($, moment) { var config = { format: 'llll' };
src/System/Tianbar/WebKit.hs view
@@ -11,8 +11,9 @@ import Graphics.UI.Gtk hiding (Signal) import Graphics.UI.Gtk.WebKit.NetworkRequest-import Graphics.UI.Gtk.WebKit.WebView import Graphics.UI.Gtk.WebKit.WebSettings+import Graphics.UI.Gtk.WebKit.WebView+import Graphics.UI.Gtk.WebKit.WebWindowFeatures import System.Environment.XDG.BaseDir @@ -51,19 +52,16 @@ allOverrides :: UriOverride allOverrides = foldr mplus Nothing . flip map uriOverrides . flip ($) -setupWebkitLog :: WebView -> IO ()-setupWebkitLog wk = do- let matcher = matchAny { matchSender = Nothing- , matchDestination = Nothing- , matchPath = parseObjectPath "/org/xmonad/Log"- , matchInterface = parseInterfaceName "org.xmonad.Log"- , matchMember = parseMemberName "Update"- }+tianbarWebView :: IO WebView+tianbarWebView = do+ wk <- webViewNew + -- Enable AJAX access to all domains wsettings <- webViewGetWebSettings wk set wsettings [webSettingsEnableUniversalAccessFromFileUris := True] webViewSetWebSettings wk wsettings + -- Process the special overrides _ <- on wk resourceRequestStarting $ \_ _ nreq _ -> case nreq of Nothing -> return () (Just req) -> do@@ -73,6 +71,53 @@ Nothing -> return () (Just override) -> override >>= networkRequestSetUri req + -- Handle new window creation+ _ <- on wk createWebView $ \_ -> do+ nwk <- tianbarWebView++ window <- windowNew+ containerAdd window nwk++ _ <- on nwk webViewReady $ do+ wfeat <- webViewGetWindowFeatures nwk++ [wx, wy, ww, wh] <- mapM (get wfeat) [ webWindowFeaturesX+ , webWindowFeaturesY+ , webWindowFeaturesWidth+ , webWindowFeaturesHeight+ ]++ windowSetGeometryHints window+ (Nothing :: Maybe Window)+ (Just (ww, wh))+ (Just (ww, wh))+ Nothing+ Nothing+ Nothing++ widgetShow window+ widgetShow nwk++ windowMove window wx wy+ windowSetKeepAbove window True+ windowStick window++ return False++ return nwk++ return wk+++setupWebkitLog :: WebView -> IO ()+setupWebkitLog wk = do+ let matcher = matchAny { matchSender = Nothing+ , matchDestination = Nothing+ , matchPath = parseObjectPath "/org/xmonad/Log"+ , matchInterface = parseInterfaceName "org.xmonad.Log"+ , matchMember = parseMemberName "Update"+ }+ htmlFile <- getUserConfigFile appName "index.html" html <- readFile htmlFile webViewLoadHtmlString wk html $ "file://" ++ htmlFile@@ -97,7 +142,7 @@ xmonadWebkitLogNew :: IO Widget xmonadWebkitLogNew = do- l <- webViewNew+ l <- tianbarWebView _ <- on l realize $ setupWebkitLog l
tianbar.cabal view
@@ -1,5 +1,5 @@ name: tianbar-version: 0.2.1.0+version: 0.2.2.0 synopsis: A desktop bar based on WebKit description: A desktop bar using WebKit for rendering as much as possible.