Awmenu

Stuff that has yet to be sorted into a category.
Message
Author
User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

Awmenu

#1 Post by jemimah »

I had the good fortune of finding this today. This is much like Dmenu, only nicer looking.

You can use this to search for anything, applications, music libraries, files. You just need to pipe a list into it, and do the right thing with the returned entry.

http://bbs.archlinux.org/viewtopic.php?id=71453

I fixed some memory management issues, and now it works.

I will package it with some scripts needed to make it useful when I get a chance to make them. But I'm so excited, I feel like posting this now. :D
Attachments
awmenu.gz
Binary
(5.21 KiB) Downloaded 580 times
awmenu.c.gz
to build: gcc `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` awmenu.c -o awmenu
(2.46 KiB) Downloaded 557 times
awmenu.jpg
(16.07 KiB) Downloaded 1626 times

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

Re: Awmenu

#2 Post by aragon »

jemimah wrote:I had the good fortune of finding this today. This is much like Dmenu, only nicer looking.

You can use this to search for anything, applications, music libraries, files. You just need to pipe a list into it, and do the right thing with the returned entry.

http://bbs.archlinux.org/viewtopic.php?id=71453

I fixed some memory management issues, and now it works.

I will package it with some scripts needed to make it useful when I get a chance to make them. But I'm so excited, I feel like posting this now. :D
wonderful :D

looking through the arch-forums is 'often' an inspiration...

will test that one soon.

aragon

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#3 Post by aragon »

coudn't resist... :roll:

EDITED for Version 0.2, as it is a 'rewrite'.

so here is awrun, a wrapper that gives you awmenu with a list of all *.desktop-files in /usr/share/applications.

we do no longer need symlinks (v. 0.2 up) as we create the list on runtime (using code examples by jemimah, THANKS VERY MUCH).

"awrun" will run awmenu with your list.

so for regular use you might want to assign a keyboard-shortcut to "awrun".

issues (so far):
- i don't know why awmenu displays an entry with 2 columns (see pic). but maybe jemimah has a simple answer... (solved in this version: http://www.murga-linux.com/puppy/viewto ... 981#395981)

EDIT:
2010.03.03 update to 0.2 rewrite
2010.03.01 update to 0.1.1 Small bugfix
Attachments
awrun-0.2.pet
actual version!
(1.37 KiB) Downloaded 600 times
awrun-0.1.1.pet
old version for docu only!
(1.5 KiB) Downloaded 549 times
awrun.png
(11.04 KiB) Downloaded 1513 times
awrun-0.1.pet
old version for docu only!
(1.46 KiB) Downloaded 546 times
Last edited by aragon on Wed 03 Mar 2010, 16:35, edited 2 times in total.

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#4 Post by jemimah »

I was thinking I'd try making the script without indexing. It's probably difficult to install so many applications to slow down the script noticeably.

Also I'm experimenting with adding browser bookmarks to the list, and files in your home directory (this may need an index depending on size). Perhaps it needs a Gui for specifying which directories to search for files.

Then assign awrun to Alt-space and you've got the perfect lightweight launcher for Puppy. I was thinking of calling it Fetch. Is that name already taken?

--

I think the original author gave up before finishing, so I'm guessing the two columns thing is not working correctly. I will try to remove it, as I don't really care if the search function is extremely sophisticated - it seems to do the job fine as it is.

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#5 Post by aragon »

jemimah wrote:I was thinking I'd try making the script without indexing. It's probably difficult to install so many applications to slow down the script noticeably.
i know you're better than me in these things ... it was just something, i already had. i only did some tuning...
Also I'm experimenting with adding browser bookmarks to the list,
from browser?
and files in your home directory (this may need an index depending on size).
could be nice
Perhaps it needs a Gui for specifying which directories to search for files.
yes, would be definitely better (if the 'door remains open' for free lists ...)
I was thinking of calling it Fetch. Is that name already taken?

freshmeat knows none... puppy has had a tool called petch, but unfortunately it's author (and the functionality of his app) has gone...
I think the original author gave up before finishing, so I'm guessing the two columns thing is not working correctly. I will try to remove it, as I don't really care if the search function is extremely sophisticated - it seems to do the job fine as it is.
yes, he seems to be back to dmenu (with vertical-patch)... search seems to be ok for me, would be nice if you could strip the 2nd column.

aragon

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#6 Post by jemimah »

All my dmenu scripts are indexing too, but I discovered Rox can open .desktop files so non-indexing is easier than I originally thought.

As far as bookmarks go, I have Chrome, which stores them in a greppable text file. I need to experiment with the other browsers and see how they do it. I was able to successfully dump Chrome's entire History database using the sqlite3 command - but after some experimentation I think this produces to much clutter in the list, bookmarks only seems better.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#7 Post by amigo »

Just a suggestion -that fetch doesn't sound like the right name to me... That name is already used for at least one downloader. I really like aewmenu and have used it to provide pop-up menus for several AppDirs before. Can anyone figure out how to get icons working for it?

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#8 Post by jemimah »

Any name suggestions? - preferably dog related... Rover maybe..

I don't think it would be hard to add icons, I was thinking of attempting it. The question is, how would that affect performance? Could I still pass it 10000 items and expect it to work?

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#9 Post by aragon »

jemimah wrote:All my dmenu scripts are indexing too, but I discovered Rox can open .desktop files so non-indexing is easier than I originally thought.
that's what i'm using with dmenu and the above script.
- symlink all desktop files from
/usr/share/applications and
/usr/local/share/applications
to
/root/.config/awrun/applications
- cut ".desktop"
- rename all to lowercase
- ls them to awmenu
As far as bookmarks go, I have Chrome, which stores them in a greppable text file. I need to experiment with the other browsers and see how they do it. I was able to successfully dump Chrome's entire History database using the sqlite3 command - but after some experimentation I think this produces to much clutter in the list, bookmarks only seems better.
i think this will be a 'problem', if you want to cover all necessary seamonkey, firefox, opera, chrome, (midori),....

opera has a simple formated text file, firefox 3.6 has a 'trashed' text file...

good luck
aragon

DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

#10 Post by DMcCunney »

jemimah wrote:As far as bookmarks go, I have Chrome, which stores them in a greppable text file. I need to experiment with the other browsers and see how they do it.
SeaMonkey 1.1 and Firefox 2.X use a bookmarks.html file. 'm fairly sure Opera also uses a bookmarks.html file.

SeaMonkey 2.X and Firefox 3+ have shifted to an SQLite database, but you can set a preference to automatically export that to an HTML file when you exist the browser, or do it manually from the Manage Bookmarks Import and Export function.
______
Dennis

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#11 Post by seaside »

Some more stuff to play with....

Most-Used caching (cobbled together from something I saw in the Arch forum and added code) Puts most often used commands at the top of the list and contains all binaries in the path.

Code: Select all

#!/bin/sh

binaries() {
    SPATH=$(IFS=:; for dir in $PATH; do echo "$dir"; done)
    find $SPATH -maxdepth 1 \( -type f -o -type l \) -perm +111 -printf "%f\n" 
2> /dev/null
}


DMENU="awmenu"
CACHE="$HOME/.dmenu_cache_recent"

touch $CACHE
MOST_USED=`sort $CACHE | uniq -c | sort -r | cut -c 8-`
RUN=`(echo "$MOST_USED"; binaries | grep -vxF "$MOST_USED") | $DMENU` &&
(echo $RUN; head -n 99 $CACHE) > $CACHE.$$ &&
mv $CACHE.$$ $CACHE
exec $RUN

Thanks jemimah for posting this and aragon is absolutely spot on in calling this the "swiss army knife" of menuing selection.

Cheers,
s

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#12 Post by smokey01 »

I like your name of Fetch but to Puppyise it why not just call it Pfetch.

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#13 Post by jemimah »

Here it is with the second column removed. I also centered it like Launchy.
Attachments
awmenu.c.gz
(2.51 KiB) Downloaded 547 times

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#14 Post by 8-bit »

aragon,
On running awrun -r, although it works, I get a "line 97 to many arguments"
It took me a little while just to determine how to make awmenu work from a command line on a chosen directory.
The instructions on use left a little to be desired for awmenu.
But now I know how it works.

Thank you for awrun. It helped!

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#15 Post by jemimah »

Here's what I'm working on for Puppeee which has Chrome and Claws. This will allow you to select from applications, bookmarks, contacts, and files in your home directory.

Code: Select all


grep ^Name= /usr/share/applications/*.desktop |cut -d= -f2 > /tmp/list

cat /root/.config/google-chrome/Default/Bookmarks |grep url\": | cut -f4 -d\" >> /tmp/list

grep email= /root/.claws-mail/addrbook/* |cut -f6 -d\" >> /tmp/list

find /root  -not -name ".*" -a -not -path "*Web-Server*" -a -not -path "*Choices*" -not -path "*Startup*" -type f | grep -v '/\.' >> /tmp/list

selection=`cat /tmp/list | awmenu`

case "$selection" in
        '') exit
                ;;
        /*) exec rox $selection
                ;;
        *@*.*) exec rox -U mailto:$selection
                ;;
        *://*) exec rox -U $selection
                ;;
esac

selection=`grep "$selection"  /usr/share/applications/*.desktop |cut -f1 -d:`
if [ ! -z "$selection" ] ; then
        exec rox $selection
fi
To get rox to handle URIs you need to create /root/Choices/URI and set up symlinks as shown.

Code: Select all

# pwd
/root/Choices/URI
# ls -al
total 8
drwxr-xr-x 2 root root 4096 2010-02-26 13:15 .
drwxr-xr-x 9 root root 4096 2010-02-26 13:13 ..
lrwxrwxrwx 1 root root   29 2010-02-26 13:15 file -> /usr/local/bin/defaultbrowser
lrwxrwxrwx 1 root root   13 2010-02-26 13:14 ftp -> /usr/bin/gftp
lrwxrwxrwx 1 root root   29 2010-02-26 13:13 http -> /usr/local/bin/defaultbrowser
lrwxrwxrwx 1 root root   27 2010-02-26 13:15 mailto -> /usr/local/bin/defaultemail

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#16 Post by seaside »

jemimah,

That looks like a great combo of material to search.

One item - the following line can produce multiple hits when matching for the .desktop file to execute.-

Code: Select all

selection=`grep "$selection"  /usr/share/applications/*.desktop |cut -f1 -d:` 
You might do the following (more specific and maybe even faster than executing a .desktop file)

Code: Select all

selection=`grep "$selection"  /usr/share/applications/*.desktop | grep Exec=|cut -f2 -d=` 
Or if no speed difference, match only one instance like this-

Code: Select all

selection=`grep -m 1 "$selection"  /usr/share/applications/*.desktop |cut -f1 -d:` 
Great to have the menu come up in the same spot by the way :D

Cheers,
s

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#17 Post by jemimah »

Yeah I just noticed the multiple match thing there. I've decided to used 'head' there just to make sure since I've fork bombed myself a couple of times with bad input. ;)

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#18 Post by aragon »

8-bit wrote:aragon,
On running awrun -r, although it works, I get a "line 97 to many arguments"
yeah line 97 is bad

if you replace

Code: Select all

elif [ ! `ls ${LKDIR}` ]
with
elif [ ! "`ls ${LKDIR}`" ] #bugfix 0.1.1
it should work.

but i will also update the pet in the orig. post.
It took me a little while just to determine how to make awmenu work from a command line on a chosen directory.
yes, if you don't know dmenu, you're lost.

@jemimah
will test your updated awmenu soon.

your scripts look very promising :D

aragon

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#19 Post by aragon »

updated awrun to 0.2. see here: http://murga-linux.com/puppy/viewtopic. ... 768#395768

rewrite:
- no symlinks any more! just creating the apps-list on runtime.

aragon

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#20 Post by jemimah »

Here is my Rover package that I'll probably use for Puppeee. This is packed with Xbindkeys, which binds Alt-Space to rover_run.
Attachments
rover-1.0.pet
(33.37 KiB) Downloaded 410 times

Post Reply