summaryrefslogtreecommitdiffstats
path: root/py3status/modules
diff options
context:
space:
mode:
Diffstat (limited to 'py3status/modules')
-rw-r--r--py3status/modules/battery_level.py6
-rw-r--r--py3status/modules/bitcoin_price.py6
-rw-r--r--py3status/modules/bluetooth.py4
-rw-r--r--py3status/modules/clementine.py7
-rw-r--r--py3status/modules/dpms.py5
-rw-r--r--py3status/modules/empty_class.py122
-rw-r--r--py3status/modules/glpi.py6
-rw-r--r--py3status/modules/imap.py6
-rw-r--r--py3status/modules/keyboard_layout.py2
-rw-r--r--py3status/modules/mpd_status.py5
-rw-r--r--py3status/modules/net_rate.py4
-rw-r--r--py3status/modules/netdata.py4
-rw-r--r--py3status/modules/ns_checker.py4
-rw-r--r--py3status/modules/online_status.py2
-rw-r--r--py3status/modules/pingdom.py9
-rw-r--r--py3status/modules/player_control.py176
-rw-r--r--py3status/modules/pomodoro.py14
-rw-r--r--py3status/modules/scratchpad_counter.py2
-rw-r--r--py3status/modules/spaceapi.py7
-rw-r--r--py3status/modules/sysdata.py5
-rw-r--r--py3status/modules/vnstat.py8
-rw-r--r--py3status/modules/weather_yahoo.py3
-rw-r--r--py3status/modules/whoami.py2
-rw-r--r--py3status/modules/window_title.py2
-rw-r--r--py3status/modules/xrandr.py2
25 files changed, 236 insertions, 177 deletions
diff --git a/py3status/modules/battery_level.py b/py3status/modules/battery_level.py
index f3cbb37..ae8fe33 100644
--- a/py3status/modules/battery_level.py
+++ b/py3status/modules/battery_level.py
@@ -1,11 +1,11 @@
-# -*- coding: utf8 -*-
+# -*- coding: utf-8 -*-
"""
-Module for displaying information about battery.
+Display the battery level.
Requires:
- the 'acpi' command line
-@author shadowprince and AdamBSteele
+@author shadowprince, AdamBSteele
@license Eclipse Public License
"""
diff --git a/py3status/modules/bitcoin_price.py b/py3status/modules/bitcoin_price.py
index 656797c..477394f 100644
--- a/py3status/modules/bitcoin_price.py
+++ b/py3status/modules/bitcoin_price.py
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
"""
-Module for displaying bitcoin prices using
-the API by www.bitcoincharts.com.
+Display bitcoin prices using bitcoincharts.com.
-Written and contributed by @tasse:
- Andre Doser <doser.andre AT gmail.com>
+@author Andre Doser <doser.andre AT gmail.com>
"""
import json
diff --git a/py3status/modules/bluetooth.py b/py3status/modules/bluetooth.py
index cd09945..3818325 100644
--- a/py3status/modules/bluetooth.py
+++ b/py3status/modules/bluetooth.py
@@ -1,6 +1,6 @@
-# -*- coding: utf8 -*-
+# -*- coding: utf-8 -*-
"""
-This module displays bluetooth status.
+Display bluetooth status.
Requires:
- hcitool
diff --git a/py3status/modules/clementine.py b/py3status/modules/clementine.py
index faadf1e..2c5c66f 100644
--- a/py3status/modules/clementine.py
+++ b/py3status/modules/clementine.py
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
"""
-This module displays the current "artist - title" playing in Clementine.
+Display the current "artist - title" playing in Clementine.
-Last modified: 2014-03-23
-Author: Francois LASSERRE <choiz@me.com>
-License: GNU GPL http://www.gnu.org/licenses/gpl.html
+@author Francois LASSERRE <choiz@me.com>
+@license GNU GPL http://www.gnu.org/licenses/gpl.html
"""
from time import time
diff --git a/py3status/modules/dpms.py b/py3status/modules/dpms.py
index bcef53c..0753df4 100644
--- a/py3status/modules/dpms.py
+++ b/py3status/modules/dpms.py
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
"""
+Activate or deactivate DPMS and screen blanking.
+
This module allows activation and deactivation
of DPMS (Display Power Management Signaling)
by clicking on 'DPMS' in the status bar.
-Written and contributed by @tasse:
- Andre Doser <dosera AT tf.uni-freiburg.de>
+@author Andre Doser <dosera AT tf.uni-freiburg.de>
"""
from os import system
diff --git a/py3status/modules/empty_class.py b/py3status/modules/empty_class.py
deleted file mode 100644
index 9a58189..0000000
--- a/py3status/modules/empty_class.py
+++ /dev/null
@@ -1,122 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# This is an example module to be used as a template.
-# See https://github.com/ultrabug/py3status/wiki/Write-your-own-modules
-# for more details.
-#
-# NOTE: py3status will NOT execute:
-# - methods starting with '_'
-# - methods decorated by @property and @staticmethod
-#
-# NOTE: reserved method names:
-# - 'kill' method for py3status exit notification
-# - 'on_click' method for click events from i3bar (read below please)
-#
-# WARNING:
-#
-# Do NOT use print on your modules: py3status will catch any output and discard
-# it silently because this would break your i3bar (see issue #20 for details).
-# Make sure you catch any output from any external program you may call
-# from your module. Any output from an external program cannot be caught and
-# silenced by py3status and will break your i3bar so please, redirect any
-# stdout/stderr to /dev/null for example (see issue #20 for details).
-#
-# CONTRIBUTORS:
-#
-# Contributors are kindly requested to agree to contribute their code under
-# the BSD license to match py3status' one.
-#
-# Any contributor to this module should add his/her name to the @author
-# line, comma separated.
-#
-# DOCSTRING:
-#
-# Fill in the following docstring: it will be parsed by py3status to document
-# your module from the CLI.
-"""
-One-line summary followed by an empty line.
-
-Multi-line description followed by an empty line.
-
-@author <your full name> <your email address>
-@license BSD
-"""
-
-# import your useful libs here
-from time import time
-
-
-class Py3status:
- """
- The Py3status class name is mendatory.
-
- Below you list all the available configuration parameters and their
- default value for your module which can be overwritten by users
- directly from their i3status config.
-
- This examples features only one parameter which is 'cache_timeout'
- and is set to 10 seconds (0 would mean no cache).
- """
-
- # available configuration parameters
- cache_timeout = 10
-
- def __init__(self):
- """
- This is the class constructor which will be executed once.
- """
- pass
-
- def kill(self, i3s_output_list, i3s_config):
- """
- This method will be called upon py3status exit.
- """
- pass
-
- def on_click(self, i3s_output_list, i3s_config, event):
- """
- This method should only be used for ADVANCED and very specific usages.
-
- Read the 'Handle click events directly from your i3status config'
- article from the py3status wiki:
- https://github.com/ultrabug/py3status/wiki/
-
- This method will be called when a click event occurs on this module's
- output on the i3bar.
-
- Example 'event' json object:
- {'y': 13, 'x': 1737, 'button': 1, 'name': 'empty', 'instance': 'first'}
- """
- pass
-
- def empty(self, i3s_output_list, i3s_config):
- """
- This method will return an empty text message
- so it will NOT be displayed on your i3bar.
-
- If you want something displayed you should write something
- in the 'full_text' key of your response.
-
- See the i3bar protocol spec for more information:
- http://i3wm.org/docs/i3bar-protocol.html
- """
- response = {
- 'cached_until': time() + self.cache_timeout,
- 'full_text': ''
- }
- return response
-
-if __name__ == "__main__":
- """
- Test this module by calling it directly.
- This SHOULD work before contributing your module please.
- """
- from time import sleep
- x = Py3status()
- config = {
- 'color_good': '#00FF00',
- 'color_bad': '#FF0000',
- }
- while True:
- print(x.empty([], config))
- sleep(1)
diff --git a/py3status/modules/glpi.py b/py3status/modules/glpi.py
index db648e0..708ed4f 100644
--- a/py3status/modules/glpi.py
+++ b/py3status/modules/glpi.py
@@ -1,13 +1,9 @@
# -*- coding: utf-8 -*-
"""
-This example class demonstrates how to display the current total number of
-open tickets from GLPI in your i3bar.
+Display the total number of open tickets from GLPI.
It features thresholds to colorize the output and forces a low timeout to
limit the impact of a server connectivity problem on your i3bar freshness.
-
-Note that we don't have to implement a cache layer as it is handled by
-py3status automagically.
"""
# You need MySQL-python from http://pypi.python.org/pypi/MySQL-python
diff --git a/py3status/modules/imap.py b/py3status/modules/imap.py
index ff53f02..47661f1 100644
--- a/py3status/modules/imap.py
+++ b/py3status/modules/imap.py
@@ -1,8 +1,6 @@
-# -*- coding: utf8 -*-
+# -*- coding: utf-8 -*-
"""
-Module displaying the number of unread messages
-on an IMAP inbox (configurable, may also be a
-comma-separated list of IMAP folders).
+Display the unread messages count from your IMAP account.
@author obb
"""
diff --git a/py3status/modules/keyboard_layout.py b/py3status/modules/keyboard_layout.py
index f7a570c..d8eb7cc 100644
--- a/py3status/modules/keyboard_layout.py
+++ b/py3status/modules/keyboard_layout.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
-Module for showing current keyboard layout.
+Display the current keyboard layout.
Requires:
- xkblayout-state
diff --git a/py3status/modules/mpd_status.py b/py3status/modules/mpd_status.py
index 10f3c99..a30830e 100644
--- a/py3status/modules/mpd_status.py
+++ b/py3status/modules/mpd_status.py
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
"""
-Mpd - module to show information from mpd in your i3bar.
-Reequires
+Display information from mpd.
+
+Requires:
- python-mpd2 (NOT python2-mpd2)
# pip install python-mpd2
diff --git a/py3status/modules/net_rate.py b/py3status/modules/net_rate.py
index 876f6cb..961578b 100644
--- a/py3status/modules/net_rate.py
+++ b/py3status/modules/net_rate.py
@@ -1,6 +1,6 @@
-# -*- coding: utf8 -*-
+# -*- coding: utf-8 -*-
"""
-Module for displaying current network transfer rate.
+Display the current network transfer rate.
@author shadowprince
@license Eclipse Public License
diff --git a/py3status/modules/netdata.py b/py3status/modules/netdata.py
index fe9406f..c43ad06 100644
--- a/py3status/modules/netdata.py
+++ b/py3status/modules/netdata.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
"""
-Display network information (Linux systems) in i3bar.
+Display network speed and bandwidth usage.
-Copyright (C) <2013> <Shahin Azad [ishahinism at Gmail]>
+@author Shahin Azad <ishahinism at Gmail>
"""
import subprocess
diff --git a/py3status/modules/ns_checker.py b/py3status/modules/ns_checker.py
index 5fa6384..d21bbb0 100644
--- a/py3status/modules/ns_checker.py
+++ b/py3status/modules/ns_checker.py
@@ -1,12 +1,14 @@
# -*- coding: utf-8 -*-
"""
+Display DNS resolution success on a configured domain.
+
This module launch a simple query on each nameservers for the specified domain.
Nameservers are dynamically retrieved. The FQDN is the only one mandatory parameter.
It's also possible to add additional nameservers by appending them in nameservers list.
The default resolver can be overwritten with my_resolver.nameservers parameter.
-Written and contributed by @nawadanp
+@author nawadanp
"""
import dns.resolver
diff --git a/py3status/modules/online_status.py b/py3status/modules/online_status.py
index 8cc6eeb..8176d21 100644
--- a/py3status/modules/online_status.py
+++ b/py3status/modules/online_status.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
-Module displaying if a connection to the internet is established.
+Display if a connection to the internet is established.
@author obb
"""
diff --git a/py3status/modules/pingdom.py b/py3status/modules/pingdom.py
index c4ec473..f47da68 100644
--- a/py3status/modules/pingdom.py
+++ b/py3status/modules/pingdom.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
"""
-Dynamically display the latest response time of the configured checks using
-the Pingdom API.
+Display the latest response time of the configured Pingdom checks.
+
We also verify the status of the checks and colorize if needed.
Pingdom API doc : https://www.pingdom.com/services/api-documentation-rest/
-#NOTE: This module needs the 'requests' python module from pypi
- https://pypi.python.org/pypi/requests
+Requires:
+ - requests python module from pypi
+ https://pypi.python.org/pypi/requests
"""
import requests
diff --git a/py3status/modules/player_control.py b/py3status/modules/player_control.py
new file mode 100644
index 0000000..1651327
--- /dev/null
+++ b/py3status/modules/player_control.py
@@ -0,0 +1,176 @@
+# -*- coding: utf-8 -*-
+"""
+Control music/video players.
+
+Provides an icon to control simple functions of audio/video players:
+ - start (left click)
+ - stop (left click)
+ - pause (middle click)
+
+@author Federico Ceratto <federico.ceratto@gmail.com>, rixx
+@license BSD
+"""
+# Any contributor to this module should add his/her name to the @author
+# line, comma separated.
+
+from syslog import syslog, LOG_INFO
+from time import time, sleep
+import dbus
+import os
+import subprocess
+
+
+def log(msg):
+ syslog(LOG_INFO, "player_control: %s" % msg[:100])
+
+
+class Py3status:
+ """
+ Configuration parameters:
+ - debug: enable verbose logging (bool) (default: False)
+ - supported_players: supported players (str) (comma separated list)
+ - volume_tick: percentage volume change on mouse wheel (int) (positive number or None to disable it)
+
+ """
+
+ debug = False
+ pause_icon = u'❚❚'
+ play_icon = u'▶'
+ stop_icon = u'◼'
+ supported_players = 'audacious,vlc'
+ volume_tick = 1
+
+ def __init__(self):
+ self.status = 'stop'
+ self.icon = self.play_icon
+
+ def on_click(self, i3s_output_list, i3s_config, event):
+ """
+ """
+ buttons = (None, 'left', 'middle', 'right', 'up', 'down')
+ try:
+ button = buttons[event['button']]
+ except IndexError:
+ return
+
+ if button in ('up', 'down'):
+ if self.volume_tick is None:
+ return
+
+ self._change_volume(button == 'up')
+ return
+
+ if self.status == 'play':
+ if button == 'left':
+ self._stop()
+
+ elif button == 'middle':
+ self._pause()
+
+ elif self.status == 'stop':
+ if button == 'left':
+ self._play()
+
+ elif self.status == 'pause':
+ if button in ('left', 'right'):
+ self._play()
+
+ def _run(self, *args):
+ if self.debug:
+ log('running %s' % repr(*args))
+
+ subprocess.check_output(*args, stderr=subprocess.STDOUT)
+
+ def _play(self):
+ self.status = 'play'
+ self.icon = self.stop_icon
+ player_name = self._detect_running_player()
+ if player_name == 'audacious':
+ self._run(['/usr/bin/audacious', '-p'])
+ elif player_name == 'vlc':
+ player = self._get_vlc()
+ if player:
+ player.Play()
+
+ def _stop(self):
+ self.status = 'stop'
+ self.icon = self.play_icon
+ player_name = self._detect_running_player()
+ if player_name == 'audacious':
+ self._run(['/usr/bin/audacious', '-s'])
+ elif player_name == 'vlc':
+ player = self._get_vlc()
+ if player:
+ player.Stop()
+
+ def _pause(self):
+ self.status = 'pause'
+ self.icon = self.pause_icon
+ player_name = self._detect_running_player()
+ if player_name == 'audacious':
+ self._run(['/usr/bin/audacious', '-u'])
+ elif player_name == 'vlc':
+ player = self._get_vlc()
+ if player:
+ player.Pause()
+
+ def _change_volume(self, increase):
+ """Change volume using amixer
+ """
+ sign = '+' if increase else '-'
+ delta = "%d%%%s" % (self.volume_tick, sign)
+ self._run(('/usr/bin/amixer', '-q', 'sset', 'Master', delta))
+
+ def _detect_running_player(self):
+ """Detect running player process, if any
+ """
+ supported_players = self.supported_players.split(',')
+ running_players = []
+ for pid in os.listdir('/proc'):
+ if not pid.isdigit():
+ continue
+
+ fn = os.path.join('/proc', pid, 'comm')
+ try:
+ with open(fn, 'rb') as f:
+ player_name = f.read().decode().rstrip()
+
+ except:
+ continue
+
+ if player_name in supported_players:
+ running_players.append(player_name)
+
+ # Pick which player to use based on the order in self.supported_players
+ for player_name in supported_players:
+ if player_name in running_players:
+ if self.debug:
+ log('found player: %s' % player_name)
+
+ return player_name
+
+ return None
+
+ def _get_vlc(self):
+ mpris = 'org.mpris.MediaPlayer2'
+ mpris_slash = '/' + mpris.replace('.', '/')
+ bus = dbus.SessionBus()
+ proxy = bus.get_object(mpris+'.vlc', mpris_slash)
+ return dbus.Interface(proxy, dbus_interface=mpris+'.Player')
+
+ def player_control(self, i3s_output_list, i3s_config):
+ return dict(
+ full_text=self.icon,
+ cached_until=time(),
+ )
+
+
+if __name__ == "__main__":
+ x = Py3status()
+ config = {
+ 'color_good': '#00FF00',
+ 'color_bad': '#FF0000',
+ }
+ while True:
+ print(x.player_control([], config))
+ sleep(1)
diff --git a/py3status/modules/pomodoro.py b/py3status/modules/pomodoro.py
index ecb3f57..38f8020 100644
--- a/py3status/modules/pomodoro.py
+++ b/py3status/modules/pomodoro.py
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
"""
-Pomodoro countdown on i3bar originally written by @Fandekasp (Adrien Lemaire)
+Display and control a Pomodoro countdown.
+
+@author Fandekasp (Adrien Lemaire), rixx, FedericoCeratto
"""
from subprocess import call
@@ -151,17 +153,21 @@ class Py3status:
if self.timer < 0:
self.alert = True
self.run = False
+ if self.status == 'start':
+ self.__play_sound(self.sound_pomodoro_end)
+
+ elif self.status == 'break':
+ self.__play_sound(self.sound_break_end)
+
self.__i3_nagbar()
if self.status == 'start':
self.__setup('break')
self.status = 'break'
- self.__play_sound(self.sound_pomodoro_end)
elif self.status == 'break':
self.__setup('start')
self.status = 'start'
- self.__play_sound(self.sound_break_end)
def __i3_nagbar(self, level='warning'):
"""
@@ -212,7 +218,7 @@ class Py3status:
try:
mixer.music.load(sound_fname)
- except Exception as e:
+ except Exception:
return
mixer.music.play()
diff --git a/py3status/modules/scratchpad_counter.py b/py3status/modules/scratchpad_counter.py
index 4bfad23..3619cda 100644
--- a/py3status/modules/scratchpad_counter.py
+++ b/py3status/modules/scratchpad_counter.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
-Module showing amount of windows at the scratchpad.
+Display the amount of windows in your i3 scratchpad.
@author shadowprince
@license Eclipse Public License
diff --git a/py3status/modules/spaceapi.py b/py3status/modules/spaceapi.py
index 719ee3e..c4eac58 100644
--- a/py3status/modules/spaceapi.py
+++ b/py3status/modules/spaceapi.py
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
"""
-This module shows if your favorite hackerspace is open or not
+Display if your favorite hackerspace is open or not.
-Last modified: 2015-02-01
-Author: @timmszigat
-License: WTFPL http://www.wtfpl.net/txt/copying/
+@author timmszigat
+@license WTFPL <http://www.wtfpl.net/txt/copying/>
"""
import codecs
diff --git a/py3status/modules/sysdata.py b/py3status/modules/sysdata.py
index 0badbe0..34bf97a 100644
--- a/py3status/modules/sysdata.py
+++ b/py3status/modules/sysdata.py
@@ -1,13 +1,12 @@
# -*- coding: utf-8 -*-
"""
-Sysdata is a module used to display system information (RAM usage)
-in i3bar (Linux systems).
+Display system RAM and CPU utilization.
NOTE: If you want py3status to show you your CPU temperature,
change value of CPUTEMP into True in Py3status class - CPUInfo function
and REMEMBER that you must install lm_sensors if you want CPU temp!
-Copyright (C) <2013> <Shahin Azad [ishahinism at Gmail]>
+@author Shahin Azad <ishahinism at Gmail>
"""
import subprocess
diff --git a/py3status/modules/vnstat.py b/py3status/modules/vnstat.py
index ad33b71..5955581 100644
--- a/py3status/modules/vnstat.py
+++ b/py3status/modules/vnstat.py
@@ -1,7 +1,9 @@
-# -*- coding: utf8 -*-
+# -*- coding: utf-8 -*-
"""
-Module for displaying vnstat's statistics.
-REQUIRE external program called "vnstat" installed and configured to work.
+Display vnstat statistics.
+
+Requires:
+ - external program called "vnstat" installed and configured to work.
@author shadowprince
@license Eclipse Public License
diff --git a/py3status/modules/weather_yahoo.py b/py3status/modules/weather_yahoo.py
index df202d0..0e5d880 100644
--- a/py3status/modules/weather_yahoo.py
+++ b/py3status/modules/weather_yahoo.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
"""
-Display current day + 3 days weather forecast as icons on your i3bar
+Display Yahoo! Weather forecast as icons.
+
Based on Yahoo! Weather. forecast, thanks guys !
http://developer.yahoo.com/weather/
diff --git a/py3status/modules/whoami.py b/py3status/modules/whoami.py
index 884cbf5..aea11fb 100644
--- a/py3status/modules/whoami.py
+++ b/py3status/modules/whoami.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
-Simply output the currently logged in user in i3bar.
+Display the currently logged in user.
Inspired by i3 FAQ:
https://faq.i3wm.org/question/1618/add-user-name-to-status-bar/
diff --git a/py3status/modules/window_title.py b/py3status/modules/window_title.py
index 3972ff6..a24f61c 100644
--- a/py3status/modules/window_title.py
+++ b/py3status/modules/window_title.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
-Py3status plugin - shows current window title.
+Display the current window title.
Requires:
- i3-py (https://github.com/ziberna/i3-py)
diff --git a/py3status/modules/xrandr.py b/py3status/modules/xrandr.py
index 4ddd856..ef88925 100644
--- a/py3status/modules/xrandr.py
+++ b/py3status/modules/xrandr.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
"""
+Control your screen(s) layout easily.
+
This modules allows you to handle your screens outputs directly from your bar!
- Detect and propose every possible screen combinations
- Switch between combinations using click events and mouse scroll