简体   繁体   English

XMonad:dmenu在启动时不会启动/产生

[英]XMonad: dmenu not launching/spawning on startup

New to XMonad and loving it so far. 到目前为止,XMonad尚不熟悉它,并且很喜欢它。 I have a fairly vanilla / regular XMonad setup and am having problems with dmenu . 我有一个相当普通的XMonad设置,并且dmenu出现了问题。 When I login and hit mod+p nothing happens. 当我登录并按下mod+p什么也没有发生。 If I then open a terminal and hit xmonad --restart then mod+p , dmenu will be working. 如果我然后打开一个终端并点击xmonad --restart然后mod+pdmenu将起作用。

There must be something wrong with my xmonad.hs ? 我的xmonad.hs一定有问题吗? I tried a no-customization setup of XMonad and things were working normally (ie dmenu was working after login). 我尝试了XMonad的无自定义设置,并且一切运行正常(即dmenu登录后dmenu工作)。

My questions: 我的问题:

  1. Is there something wrong with my xmonad.hs ? 我的xmonad.hs吗?
  2. Why won't dmenu work unless I xmonad --restart ? 如果不dmenu xmonad --restart为什么dmenu不起作用?
  3. Could something fail in xmonad.start that would prevent dmenu from loading properly when starting xmonad? xmonad.start中是否会出现故障,从而导致在启动xmonad时dmenu无法正确加载?

Here are my files (borrowed from overthink ). 这是我的文件(是从overthink借来的)。 :

xmonad.hs xmonad.hs

import System.IO
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.SetWMName
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Util.Run(spawnPipe)
import XMonad.Hooks.ICCCMFocus

myWorkspaces = ["1", "2", "3", "4", "5", "6"] 

myManageHook = composeAll
  [ className =? "Gimp" --> doFloat
  , className =? "Vncviewer" --> doFloat
  ]

main = do
  xmproc <- spawnPipe "/usr/bin/xmobar /home/aaron/.xmobarrc"
  xmonad $ defaultConfig { terminal = "urxvt" }
      { manageHook = manageDocks <+> manageHook defaultConfig
      , startupHook = takeTopFocus >> setWMName "LG3D" -- fix for Java apps
      , layoutHook = avoidStruts  $  layoutHook defaultConfig
      , logHook = dynamicLogWithPP xmobarPP
                      { ppOutput = hPutStrLn xmproc
                      , ppTitle = xmobarColor "green" "" . shorten 50
                      }
      , modMask = mod4Mask     -- Rebind Mod to the Windows key
      , workspaces = myWorkspaces
      } `additionalKeys`
      [ ((mod4Mask .|. shiftMask, xK_l), spawn "gnome-screensaver-command --lock") ]

xmonad.desktop xmonad.desktop

[Desktop Entry]
Encoding=UTF-8
Name=Xmonad-****
Comment=Ligthweight, pretentious tiling window manager
Exec=xmonad.start
Icon=xmonad.png
Type=XSession

xmonad.start xmonad.start

#!/bin/bash

xrdb -merge .Xresources

trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype percent --width 10 --heighttype pixel --height 20 --transparent true --alpha 0 --tint 0x333333 &

# settings daemon is a prereq for some other gnome apps
gnome-settings-daemon &

# Network monitor (connections, vpns) applet in tray
if [ -x /usr/bin/nm-applet ] ; then
    nm-applet --sm-disable &
fi

# volume indicator in tray
if [ -x /usr/bin/gnome-sound-applet ] ; then
  gnome-sound-applet &
fi

eval $(gnome-keyring-daemon --start)
export GNOME_KEYRING_SOCKET
export GNOME_KEYRING_PID

#exec xmonad
dbus-launch --exit-with-session xmonad

Thanks for your help! 谢谢你的帮助!

I have a vague feeling that when you first launch xmonad, it uses one executable+configuration, and then when you recompile, it finds the "right" one. 我有一种模糊的感觉,当您第一次启动xmonad时,它使用一个可执行文件+配置,然后当您重新编译时,它会找到“正确的”文件。 In xmonad.desktop, try changing the Exec= line to include a full path to your xmonad.start. 在xmonad.desktop中,尝试更改Exec=行以包含xmonad.start的完整路径。

Exec=/full/path/to/xmonad.start

Or you might try changing the last line in xmonad.start to include the full path to your xmonad executable. 或者,您可以尝试更改xmonad.start的最后一行以包含xmonad可执行文件的完整路径。

dbus-launch --exit-with-session /full/path/to/xmonad

Another thing to try is changing the last two lines to: 要尝试的另一件事是将最后两行更改为:

exec xmonad
#dbus-launch --exit-with-session xmonad

If any of these options change the behaviour you're seeing, that might give us a clue. 如果这些选项中的任何一个改变了您所看到的行为,那么可能会给我们一个提示。


EDIT: Let's try a different way of launching it, to see if we can learn anything. 编辑:让我们尝试一种不同的启动方式,看看我们是否可以学到任何东西。 Don't start any window manager, log into a plain terminal instead. 不要启动任何窗口管理器,而是登录到普通终端。 Type the command xinit -- xmonad or xinit -- /full/path/to/xmonad . 输入命令xinit -- xmonadxinit -- /full/path/to/xmonad

Alternatively, create the file .xinitrc with one line in it: 或者,创建文件.xinitrc并在其中一行:

xmonad

Then type the command startx . 然后键入命令startx

I also found this on the Xmonad FAQ, which may help: 我也在Xmonad常见问题解答中找到了这一点,它可能会有所帮助:

2.6 not found errors or changes to xmonad.hs won't take effect 2.6找不到错误或对xmonad.hs的更改不会生效

Ensure that ghc, and the xmonad executable are both in the environment PATH from which you start X. Alternatively symlink them to locations already in the PATH. 确保ghc和xmonad可执行文件都在启动X的环境PATH中。或者将它们符号链接到PATH中已经存在的位置。 ghc-pkg list should show ghc, xmonad, X11, etc. without brackets, eg {xmonad} is bad. ghc-pkg列表应显示ghc,xmonad,X11等,不带方括号,例如{xmonad}不好。 ghc-pkg check will tell you if you have inconsistent dependencies or other registration problems. ghc-pkg检查将告诉您是否存在不一致的依赖性或其他注册问题。

The mod-q action calls the xmonad binary to recompile itself, so if your display manager is starting it with /path/to/xmonad you'll also have to edit your xmonad.hs mod-q binding to use the full path and restart X (or in newer versions use 'xmonad --restart') to restart xmonad with the new mod-q full path binding. mod-q操作调用xmonad二进制文件重新编译自身,因此,如果您的显示管理器以/ path / to / xmonad启动它,则还必须编辑xmonad.hs mod-q绑定以使用完整路径并重新启动X(或在较新版本中使用'xmonad --restart')以新的mod-q全路径绑定重新启动xmonad。

UPDATE: 更新:

The fix that seems to have solved the problem is changing: 似乎已解决问题的解决方案正在更改:

exec xmonad

To: 至:

touch ~/.xmonad/xmonad.hs
exec xmonad

in

/usr/local/bin/xmonad.start (or .xinitrc/.xsession if xmonad is started using startx)

OLD: 旧:

How about changing: 如何更改:

} `additionalKeys`
 [ ((mod4Mask .|. shiftMask, xK_l), spawn "gnome-screensaver-command --lock") ]

To: 至:

} `additionalKeys`
  [ ((mod4Mask .|. shiftMask, xK_l), spawn "gnome-screensaver-command --lock") 
  , ((mod4Mask, xK_p), spawn "dmenu_run -b -nb black") ]

I had the same issue as you and it was because I had used something like: 我遇到了与您相同的问题,这是因为我使用了类似的方法:

((mod4Mask, xK_p), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")

which, for some reason, only works properly after a "xmonad --restart". 由于某种原因,它只能在“ xmonad --restart”之后才能正常工作。 Changing the binding to simply "dmenu-run" fixed the problem. 将绑定更改为简单的“ dmenu运行”即可解决此问题。 In your case, though, it looks like you're missing the binding at all. 但是,就您而言,似乎根本就没有绑定。

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

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