Hi all,<br>Scratchpad is an XMonad extension that brings up or spawns a terminal window on Alt-F2 (as I have it configured) and hides it in a hidden workspace when I am done. <br><br>The code looked pretty simple and I tried to adapt this script to do the same thing with my Conkeror window. This script worked until I upgraded to 0.8.1. Now it doesn't detect an existing Conkeror window and keeps launching a new instance. <br>
<br>Xprop output shows the class name of Conkeror is: "Navigator", "Conkeror".<br><br>Since <a href="http://hpaste.org">hpaste.org</a> seems to be down, here it is my hacked Scratchpad sans imports and header comment ( if the author of Scratchpad is reading this, yes the code below is pretty much cut-and-paste):<br>
<br>---------------------------------------------------------------------------<br>-- | Action to pop up the browser, for the user to bind to a custom key.<br>scratchBrowserSpawn :: X ()<br>scratchBrowserSpawn = <br> scratchpadAction $ spawn "conkeror"<br>
<br>scratchpadAction :: X () -> X ()<br>scratchpadAction action = withWindowSet $ \s -> do<br> filterCurrent <- filterM (runQuery scratchpadQuery) <br> ( (maybe [] W.integrate <br> . W.stack <br>
. W.workspace <br> . W.current) s)<br> case filterCurrent of<br> (x:_) -> do<br> if null (filter ( (== scratchpadWorkspaceTag) . W.tag) (W.workspaces s))<br> then addHiddenWorkspace scratchpadWorkspaceTag<br>
else return ()<br> windows (W.shiftWin scratchpadWorkspaceTag x)<br> [] -> do<br> filterAll <- filterM (runQuery scratchpadQuery) (W.allWindows s)<br> case filterAll of<br> (x:_) -> windows (W.shiftWin (W.currentTag s) x)<br>
[] -> action -- run the provided action to spawn it.<br><br><br>-- factored out since it appears in several places<br>scratchpadWorkspaceTag :: String<br>scratchpadWorkspaceTag = "BR"<br><br>-- factored out since this is common to both the ManageHook and the action<br>
scratchpadQuery :: Query Bool<br>scratchpadQuery = (className =? "Conkeror") <||> (className =? "Navigator")<br><br><br>-- | The ManageHook, with the default rectangle:<br>-- Half the screen wide, a quarter of the screen tall, centered.<br>
scratchpadManageHookDefault :: ManageHook<br>scratchpadManageHookDefault = scratchpadManageHook scratchpadDefaultRect<br><br><br>-- | The ManageHook, with a user-specified StackSet.RationalRect,<br>-- eg.<br>--<br>-- > scratchpadManageHook (W.RationalRect 0.25 0.375 0.5 0.25)<br>
scratchpadManageHook :: W.RationalRect -- ^ User-specified screen rectangle.<br> -> ManageHook<br>scratchpadManageHook rect = scratchpadQuery --> doRectFloat rect<br><br><br>-- | Transforms a workspace list containing the SP workspace into one that<br>
-- doesn't contain it. Intended for use with logHooks.<br>scratchpadFilterOutWorkspace :: [WindowSpace] -> [WindowSpace]<br>scratchpadFilterOutWorkspace = filter (\(W.Workspace tag _ _) -> tag /= scratchpadWorkspaceTag)<br>
<br><br>scratchpadDefaultRect :: W.RationalRect<br>scratchpadDefaultRect = W.RationalRect 0.25 0.375 0.5 0.25<br><br>-------------------------------------------------------------------------------------------------<br>Thanks ...<br>
Deech<br><br><br><br>