Check-in [33a1e31904]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added a function and default key binding to quit Minx.
Timelines: family | ancestors | descendants | both | dev1.x
Files: files | file ages | folders
SHA1:33a1e31904795fa64d29c17156383f9a4963ace9
User & Date: manuv 2013-07-30 00:17:39
Context
2013-07-30
00:21
Make full layout occupy entire area of its parent window. Until now, we were leaving a little space on each side for debugging; that doesn't seem necessary any more... check-in: b66fd70acf user: manuv tags: dev1.x
00:17
Added a function and default key binding to quit Minx. check-in: 33a1e31904 user: manuv tags: dev1.x
2013-07-28
14:56
  • Added support for end-user hook to create layouts before managing existing windows and entering event loop.
  • Made the display and root_windows members of the minx.core.wm class public (i.e., removed leading underscore) so that they can be accessed by the init_hook.
  • Removed unnecessary layout creation in wm.start() because the default layout logic in the layman.receptive_layout() method takes care of this already.
check-in: ac0236beec user: manuv tags: dev1.x
Changes

Changes to core/wm.py.

222
223
224
225
226
227
228


229
230
231
232
233
234
235

236
237
238
239
240
241
242
...
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
...
651
652
653
654
655
656
657











658
659
660
661
662
663
664
        self.layouts = layman(self)

        logger.info('setting up X event handlers and default keybindings')
        self.hooks = hooks()
        self._xevents = xevents(self)
        self._init_keybindings()



    # Default keybindings
    def _init_keybindings(self):
        self.hooks.add(  'A-Tab', self.focus_next)
        self.hooks.add('S-A-Tab', self.focus_prev)
        self.hooks.add(   'A-F4', self.kill)
        self.hooks.add(   'C-F4', self.nuke)
        self.hooks.add(  'C-A-T', lambda: self.spawn(self.config.terminal))


    # Start the window manager
    def start(self):
        """Start the window manager.

        Call this method after creating a wm instance to get Minx up and
        running. Here is an example showing how to start Minx with its
................................................................................
        @par
        If you decide not to use wm.start(), look at the Minx code to
        see how and what you will need to do to effectively use this
        function.

        """
        logger.info('entering event loop')
        while True:
            try:
                logger.debug('waiting for event')
                e = self.display.get_event()
                logger.debug('got event {}'.format(e))
                self.hooks.trigger(str(e), e)

            # Tried to query the window hierarchy of a non-existent
................................................................................
        for r in self.hooks.trigger('manage_hook', w):
            if r == False:  # some manage hook returned False
               return False # therefore, ignore w

        # If we get here, all manage hooks passed w ==> we should
        # manage it...
        return True












#-----------------------------------------------------------------------

##############################################
# Editor config:                             #
##############################################
# Local Variables:                           #







>
>







>







 







|







 







>
>
>
>
>
>
>
>
>
>
>







222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
...
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
...
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
        self.layouts = layman(self)

        logger.info('setting up X event handlers and default keybindings')
        self.hooks = hooks()
        self._xevents = xevents(self)
        self._init_keybindings()

        self._quit = False

    # Default keybindings
    def _init_keybindings(self):
        self.hooks.add(  'A-Tab', self.focus_next)
        self.hooks.add('S-A-Tab', self.focus_prev)
        self.hooks.add(   'A-F4', self.kill)
        self.hooks.add(   'C-F4', self.nuke)
        self.hooks.add(  'C-A-T', lambda: self.spawn(self.config.terminal))
        self.hooks.add(  'C-A-X', self.quit)

    # Start the window manager
    def start(self):
        """Start the window manager.

        Call this method after creating a wm instance to get Minx up and
        running. Here is an example showing how to start Minx with its
................................................................................
        @par
        If you decide not to use wm.start(), look at the Minx code to
        see how and what you will need to do to effectively use this
        function.

        """
        logger.info('entering event loop')
        while not self._quit:
            try:
                logger.debug('waiting for event')
                e = self.display.get_event()
                logger.debug('got event {}'.format(e))
                self.hooks.trigger(str(e), e)

            # Tried to query the window hierarchy of a non-existent
................................................................................
        for r in self.hooks.trigger('manage_hook', w):
            if r == False:  # some manage hook returned False
               return False # therefore, ignore w

        # If we get here, all manage hooks passed w ==> we should
        # manage it...
        return True

    # Quit window manager
    def quit(self):
        """Quit the window manager.

        This function sets a flag that will eventually result in Minx
        exiting its event loop. It is meant to be invoked via a key
        binding or other similar action.

        """
        self._quit = True

#-----------------------------------------------------------------------

##############################################
# Editor config:                             #
##############################################
# Local Variables:                           #