You are not logged in.
dmenu-supergenpass: supergenpass ALL the passwords.
For the uninitiated: supergenpass.com provides a service (bookmarklet) that lets
you continue the very convenient practice of reusing one password for
everything. It takes your one password (The Master Password) and takes the
domain name of the site you are on and hashes them to produce a new password.
This utility does the same thing (exactly like supergenpass to remain
compatible, except it generates 20 chars by default as opposed to 10)
but works from your desktop, and uses dmenu. It will prompt for an
'item' and the 'master password' (obscured in dmenu) and will create the
password then send it to the currently active window. You can use it for any
program of course. On web browsers, you can just select the domain name and then
run the utility, it will give you the current selection as the first choice!
You need xsel and xdotool (both in the community repos).
My personal usage is to keep websites in a couple different 'categories' with a master
password for each category. The categories can be noted somewhere to help you
remember which master password you use for which site.
#!/bin/bash
# Author: mnzaki on arch forums (bbs.archlinux.com)
# and on the gmail servers
# The Author can not be held liable for any data loss that may be a direct or
# indirect consequence of using this piece of software.
# Can be used as "dmenu-supergenpass gmail.com"
# Or call it with no argument to let you enter the item or choose from a list
# The currently selected text (from X primary selection) will be the first choice.
# In both cases you will next be prompted for the master password
# The password will be generated and sent to the active window
#
# Note that the original supergenpass uses 'items' that are the domain + TLD of
# the website. This includes something.edu.eg for example. You can of course use
# this for anything besides websites, with any arbitrary item.
#
# If you need to remove items, remove them from .config/dmenu-supergenpass/items
# stealth salt: gets added to the password before hashing
salt=""
# to comply with supergenpass.com pass_len should be between 4 and 24
pass_len=20
dmenu_cmd="dmenu $DMENU_OPTIONS"
dmenu_pass="dmenu -nf #204a87 -nb #204a87 -sf black -sb #babdb6"
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/dmenu-supergenpass"
cache="$config_dir/items"
mkdir -p "$config_dir"
touch "$cache"
item="$1"
IFS=" "
sel=$(xsel -p)
choices=$(cat "$cache" | grep -vx "$sel")
[[ $sel != "" ]] && choices="$sel\n$choices"
if [[ "$item" = "" ]]; then
item=$(echo -e "$choices" | $dmenu_cmd -p "Password Item: ") || exit
fi
echo "$item" > "$cache.$$"
grep -vx "$item" "$cache" >> "$cache.$$"
mv "$cache.$$" "$cache"
master=$(echo | $dmenu_pass -p "Master Password: ") || exit
pass="$(echo -n "$master$salt:$item" |
perl -MDigest::MD5\(md5_base64\) -pwe \
'$p=$_;for($i=0;$i<10 || !($p=~/^[a-z]/) || !($p=~/.[A-Z]/) || !($p=~/.[0-9]/); $i++)
{ $_ = md5_base64($_)."AA"; $_ =~ tr/+\//98/;$p=substr $_,0,'$pass_len';}$_=$p';)"
xdotool type "$pass"
Update 29 June: Fixed bug that would cause items to be incorrectly filtered out of the choices
Update2 29 June: Do not generate a password if master password dmenu was cancelled
Last edited by mnzaki (2012-07-02 16:31:40)
Offline
Using dmenu to list the windows and go to one by typing part of its name or window class (WM_CLASS). It's a python script that uses wmctrl, xprop and dmenu.
Pretty ugly, but works (at least here . If you do any modifications or improvements, let me know!
The reason for the complicated code is that I can't get the window class using wmctrl, so I need to call xprop and map the returned classes back into the name:id dict. If not for the WM_CLASS thing it could be done shorter in bash using awk, grep, etc. Sadly I have no idea how to use arrays in bash, so I went back to my old trusty python.
There are two types of people in this world - those who can count to 10 by using their fingers, and those who can count to 1023.
Offline
Hello, guys!
I'd like to share my patch for dmenu which enables multiple menus option.
WHAT IT DOES
Multiple menus allow you to see and choose many options during one dmenu run. It looks like this:
Alternative screenshot:
After you press Enter all selected items will be printed to console.
MOTIVATION
I have a small wrapper for scrot on bash which asks some questions before taking a screenshot. The questions such as: take a screenshot of the region or the whole screen, which filename to use, delay, save file after publishing or not and so on. Also, I cache answers for these questions. However, sometimes I need to take a screenshot with slightly different param and then I have to answer all questions again even though I want to change only one. With this patch I can 1) see all questions at once 2) quickly jump to questions I want to change. I belive this patch is a generalisation and can be useful in larget set of cases than original dmenu.
WHERE TO GET
You can get it from my repo:
hg clone https://bitbucket.org/balta2ar/dmenu-multiple-menu
cd dmenu-multiple-menu
hg checkout multiple-menu
or apply patch to master repo:
hg clone http://hg.suckless.org/dmenu
cd dmenu
wget -O dmenu-4.5-multiple-menu.diff http://ix.io/2Cy
hg patch dmenu-4.5-multiple-menu.diff
Build and run:
make
./dmenu -id " " < test.txt
or (notice -e argument)
echo -e "something\na b c\nsomething else seperated by spaces" | ./dmenu -id " "
ARGUMENTS
The patch adds -id <delims> argument which sets item delimeters string. Menu delimiter character in this case is set to newline (\n).
WARNING
This version is my first attempt to hack dmenu. For now it is just a quick and very dirty hack. Some old functionality is missing:
* no prompt support
* no vertical menus support
* there might be visual glitches and sudden crashes
USER EXPERIENCE
So what do you think? Do you like the idea? Can this be of any use to anybody? The code is very messy for now because I want to test the idea first and if people like it, I plan to refactor it and submit to dmenu developers maillist.
Thank you!
Last edited by balta2ar (2012-07-08 14:29:39)
Offline
Hello, guys!
I'd like to share my patch for dmenu which enables multiple menus option.
WHAT IT DOES
Multiple menus allow you to see and choose many options during one dmenu run. It looks like this:
http://s1.ipicture.ru/uploads/20120702/thumbs/s6YyU3zR.png
After you press Enter all selected items will be printed to console.
Sounds like an interesting idea. Though I couldn't get your code to work.
Tested with:
echo "something\na b c\nsomething else seperated by spaces" | ./dmenu -id " "
Also your screenshot is broken.
bladdo / mil / Miles
userbound.com - blog and projects
Offline
Tested with:
echo "something\na b c\nsomething else seperated by spaces" | ./dmenu -id " "
That's because new line characters are interpreted as string. Try adding -e argument to echo command. I updated my post with your example corrected.
Also your screenshot is broken.
Thank you, I uploaded it to another image hosting site.
Offline
Screenshot looks good.
With echo -e it still doesn't work though. if I use dmenu w/o the -id option it works though. Can you provide a working command that shows the functionality of -id?
bladdo / mil / Miles
userbound.com - blog and projects
Offline
Screenshot looks good.
With echo -e it still doesn't work though. if I use dmenu w/o the -id option it works though. Can you provide a working command that shows the functionality of -id?
Does this command work?
./dmenu -id " " < test.txt
test.txt is included to my repo and to the patch.
Also, which way did you get the source? If it was hg clone, make sure to execute checkout as well.
Offline
bladdo wrote:Screenshot looks good.
With echo -e it still doesn't work though. if I use dmenu w/o the -id option it works though. Can you provide a working command that shows the functionality of -id?
Does this command work?
./dmenu -id " " < test.txt
test.txt is included to my repo and to the patch.
Also, which way did you get the source? If it was hg clone, make sure to execute checkout as well.
Ah gotcha, forgot the checkout. More of a git person sorry. Looks good.
bladdo / mil / Miles
userbound.com - blog and projects
Offline
I just uploaded dmenu with pango support to AUR. This will make foreign characters work properly when your font doesn't have the glyph for it.
Offline
I just uploaded dmenu with pango support to AUR. This will make foreign characters work properly when your font doesn't have the glyph for it.
Awesome, thanks a lot! Now why didn't that occur to me, I have dwm-pango and i3-pango already…
Offline
I wanted to create a tool like OSX finder to be able to show OSX users how cool Linux can be.
#!/bin/bash
if [ -f $HOME/.dmenurc ]; then
. $HOME/.dmenurc
else
DMENU='dmenu -i'
fi
input="$(xsel -o | $DMENU -p "file search":)"
if [ "$input" != '' ]
then
result="$(echo "$input" | locate -e -r "$input" | $DMENU -p "search result:" )"
xdg-open "$result"
fi
Quite nice
Last edited by Army (2012-07-17 12:52:37)
Offline
Love it Army, thanks.
Here's my pdf menu. This lists/searches references in a bibtex bibliography and if a pdf is available for the file it displays the pdf of the entry selected. Note that this assumes pdf files in a pdf directory have basenames that match the bibtex key. This is how my pdfs are organized, if yours are different this would have to be modified.
edit: I forgot I improved the part that is now crossed out. Pdfmenu looks for a pdf entry in the bibtex file.
Last edited by Trilby (2012-07-20 20:20:32)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
This one is for setting wallpaper
#!/bin/sh
DMENU="dmenu -i"
WALLPAPER_DIR="/data/Image"
WALLPAPER=`ls $WALLPAPER_DIR \
| $DMENU -p "Choose a Wallpaper :"`
FEH="feh --bg-fill"
$FEH $WALLPAPER_DIR/$WALLPAPER
Offline
mnzaki, I've been using your script for the past few days, and I'm really loving it. I was about to sit down and attempt to write something almost identical, so thanks for saving me the trouble!
Offline
Plays songs from the current mpd playlist:
#!/bin/bash
set -e
# Get the current playlist
format="%artist% - %title%"
playlist="$(mpc playlist -f "$format")"
# Pipe the playlist to dmenu, catch name
name="$(echo "$playlist" | dmenu "$@")"
# Get the playlist position of the name with sed
songnum="$(echo "$playlist" | sed -n "/${name}/=")"
# Play the song
mpc play $songnum
I have a version that takes command line arguments for the format to pass to mpc in the AUR.
Last edited by ne (2012-08-20 12:18:55)
Offline
dmenu-translate
uses google's translator
#!/bin/bash
##########################
# LIST OF LANGUAGES #
##########################
# af (Afrikaans) #
# sq (Albanian) #
# ar (Arabic) #
# hy (Armenian) #
# az (Azerbaijani) #
# eu (Basque) #
# be (Belarusian) #
# bn (Bengali) #
# bg (Bulgarian) #
# ca (Catalan) #
# zh-CN (Chinese) #
# hr (Croatian) #
# cs (Czech) #
# da (Danish) #
# nl (Dutch) #
# en (English) #
# eo (Esperanto) #
# et (Estonian) #
# tl (Filipino) #
# fi (Finnish) #
# fr (French) #
# gl (Galician) #
# ka (Georgian) #
# de (German) #
# el (Greek) #
# gu (Gujarati) #
# ht (Haitian-Creole) #
# iw (Hebrew) #
# hi (Hindi) #
# hu (Hungarian) #
# is (Icelandic) #
# id (Indonesian) #
# ga (Irish) #
# it (Italian) #
# ja (Japanese) #
# kn (Kannada) #
# ko (Korean) #
# la (Latin) #
# lv (Latvian) #
# lt (Lithuanian) #
# mk (Macedonian) #
# ms (Malay) #
# mt (Maltese) #
# no (Norwegian) #
# fa (Persian) #
# pl (Polish) #
# pt (Portuguese) #
# ro (Romanian) #
# ru (Russian) #
# sr (Serbian) #
# sk (Slovak) #
# sl (Slovenian) #
# es (Spanish) #
# sw (Swahili) #
# sv (Swedish) #
# ta (Tamil) #
# te (Telugu) #
# th (Thai) #
# tr (Turkish) #
# uk (Ukrainian) #
# ur (Urdu) #
# vi (Vietnamese) #
# cy (Welsh) #
# yi (Yiddish) #
##########################
if [ -f $HOME/.dmenurc ]; then
. $HOME/.dmenurc
else
DMENU='dmenu -i'
fi
# first run
if [ ! -e $XDG_CONFIG_HOME/dmenu-translate ]
then
languages=$(echo "" | $DMENU -p "please provide your default languages (see the list of languages in the script), separated by space:")
if [ "$languages" != '' ]
then
echo $languages > $XDG_CONFIG_HOME/dmenu-translate
fi
else
languages=$(cat $XDG_CONFIG_HOME/dmenu-translate | sed 's/\ /\\n/g')
if [ "$languages" != '' ]
then
from=$(echo -e "$languages" | $DMENU -p "translate from")
if [ "$from" != '' ]
then
to=$(echo -e "$languages" | $DMENU -p "translate to")
if [ "$to" != '' ]
then
text="$(xsel -o | $DMENU -p "text":)"
if [ "$text" != '' ]
then
echo $(wget --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1" "http://translate.google.com/translate_a/t?client=x&text=$text&hl=$from&sl=$from&tl=$to" -qO-)| awk -F\" '{ print $6 }' | tr \\n \\0 | $DMENU -p "translation from $from to $to:" | xsel -i
fi
fi
fi
fi
fi
or http://codepad.org/Cggq1GiG
For code improvements (I'm not sure if my way is the best way), please tell me, I'm willing to learn!
edited: little bug in the script
Last edited by Army (2012-08-27 10:28:34)
Offline
I wanted to create a tool like OSX finder to be able to show OSX users how cool Linux can be.
#!/bin/bash if [ -f $HOME/.dmenurc ]; then . $HOME/.dmenurc else DMENU='dmenu -i' fi input="$(xsel -o | $DMENU -p "file search":)" if [ "$input" != '' ] then result="$(echo "$input" | locate -e -r "$input" | $DMENU -p "search result:" )" xdg-open "$result" fi
Quite nice
looks interesting will give it a try
you should mention it needs xsel and locate installed - I didn't have them.
You can like linux without becoming a fanatic!
Offline
Ok, yes I missed that
Offline
what package contains locate? I don't seem to have it installed and a search through the repo's + AUR turns up nothing.
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
what package contains locate? I don't seem to have it installed and a search through the repo's + AUR turns up nothing.
➜ ~ pkgfile locate
core/mlocate
Offline
Nice, thanks!
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
dmenu-translate
uses google's translator#!/bin/bash ########################## # LIST OF LANGUAGES # ########################## # af (Afrikaans) # # sq (Albanian) # # ar (Arabic) # # hy (Armenian) # # az (Azerbaijani) # # eu (Basque) # # be (Belarusian) # # bn (Bengali) # # bg (Bulgarian) # # ca (Catalan) # # zh-CN (Chinese) # # hr (Croatian) # # cs (Czech) # # da (Danish) # # nl (Dutch) # # en (English) # # eo (Esperanto) # # et (Estonian) # # tl (Filipino) # # fi (Finnish) # # fr (French) # # gl (Galician) # # ka (Georgian) # # de (German) # # el (Greek) # # gu (Gujarati) # # ht (Haitian-Creole) # # iw (Hebrew) # # hi (Hindi) # # hu (Hungarian) # # is (Icelandic) # # id (Indonesian) # # ga (Irish) # # it (Italian) # # ja (Japanese) # # kn (Kannada) # # ko (Korean) # # la (Latin) # # lv (Latvian) # # lt (Lithuanian) # # mk (Macedonian) # # ms (Malay) # # mt (Maltese) # # no (Norwegian) # # fa (Persian) # # pl (Polish) # # pt (Portuguese) # # ro (Romanian) # # ru (Russian) # # sr (Serbian) # # sk (Slovak) # # sl (Slovenian) # # es (Spanish) # # sw (Swahili) # # sv (Swedish) # # ta (Tamil) # # te (Telugu) # # th (Thai) # # tr (Turkish) # # uk (Ukrainian) # # ur (Urdu) # # vi (Vietnamese) # # cy (Welsh) # # yi (Yiddish) # ########################## if [ -f $HOME/.dmenurc ]; then . $HOME/.dmenurc else DMENU='dmenu -i' fi # first run if [ ! -e $XDG_CONFIG_HOME/dmenu-translate ] then languages=$(echo "" | $DMENU -p "please provide your default languages (see the list of languages in the script), separated by space:") if [ "$languages" != '' ] then echo $languages > $XDG_CONFIG_HOME/dmenu-translate fi else languages=$(cat $XDG_CONFIG_HOME/dmenu-translate | sed 's/\ /\\n/g') if [ "$languages" != '' ] then from=$(echo -e "$languages" | $DMENU -p "translate from") if [ "$from" != '' ] then to=$(echo -e "$languages" | $DMENU -p "translate to") if [ "$to" != '' ] then text="$(xsel -o | $DMENU -p "text":)" if [ "$text" != '' ] then echo $(wget --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1" "http://translate.google.com/translate_a/t?client=x&text=$text&hl=$from&sl=$from&tl=$to" -qO-)| awk -F\" '{ print $6 }' | tr \\n \\0 | $DMENU -p "translation from $from to $to:" | xsel -i fi fi fi fi fi
or http://codepad.org/Cggq1GiG
For code improvements (I'm not sure if my way is the best way), please tell me, I'm willing to learn!
edited: little bug in the script
hi, I am using your script but having a problem, actually the translated results are in some weird language (some random characters ) , but not in the language i am translating. I explicitly defined the font in the "DMENU" line too. but no luck, is it something related to pango or xft patch for dwm. i am not using anyone of them.
DMENU='dmenu -fn -misc-freesans-medium-r-normal--9-0-0-0-p-0-iso8859-1 -i'
Can you tell me what I could be doing wrong?
WM: dwm
Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github
Offline
Ok, change the last line before the "fi"s come from
echo $(wget --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1" "http://translate.google.com/translate_a/t?client=x&text=$text&hl=$from&sl=$from&tl=$to" -qO-)| awk -F\" '{ print $6 }' | tr \\n \\0 | $DMENU -p "translation from $from to $to:" | xsel -i
to
echo $(wget --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1" "http://translate.google.com/translate_a/t?client=x&text=$text&hl=$from&sl=$from&tl=$to" -qO-)| tr \\n \\0 | $DMENU -p "translation from $from to $to:" | xsel -i
(remove the awk part which filters the result which comes back from Google's server)
I made a test, translate the text "This is a test!" from en (English) to de (German) with this result:
{"sentences":[{"trans":"Dies ist ein Test!","orig":"This is a test!","translit":"","src_translit":""}],"src":"en","server_time":37}
What do you get with such an example?
Offline
I tried this from your script in the browser
translate.google.com/translate_a/t?client=x&text=hello&hl=en&sl=en&tl=hi
and got the file which translates the text correctly. But having problem displaying that font in dmenu.
Your solution works too but as stated above text is not in the language i want . I redirected the output to a text file , opened in gvim and I can see the translated text in my native language but that is not the case in dmenu output.
and here is the output i got : Output
I think your script is doing its job fine, maybe I need to look little bit deeper in this issue. do you have any clue regarding this ?
Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github
Offline
I don't use it, but as far as I understand this looks like you need the pango patch.
Offline