Skip to content

Instantly share code, notes, and snippets.

@rejuvyesh
Last active December 26, 2015 13:49
Show Gist options
  • Save rejuvyesh/7161330 to your computer and use it in GitHub Desktop.
Save rejuvyesh/7161330 to your computer and use it in GitHub Desktop.
-- search
awful.key({modkey }, "g", function()
awful.prompt.run({ prompt = "<span foreground='#7f9f7f'>Google Search:</span> "},
promptbox[mouse.screen].widget,
function(input)
awful.util.spawn_with_shell("searchGoogle.sh " .. input)
end, nil
)
end),
awful.key({modkey }, "s", function()
awful.prompt.run({ prompt = "<span foreground='#7f9f7f'>Scholar Search:</span> "},
promptbox[mouse.screen].widget,
function(input)
awful.util.spawn_with_shell("searchScholar.sh " .. input)
end, nil
)
end),
awful.key({modkey, "Shift" }, "g", function()
local f = io.popen("xsel -o")
local input = f:read("*a")
f:close()
awful.util.spawn_with_shell("searchGoogle.sh " .. input)
end),
awful.key({modkey, "Shift" }, "y", function()
local f = io.popen("xsel -o")
local input = f:read("*a")
f:close()
awful.util.spawn_with_shell("searchScholar.sh " .. input)
end),
#!/bin/zsh
term=$@
foo=''
#search with surfraw
sr google $term
#wait until the window exists and registers with the WM
while [ -z "$foo" ]; do
foo=$(wmctrl -l |grep -i "$term - Google Search")
sleep .5
done
#could use wmctrl -a, but it's not always reliable in awesome with dual screens
wmctrl -r "$term - Google Search" -b add,demands_attention
#!/bin/zsh
term=$@
foo=''
#search with surfraw
sr scholar $term
#wait until the window exists and registers with the WM
while [ -z "$foo" ]; do
foo=$(wmctrl -l |grep -i "$term - Scholar Search")
sleep .5
done
#could use wmctrl -a, but it's not always reliable in awesome with dual screens
wmctrl -r "$term - Scholar Search" -b add,demands_attention
@rejuvyesh
Copy link
Author

xmonad selectSearch and promptSearch in awesome-wm using Surfraw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment