You are not logged in.
Just pipe your text into dmenu, e.g.:
acpi | dmenu
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
awesome!
Offline
I was wondering how it would be possible to show some information as soon as opening dmenu, without entering any text. Like battery state, date, cpu, mem etc. I think that would be nice.
Just pipe whatever information you want to dmenu, then set the right number of lines. Or if it's just something short, use it as the prompt - that's all built in. Do these not work for you?
EDIT: too slow.
Last edited by Trilby (2013-08-29 21:47:55)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Cool, what i'm trying to figure out now is if I could show this information without it being highlighted.
Offline
Just change the highlighting colors to be the same as the default colors.
Why do you want to use dmenu for this though?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I want to use dmenu as a launcher as well so that wouldn't be ideal.
Show information upon starting an as soon as I type something filter the executable list.
Actually I just realized piping won't work because it removes all applications, I could bind it I guess.
Last edited by madprops (2013-08-29 22:38:14)
Offline
You want the information in the same instance as the one that launches your applications? That won't work.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
It can work, edit the script you use and let it execute acpi before the rest.
{ acpi; ls /usr/bin/; } | dmenu
Offline
dmenu_run is a script that comes with dmenu that lists the executables. If you incorporate Procyon's idea into a new version of it, you get the cache as well.
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Use dmenu -p (prompt) in dmenu_run or wherever. | dmenu -p "$(acpi)"
Offline
Dmenu expert needed - ok maybe not expert..
skanky wrote dedit
#!/bin/sh
#
# d-edit: Use dmenu to open and edit a file from a given list.
# Global variables:
#FILES=${1:-"/home/boo/.config/dmenu/edit-list"}
if [ -f $XDG_CONFIG_HOME/dmenu/dmenurc ]; then
. $XDG_CONFIG_HOME/dmenu/dmenurc
else
DMENU='dmenu -i -l 8'
fi
EDITOR=xfw
# Show list of options
choice=$(awk '{print $1}' $FILES | $DMENU -p "File to edit:")
if [ $choice ]; then
# use eval as get vim error is use awk's system
eval $(awk '/'$choice'/ && NF == 2 {printf("'$EDITOR' %s",$2); exit}
/'$choice'/ && NF == 3 {printf("%s %s",$3,$2); exit}' $FILES)
fi
How would I get it so that I dont have to use a list that I have to edit but just to look in a particular folder only used for text files like "/home/boo/text-files/
--------------
by the way this guy has a few handy dmenu things like a wget script
http://www.uzbl.org/wiki/dm-dm
Last edited by chickenPie4tea (2013-09-05 09:22:29)
You can like linux without becoming a fanatic!
Offline
Substitute the
choice=$(awk '{print $1}' $FILES | $DMENU -p "File to edit:")
with
choice=$(ls -1 /home/boo/text/files | $DMENU -p "File to edit:")
You could put the path in a variable (in which case quote it - and $FILES above should be quoted).
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Thanks for the very quick reply!
I now get the files listed but when i choose one it doesnt open
#!/bin/sh
#
# d-edit: Use dmenu to open and edit a file from a given list.
# Global variables:
#FILES=${1:-"/home/boo/.config/dmenu/edit-list"}
FILES=${1:-"/home/boo/text-files/*.txt"}
if [ -f $XDG_CONFIG_HOME/dmenu/dmenurc ]; then
. $XDG_CONFIG_HOME/dmenu/dmenurc
else
DMENU='dmenu -i -l 8'
fi
EDITOR=xfw
# Show list of options
#choice=$(awk '{print $1}' $FILES | $DMENU -p "File to edit:")
choice=$(ls -1 /home/boo/text-files | $DMENU -p "File to edit:")
if [ $choice ]; then
# use eval as get vim error is use awk's system
eval $(awk '/'$choice'/ && NF == 2 {printf("'$EDITOR' %s",$2); exit}
/'$choice'/ && NF == 3 {printf("%s %s",$3,$2); exit}' $FILES)
fi
You can like linux without becoming a fanatic!
Offline
Thanks for the very quick reply!
I now get the files listed but when i choose one it doesnt open#!/bin/sh # # d-edit: Use dmenu to open and edit a file from a given list. # Global variables: #FILES=${1:-"/home/boo/.config/dmenu/edit-list"} FILES=${1:-"/home/boo/text-files/*.txt"} if [ -f $XDG_CONFIG_HOME/dmenu/dmenurc ]; then . $XDG_CONFIG_HOME/dmenu/dmenurc else DMENU='dmenu -i -l 8' fi EDITOR=xfw # Show list of options #choice=$(awk '{print $1}' $FILES | $DMENU -p "File to edit:") choice=$(ls -1 /home/boo/text-files | $DMENU -p "File to edit:") if [ $choice ]; then # use eval as get vim error is use awk's system eval $(awk '/'$choice'/ && NF == 2 {printf("'$EDITOR' %s",$2); exit} /'$choice'/ && NF == 3 {printf("%s %s",$3,$2); exit}' $FILES) fi
Sorry, my bad. I forgot about the action of opening the file.
Replace the "if choice" section with:
if [ "$choice" ]; then
$EDITOR "${FILES}/${choice}"
fi
You also need to change the path in the choice= line to "$FILES".
EDIT: Aaaah! sorry that will only work if you drop the *.txt from the FILES initialisation.
Hold on...
Last edited by skanky (2013-09-05 10:43:14)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
This should work - though I've not had time to test it.
#!/bin/sh
#
# d-edit: Use dmenu to open and edit a file from a given list.
# Global variables:
#FILES=${1:-"/home/boo/.config/dmenu/edit-list"}
FILES=${1:-"/home/boo/text-files/"}
if [ -f $XDG_CONFIG_HOME/dmenu/dmenurc ]; then
. $XDG_CONFIG_HOME/dmenu/dmenurc
else
DMENU='dmenu -i -l 8'
fi
EDITOR=xfw
# Show list of options
#choice=$(awk '{print $1}' $FILES | $DMENU -p "File to edit:")
choice=$(ls -1 "${FILES}*.txt" | $DMENU -p "File to edit:")
if [ $choice ]; then
$EDITOR ${FILES}/${choice}
fi
I'm sure some could improve on it (I probably could a bit as I'm not happy about the *.txt in the ls command).
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Great, it's working now
It didn't at first but I just dropped the *.txt part as there are only text files in that folder anyway.
I find it very handy for note taking on various subjects - I just have all my notes in one folder and can now access them with a nice menu - thanks!
You can like linux without becoming a fanatic!
Offline
Great, it's working now
It didn't at first but I just dropped the *.txt part as there are only text files in that folder anyway.
I find it very handy for note taking on various subjects - I just have all my notes in one folder and can now access them with a nice menu - thanks!
No problem. Sorry I messed it up first time round.
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Edit: fyr has been updated to also launch applications from desktop files and handle names with embedded spaces.
It has now been added as an AUR package.
Inspired by Ghost1227 this is a launcher menu which allows you to execute (=), add (+) or delete (-) application symlinks stored in the ~/.fyrd directory. To start it off, press Enter and the '=' will change to a '+'; now type in the name of your application, (say) leafpad, and then Enter to save the symlink to /usr/bin/leafpad. When fyr is run again, 'leafpad' appears in the menu. Repeat as necessary. The action symbols '=', '+' and '-' just go around in a cycle.
#!/bin/bash
# fyr: Application launcher by ninian @ 25/09/13
emsg() {
notify-send -u critical "Fyr error" "$*" &
}
apadd() {
cmd=$(command -v $app)
if [[ -z $cmd ]]; then emsg Application \'$app\' not found on PATH; return 1
else
if [[ -L $fyrd/$app ]]; then emsg Launcher \'$app\' already exists; return 1
else
[[ -d $fyrd ]] || mkdir -p $fyrd
ln -s $cmd $fyrd/$app; return 0
fi
fi
}
apdel() {
if [[ -L $fyrd/$app ]]; then rm -f $fyrd/$app; return 0
else emsg Launcher \'$app\' not found; return 1
fi
}
fyrd="$HOME/.fyr"
act="="
while true; do
app=$((echo "$act"; ls $fyrd) | dmenu -i -p 'Application')
case "$app"x in
"$act"x) case "$act" in
'=') act='+' ;;
'+') act='-' ;;
'-') act='=' ;;
esac ;;
x) exit ;;
*) break ;;
esac
done
case "$act" in
'=') exec $app ;;
'+') apadd ;;
'-') apdel ;;
esac
Also, inspired by Gullible Jones I think this is about as efficient as can be done to execute any command from all the installed desktop files:
#!/bin/sh
# deskexec: Displays menu of commands from all desktop files and executes selection
# By ninian @ 28/09/13
eval exec "$(find $HOME/.local/share/applications /usr/{local/,}share/applications -name '*.desktop' -print0 \
| xargs -0 awk 'sub(/^Exec=/,"")+gsub(/\s%[fFuU]/,"")' \
| dmenu -i -p Exec)"
Edit: script updated to handle commands with embedded spaces
Last edited by ninian (2013-09-28 22:14:44)
Offline
Hello guys, do you have any hint about what to change to make dmenu_run start gajim?
If I start dmenu_run from terminal and then type gajim in it, gajim will start, but if I start dmenu_run with a shortcut (not from terminal), gajim won't start. As a workaround, I can start gajim from dmenu_run with urxvt -e gajim, but then I will have an extra terminal opened. Any suggestions are welcome.
/usr/bin/gajim looks similar to this
#!/bin/sh
cd "/usr/lib/python2.7/site-package/gajim"
exec "python2" -OO gajim.py "$@"
English isn't my first language.
Is Arch Linux user called archer? Where are our bows and arrows?
Offline
I'm guessing gajim.py relies on an environment variable setting.
Where is the shortcut for dmenu_run defined? If it's in your window manager, how do you start your window manager?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I'm guessing gajim.py relies on an environment variable setting.
Where is the shortcut for dmenu_run defined? If it's in your window manager, how do you start your window manager?
I'm using 2bwm, so the shortcut is defined in config.h file of the 2bwm, the shortcut should call /usr/bin/dmenu_run. I start my window manager from .xinitrc:
#!/bin/sh
# ~/.xinitrc
# some generic commands
2bwm &
exec urxvt
I have the same issue with starting gajim via gmrun as well.
When I run dmenu_run from shortcut, my pstree has this branch:
...urxvt---2bwm---dmenu_run---dmenu_run---dmenu
When I start dmenu_run from terminal, then pstree has this branch:
...urxvt---2bwm---urxvt---bash---dmenu_run---dmenu_run---dmenu
English isn't my first language.
Is Arch Linux user called archer? Where are our bows and arrows?
Offline
Yup, I'm pretty sure that is an environment variable issue.
What runs your xinitrc? Is it some systemd user service or display manager, or do you log in to the tty then run startx/xinit? If it's the latter I'm likely wrong, as loging in to a tty would source all the same files to set environment variables that your terminal sessions do.
Last edited by Trilby (2013-10-01 22:10:01)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Yup, I'm pretty sure that is an environment variable issue.
What runs your xinitrc? Is it some systemd user service or display manager, or do you log in to the tty then run startx/xinit? If it's the latter I'm likely wrong, as loging in to a tty would source all the same files to set environment variables that your terminal sessions do.
I'm using the latter approach, so I just log in to the tty and then run startx.
English isn't my first language.
Is Arch Linux user called archer? Where are our bows and arrows?
Offline
Hmm, sorry then, that suggests my suspicion was wrong. To double check, you could compare the output of `env` from the tty right before starting x, and from a terminal emulator within X. but if that's how you're starting X there shouldn't be any differences.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Hmm, sorry then, that suggests my suspicion was wrong. To double check, you could compare the output of `env` from the tty right before starting x, and from a terminal emulator within X. but if that's how you're starting X there shouldn't be any differences.
No, don't be sorry, I really appreciate your help. The output of env isn't exactly the same, but I don't see any difference what should really matter. I run env from my urxvt terminal and from gajim starting script (/usr/bin/gajim) started by dmenu_run, here is the diff of results.
# diff env-gajim env-urxvt
2d1
< XDG_SESSION_ID=1
3a3
> XDG_SESSION_ID=1
4a5
> TERM=rxvt-unicode-256color
6c7
< TERM=linux
---
> WINDOWID=14680075
10d10
< PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl
11a12
> PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl
14,15c15
< HOME=/home/peta
< XDG_SEAT=seat0
---
> COLORFGBG=15;default
16a17,19
> XDG_SEAT=seat0
> HOME=/home/peta
> TERMINFO=/usr/share/terminfo
20d22
< DISPLAY=:0
21a24,25
> DISPLAY=:0
> COLORTERM=rxvt
I forgot to mention, that I slightly changed my dmenu_run script, so programs started by dmenu_run aren't dmenu_run's children. Anyway, the problem with running gajim from it was there even with the original version.
English isn't my first language.
Is Arch Linux user called archer? Where are our bows and arrows?
Offline