简体   繁体   English

Xmonad - 在指定的监视器和工作区上静默生成程序?

[英]Xmonad - Spawn a program silently on specified monitor and workspace?

How to start a program on specific monitor and specific workspace silently without focusing on it, sort of like you do when you press Mod + Shift + n ?如何在不专注于它的情况下静默地在特定显示器和特定工作空间上启动程序,就像按Mod + Shift + n时所做的那样? The problem with the following approach以下方法的问题

className =? "ProgramClass" --> doShift ( workspaces !! n ),

is that it not only moves the window to the workspace it also opens a workspace, which I would rather avoid.是它不仅将 window 移动到工作区,还打开了一个工作区,这是我宁愿避免的。 spawnOn essentially does the same. spawnOn本质上是一样的。

This is my current config这是我目前的配置

Too long comment here.这里评论太长了。 I haven't tested the solution:我还没有测试解决方案:

doShift doesn't change the workspace up to the documentation, the problem is that the new window is directly opened in the new workspace. doShift没有将工作空间更改为文档,问题是新的 window 是直接在新工作空间中打开的。 I think you should define the ManageHook and execute it:我认为您应该定义ManageHook并执行它:

-- neccesary imports
import XMonad.ManageHook
import qualified XMonad.StackSet as W

-- creates a new ManageHook
openSilent :: WorkspaceId -> ManageHook
openSilent tows = do
   fromws <- liftX $ return . W.currentTag . windowset =<< get -- get the current ws tag
   wid    <- ask                                             -- get opened windowId
   doF $ W.view fromws . W.insertUp wid . W.view tows
--       |               |                |- move focus to "to" workspace
--       |               |- insert window
--       |- move focus back to "from" workspace

The hook should be use as regular钩子应该像常规一样使用

className =? "ProgramClass" --> openSilent "workspaceName"

Ok my problem was XMonad.Hooks.EwmhDesktops after removing it from config doShift works without stealing my focus and moves items to a dedicated workspace without activating it.好的,我的问题是XMonad.Hooks.EwmhDesktops从配置中删除后doShift可以正常工作而不会窃取我的注意力,并将项目移动到专用工作区而不激活它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM