From 5880e01ad2c2953704c6b0504c3357194979c7d0 Mon Sep 17 00:00:00 2001 From: Zubin Duggal Date: Thu, 9 Apr 2020 01:06:20 +0530 Subject: [PATCH 1/2] Add message to window prompt to execute arbitrary actions with the window --- XMonad/Prompt/Window.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/XMonad/Prompt/Window.hs b/XMonad/Prompt/Window.hs index f81dade2..24367cbc 100644 --- a/XMonad/Prompt/Window.hs +++ b/XMonad/Prompt/Window.hs @@ -72,13 +72,14 @@ import XMonad.Util.NamedWindows -- "XMonad.Doc.Extending#Editing_key_bindings". -- Describe actions that can applied on the selected window -data WindowPrompt = Goto | Bring | BringCopy | BringToMaster +data WindowPrompt = Goto | Bring | BringCopy | BringToMaster | WithWindow String (Window -> X()) instance XPrompt WindowPrompt where showXPrompt Goto = "Go to window: " showXPrompt Bring = "Bring window: " showXPrompt BringToMaster = "Bring window to master: " showXPrompt BringCopy = "Bring a copy: " + showXPrompt (WithWindow xs _) = xs commandToComplete _ c = c nextCompletion _ = getNextCompletion @@ -96,13 +97,15 @@ instance XPrompt WindowModePrompt where modeAction (WindowModePrompt action winmap _) buf auto = do let name = if null auto then buf else auto a = case action of - Goto -> gotoAction winmap - Bring -> bringAction winmap - BringCopy -> bringCopyAction winmap - BringToMaster -> bringToMaster winmap + Goto -> gotoAction + Bring -> bringAction + BringCopy -> bringCopyAction + BringToMaster -> bringToMaster + WithWindow _ f -> withWindow f a name where - winAction a m = flip whenJust (windows . a) . flip M.lookup m + withWindow f = flip whenJust f . flip M.lookup winmap + winAction a = withWindow (windows . a) gotoAction = winAction W.focusWindow bringAction = winAction bringWindow bringCopyAction = winAction bringCopyWindow From f7ed56fc6b61a33ac4432cb6b6bcf5c7746d6b19 Mon Sep 17 00:00:00 2001 From: Zubin Duggal Date: Thu, 9 Apr 2020 01:11:04 +0530 Subject: [PATCH 2/2] Update changelog --- CHANGES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 9fb87eee..d355fb84 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -77,6 +77,11 @@ - Added `recentWS` function which allows the recency list to be filtered with a user-provided predicate. + * `XMonad.Prompt.Window` + + - Added a `WithWindow` constructor to `WindowPrompt` to allow executing + actions of type `Window -> X ()` on the chosen window. + ## 0.16 ### Breaking Changes