You are not logged in.
Pages: 1
#! forums have being well known as the OpenBox and Conky reference site, but also one of the best dmenu resources you can find. I guess we should keep this going here too.
In case you are not aware of it, Like formerly in Crunchbang, dmenu is a default goodie in BL and part of the suckless-tools package in Debian.
For the noobs. Hit Alt+F3 and type some exceutable/app name. Press Enter or Esc to exit. Done. That's all it takes to launch an app or check if some package is present in your system. But properly tweaked it can do a whole lot more.
For starters, some good reading:
It seems there's a lot of love for dmenu amongst the french Debian users community. I've found many neat tricks in the French Debian forums and also the great Arpinux's LiveArp site. It's all in french, but it well worths some searches, a bit of translator (and sunglasses for the French Forum theme).
Yet another great (french) source for hacks.
And a guide for launchers (sunglasses required)
Or... if you are really into it and the bug caught you.
There is also an extension of dmenu that might interest you: dmenu-extended. It also deserves a good try. You may prefer the old plain thing or adding this. The choice is up to you, but don't forget to share your configs, tricks and hacks in any case.
Now it's your turn.
Last edited by Snap (2015-10-05 06:15:24)
Offline
Nice thread!
To install the latest git MASTER version of dmenu (with full Xft support), first install the dependencies:
sudo apt-get install libxinerama-dev libx11-dev build-essential git
Then clone the repository:
git clone http://git.suckless.org/dmenu
The options can be configured now to avoid the need to add the "-{fn,sb,sf,nb,nf}" flags at run-time:
cd dmenu && cp config.def.h config.h && vim config.h
The configuration file is well-commented and pretty self-explanatory.
Finally, compile the program with a simple:
make
There are two options now:
Follow this guide to make a .deb package and install this with `dpkg` or gdebi
Run `sudo make install clean` to install the package to /usr/local/bin
If the second method is used, APT cannot remove the binaries so you will have to do that manually if required.
An advantage to compiling the package from the source code is that the many available patches can be applied:
http://tools.suckless.org/dmenu/patches/
If this method is used, be sure to remove the suckless-tools package that includes dmenu
Offline
Nice thread!
Ideed.
full Xft support
A blessing.
Besides the benefits already explained by Head_on_a_Stick, if like me you don't need/use any other of the tools in the suckless tools package excepting dmenu (I keep wondering why they're all packed together in Debain) git is also the way to go. Thanks for posting the "better go git" guide, head.
PS, this excellent guide by hhh might be helpful to make debs too.
Last edited by Snap (2015-10-05 06:35:40)
Offline
Thanks
La liberté, personne ne peut l’expliquer mais tout le monde peut la comprendre.Cecilia Meireles
Tout ce qui n'est pas donné ou partagé est perdu (proverbe tsigane)
Offline
Here's my take on a basic file manager explorer:
#!/bin/sh
handle_file() {
if [ -d "$1" ]; then
cd "$1"
elif [ -f "$1" ]; then
exec xdg-open "$(pwd)/$1" &
exit 0
else
printf "%s is neither a file nor a directory\n" "$(pwd)/$1" >&2
fi
}
needed=("xdg-open" "dmenu")
for n in "${needed[@]}"; do
if ! which "$n" &> /dev/null; then
printf "Please install %s in order to use this script!\n" "$n" >&2
exit 1
fi
done
while : ; do
file="$(ls -1 --group-directories-first | dmenu -l 10 -p "Browse $(basename $(pwd)):")"
if [ -e "$file" ]; then
handle_file "$file"
else
break
fi
done
Browse and select a netctl profile to connect to:
#!/bin/sh
needed=("netctl" "sudo" "dmenu")
for n in "${needed[@]}"; do
if ! which "$n" &> /dev/null; then
printf "Please install %s in order to use this script!\n" "$n" >&2
exit 1
fi
done
profile="$(find /etc/netctl/ -maxdepth 1 -type f -printf "%f\n" | dmenu -p "Select profile:" $*)"
if [ "$profile" ]; then
sudo netctl stop-all
sudo netctl start "$profile"
else
printf "Could not find a profile to connect to\n" >&2
exit 1
fi
Mandatory shutdown script:
#!/bin/sh
cmd=$(printf "poweroff\nreboot\nsuspend\nlock\nkillX\n" | dmenu -p "Execute:" $*)
if [ -z "$cmd" ]; then
exit 0
fi
case "$cmd" in
poweroff)
systemctl poweroff ;;
reboot)
systemctl reboot ;;
suspend)
systemctl suspend ;;
lock)
slock ;;
killX)
killall X ;;
*)
printf "Option not recognized: %s\n" "$cmd" >&2
esac
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
Now this starts to get juicy. Thanks for keep it rolling, folks.
Offline
There are two options now:
Follow this guide to make a .deb package and install this with `dpkg` or gdebi
Run `sudo make install clean` to install the package to /usr/local/bin
If the second method is used, APT cannot remove the binaries so you will have to do that manually if required.
I was thinking for sometime, whether you need to create a deb package or just copy & paste the binaries, scripts etc into your /usr/local/bin, which is your own bin directory. For example, in this dmenu app, after the make command, you get 3 executable files dmenu_run, dmenu and stest. And, as the files in this folder is not seen by APT, they are not susceptible any future upgrade (breakage). Also, you know exactly what you've done to your system. I keep most of such apps in /usr/local/bin.
The other thing that came to mind is the extension .deb has no real value as Linux is an extension-less system. Only thing this .deb shows is that, the given package is somewhat compatible with Debian. You can delete the .deb part of a "deb package" dpkg -i it, and it'd still install the app.
Offline
I use i3 with dmenu along with j4-dmenu-desktop which makes it a lot faster. I have just put it in openbox with a vertical menu 20 lines deep and it works fine, so have now dumped the flaky Debian menu.
<keybind key="A-d">
<action name="Execute">
<name>dmenu</name>
<command>j4-dmenu-desktop --dmenu="dmenu -i -l 20"</command>
</action>
Offline
What are you using dmenu for? I use it to
open apps (+ open terminal apps)
search google
search IMBD
open often visited websites
open folders
Offline
In i3 just for opening apps
Offline
Using dmenu in task launcher with xdotool and this desktop file
[Desktop Entry]
Encoding=UTF-8
Name=dmenu
Comment=dmenu
Exec=xdotool key Alt+F3
Terminal=false
Type=Application
Icon=run
Categories=Menu;
StartupNotify=true
You can point it to any icon you like. I usually put mine in
/usr/share/icons/hicolor/scalable/apps/
Offline
I was using dmenu-extended a few months ago. Interesting extension:
An extension to the original dmenu allowing super fast access to your files, folders, and programs. dmenu-extended has support for plugins, command aliasing, file filtering, and customisation.
Offline
I find easier and faster using aliases in a terminal than menu extended to deal with apt. Also there are better ways to lauch links or searches (if you use that plugin). But true it's a cool extension to copnsider. It might be perfect for certain workflows.
Last edited by Snap (2015-11-04 22:48:07)
Offline
Though this is surely well known by seasoned dmenu lovers, maybe it helps noobs if they happen to stumble upon this topic... or just grabs some new adepts
Typically nobody uses the plain dmenu_run. If nothing special for fonts and colors is defined into ~/.Xresources (or ~/.Xdefaults) dmenu will inherit the xrdb defaults, which look erm.... (fugly... cough, cough...) does not exactly match your desktop theming, does it? That's why most use a customized dmenu_bin script instead. It can be as simple or complex as you want, or as your bash scripting skills drives you.
A simple one placing it at the bottom and defining the font and colors, typically living into ~/bin or somewhere else into your $PATH:
dmenu_bin.sh
#!/bin/sh
dmenu_run -b -i -fn 'snap' -nf '#505050' -nb '#000000' -sf '#ffb964' -sb '#000000'
This is nice, but a typical and common use is making a ~/.dmenurc config file and sourcing it into dmenu_bind. Follow some examples:
.dmenurc
#!/bin/bash
HEIGHT="15"
FN="snap"
NF="#505050"
NB="#000000"
SF="#ffb964"
SB="#000000"
OPTIONS="-b -i -l $HEIGHT -fn $FN -nf $NF -nb $NB -sf $SF -sb $SB"
export HEIGHT FN NF NB SF SB OPTIONS
dmenu_bind
#!/bin/sh
. $HOME/.dmenurc
dmenu_run -b -i -fn $FN -nf $NF -nb $NB -sf $SF -sb $SB
If you use twoion's dmenu-v you can add some nice placement tweaks too.
Now if you like to run some savvy dmenu scripts collection (more on this later), add one these snippets to them so they all grab the configs for a coherent dmenuing experience.
. ~/.dmenurc
Or
source $HOME/.dmenurc
Or if you want to make sure the dmenu scripts will run in any system even without an existing ~./dmenurc and a dmenu_bind the snippet might look like this.
if [ -f $HOME/.dmenurc ]; then
. $HOME/.dmenurc
else
MENU="dmenu_run"
fi
You can also add the options you like to the $MENU variable.
dmenu scripts will follow. Of course, please, add your favorites here.
Stay tuned!
Last edited by Snap (2016-11-27 17:35:14)
Offline
A bit off-topic.
Though I have a lot of dmenu love, I switched to rofi a while ago. It can do anything dmenu does if running it as rofi -dmenu plus a lot more. You can switch modi and implement your own too. It's not in the Jessie repos or the backports, though it's available in Testing and Sid.
rofi is great, but unlike dmenu it won't run everywhere. It's not friendly with some window managers, specially tilers. In this case dmenu is still the right maid for the duty. So I use rofi where I can and dmenu2 or dmenu-v where rofi doesn't do it. Some consider dmenu as the right and only choice and rofi as bloat... I obviously don't
The reason for this OT, is that I will post scripts that should work for both dmenu and rofi. I'll include the needed lines for this to happen. Just comment or delete the adequate lines into the scripts to suit your needs... Or will simply post the two different versions for each scenario to make the scripts simpler.
Cheers.
Last edited by Snap (2016-11-27 11:06:53)
Offline
...
That's why most use a customized dmenu_bin script instead. It can be as simple or complex as you want, or as your bash scripting skills drives you.A simple one placing it at the bottom and defining the font and colors, typically living into ~/bin or somewhere else into your $PATH:
...
Infomation specific to BunsenLabs, for those who don't know:
The config script is "~/.config/dmenu/dmenu-bind.sh", and there is a menu entry for editing it: "Menu -> Preferences -> dmenu -> Edit Start-up script"
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
^ Thanks, damo.
Many distros using window managers rather than desktop environments use to have some sort of exit scripts, often based on the old and good corenominal's python script we used to find in Crunchbang or or using a GUI provided by zenity or yad. dmenu can do it too. Here's a sample:
d-exit
#!/bin/bash
# Choose your menu
MENU="dmenu_bind"
#MENU="rofi -dmenu"
choice=`echo -e "0: Cancel\n1: Logout\n2: Shutdown\n3: Reboot\n4: Lock" | $MENU -p "select an action:" | cut -d ':' -f 1`
case "$choice" in
0) exit ;;
1) xdotool key Ctrl+Alt+Delete ;;
2) sudo /sbin/reboot ;;
3) sudo /sbin/poweroff ;;
4) slock ;;
esac
That's the one I use. Needs xdotool, sudo and slock (included into the suckless-tools package or installed alone as I use to do). You'll get the idea. Modify it to suit your system or user case.
Last edited by Snap (2016-11-27 17:54:35)
Offline
exit scripts [...] dmenu can do it too
https://github.com//bunsen-exit-ng
EDIT: ah, I see the author has already mentioned this here:
https://forums.bunsenlabs.org/viewtopic … 1882#p1882
Note to self: read thread before posting...
Last edited by Head_on_a_Stick (2016-11-27 18:09:16)
Offline
Yup, that's a smart one.
What I wanted to point out is that you can use dmenu instead of python, yad or zenity for your GUI menu/choice scripts. Here goes a basic example for moc control:
d-moc
#!/bin/bash
# Custom dmenu-moc.sh
#
# Copyright 2009, Gatti Paolo (lordkrandel at gmail dot com)
# Distributed as public domain.
# Modified to use with MOC by rhowaldt 290415
MENU="dmenu_bind"
#MENU="rofi -dmenu"
title="MoC "
moc_running=$(pidof "mocp" > /dev/null && echo 1 || echo 0)
if [ $moc_running -eq 1 ]; then
menu=( \
# labels commands
# Main =========================================
next "mocp --next"
play-pause "mocp --toggle-pause"
stop "mocp --stop"
quit "mocp --exit"
)
for (( count = 0 ; count < ${#menu[*]}; count++ )); do
# build two arrays, one for labels, the other for commands
temp=${menu[$count]}
if (( $count < ${#menu[*]}-2 )); then
temp+="\n"
fi
if (( "$count" % 2 == "0" )); then
menu_labels+=$temp
else
menu_commands+=$temp
fi
done
select=`echo -e $menu_labels | $MENU -p $title`
if [ "$select" != "" ]; then
# fetch and clean the index of the selected label
index=`echo -e "${menu_labels[*]}" | grep -xnm1 $select | sed 's/:.*//'`
# get the command which has the same index
part=`echo -e ${menu_commands[*]} | head -$index`
exe=`echo -e "$part" | tail -1`
# execute
$exe &
fi
else
echo "--server not running--" | $MENU -p $title
fi
It's more than enough for me as is, though I'm working on a more complete version just as an exercise.
A more complex example for deluge-console (if you use that). I'm trying to adapt it for transmission-remote. I'll post it when done. Who needs yad! LOL.
Last edited by Snap (2016-11-28 07:06:35)
Offline
Pages: 1