You are not logged in.
Hi, I use i3wm which has dmenu as standard and initiates it with
bindsym $mod+d exec dmenu_run
Unfortunately, the font size is way too small for my old eyes.
So, is there a very easy way to increase the font size ? I have read the man page, but unfortunately there is no example there.
Sorry if silly question, but i have found little help by googling & what there is, is pitched at a technical level far beyond my understanding.
If I'm curt with you it's because time is a factor. I think fast, I talk fast and I need you guys to act fast if you wanna get out of this. So, pretty please... with sugar on top. Clean the [censored] car. -The Wolf
Offline
flipper, unless I'm missing something, you'd just need the "-fn" option. use `dmenu_run -fn <fontname>` where fontname is a full X11 fontstring. The easiest way to get a suitable fontstring is from xfontsel.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks trilby, after a lot of messing about with xfontsel, finally got a more legible font size.
For anyone with same problem:
exec dmenu_run -fn -misc-fixed-*-*-*-*-20-200-*-*-*-*-*-*
worked for me.
thx again.
If I'm curt with you it's because time is a factor. I think fast, I talk fast and I need you guys to act fast if you wanna get out of this. So, pretty please... with sugar on top. Clean the [censored] car. -The Wolf
Offline
Hello,
My first attempt: send an e-mail through Mutt.
#!/bin/bash
dmn="dmenu -i -b -fn -*-terminus-medium-r-*-*-13-*-*-*-*-*-*-* -nb black -nf white -sb black -sf yellow"
t=$(echo | $dmn -p "Text:")
s=$(echo | $dmn -p "Subject:")
ad=$(echo | $dmn -p "Address:")
at=$(echo | $dmn -p "Attachment:")
if [ "$ad" != "" ]
then
if [ "$at" != "" ]
then
echo "Text: $t; subject: $s; to: $ad; attachment: $at" | $dmn &> /dev/null
echo $t | mutt -s $s $ad -a $at && echo "Sent." | $dmn &> /dev/null
else
echo "Text: $t; subject: $s; to: $ad" | $dmn &> /dev/null
echo $t | mutt -s $s $ad && echo "Sent." | $dmn &> /dev/null
fi
else
echo "You didn't insert any address." | $dmn &> /dev/null
exit 1
fi
exit 0
Last edited by rix (2012-11-19 13:18:45)
Offline
I have a question about the actual code of dmenu. In the DWM hacking thread, Ivoarch shared a runorraise patch: https://gist.github.com/4107047
I was wondering if this could also be implemented somewhere in dmenu? To just switch to the open application running, if there is one. If not, launch that application.
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
I tried patching dmenu myself by taking Ivoarch's patch and the different DWM functions at hand and I came up with this:
--- dmenu.c.orig 2012-11-22 22:36:31.698980119 +0100
+++ dmenu.c.patched 2012-11-23 21:10:13.922942154 +0100
@@ -38,6 +38,7 @@
static void paste(void);
static void readstdin(void);
static void run(void);
+static void runorraise(void);
static void setup(void);
static void usage(void);
@@ -121,7 +122,7 @@
grabkeyboard();
}
setup();
- run();
+ runorraise();
cleanup();
return ret;
@@ -532,6 +533,19 @@
}
void
+runorraise(void) {
+ XClassHint hint = { NULL, NULL };
+
+ XGetClassHint(dc->dpy, win, &hint);
+ if (hint.res_class) {
+ XSetInputFocus(dc->dpy, win, RevertToPointerRoot, CurrentTime);
+ //sendevent(win, XInternAtom(dc->dpy, "WM_TAKE_FOCUS", False), NoEventMask, XInternAtom(dc->dpy, "WM_TAKE_FOCUS", False), CurrentTime, 0, 0, 0);
+ return;
+ }
+ run();
+}
+
+void
setup(void) {
int x, y, screen = DefaultScreen(dc->dpy);
Window root = RootWindow(dc->dpy, screen);
Now it compiles fine but obviously doesn't work as expected. I'm not sure how to make it read the name of the application you try to run and getting the Class of that application accordingly. Ivoarch uses the config.h of DWM so we can apply certain classes in there, as per so:
static const char *emacs[] = { "emacs", NULL, "Emacs" };
{ Modkey, XK_e, runorraise, {.v = emacs } },
But obviously we can't do that in dmenu. I have no idea how to do that, but if anyone knows feel free to chime in and get this working!
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
Didn't see this on here so I figured I'd share it.
This is a simple openbox menu for any wndow manager. I bound it to my middle click. One middle click opens, the next middle click closes.
It is configured using a seperate file, making it very easy to modify on the fly. I modified some version I found online.
menu.sh
#!/bin/sh
WIDTH=60
FONT='-*-lime-*-*-*-*-*-*-*-*-*-*-*-*'
# Width of the graphical separator (default 80% of window's width)
SEPARATOR_WIDTH=`expr $WIDTH - \( $WIDTH / 100 \) \* 20`
#Position
X=$(getcurpos | cut -c1-4)
Y=$(getcurpos | cut -c5-10)
[ -f "$1" ] && MENUFILE="$1" || exit
# number of visible menu entries (access the others through scrolling up/down)
LINES=`wc -l "$MENUFILE"|sed -e 's/ .*//'`
[ $LINES -gt 20 ] && LINES=20
# if process already exists, kill it. We dont want more than one instance
if [ $(pgrep dzen | wc -w) -gt 2 ]; then
kill $(pgrep dzen | tail -n1)
exit
fi
execute () {
read PROG
while read LINE; do
LBL=;APP=
LBL=$(echo $LINE|sed -e 's/:.*$//' -e 's/^[ \t]*//' -e 's/[ \t]*$//')
APP=$(echo $LINE|sed -e 's/^.*://' -e 's/^[ \t]*//' -e 's/[ \t]*$//')
if [ x"$APP" = x"exit" ]; then
exit
elif [ x"$LBL" = x"$PROG" ]; then
if [ x"$APP" = x"" ]; then
$LBL&
else
$APP&
fi
exit
fi
done < "$MENUFILE"
}
(
echo "^bg(#556c85)^fg(#000000) "
sed -e 's/:.*$//' \
-e 's/^.--*/^r('${SEPARATOR_WIDTH}'x1)/' "$MENUFILE"
) | \
dzen2 -l $LINES -w $WIDTH -x $X -y $Y -fn $FONT -bg '#000000' -fg '#FFFFFF' -p -m -sa l -e 'onstart=uncollapse,scrollhome;button1=menuprint_noparse,exit;button3=exit;button4=scrollup;button5=scrolldown' | execute
config
^fg(#556c85)^i(/home/sunn/.dzen/arch.xbm)^fg() term:urxvt
^fg(#556c85)^i(/home/sunn/.dzen/fs_01.xbm)^fg() www:chromium
^fg(#556c85)^i(/home/sunn/.dzen/diskette.xbm)^fg() pdf:zathura
^fg(#556c85)^i(/home/sunn/.dzen/plug.xbm)^fg() doc:lowriter
^fg(#556c85)^i(/home/sunn/.dzen/stop.xbm)^fg() xls:localc
^fg(#556c85)^i(/home/sunn/.dzen/ac.xbm)^fg() ppt:loimpress
^fg(#556c85)^i(/home/sunn/.dzen/fox.xbm)^fg() gimp:gimp
^fg(#556c85)^i(/home/sunn/.dzen/cpu.xbm)^fg() ise:ise
^fg(#556c85)^i(/home/sunn/.dzen/mem.xbm)^fg() matlab:urxvt -e matlab -nodesktop -nosplash
----------
^fg(#556c85)^i(/home/sunn/.dzen/play.xbm)^fg() run:gmrun
^fg(#556c85)^i(/home/sunn/.dzen/full.xbm)^fg() suspend:sudo pm-suspend
^fg(#556c85)^i(/home/sunn/.dzen/half.xbm)^fg() restart:sudo reboot
^fg(#556c85)^i(/home/sunn/.dzen/empty.xbm)^fg() shutdown:sudo shutdown -h now
Make executable, place a symlink in /usr/bin and execute with
menu config
The only thing you may have to modify is the number of dzen processes running. In my Xmonad config, I have two dzen processes running, so when searching for the process I simply checked the count and restarted the last one. There is probably a better way to do this, but this is just a quick edit.
Sharing this because it took me forever to find. It makes my Xmonad setup usable by everyone that wants to borrow my laptop. No more "WHERES THE LAUNCHER" questions
Last edited by earsplit (2012-11-23 20:54:41)
Offline
Earsplit, did you mean to post that in the dzen thread? How is it relevant to dmenu?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I just figured out what dmenu actually does... and my mind is blown.
Offline
#125 & #126
I just made this. It lists running applications and switches to the tag they're in. It depends on xdotool and dmenu:
#!/bin/bash
# Search through open programs and switch to their tag
# List all applications (and ignore "plugin-container", since it's flash in firefox)
application=$(xlsclients | grep -v "plugin-container" | cut -d" " -f3 | dmenu -i -p "Switch to")
# Switch to application
xdotool search "$application" windowactivate &> /dev/null
EDIT: Seems like some applications are immune to the approach above (so far gimp, truecrypt and libreoffice).
Here's a version that works with libreoffice and virtualbox but NOT gimp/truecrypt.
EDIT2: And here's a version that works with gimp/truecrypt too, thanks to Army.
Last edited by graph (2013-01-03 09:52:47)
Offline
For Gimp, you have to use
xdotool search --onlyvisible -classname "$application" windowactivate
At least that's how it works here.
Offline
@Army
Yep, that works for gimp and truecrypt. Thank you very much.
Here's the updated script with all the bells and whistles (as in, works with everything I usually have running).
Last edited by graph (2013-01-03 09:55:30)
Offline
To be more precise, my line seems to work for everything, doesn't it? (I didn't invest that much time testing it)
Offline
It doesn't work with firefox and libreoffice/soffice, but otherwise you seem to be right.
Last edited by graph (2013-01-03 12:52:39)
Offline
You're right. It looks like you can just put the different versions of the command line after each other. One of them will work eventually. Here's how I have it right now
#!/bin/bash
# Search through open programs and switch to their tag
# List all applications (and ignore "plugin-container", since it's flash in firefox)
application=$(xlsclients | grep -v "plugin-container" | cut -d" " -f3 | dmenu -i -p "switch to")
# Switch to application
xdotool search --onlyvisible -classname "$application" windowactivate
xdotool search --onlyvisible -name "$application" windowactivate
(This &> /dev/null at the end doesn't seem to be required)
Pretty neat, except if you run multiple terminals. For this to work you have to give each instance a name for xdotool to pick the right one. But xlsclients doesn't list the terminals by its name.
Last edited by Army (2013-01-03 13:07:19)
Offline
(This &> /dev/null at the end doesn't seem to be required)
You're right. It's there because i did not provide a class to search, which resulted in a "switching to default"-message being printed, which annoyed me - Your solution is better.
My OCD tells me to end the first xdotool command with a "&& exit 0", so we possibly avoid starting another xdotool-instance (if something is found on the first one, no need to execute the last one).
EDIT: My OCD is wrong, "&& exit 0" won't work with e.g. Firefox.
Pretty neat, except if you run multiple terminals.
I have a single urxvtc-window which connects to a tmux-session running multiple terminals, so that's not a problem for me.
NB: Your solution will not work with VirtualBox and LibreOffice, since they're started by a weird command - see the updated script above.
Last edited by graph (2013-01-04 16:24:11)
Offline
On the suckless mailing list this problem was solved in a VERY nice way!
This script depends on lsw, which is also a suckless project and available in the AUR.
#!/bin/bash
declare -i active_id
declare -i win_id
winlist=$(xprop -root _NET_CLIENT_LIST|cut -d "#" -f 2|tr "," " ")
count=$(echo $winlist|wc -w)
active_id=$(xprop -root _NET_ACTIVE_WINDOW|awk -F' ' '{ print $NF }')
foo=$(for i in $winlist; do
win_id="${i}"
if [ $win_id -eq $active_id ]; then
focustag="*"
else
focustag=" "
fi
win_class=$(xprop -id ${win_id} WM_CLASS | cut -d'"' -f2)
win_title=$(xprop -id ${win_id} WM_NAME | cut -d'=' -f2-)
printf "%10.10s${focustag}| %60.60s | 0x%7.7x\n" "${win_class}" "${win_title}" "${win_id}"
done |sort| dmenu -i -l $count)
if [ $? -eq 0 ]; then
xdotool windowactivate $(echo $foo | awk -F'|' '{ print $NF }')
fi
Works for firefox and libreoffice as well. Perfect! (Slowly but surely it's getting hard to find a not already used shortcut for all those fine dmenu tools!)
Last edited by Army (2013-02-12 20:27:09)
Offline
Slowly but surely it's getting hard to find a not already used shortcut for all those fine dmenu tools!
You may have to make a dmenu tool to list and select which dmenu tool you wish to use.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Brilliant idea!
Offline
Would it be the first entry inside itself?
"...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
Don't need it yet, but as soon as this gets out of hand I'll make a script to list and select tools I don't use that often. But no, it won't be the first entry inside itself But it makes more sense to list it by ranking.
I think I'll write one soon and of course then share it here.
Offline
Don't need it yet, but as soon as this gets out of hand I'll make a script to list and select tools I don't use that often. But no, it won't be the first entry inside itself But it makes more sense to list it by ranking.
I think I'll write one soon and of course then share it here.
Actually, the obvious entry for it inside itself is to edit its config. That's where my dedit script (above) has itself inside it.
"...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
I thought I'll get those entries automatically by naming the scripts e.g. dmenu-nso-* (nso = not so often). Maybe this will be too hard for me, since I'm a horrible scripter. But providing an entry to edit the config makes perfectly sense!
Offline
You could adapt this - https://bbs.archlinux.org/viewtopic.php … 5#p1118255
There's a simpler version a couple of posts further up.
"...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