[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devilspie2-discuss] problems with compiz
From: |
Tomáš Hnyk |
Subject: |
[Devilspie2-discuss] problems with compiz |
Date: |
Wed, 03 Sep 2014 15:49:14 +0200 |
User-agent: |
Opera Mail/12.16 (Linux) |
Hello,
as you probably know, compiz uses viewports, that is one giant workspace
divided into several viewports. Devilspie2 seems to have some problems
with that.
Viewport 1,1 is the top leftmost, 1,3 is top and the third from the left
to the right
1) set_window_geometry seems to be relative to viewport 1,1. If my screen
is 1920x1080 I am on vieport 2,2 and I use
set_window_geometry(2100,1200,650,950)
to open a window on that vieport, it is set to vieport 3,3.
2) set_viewport works only for the first row of the viewport grid (one can
use it to reach viewports 1,1, 1,2, 1,3 in a 3x3 grid, but not the rest)
3) I miss a get_viewport function (if I set an application to open on
certain viewport, then move it manually, and it opens a new window, I
would need to capture the current viewport so that I can direct the new
window to the current viewport)
At moment, I need to use a lot of glue and external tools like xdotool to
do what I want. For example, to set a na application on a particualr
viewport, I use:
if (get_window_class()=="Chromium-browser") then
os.execute("xdotool set_desktop_viewport 0 0")
set_window_geometry2(100,2250,800,600)
maximize()
os.execute("xdotool set_desktop_viewport 0 2160")
end
It seems to be to complicated. Now, for opening a Pidgin conversation in a
3,3 viewport in the background (i.e. without changing my curent viewport),
I do:
-- a helper function to capture string from external command output
function os.capture(cmd, raw)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
if raw then return s end
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end
if (get_window_class()=="Pidgin" and get_window_role()=="conversation")
then
-- get the current viewport
vp = os.capture("xprop -root |grep '_NET_DESKTOP_VIEWPORT(CARDINAL) =
' |cut -d ' ' -f 3-4 |tr -d ','")
-- unfortunately, the below does not work due to a bug in xdotool
-- vp = os.capture("xdotool get_desktop_viewport")
-- set_window_geomtery is relative to current position, it seems, so
go to the left and top most vieport
os.execute("xdotool set_desktop_viewport 0 0")
-- set the window maximized and to viewport 3,3
set_window_geometry(3930,2250,650,950)
maximize()
-- now go to the original viewport
os.execute("xdotool set_desktop_viewport " .. vp)
end
devilspie2 still allows me to do what I want but I guess it could be less
complicated. All this is under Unity on Ubuntu 14.04.
Regards,
Tomas
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Devilspie2-discuss] problems with compiz,
Tomáš Hnyk <=