-- this allows for floating windows --dopath("detach.lua") --detach.setup_hooks() -- this sets up the audio controls --[[ defbindings("WScreen", { kpress("SunAudioLowerVolume", "ioncore.exec_on(_, 'aumix -v-5')"), kpress("SunAudioRaiseVolume", "ioncore.exec_on(_, 'aumix -v+5')"), kpress("SunAudioMute", "ioncore.exec_on(_, 'aumix -v0')"), }) --]] -- this allows for C-M-space to create a per window scratchpad --[[ dopath("cwin_sp.lua") defbindings("WFrame", { kpress(CTRL..MOD1.."space", "make_cwin_sp(_, _sub)"), kpress(MOD1.."space", "mod_sp.toggle(default_sp)") --kpress(MOD1.."space", "mod_sp.set_shown_on(_, 'toggle')"), }) --]] function exists(n) local f = assert(io.open(n, "r")) io.close(f) return not (f==nil) end -- http://www.jukie.net/ -- /dev/null function my_url_handler (ws) ioncore.request_selection( function (str) local safe = string.shell_safe(str) if (string.find(str, "http://") ~= nil) then ioncore.exec_on (ws, "firefox -new-tab " .. safe) elseif (exists(str)) then ioncore.exec_on (ws, "/usr/local/bin/gvim " .. safe) end end) end --[[ -- -- How do you capture the output of ioncore.exec() ? -- function my_get_lastfm_playing(ws) local playing = `echo player/currentlyPlaying | nc localhost 32213` -- then set selection somehow -- http://www.modeemi.cs.tut.fi/~tuomov/ion-doc-3/ionconf/ionconf.html end --]] defbindings("WScreen", { kpress("Mod4+U", "my_url_handler(_)"), kpress("Mod4+grave", "ioncore.exec('echo player/currentlyPlaying | nc localhost 32213 | xclip -i')"), })