commit fd6553be9a01065168bb0a865b63de2c909ed7fd
Author: efe <[email protected]>
Date:   Thu Nov 29 22:06:55 2018 -0500

    add descriptions for some programs in /rocks
    
    I've added descriptions for the programs I'm familiar with in
    the suckless.org/rocks and added the program mpop there, which I
    think rocks. Also I've updated and simplified my script hosted on
    /dmenu/scripts/.

diff --git a/suckless.org/rocks/index.md b/suckless.org/rocks/index.md
index 9d3d7d8e..d92c3ccd 100644
--- a/suckless.org/rocks/index.md
+++ b/suckless.org/rocks/index.md
@@ -55,7 +55,7 @@ This covers most console-based programs and programs from 
[plan9port][].
 
 ### Audio Players
 
-* [C* Music Player](https://cmus.github.io/)
+* [C* Music Player](https://cmus.github.io/) - An ncurses music player that 
can be controlled with an UNIX socket.
 * [cplay](http://cplay.sourceforge.net/)
 * [DeaDBeeF](http://deadbeef.sourceforge.net/)
 * [moc](http://moc.daper.net/)
@@ -103,7 +103,7 @@ This covers most console-based programs and programs from 
[plan9port][].
 
 ### Image Viewers
 
-* [feh](https://feh.finalrewind.org/)
+* [feh](https://feh.finalrewind.org/) - A highly customizable image viewer 
that can also set desktop background image.
 * [jpg/gif/bmp/png][plan9port] - Simple programs from Plan 9 to display images 
in no-frills windows. Included with plan9port.
 * [meh](https://www.johnhawthorn.com/meh/) - image viewer using raw XLib, 
libjpeg, libpng and libgif
 * [page][plan9port] - Plan 9's image/document viewer program. Included with 
plan9port.
@@ -130,10 +130,11 @@ This covers most console-based programs and programs from 
[plan9port][].
 * [isync](http://isync.sourceforge.net/) - MDA that can work better for IMAP
 * [heirloom-mailx](http://heirloom.sourceforge.net/mailx.html) - A mail client 
based on the original Berkeley Mail 8.1 with many new features.
 * [s-nail](https://www.sdaoden.eu/code.html) - An improved heirloom-mailx.
-* [mutt](http://www.mutt.org/)
+* [mutt](http://www.mutt.org/) - An ncurses mail client for fetching, reading 
and sending email.
 * [nmh](http://www.nongnu.org/nmh/)
 * [mmh](http://marmaro.de/prog/mmh/)
 * [mblaze](https://github.com/chneukirchen/mblaze) - Unix utilities to deal 
with Maildir
+* [mpop](https://marlam.de/mpop/) - a POP3 mail client. It is much [faster and 
simpler than fetchmail](https://marlam.de/mpop/documentation).
 
 ### Media Players
 
@@ -149,8 +150,8 @@ This covers most console-based programs and programs from 
[plan9port][].
 
 ### PDF Viewers
 
-* [mupdf](https://mupdf.com/)
-* [zathura](https://pwmt.org/projects/zathura/)
+* [mupdf](https://mupdf.com/) - a lightweight PDF viewer written in C. It 
supports PDF, XPS, EPUB, XHTML, CBZ, PNG, JPEG, GIF, and TIFF.
+* [zathura](https://pwmt.org/projects/zathura/) - an extensible document 
viewer/shell which can support CBZ, DJVU, PS, EPUB (with mupdf), and PDF (with 
mupdf or poppler).
 
 ### Shells
 
@@ -167,7 +168,7 @@ This covers most console-based programs and programs from 
[plan9port][].
 * [nvi](https://sites.google.com/a/bostic.com/keithbostic/vi) - A small, 
multiple file vi-alike.
 * [sam](http://sam.cat-v.org/) - An editor by Rob Pike with inspiration from 
ed.
 * [traditional vi](http://ex-vi.sourceforge.net/) - A fixed version of the 
original vi.
-* [vim](https://www.vim.org) (With the GUI, use `:set go+=c` to kill popup 
dialogs)
+* [vim](https://www.vim.org) (With the GUI, use `:set go+=c` to kill popup 
dialogs). It can be compiled to be as minimal as possible (see vim-tiny in 
Debian repos).
 * [vis](https://github.com/martanne/vis) - A modern, legacy free, simple yet 
efficient vim-like editor.
 * [wily](http://www.cse.yorku.ca/~oz/wily/) - An acme clone for POSIX.
 * [ed](https://9fans.github.io/plan9port/man/man1/ed.html) - [ED IS THE 
STANDARD TEXT EDITOR!](https://www.gnu.org/fun/jokes/ed-msg.html)
@@ -187,20 +188,20 @@ This covers most console-based programs and programs from 
[plan9port][].
 
 * [Abaco](http://lab-fgb.com/abaco/)
 * [Conkeror](http://www.conkeror.org/) - A Gecko based browser, imparting it 
Emacs style key bindings, appearances, and behaviors.
-* [Dillo](https://www.dillo.org/)
-* [edbrowse](http://edbrowse.org/)
-* [ELinks](http://elinks.or.cz/)
-* [Links](http://links.twibright.com/)
-* [Lynx](http://lynx.invisible-island.net/)
-* [netsurf](http://www.netsurf-browser.org/)
-* [surf](//surf.suckless.org/)
+* [Dillo](https://www.dillo.org/) - Blazingly fast graphical browser with 
incomplete CSS support.
+* [edbrowse](http://edbrowse.org/) - ed-alike webbrowser. Unfortunately it is 
not the standard web browser.
+* [ELinks](http://elinks.or.cz/) -  Feature-rich fork of Links, but without 
the graphical mode.
+* [Links](http://links.twibright.com/) - A text-based browser that also has a 
simple graphical mode.
+* [Lynx](http://lynx.invisible-island.net/) - Lynx sets the stardard for 
text-mode web clients since 1992. It even supports Gopher protocol.
+* [netsurf](http://www.netsurf-browser.org/) - Very fast graphical browser 
with custom engine that has near-perfect CSS support.
+* [surf](//surf.suckless.org/) - WebKit2 browser that can be embedded into 
other applications and uses dmenu as the address bar.
 * [Tridactyl](https://github.com/cmcaine/tridactyl) - A WebExtension that 
tries to make Firefox Vim like. Unlike many similar extensions it works with 
firefox 57+
 * [uzbl](https://www.uzbl.org/) - Web interface tools which adhere to the unix 
philosophy.
 * [Vimperator](http://vimperator.org/) - An extension to make Firefox keyboard 
friendly and Vim-like. (Doesn't work with firefox 57+)
 * [VimFX](https://addons.mozilla.org/en-US/firefox/addon/vimfx/) -
   Another extension to make Firefox Vim-like. Less invasive than
   Vimperator (Doesn't work with firefox 57+)
-* [w3m](http://w3m.sourceforge.net/)
+* [w3m](http://w3m.sourceforge.net/) - Text-based browser which can view 
images in terminal.
 
 ### X11
 
diff --git a/tools.suckless.org/dmenu/scripts/dmenu_websearch 
b/tools.suckless.org/dmenu/scripts/dmenu_websearch
index 0bbe3ef5..5f3ecef7 100755
--- a/tools.suckless.org/dmenu/scripts/dmenu_websearch
+++ b/tools.suckless.org/dmenu/scripts/dmenu_websearch
@@ -3,102 +3,69 @@
 # title: dmenu_websearch
 # license: CC0
 # author: Sunur Efe Vural <[email protected]>
+# version: 28/11/2018
+# some dependencies: dmenu, xdotool, hexdump, xprop, pstree, setxkbmap
 
-# This  is a  simple  shell script  which  spawns a  browser-independent
-# address bar. The dmenu_websearch bar can follow a URL, search the web,
-# and read bookmarks from a bookmarks file. If the cursor is not focused
-# to a  web browser, it will  open the URL  or the search term  with the
-# default browser. If the cursor is focused to a browser, be it terminal
-# or graphical, it will act as the address bar of that browser.
-
-# The reason of me  writing this script is to have  the same address bar
-# for all browsers which allows me to have one simple bookmarks file and
-# same address bar settings and  behaviour for all browsers. w3m, links,
-# lynx, dillo, etc.  don't allow you to perform web  searches with their
-# built-in address  bar. With  dmenu_websearch bar I  don't have  to use
-# their built-in address bars. Also having to enter a URL or search term
-# without first openning a browser is convenient and faster.
-
-
-# DEFINITIONS
+# dmenu_websearch  is a  browser-independent address  bar with  bookmark
+# support. If  the cursor  is focused on  a web browser  it acts  as the
+# address bar of that browser.
 
 browser="$TERMINAL -e $BROWSERCLI"
 homepage=$WWW_HOME
-bookmarks_file=$HOME/.bookmarks
-# The  first line  of the  bookmarks file  should have  the monkey  head
-# (🐵).  Following the  monkey head  it should  have a  URL per  line.
-# Bookmarks can be  commented with `#`. Also, bookmarks  can have names.
-# If a bookmark has a name it should follow this format: `URL, "NAME"`.
+bookmarks_file=$HOME/.bookmarks #url per line
 search_engine="https://duckduckgo.com/lite/?q=%s";
-# Alternative search engines:
-# "https://duckduckgo.com/?q=%s";
-# "https://duckduckgo.com/html/?q=%s";
-# "https://www.startpage.com/do/search?query=%s";
-# "https://google.com/search?q=%s";
-
-
-# BODY OF THE SCRIPT
 
 openchoice() {
        if [ "$windowid" != "notabrowser" ]
-       then xdotool key $keysequence type --delay 2 "$choice" ;\
-        sleep 0.1 ; xdotool key Return
+       then
+               #change layout to us cuz xdotool spasms with non-latin layouts
+               layout=`setxkbmap -query | awk '/^layout:/{ print $2 }'`
+               setxkbmap -layout us
+               xdotool key --clearmodifiers $shortcut\
+               type --clearmodifiers --delay 2 "$choice"
+               xdotool key --clearmodifiers Return
+               setxkbmap -layout $layout
        else $browser $choice
        fi
 }
 
 searchweb() {
-       choice=`echo $choice | sed 's/\ /+/g'`
-       choice=`echo $search_engine | sed "s/%s/$choice/"`
-       openchoice
-}
-
-openhome() {
-       if [ "$homepage" = "" ]
-       then choice="https://duckduckgo.com";
-       else choice=$homepage
-       fi
+       #convert search term to percent encoding
+       choice=`echo $choice | hexdump -v -e '/1 " %02x"' | sed 's/ 0a$//'`
+       #insert search term into the search engine url
+       choice=`echo $search_engine | sed "s/%s/$choice/;y/ /%/"`
        openchoice
 }
 
+#get termprocess for text browsers and windowclass for gui browsers.
 windowid=`xprop -root _NET_ACTIVE_WINDOW | awk '{print $5}'`
-
 if [ "$windowid" != "" ]
 then
-processid=`xprop -id "$windowid" _NET_WM_PID | awk '{print $3}'`
-termprocess=`pstree -Al "$processid" | awk -F "---" '{print $NF}'`
-windowclass=`xprop -id "$windowid" WM_CLASS | grep -o '".*"'`
+       processid=`xprop -id "$windowid" _NET_WM_PID | awk '{print $3}'`
+       termprocess=`pstree -Al "$processid" | awk -F "---" '{print $NF}'`
+       windowclass=`xprop -id "$windowid" WM_CLASS | grep -o '".*"'`
 fi
 
-if echo "$windowclass $termprocess" | grep -i \
+#get the shortcut to open address bar for each browser
+if echo "$windowclass" | grep -i \
 "firefox\|chromium\|vivaldi\|opera\|chrome\|netsurf\|arora\|epiphany\
 \|midori\|dillo\|konqueror\|brave\|palemoon\|iceweasel\|icecat"
-then keysequence="ctrl+l"
-elif echo "$windowclass $termprocess" | grep -i "luakit\|qutebrowser\|uzbl"
-then keysequence="o"
+then shortcut="ctrl+l"
+elif echo "$windowclass" | grep -i "luakit\|qutebrowser\|uzbl"
+then shortcut="o"
 elif echo "$windowclass $termprocess" | grep -i "links\|lynx\|conkeror"
-then keysequence="g"
-elif echo "$windowclass $termprocess" | grep -i "w3m"
-then keysequence="U"
+then shortcut="g"
+elif echo "$termprocess" | grep -i "w3m"
+then shortcut="U"
 else windowid=notabrowser
 fi
 
-if [ "$browser" = "" ]
-then browser="xdg-open"
-fi
-
-pgrep -x dmenu && exit
 choice=`grep -v "^#" $bookmarks_file\
  | dmenu -i -w $windowid -p "Enter URL or search term:"` || exit 1
-choice=`echo $choice | awk -F ", \"" '{ print $1 }'`
 
-if [ "$choice" = "🐵" ]
-then openhome
-elif echo "$choice" | grep -EZ\
- "^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*\.onion"
-then torsocks $browser $choice
-elif echo "$choice" | grep -EZ\
+if echo "$choice" | grep -EZ\
  "^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*"
-then openchoice
+then choice=`echo $choice | awk -F" " '{ print $1 }'`
+       openchoice
 else searchweb
 fi


Reply via email to