XMonad: dmenu not launching/spawning on startup - linux

New to XMonad and loving it so far. I have a fairly vanilla / regular XMonad setup and am having problems with dmenu. When I login and hit mod+p nothing happens. If I then open a terminal and hit xmonad --restart then mod+p, dmenu will be working.
There must be something wrong with my xmonad.hs? I tried a no-customization setup of XMonad and things were working normally (i.e. dmenu was working after login).
My questions:
Is there something wrong with my xmonad.hs?
Why won't dmenu work unless I xmonad --restart ?
Could something fail in xmonad.start that would prevent dmenu from loading properly when starting xmonad?
Here are my files (borrowed from overthink). :
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
[Desktop Entry]
Encoding=UTF-8
Name=Xmonad-****
Comment=Ligthweight, pretentious tiling window manager
Exec=xmonad.start
Icon=xmonad.png
Type=XSession
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. In xmonad.desktop, try changing the Exec= line to include a full path to your 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.
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.
Alternatively, create the file .xinitrc with one line in it:
xmonad
Then type the command startx.
I also found this on the Xmonad FAQ, which may help:
2.6 not found errors or changes to xmonad.hs won't take effect
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-pkg list should show ghc, xmonad, X11, etc.
without brackets, e.g. {xmonad} is bad. ghc-pkg check will tell you if
you have inconsistent dependencies or other registration problems.
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.

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". Changing the binding to simply "dmenu-run" fixed the problem. In your case, though, it looks like you're missing the binding at all.

Related

'Control+t' not detected in emacs

This article is about the keyboard key combination 'Control + t' (smallcase 't') and emacs.
This problem is exclusive to the gui version and does not come up while using the terminal.
I am using Wayland
Control+t : The cursor just blinks and nothing happens.
C-h k + C-t (Control+h and k followed by Control + t) : Nothing shows up.
C-h k + C-S-t : Works. Shows this
'C-t (translated from C-S-t) runs the command transpose-chars (found in global-map), which is an interactive compiled Lisp function...'
Note Translated from C-S-t
This basically means that Control-t is getting eaten up somewhere in the process.
Some more info and curious things -
Control+t and terminals -
Works in Kitty and termite - Detected by wev ; C-t 'tranpose-chars' in emacs-mode (bindkey -e in zsh) works
Does not work in konsole - Detected by wev ; C-t 'tranpose-chars' in emacs-mode (bindkey -e in zsh) does not work.
wev output -
[14: wl_keyboard] key: serial: 5101; time: 10021865; key: 66; state: 1 (pressed)
sym: Control_L (65507), utf8: ''
[14: wl_keyboard] modifiers: serial: 0; group: 0
depressed: 00000004: Control
latched: 00000000
locked: 00000000
[14: wl_keyboard] key: serial: 5103; time: 10022192; key: 28; state: 1 (pressed)
sym: t (116), utf8: ''
Emacsclient -t (emacs client on terminal and tty)
Works.
C-t runs the command transpose-chars (found in global-map), which is an interactive compiled Lisp function in `simple.el'.
Firefox and Chrome is able to detect the keypresses. Tested on https://keyboardchecker.com/
What do I need?
I need to understand why this is happening.
The solution to the same.
And I need your help.
TODO:
Need to check the same in X11 and then report.
[Update]
The same problem persists in X11. Again, Control+Shift+t works but not Control+t

Rebar ./bin/sp restart report {'cannot load',asn1rt_nif,get_files} and can not start

Environment
Mac OS X 10.10.5
Erlang/OTP: 17.5
rebar 2.6.0 17 20150818_094957 git 2.6.0-16-g3239e74-dirty
It is an example of application from the book Programming Erlang. I have git push to github
Steps to reproduce the error
build
$ git clone https://github.com/mingchaoyan/sellaprime.git
...
$ cd sellaprime
$ rebar prepare-deps
...
$ rebar compile
...
release
$ mkdir rel
$ cd rel
$ rebar create-node nodeid=sp
...
edit reltool.config as follow
```
%% -*- mode: erlang -*-
%% ex: ft=erlang
{sys, [
{lib_dirs, []},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "sp", "1.0.0",
[
kernel,
stdlib,
sasl,
goldrush,
lager,
sp
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "sp"},
{profile, embedded},
{incl_cond, derived},
{excl_archive_filters, [".*"]}, %% Do not archive built libs
{excl_sys_filters, ["^bin/(?!start_clean.boot)",
"^erts.*/bin/(dialyzer|typer)",
"^erts.*/(doc|info|include|lib|man|src)"]},
{excl_app_filters, ["\.gitignore"]},
{app, goldrush, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/goldrush"}]},
{app, lager, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/lager"}]},
{app, sp, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]}
]}.
{target_dir, "sp"}.
{overlay, [
{mkdir, "log/sasl"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "releases/\{\{rel_vsn\}\}/nodetool"},
{copy, "sp/bin/start_clean.boot",
"\{\{erts_vsn\}\}/bin/start_clean.boot"},
{copy, "files/sp", "bin/sp"},
{copy, "files/sp.cmd", "bin/sp.cmd"},
{copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
{copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
{copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
]}.
```
then
$ rebar generate
...
start
$ cd sp
$ ./bin/sp start
$ ./bin/sp getpid
...
$ ./bin/sp attach
start an another erlang shell
erl -name 'other#127.0.0.1' -noinput -noshell -eval "rpc:call('sp#127.0.0.1', init, restart, [])" -setcookie sp
then the first erlang shell will report
sp#127.0.0.1)1> {"init terminating in do_boot",{'cannot load',asn1rt_nif,get_files}}
How this happened?
And why asn1rt will be released, actually I didn't config it in reltool.config
Thank you!
You can find an answer in this old rebar issue: you need to prevent the boot script from loading the crypto module. To do this, edit the sp/bin/sp script and remove -mode embedded from the CMD variable setting, changing this:
CMD="$BINDIR/erlexec $SLIM_ARGS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -mode embedded -config $CONFIG_PATH -args_file $VMARGS_PATH"
to this:
CMD="$BINDIR/erlexec $SLIM_ARGS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -config $CONFIG_PATH -args_file $VMARGS_PATH"

running linux commands from R

I have a bunch of random files and I am going to run LINUX-file command on each file. Linux screen will be as follows
m7% file date-file.csv
date-file.csv: ASCII text, with CRLF line terminators
m7% file image-file.JPG
image-file.JPG: JPEG image data, EXIF standard
Only when Linux says that the file is a text file, I want to run a R script that goes through that file and finds all column names. In above screen, I want to run R script only on the first file. How could I achieve this conditional processing?
Is there any way I can run Linux commands from R? If i can do that then I can analyze the output given by Linux command to see if it contains text and then I can execute R script if required.
I am having difficulty achieving this and any help is appreciated
Try system()
08/27 7:08 [nodakai#kaidev01] ~/R$ R -q
> system("ls /")
bin boot dev etc home initrd.img initrd.img.old lib lib32 lib64 libGL.so libnss3.so lost+found media mnt opt proc root run sbin selinux sftp srv sys tmp usr var vmlinuz vmlinuz.old
> x = system("ls", TRUE)
> x
[1] "a.csv" "abi.pdf"
[3] "b.csv" "image.jpeg"
[5] "x86_64-pc-linux-gnu-library"
> for (f in system("ls", TRUE)) { if (length(grep("ASCII", system(paste("file", f), TRUE)))) { print(f) } }
[1] "a.csv"
[1] "b.csv"
http://stat.ethz.ch/R-manual/R-devel/library/base/html/system.html
Globbing
If you're sure all files ending ".csv" are really plain text CSV files, just use Sys.glob()
> list.files()
[1] "a.csv" "abi.pdf"
[3] "b.csv" "image.jpeg"
[5] "x86_64-pc-linux-gnu-library"
> Sys.glob("*.csv")
[1] "a.csv" "b.csv"
http://stat.ethz.ch/R-manual/R-devel/library/base/html/Sys.glob.html

Link error undefined reference to `dgels_' in Lapack

I followed this below webpage to install ATLAS + Lapack in linux :
http://math-atlas.sourceforge.net/atlas_install/node6.html
bunzip2 -c atlas3.10.1.tar.bz2 | tar xfm - # create SRCdir
mv ATLAS ATLAS3.10.1 # get unique dir name
cd ATLAS3.10.1 # enter SRCdir
mkdir Linux_C2D64SSE3 # create BLDdir
cd Linux_C2D64SSE3 # enter BLDdir
../configure -b 64 -D c -DPentiumCPS=2400 \ # configure command
--prefix=/home/whaley/lib/atlas \ # install dir
--with-netlib-lapack-tarfile=/home/whaley/dload/lapack-3.4.2.tgz
make build # tune & build lib
make check # sanity check correct answer
make ptcheck # sanity check parallel
make time # check if lib is fast
make install # copy libs to install dir
After that , I try to run an sample in
http://www.netlib.org/lapack/lapacke.html
the sample code :
#include <stdio.h>
#include <lapacke.h>
int main (int argc, const char * argv[])
{
double a[5*3] = {1,2,3,4,5,1,3,5,2,4,1,4,2,5,3};
double b[5*2] = {-10,12,14,16,18,-3,14,12,16,16};
lapack_int info,m,n,lda,ldb,nrhs;
int i,j;
m = 5;
n = 3;
nrhs = 2;
lda = 5;
ldb = 5;
info = LAPACKE_dgels(LAPACK_COL_MAJOR,'N',m,n,nrhs,a,lda,b,ldb);
for(i=0;i<n;i++)
{
for(j=0;j<nrhs;j++)
{
printf("%lf ",b[i+ldb*j]);
}
printf("\n");
}
return(info);
}
I have found out the build library has no iblapacke.a , so I build this library by myslef
cd lapack-3.4.2
cp make.inc.example make.inc
cd lapacke
make
Then , finally I have the iblapacke.a now , so I compile the sample above by :
g++ test3.cpp liblapacke.a -o test3.exe
I get the following errors :
liblapacke.a(lapacke_dgels_work.o): In function `LAPACKE_dgels_work':
lapacke_dgels_work.c:(.text+0x1dd): undefined reference to `dgels_'
lapacke_dgels_work.c:(.text+0x2b7): undefined reference to `dgels_'
After I google , I have found :
http://www.netlib.org/lapack/explore-html/d7/d3b/group__double_g_esolve.html
Functions/Subroutines
subroutine dgels (TRANS, M, N, NRHS, A, LDA, B, LDB, WORK, LWORK, INFO)
DGELS solves overdetermined or underdetermined systems for GE matrices
There is a function dgels , without underline , and in
http://shtools.ipgp.fr/www/faq.html#l4
I think the underline is added for accident ,
nm -A liblapacke.a |grep "dgels_"
liblapacke.a:lapacke_dgels.o: U LAPACKE_dgels_work
liblapacke.a:lapacke_dgels_work.o: U LAPACKE_dge_trans
liblapacke.a:lapacke_dgels_work.o:0000000000000000 T LAPACKE_dgels_work
liblapacke.a:lapacke_dgels_work.o: U LAPACKE_xerbla
liblapacke.a:lapacke_dgels_work.o: U dgels_
liblapacke.a:lapacke_dgels_work.o: U free
liblapacke.a:lapacke_dgels_work.o: U malloc
I think I should try to not avoid underline like build "dgels" not to "dgels" while build liblapack.a ,means I should change something build Lapack and ATLAS ,
just don't know how to do it ....Any suggestion is appreciated !!
Update : http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_lapack_examples/c_bindings.htm
I have no idea if related , -Ddgels=dgels_ is added , the same link error !!
see:
http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=12&t=3336
for example:
gcc LinearEquation.c -Ilapack-3.5.0/lapacke/include/ -Llapack-3.5.0 -llapacke -llapack -lrefblas -lgfortran -o LinearEquation
the order of lapacke > lapack > refblas is important... also if you don't want to use the double step gcc gfortran, use -lgfortran
I had the exact same problem. You need to do it as follows:
gcc(or g++) -c -O3 -I ../include -o test.o test.c
and then
gfortran test.o ../liblapacke.a ../liblapack.a ../blas.a -o test.exe
You can then run it like so:
./test.exe
Basically, you need to follow the gcc compile with a gfortran compile. The -c option in the first command forces gcc to skip the linker. gfortran is then used to link the libraries.
You can learn more by looking at the makefile for the examples provided with LAPACKE.
I had the same problem (using g++), but fixed my problems by adding a -lblas and -lgfortran.
To resolve the issue, here are the steps I have done.
sudo apt-get install libblas-dev liblapack-dev gfortran
linking a -lblas and -lgfortran when it runs

Error when spawning child process in node.js

I'm trying to get a little ffmpeg converter-service up and running, made pretty good progress so far. But when it comes to spawning the actual ffmpeg process for conversion, i'm hitting a brick wall.
// options.ffmpegopts is an array containing format-specific parameters
var args = [ '-y', '"' + options.targetfile + '"' ];
args = options.ffmpegopts.concat(args);
var ffmpegProc = spawn('ffmpeg ', args);
ffmpegProc.stderr.on('data', function(data) {
console.log('stderr: ' + data);
});
When executing this code, i get the following console output:
stderr: execvp(): No such file or directory
I already checked different node versions (0.4.0, 0.4.2 and 0.5.0-pre) without any effect.
Another really strange behavior is the fact that i have to call spawn including a space ('ffmpeg ' instead of just 'ffmpeg'). If i omit this space, i get a different error (stderr: "/path/to/my/movie.mpeg": no such file or directory). When calling ffmpeg directly from the shell, the command sent to child_process.spawn() executes without any problems.
Any hints on that one? I already checked other projects who achieve the same (like node-imagemagick or ffmpeg-node, but the enlightment didn't hit me...
Update: strace() output
When running my application using strace -fF -o strace.log node server.js, i can grep the following process spawning calls:
execve("/usr/local/sbin/ffmpeg", ["ffmpeg", "-i", "\"/data/media_dev/test/ORG_mymovi"..., "-sameq", "-ab", "128k", "-ar", "44100", "-b", "512k", "-r", "25", "-s", "320x240", "-f", "flv", ...], [/* 20 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/local/bin/ffmpeg", ["ffmpeg", "-i", "\"/data/media_dev/test/ORG_mymovi"..., "-sameq", "-ab", "128k", "-ar", "44100", "-b", "512k", "-r", "25", "-s", "320x240", "-f", "flv", ...], [/* 20 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/sbin/ffmpeg", ["ffmpeg", "-i", "\"/data/media_dev/test/ORG_mymovi"..., "-sameq", "-ab", "128k", "-ar", "44100", "-b", "512k", "-r", "25", "-s", "320x240", "-f", "flv", ...], [/* 20 vars */]) = -1 ENOENT (No such file or directory)
execve("/usr/bin/ffmpeg", ["ffmpeg", "-i", "\"/data/media_dev/test/ORG_mymovi"..., "-sameq", "-ab", "128k", "-ar", "44100", "-b", "512k", "-r", "25", "-s", "320x240", "-f", "flv", ...], [/* 20 vars */]) = 0
After seeing that strangely escaped double quotes on the path, i tried to call ffmpeg without the quotes...worked like a charm. But the problem remains, i need to be able to work with spaces in my paths.
Any suggestions?
Update: Solution
Got it working with spaces, a simple inputfile.replace(' ', '\ ') was enough.
I'd wager money that the space at the end of "ffmpeg " is the cause of the current problem. A quick little C program will show that:
#include <unistd.h>
int main(int argc, char *argv[]) {
execvp(argv[1], &argv[1]);
perror(argv[0]);
}
gives the following output:
$ ./execvp "ffmpeg"
FFmpeg version 0.6-4:0.6-2ubuntu6, Copyright (c) 2000-2010 the FFmpeg developers
...
$ ./execvp "ffmpeg "
./execvp: No such file or directory
$
I suggest removing the space again, and re-run under strace(1) -fF. Look for the command that is actually executed, and look to see if the error message about /path/to/my/movie.mpeg is coming from ffmpeg or from node.js.

Resources