I'm using Ubuntu 14.10 and would like to be able to have different screen resolutions on different workspaces. I was thinking of writing a script/daemon that calls xrandr whenever it detects a switch – the question is, how does one detect a change?
 
    
    - 731
1 Answers
The question marked as providing an answer does indeed provide an ample solution to my specific problem, but is a slightly narrower question. In the interests of the community, I shall summarise the parts relevant to this broader question, and in a more general manner:
The tool one requires is wmctrl (installable through apt-get install wmctrl). wmctrl -d gives information about the current desktop, including (DG) the total size of the virtual desktop (i.e. the combined size of all workspaces) and (VP) the absolute position of the top-left corner of the current workspace relative to the virtual desktop. The column of the currently active workspace can be determined by dividing the x-coord of VP by the horizontal part of the current screen resolution. The row of the current workspace can be calculated using the y-coord of VP and the vertical part of the current resolution. To detect a switch, one should use a while loop to constantly check the row and column of the current workspace and determine if it has changed / meets a certain test.
