Skip to content

Instantly share code, notes, and snippets.

@harizvi
Created July 27, 2014 02:44
Show Gist options
  • Save harizvi/1482e5afc0d0ea81bd20 to your computer and use it in GitHub Desktop.
Save harizvi/1482e5afc0d0ea81bd20 to your computer and use it in GitHub Desktop.
Place windows based on window app or title
function ext.utilfns.smartlyPlaceWindow()
local win = window.focusedwindow()
local winName = win:title()
local appName = win:application():title()
if (string.match(winName, "started: ")) then -- sametime messaging window
positioncurrentwindow(win,{0.01,0.15,0.45,0.65})
elseif (string.match(winName, "IBM Sametime Connect")) then
positioncurrentwindow(win,{0,0,0.2,0.9})
elseif (appName == "Adium" and string.match(winName, "Contacts")) then -- Adium contacts window
positioncurrentwindow(win,{0,0,0.2,0.9})
elseif (appName == "Adium") then -- it is the Adium messaging window
positioncurrentwindow(win,{0.05,0.3,0.4,0.55})
elseif (appName == "Terminal" or appName == "iTerm") then
positioncurrentwindow(win,{0.,0.4,0.50,0.5})
elseif (appName == "Emacs") then
positioncurrentwindow(win,{0.25,0.05,0.65,0.90})
elseif (appName == "Conkeror") then
positioncurrentwindow(win,{0.25, 0.05,0.75,0.95})
elseif (appName == "IBM Notes") then
positioncurrentwindow(win,{0.10, 0.05,0.80,0.90})
else -- kinda sorta in the middle
positioncurrentwindow(win,{0.10, 0.05,0.80,0.95})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment