--- Read the nice value of pid from /proc.
-local function get_nice_value(pid)
- local n = first_line('/proc/' .. pid .. '/stat')
- if not n then return 0 end
-
- -- Remove pid and tcomm. This is necessary because tcomm may contain
- -- nasty stuff such as whitespace or additional parentheses...
- n = string.gsub(n, '.*%) ', '')
-
- -- Field number 17 now is the nice value.
- fields = split(n, ' ')
- return tonumber(fields[17])
-end
-
--- To be used as a signal handler for "focus"
--- This requires beautiful.border_focus{,_highprio,_lowprio}.
-function util.niceborder_focus(c)
- local n = get_nice_value(c.pid)
- if n == 0
- then
- c.border_color = beautiful.border_focus
- elseif n < 0
- then
- c.border_color = beautiful.border_focus_highprio
- else
- c.border_color = beautiful.border_focus_lowprio
- end
-end
-
--- To be used as a signal handler for "unfocus"
--- This requires beautiful.border_normal{,_highprio,_lowprio}.
-function util.niceborder_unfocus(c)
- local n = get_nice_value(c.pid)
- if n == 0
- then
- c.border_color = beautiful.border_normal
- elseif n < 0
- then
- c.border_color = beautiful.border_normal_highprio
- else
- c.border_color = beautiful.border_normal_lowprio
- end
+ c.floating = true
+ local s = awful.screen.focused()
+ local mg = s.geometry
+ local mwfact = s.selected_tag.master_width_factor or 0.5
+ local g = {}
+ g.width = sqrt(mwfact) * mg.width
+ g.height = sqrt(mwfact) * mg.height
+ g.x = mg.x + (mg.width - g.width) / 2
+ g.y = mg.y + (mg.height - g.height) / 2
+
+ if c then c:geometry(g) end -- if c is still a valid object