You are not logged in.

#1 2011-07-21 14:36:43

securitybreach
Member
From: In front of my computers
Registered: 2007-11-18
Posts: 416
Website

SOLVED:Dmenu not launching correctly in Xmonad

I am running xmonad and I am having issues getting the dmenu_run to execute properly. It was working fine before but now it just launches with a white bar and nothing autocompletes. I am running Xmonad 0.9.2-2.1 and dmenu 4.4-1. Here is my entry in xmonad.hs:

, ((modMask,               xK_p        ), spawn "dmenu_run | dmenu -b")

Also, here is my entire xmonad.hs:

import XMonad hiding (Tall)
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers

import XMonad.Layout.HintedTile
import XMonad.Layout.LayoutHints (layoutHints)
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Util.Run(spawnPipe)
 
import System.Exit
import System.IO
import Data.Monoid
 
import qualified XMonad.StackSet as W
import qualified Data.Map        as M
 
myBorderWidth   = 1
main = do
    xmproc <- spawnPipe "/usr/bin/xmobar /home/comhack/.xmobarcc"
    xmonad $ defaultConfig {
        terminal           = "urxvt",
        modMask            = mod1Mask,
        workspaces         = ["Net", "Chat", "Work", "4", "5", "6", "7", "8", "9"],
        normalBorderColor  = "#000000",
        focusedBorderColor = "#838B8B",
        manageHook         = composeOne [isFullscreen -?> doFullFloat],
        borderWidth        = myBorderWidth,
        keys               = myKeys,
        focusFollowsMouse  = True,
        layoutHook         = myLayout,
        logHook            = dynamicLogWithPP $ xmobarPP 
                           {  ppOutput = hPutStrLn xmproc,
                              ppTitle = xmobarColor "green" "" . shorten 60,
                              ppHiddenNoWindows = xmobarColor "grey" ""
                                     }
    }

          
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
 
    [ ((modMask              , xK_Return   ), spawn $ XMonad.terminal conf)
    , ((modm              , xK_backslash ), spawn “amixer -q set Master toggle”)
    , ((modm              , xK_minus     ), spawn “amixer -q set Master 3- unmute”)
    , ((modm              , xK_equal     ), spawn “amixer -q set Master 3+ unmute”)
    , ((modMask .|. shiftMask, xK_c        ), kill)
    , ((modMask              , xK_space    ), sendMessage NextLayout)
    , ((modMask .|. shiftMask, xK_space    ), setLayout $ XMonad.layoutHook conf)
    , ((modMask              , xK_n        ), refresh)
    , ((modMask,               xK_p     ), spawn "dmenu_run | dmenu -b")
    , ((modMask              , xK_Tab      ), windows W.focusDown)
    , ((modMask              , xK_j        ), windows W.focusDown)
    , ((modMask              , xK_k        ), windows W.focusUp)
    , ((modMask              , xK_m        ), windows W.focusMaster)
    , ((modMask .|. shiftMask, xK_Return   ), windows W.swapMaster)
    , ((modMask .|. shiftMask, xK_j        ), windows W.swapDown)
    , ((modMask .|. shiftMask, xK_k        ), windows W.swapUp)
    , ((modMask              , xK_h        ), sendMessage Shrink)
    , ((modMask              , xK_l        ), sendMessage Expand)
    , ((modMask              , xK_t        ), withFocused $ windows . W.sink)
    , ((modMask              , xK_comma    ), sendMessage (IncMasterN 1))
    , ((modMask              , xK_period   ), sendMessage (IncMasterN (-1)))
    , ((modMask .|. shiftMask, xK_q        ), io (exitWith ExitSuccess))
    , ((modMask              , xK_q        ), spawn "xmonad --recompile")
    , ((modMask              , xK_F2       ), shellPrompt defaultXPConfig)
    , ((0                    , 0x1008ff30  ), shellPrompt defaultXPConfig)
    , ((0                    , 0x1008ff13  ), spawn "amixer -q set Master 2dB+")
    , ((0                    , 0x1008ff11  ), spawn "amixer -q set Master 2dB-")
    , ((0                    , 0x1008ff12  ), spawn "amixer -q set Master toggle")
    , ((0                    , 0x1008ff16  ), spawn "cmus-remote --prev")
    , ((0                    , 0x1008ff17  ), spawn "cmus-remote --next")
    , ((0                    , 0x1008ff14  ), spawn "cmus-remote --pause")
    , ((0                    , 0x1008ff5b  ), spawn "urxvt -e screen -rd cmus")
    , ((modMask              , xK_Print    ), spawn "scrot -e 'mv $f ~/Screenshots'")
    ]
    ++
 
    [((m .|. modMask, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
 
    ++
 
    [((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
 
myLayout = avoidStruts $ tiled ||| wideTiled ||| Full
  where
     tiled = HintedTile nmaster delta ratio Center Tall
     wideTiled = HintedTile nmaster delta ratio Center Wide
     nmaster = 1
     ratio   = 1/2
     delta   = 3/100

It was working fine before so I am thinking that it must of been an update or something. If I run the command in a terminal, it works just fine. So it has to be the syntax or something. This works perfectly:

dmenu_run | dmenu -b

Any ideas?

Last edited by securitybreach (2011-08-08 03:07:25)


"Every normal man must be tempted at times to spit upon his hands, hoist the black flag, and begin slitting throats." -- H.L. Mencken
Website      Configs
Forum Admin: Bruno's All Things Linux   
securitybreach<a>archlinux.us

Offline

#2 2011-07-21 14:43:57

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

Re: SOLVED:Dmenu not launching correctly in Xmonad

how about:

dmenu_run -b

?

Last edited by JokerBoy (2011-07-21 14:44:18)

Offline

#3 2011-07-21 14:47:31

securitybreach
Member
From: In front of my computers
Registered: 2007-11-18
Posts: 416
Website

Re: SOLVED:Dmenu not launching correctly in Xmonad

Thanks Joker but that did not work either.

Also, I am getting an error when I --recompile XMonad:

╔═ comhack@Cerberus 09:46 AM 
╚═══ ~-> xmonad --recompile
Error detected while loading xmonad configuration file: /home/comhack/.xmonad/xmonad.hs

xmonad.hs:17:18:
    Could not find module `XMonad.StackSet':
      Use -v to see a list of the files searched for.

Please check the file for errors.

xmonad: xmessage: executeFile: does not exist (No such file or directory)

Maybe this is related?


"Every normal man must be tempted at times to spit upon his hands, hoist the black flag, and begin slitting throats." -- H.L. Mencken
Website      Configs
Forum Admin: Bruno's All Things Linux   
securitybreach<a>archlinux.us

Offline

#4 2011-07-21 15:21:44

marxav
Member
From: Gatineau, PQ, Canada
Registered: 2006-09-24
Posts: 386

Re: SOLVED:Dmenu not launching correctly in Xmonad

Might not be just an XMonad issue.  After upgrade yesterday, not quite working for me neither with Openbox.  I downgraded to get it to work again.

Offline

#5 2011-07-21 16:53:10

xamaco
Member
From: Corsica, France
Registered: 2010-04-05
Posts: 87

Re: SOLVED:Dmenu not launching correctly in Xmonad

Same problem with openbox too and also did a downgrade to solve the issue.

Offline

#6 2011-07-21 18:12:04

securitybreach
Member
From: In front of my computers
Registered: 2007-11-18
Posts: 416
Website

Re: SOLVED:Dmenu not launching correctly in Xmonad

Thanks a lot Marxav and Xamaco, gonna downgrade now.


As soon as I downgraded, it worked perfectly. I did not even have to --recompile Xmonad.

Last edited by securitybreach (2011-07-21 18:16:16)


"Every normal man must be tempted at times to spit upon his hands, hoist the black flag, and begin slitting throats." -- H.L. Mencken
Website      Configs
Forum Admin: Bruno's All Things Linux   
securitybreach<a>archlinux.us

Offline

#7 2011-07-21 21:49:33

austin.rbn
Member
Registered: 2010-01-23
Posts: 77

Re: SOLVED:Dmenu not launching correctly in Xmonad

I have the exact same problem here. So, perhaps a bug should be filed?


"Computer Science is embarrassed by the computer." -- Alan J. Perlis

Offline

#8 2011-07-21 22:54:24

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

Re: SOLVED:Dmenu not launching correctly in Xmonad

Same problem on XMonad here as well.


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#9 2011-07-22 05:41:10

mjdwitt
Member
From: Indiana University, USA
Registered: 2011-02-14
Posts: 27
Website

Re: SOLVED:Dmenu not launching correctly in Xmonad

I'm having the same issues on XMonad as well.  Anyone having these issues on anything other than Arch? If not, I'm going to go ahead and submit bug reports both here and upstream. (Correct me if that's not due process; this will be my first bug retort.)

Last edited by mjdwitt (2011-07-22 05:42:09)

Offline

#10 2011-07-22 09:33:08

Obscaenvs
Member
Registered: 2011-07-22
Posts: 1

Re: SOLVED:Dmenu not launching correctly in Xmonad

I don't think it's an actual bug; it's just updated syntax. For me, this solved the issue:

In my xmonad.hs, I _had_ the line

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

I changed this to use dmenu_run instead and not piping to dmenu:

, ((modm,               xK_p     ), spawn "exe=`dmenu_run` && eval \"exec $exe\"")

A recompile is necessary for this to take effect. One of you did not have to recompile, but that was most likely because the downgraded dmenu understood the old syntax.

Now it works...YMMV.

EDIT: I see now that user "securitybreach" uses "dmenu_run" already... Try not piping the command; when I did this, I got two instances of Dmenu running: one with all the executables in path as usual, and one blank.

Last edited by Obscaenvs (2011-07-22 09:49:52)

Offline

#11 2011-07-22 11:00:07

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: SOLVED:Dmenu not launching correctly in Xmonad

Please look into the dmenu_run script by yourself. You don't need the pipe. Plain dmenu_run will work.

For the record:
1. dmenu 4.4 changes it's cache from ~/.dmenu_cache to ~/.cache/dmenu_run. You can remove ~/.dmenu_cache now.
2. dmenu_run now uses lsx (also from suckless, shipped with dmenu 4.4) to create the list of excutables, saved to the cache file. dmenu_path is gone.


This silver ladybug at line 28...

Offline

#12 2011-07-22 14:24:00

securitybreach
Member
From: In front of my computers
Registered: 2007-11-18
Posts: 416
Website

Re: SOLVED:Dmenu not launching correctly in Xmonad

@Obscaenvs I tried your second entry but I get the same white bar without the executables even after recompiling Xmonad.


"Every normal man must be tempted at times to spit upon his hands, hoist the black flag, and begin slitting throats." -- H.L. Mencken
Website      Configs
Forum Admin: Bruno's All Things Linux   
securitybreach<a>archlinux.us

Offline

#13 2011-07-22 14:41:44

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

Re: SOLVED:Dmenu not launching correctly in Xmonad

Obscaenvs wrote:

I don't think it's an actual bug; it's just updated syntax. For me, this solved the issue:

In my xmonad.hs, I _had_ the line

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

I changed this to use dmenu_run instead and not piping to dmenu:

, ((modm,               xK_p     ), spawn "exe=`dmenu_run` && eval \"exec $exe\"")

A recompile is necessary for this to take effect. One of you did not have to recompile, but that was most likely because the downgraded dmenu understood the old syntax.

Now it works...YMMV.

EDIT: I see now that user "securitybreach" uses "dmenu_run" already... Try not piping the command; when I did this, I got two instances of Dmenu running: one with all the executables in path as usual, and one blank.

There are people having issues with dmenu using other window managers besides XMonad, so that is not the same issue.  Not to mention, that my spawn of dmenu is WAY less complicated than that, and I am still getting the issue (before downgrade).


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#14 2011-07-22 14:52:04

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: SOLVED:Dmenu not launching correctly in Xmonad

I'm shocked by this thread.
Why do people do things like

dmenu_run | dmenu -b

or even

exe=`dmenu_run` && eval \"exec $exe\"

which are plain wrong, especially the second one can set your ass on fire.

Read /usr/bin/dmenu_run please.


This silver ladybug at line 28...

Offline

#15 2011-07-22 15:17:16

iamsmrt
Member
Registered: 2009-08-12
Posts: 138

Re: SOLVED:Dmenu not launching correctly in Xmonad

lolilolicon wrote:

I'm shocked by this thread.
Why do people do things like

dmenu_run | dmenu -b

or even

exe=`dmenu_run` && eval \"exec $exe\"

which are plain wrong, especially the second one can set your ass on fire.

Read /usr/bin/dmenu_run please.

Why is #2 plain wrong? Why will it set your ass on fire?

Offline

#16 2011-07-22 15:41:49

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: SOLVED:Dmenu not launching correctly in Xmonad

iamsmrt wrote:
lolilolicon wrote:

I'm shocked by this thread.
Why do people do things like

dmenu_run | dmenu -b

or even

exe=`dmenu_run` && eval \"exec $exe\"

which are plain wrong, especially the second one can set your ass on fire.

Read /usr/bin/dmenu_run please.

Why is #2 plain wrong? Why will it set your ass on fire?

First, sorry I forgot to remove the backslash.
The following is what the guy whould run with that config, run it in a new terminal window:

exe=`dmenu_run` && eval "exec $exe"

in the dmenu prompt, type

echo touch /tmp/bomb

The first thing you notice is that your terminal window disappears.
Then if you check /tmp, you will see that bomb.
The code *does* do what you said to do, but it *also* does whatever your command spits out to stdout.


This silver ladybug at line 28...

Offline

#17 2011-07-22 18:28:41

mjdwitt
Member
From: Indiana University, USA
Registered: 2011-02-14
Posts: 27
Website

Re: SOLVED:Dmenu not launching correctly in Xmonad

I see what you mean, lolilolicon, about it not being a dmenu bug.  I am confused, however, about something you said earlier.  If

exe='dmenu_run' && eval "exec $exec"

is such a bad idea–as it sounds from your explanation–then why does the xmonad 0.9.2 config use

exe='dmenu_path | dmenu' && eval "exec $exe"

as the default method of launching dmenu?

Offline

#18 2011-07-22 18:43:31

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: SOLVED:Dmenu not launching correctly in Xmonad

@mjdwitt
The two commands are not equal.
dmenu_run already does the exec part, as well as listing executables (what dmenu_path did).
BTW it's not single quotes ('}, but backticks (`).
I suggest that you learnt some basic shell scripting. It's required for staying alive wink

To all those too lazy to look at the dmenu_run script: Ubuntu?


This silver ladybug at line 28...

Offline

#19 2011-07-23 02:49:46

mjdwitt
Member
From: Indiana University, USA
Registered: 2011-02-14
Posts: 27
Website

Re: SOLVED:Dmenu not launching correctly in Xmonad

If anyone is still having issues, I got mine working as it was before the upgrade without downgrading dmenu.  As lolilolicon was directing, dmenu_run takes care of the exec command that is coded into xmonad.hs.  To adjust for this, change

exe=`dmenu_path | dmenu` && eval "exec $exe"

to

dmenu_run

This should fix your M-p dmenu.

Offline

#20 2011-07-23 23:07:38

vae77
Member
Registered: 2010-07-02
Posts: 75
Website

Re: SOLVED:Dmenu not launching correctly in Xmonad

mjdwitt wrote:

If anyone is still having issues, I got mine working as it was before the upgrade without downgrading dmenu.  As lolilolicon was directing, dmenu_run takes care of the exec command that is coded into xmonad.hs.  To adjust for this, change

exe=`dmenu_path | dmenu` && eval "exec $exe"

to

dmenu_run

This should fix your M-p dmenu.

Thanks smile

Offline

#21 2011-07-24 07:23:03

iamsmrt
Member
Registered: 2009-08-12
Posts: 138

Re: SOLVED:Dmenu not launching correctly in Xmonad

mjdwitt wrote:

If anyone is still having issues, I got mine working as it was before the upgrade without downgrading dmenu.  As lolilolicon was directing, dmenu_run takes care of the exec command that is coded into xmonad.hs.  To adjust for this, change

exe=`dmenu_path | dmenu` && eval "exec $exe"

to

dmenu_run

This should fix your M-p dmenu.

I've done that and it still doesn't work, here's the relevant part of my conf:

myKeys conf@(XConfig {XMonad.modMask = modMask}) = 
[ ((modMask, xK_o), sendMessage ToggleStruts)
  , ((modMask, xK_p), (spawn "dmenu_run")) ]

newKeys x  = M.union (keys defaultConfig x) (M.fromList (myKeys x))

Offline

#22 2011-07-24 11:47:24

joenba7
Member
Registered: 2011-07-24
Posts: 1

Re: SOLVED:Dmenu not launching correctly in Xmonad

Hey guys,

Saw your post here, and I got this working, so thought I'd share my solution. The reason for dmenu not autocompleting things is because (at least on my machines) dmenu_path wasn't working correctly. In fact, there was no such command after the upgrade of dmenu. Instead I installed 'dmenu-path-c':

[jorge@ashitaka ~]$ packer -Ss dmenu_path
aur/dmenu-path-c 0.1-2
    dmenu_path C rewrite. 2-4x faster on cache hits, 10-20x faster on cache misses 

So after installing this package, I modified the entry in my xmonad.hs to look like this:

    -- launch dmenu
    , ((modm,               xK_p     ), spawn "exe=`dmenu_path_c | dmenu` && eval \"exec $exe\"")

That seems to do the trick, as everything is working fine. Hope this helps out someone. smile

Offline

#23 2011-07-24 12:24:56

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: SOLVED:Dmenu not launching correctly in Xmonad

joenba7 wrote:

Saw your post here

You saw, but you didn't read.
https://bbs.archlinux.org/viewtopic.php … 95#p964095

This thread is so heartbreaking.

If I really didn't make it clear enough:
1. lsx replaced dmenu_path.
2. `dmenu_run' is all you need to use dmenu as an application launcher.

This thread is a shock movie.

Also, JFTR dmenu 4.4 does have some bugs, but they're nothing relevant to this thread.

Last edited by lolilolicon (2011-07-24 12:28:22)


This silver ladybug at line 28...

Offline

#24 2011-07-24 23:33:42

tkcne
Member
Registered: 2011-07-24
Posts: 1

Re: SOLVED:Dmenu not launching correctly in Xmonad

I don't explicitly call dmenu in my config or define any keys. What  is the simplest way for me to add dmenu_run to my config?

Offline

#25 2011-07-25 10:39:10

austin.rbn
Member
Registered: 2010-01-23
Posts: 77

Re: SOLVED:Dmenu not launching correctly in Xmonad

tkcne wrote:

I don't explicitly call dmenu in my config or define any keys. What  is the simplest way for me to add dmenu_run to my config?

I use EZConfig to add additional keybindings. There's some documentation with examples here. You'll be wanting to add a binding somewhat like this, using additionalKeys:

((modMask, xK_p), spawn "dmenu_run")

Note that this line will be different if you've re-defined modMask.

Also, if you want to be really lazy and copy from my (extremely minimal) XMonad config, you can find that here.

Last edited by austin.rbn (2011-07-25 10:49:42)


"Computer Science is embarrassed by the computer." -- Alan J. Perlis

Offline

Board footer

Powered by FluxBB