예제 #1
0
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

from plwm import modewindow, event, wmanager
import sys
import os
import time
import re
import socket

TimerEventType = event.new_event_type()
ACPIEventType = event.new_event_type()

# ACPI interface:

#  probe: check if interface is present

#  get_event_socket: return an event socket, if any

#  handle_event_socket: process data read from event socket, return
#  pair with new status: (status, numbeeps), or None if no change.

#  poll: check all data, return pair (status, numbeeps) or None as above


class BadInfo(Exception):
예제 #2
0
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

from stat import *
import os
import sys

from plwm import modewindow, event

BiffEventType = event.new_event_type()


# wm mixin
class ModeWindowBiff:
    mw_biff_position = 0.0
    mw_biff_justification = modewindow.LEFT

    mw_biff_mail_message = 'Mail'
    mw_biff_new_mail_message = 'New mail'

    def __wm_init__(self):
        try:
            self.mw_biff_mailpath = os.environ['MAIL']
        except KeyError:
            sys.stderr.write('%s: $MAIL not set, mw_biff disabled\n' % sys.argv[0])
예제 #3
0
# for controlling the XMMS player.
#
# Of course for any of this to be relevant you must have XMMS, and be
# using it.  Further, you have to have the PyXMMS module.  If you
# don't this module won't cause your WM to crash if you use it, it
# just won't do anything.
#
# This has been developed using PyXMMS-2.03
#   http://people.via.ecp.fr/~flo/

from plwm import modewindow, event, wmanager, keys

try:
    import xmms

    XMMSTimerEvent = event.new_event_type()

    class ModeWindowXMMS:

        # These values are so that the XMMS position appears just
        # to the right of the default output of the mw_load mixin.
        mw_xmms_position = 0.070
        mw_xmms_justification = modewindow.LEFT

        def __wm_init__(self):

            self.wm_xmms_message = modewindow.Message(self.mw_xmms_position,
                                                      self.mw_xmms_justification)

            for s in self.screens:
                s.modewindow_add_message(self.wm_xmms_message)
예제 #4
0
import types
import re
import os

from plwm import event, wmanager

# This is all a bit hacky.  Possibly something more cooked should be
# presented to the user than just affecting different device controls
# directly.  The interface adapters are not very well designed, and
# very sensitive to the output format of the various tools.

# Devices that can be used
MASTER = 'vol'  # named thus for backward compitability
PCM = 'pcm'

MixerIOEventType = event.new_event_type()
MixerTimeoutEventType = event.new_event_type()


class ReximaInterface:
    dev_re = re.compile(r'^([a-z0-9]+)\s+(\d+)(, (\d+))?', re.MULTILINE)

    def probe_cmd(self):
        return 'type rexima > /dev/null 2>&1'

    def get_cmd(self):
        return 'rexima -v'

    def set_cmd(self, dev, val1, val2):
        if val2 is None:
            return 'rexima %s %d' % (dev, val1)
예제 #5
0
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

"""mw_xmms2.py - Display xmms2 track title in the mode window.

This requires xmms2's Python bindings, which live in the xmmsclient module.

"""

from plwm import modewindow, event

try:
    import xmmsclient, os

    XMMS2TimerEvent = event.new_event_type()
    XMMS2ReconnectEvent = event.new_event_type()

    class ModeWindowXMMS2:
        """WM mixin providing an XMMS2 status display in the ModeWindow.

        Example:

        >>> from plwm import mw_xmms2, wmanager, modewindow
        >>> class MyScreen(wmanager.Screen, modewindow.ModeWindowScreen):
        ...     pass
        ... 
        >>> class MyWM(wmanager.WindowManager, mw_xmms2.ModeWindowXMMS2):
        ...     screen_class = MyScreen
        ...     mw_xmms2_position = 0.7
        ...     mw_xmms2_justification = modewindow.RIGHT
예제 #6
0
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

import os
from plwm import modewindow, event, wmanager, keys
from gmailconstants import *
try:
    import libgmail

    GMAILTimerEvent = event.new_event_type()

    class ModeWindowGmail:

        # To use this mix-in, create a ~/.mw_gmailrc file.
        # The first line should be your account name, the second
        # your password ... and make sure the file is only user
        # readable, if you want to be secure.

        mw_gmail_position = 0.01
        mw_gmail_justification = modewindow.LEFT

        def __wm_init__(self):

            self.wm_gmail_message = modewindow.Message(
                self.mw_gmail_position, self.mw_gmail_justification)
예제 #7
0
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

from plwm import modewindow, event, wmanager
import time

ClockEventType = event.new_event_type()


# wm mixin
class ModeWindowClock:
    mw_clock_position = 1.0
    mw_clock_justification = modewindow.RIGHT

    def __wm_init__(self):
        self.mw_clock_format = self.rdb_get('.modewindow.clock.format',
                                            '.ModeWindow.Clock.Format',
                                            '%H:%M')

        self.mw_clock_message = modewindow.Message(self.mw_clock_position,
                                                   self.mw_clock_justification)
        for s in self.screens:
예제 #8
0
#                    4 : no. of running processes and total number of processes
#   mw_load.UnixLoad.loadcmd: command which prints load averages
#   mw_load.UnixLoad.displaylist: list of entries to be displayed
#       (for my uptime command, numbers 9,10 and 11 are the load averages)




from plwm import modewindow, event, wmanager
import os.path
import string
import sys
import re
import errno

LoadTimerEvent = event.new_event_type()

class LinuxLoad:
    loadfile = "/proc/loadsavg"
    displaylist = [0,1,2,3]

    def probe(self):
        return os.path.isfile(self.loadfile)

    def get(self, wm):
        f=open(self.loadfile,'r')
        l=string.split(f.readline())
        f.close()
        str=""
        for x in self.displaylist:
            str = str + l[x] + " "