Closed dalbandea closed 4 years ago
May I ask what is the output of following command:
echo $TERMINAL
I set $TERMINAL
to be mate-terminal
by writing
export TERMINAL=mate-terminal
in my .bashrc
file. It returns mate-terminal
. I have also tried with gnome-terminal
and urxvt
, but the same happens. The Terminal
action only works if I trigger dmenufm
from a terminal.
I'll see if I can replicate this when I get home today. Looking at this in the script I can not see why this would not work, as the section responsible is here at line 232 in dmenufm-menu
.
"$TERM") $TERMINAL ;;
and all this should do in theory is execute whatever $TERMINAL
is set to. Could you paste the output of file /bin/sh
seeing if this is a symlink to another shell?
I had an idea that maybe the DISPLAY
variable isn't set right when launched by your shortcut but is when launched in terminal, but this doesn't seem to make sense considering dmenufm still shows up as I understand. Do see if your $DISPLAY
variable is set and if not try exporting it as :0
as this is worth a shot. Again I will look more into it at home but at first glance I cannot see much of a reason this would occur.
I am actually not sure what's happened lol, so I'll ask some details:
ls -a /bin/sh
?export
line to .profile
, will it help?dmenu
or rofi
? In the configuration section, you can use other menu system like rofi
. If you use dmenu
directly, would this happen again? Or you use rofi
directly by add FM_PROG=rofi
into your dmenufm.conf
, would this happen again?$DISPLAY
?I'll directly tell you more about the code:
https://github.com/huijunchen9260/dmenufm/blob/master/dmenufm-menu#L232
By the design, all the codes possibly related to this issue would be in this line. Of course I might be wrong, but maybe you can also tweak this line a little bit, like modifying it to be
"$TERM") $TERMINAL & ;;
to see whether putting it to background process makes it work.
1) The output of file /bin/sh
is
/bin/sh: symbolic link to dash
The output of ls -a /bin/sh
is bin/sh
, which is a symlink to dash.
And echo $DISPLAY
returns :0
.
2) I tried to move the export
line to .profile
(and removed it from .bashrc
) and rebooted my system, but then echo $TERMINAL
returns nothing. So I tried putting it in both .profile
and .bashrc
, but the problem is still there.
3) Regarding the configuration, I've tried changing the menu putting this code in dmenufm.config
FM_PROG="bemenu"
FM_OPTS="-l 10"
FM_OPT_PROMPT="-p"
FM_OPTS_GENERIC="--sb='#005577'"
FM_OPTS_ACTION_LV1="--sb='#33691e'"
FM_OPTS_ACTION_LV2="--sb='#FF8C00'"
FM_OPTS_ACTION_BULK="--sb='#CB06CB'"
I have changed bemenu
by dmenu
or rofi
, but I do not appreciate any difference, it just opens with dmenu
. To run it with with rofi
I run the command
dmenufm -m "rofi -dmenu -i -sort -l 25"
and the same happens: if I run that command on the terminal, everything alright; if I set a keyboard shortcut with that line, the Terminal does not open.
4) I just tried to add the &
in that line of code to try see if that solves the issue, but the problem is still there :(
Not sure if your shortcut program supports full reading of redirections, but worth a shot.
Try making your shortcut run dmenufm 2> ~/dmenufm-log.txt
. Check if there is a new file created in your home directory called dmenufm-log.txt
. If there is review it and paste it here if you feel. The main errors we are looking for is any command not found
or can't open display
. There may be other important ones.
If this file was not created it seems your shortcut program doesn't do redirection for the program itself. In this case, you may simply run this to create a basic script to do the work itself.
# creates a new script
echo "dmenufm 2> ~/dmenufm-log.txt" > ~/dmenufm-test.sh
# makes it executable
chmod +x ~/dmenufm-test.sh
In your shortcut tool, add $HOME/dmenufm-test.sh
as the script and launch it and finally review that dmenufm-log.txt
file that is created.
1. I tried to move the `export` line to `.profile` (and removed it from `.bashrc`) and rebooted my system, but then `echo $TERMINAL` returns nothing. So I tried putting it in both `.profile` and `.bashrc`, but the problem is still there.
I guess your DE or WM cannot read the env variable defined in .bashrc
. Try to add that export
line in .xinitrc
to see whether this variable is read or not.
My shortcut program is the GUI provided by KDE Plasma System Settings, and the window manager is KWin (don't know if this helps). I tried the two things you said, and both of them generate the file dmenufm-log.txt
. But in both cases it is empty.
Very strange! I thought for sure it would be something that would warrant an error.
Lets try bash -x dmenufm 2>&1 | tee dmenufm-log.txt
run from shortcut program. This will give a ton of output. Note that this output will contain names of files and your user's name etc. (as this will contain basically every step the script walks through) so do make sure nothing really sensitive is in there before you send it here. Make sure once you run it, simply in dmenufm launch the terminal option (that doesn't work, still launch it so the output will contain logs of trying to run it) and once you do, close it down and the log file will be created.
Again if this does not produce the file, simply make a script like earlier that just contains the command, chmod it, and add that as the program. If it does produce that dmenufm-log.txt file with lots of output, do not worry about that though.
Probably this would help.
1) I didn't have a .xinitrc
file, so I created it adding the export
line. I rebooted, but it does not seem to read it, as happened with .profile
. It only works when I run . ~/.profile
or . ~/.xinitrc
, but only for that terminal session. If I close and open the terminal, echo $TERMINAL
returns nothing again.
2) I'm checking the KDE Session Environment Variables site, and I created an executable .sh
file with the export
line in the env
folder of plasma's workspace, since it says it automatically executes every .sh
file there. Let me reboot and I tell you if something happened.
3) It generates output. I don't understand it, but probably the interesting part is here.
+ '[' '' = true ']'
+ '[' /home/david = '' ']'
+ TwoPWD
+ TMP=/home
+ TMP=home
+ '[' 4 -ge 30 ']'
+ TMP2=david
+ '[' 5 -ge 30 ']'
+ TwoPWD=home/david
+ unset TMP TMP2
++ yprompt home/david '-fn Monospace-15 -sb #005577'
++ printf '%s\n%s\n%s\n%s\n%s' ../ ./ Actions Terminal '~
++ dmenu -f -i -l 10 -fn Monospace-15 -sb '#005577' -p 'home/david '
+ CHOICE=Terminal
+ case "$CHOICE" in
+ '[' -n Terminal ']'
+ '[' -z '' ']'
+ Menu
+ set -- '~' ' ' AdbeRdr9.5.5-1_i386linux_enu.deb anaconda2 ...
I upload it here anyway, there seems not to be any sensitive information.
EDIT: I unupload it since it is no longer necessary, issue solved.
Probably this would help.
This was the key! Sorry, it was something I should have figured out by myself (I learned today what is an environmental variable though, so maybe it would have been a long time until I came up with searching something related to KDE's environmental variables).
Thank you so much for the fast replies guys! Now the tool is even more great for me! :D
I would not know that KDE has its own way of setting environmental variable until this issue open.
Feel free to check my other projects. Now I am working extensively on shbib. Hope you'll also be interested in it.
I'm not reallly sure whether this is a dmenufm issue. I have set a keyboard shortcut to open
dmenufm
viaSuper
+F
, but running it this way the actionTerminal
doesn't do anything. However, when I rundmenufm
in the terminal and run theTerminal
action, another terminal instance pops up.If you want to see a video of it, it also happens to this guy in minute 10:06
https://www.youtube.com/watch?v=oFfuJBp2M7w&t=618s