Michael, thanks for your work! You made a good start and I'm thinking of a little more general plugin system. What about the following.
There are hook scripts in ~/.disper/hooks and /usr/share/disper/hooks. Each hook is either a program/shellscript, or a python script (identified by extension .py). Programs/shellscripts are executed as an external program, python scripts are executed within disper itself so as to easily access all the functionality.
Programs/shellscripts are run with the following variables set, with example values:
# disper version
DISPER_VERSION=0.2.3
# log level: 0=quiet, 1=normal, 2=verbose
DISPER_LOG_LEVEL=1
# execution stage: prepare or switch. Only should act on "switch" usually (for future compatibility)
DISPER_STAGE=switch
# space-separated list of display id's that have output
DISPER_DISPLAYS=DFP_0 CRT_0
# one of: clone, left, right, top, bottom
DISPER_LAYOUT=right
# resolution and position for each display
# should prbly be equal to xinerama info (xdpyinfo -ext XINERAMA)
# you can easily get components in shellscript by temporarily changing IFS
DISPER_RESOLUTION_DFP_0=800x600
DISPER_POSITION_DFP_0=0,0
DISPER_RESOLUTION_CRT_0=1024x768
DISPER_POSITION_CRT_0=800,0
# full bounding box resolution
DISPER_BB_RESOLUTION=1824x768
All disper options are given to the hook command as well. For now the environment should be used to set hook configuration, but in the future maybe functionality might be included to add disper command-line parameters for hooks.
An extra disper parameter --hooks=foo,bar,blah activates the specified plugin.
The file ~/.disper/config has default command-line options (long names only, one per line, without dashes), this also enables one to activate a default set of hooks by including "hooks=foo,bar".
API for python hooks still to be determined.
So what would you think about this? Would it be convenient, not complete enough or too complex? Other comments?
Michael, thanks for your work! You made a good start and I'm thinking of a little more general plugin system. What about the following.
There are hook scripts in ~/.disper/hooks and /usr/share/ disper/ hooks. Each hook is either a program/ shellscript, or a python script (identified by extension .py). Programs/ shellscripts are executed as an external program, python scripts are executed within disper itself so as to easily access all the functionality. shellscripts are run with the following variables set, with example values: VERSION= 0.2.3 LOG_LEVEL= 1 STAGE=switch DISPLAYS= DFP_0 CRT_0 LAYOUT= right RESOLUTION_ DFP_0=800x600 POSITION_ DFP_0=0, 0 RESOLUTION_ CRT_0=1024x768 POSITION_ CRT_0=800, 0 BB_RESOLUTION= 1824x768
Programs/
# disper version
DISPER_
# log level: 0=quiet, 1=normal, 2=verbose
DISPER_
# execution stage: prepare or switch. Only should act on "switch" usually (for future compatibility)
DISPER_
# space-separated list of display id's that have output
DISPER_
# one of: clone, left, right, top, bottom
DISPER_
# resolution and position for each display
# should prbly be equal to xinerama info (xdpyinfo -ext XINERAMA)
# you can easily get components in shellscript by temporarily changing IFS
DISPER_
DISPER_
DISPER_
DISPER_
# full bounding box resolution
DISPER_
All disper options are given to the hook command as well. For now the environment should be used to set hook configuration, but in the future maybe functionality might be included to add disper command-line parameters for hooks.
An extra disper parameter --hooks= foo,bar, blah activates the specified plugin.
The file ~/.disper/config has default command-line options (long names only, one per line, without dashes), this also enables one to activate a default set of hooks by including "hooks=foo,bar".
API for python hooks still to be determined.
So what would you think about this? Would it be convenient, not complete enough or too complex? Other comments?