本文整理汇总了Python中i3pystatus.Status类的典型用法代码示例。如果您正苦于以下问题:Python Status类的具体用法?Python Status怎么用?Python Status使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Status类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_missing_required_shows_error
def test_missing_required_shows_error():
""" Ensure that when an a required module parameter is missing an error is shown in the bar. """
status = Status(standalone=False)
status.register("text")
assert len(status.modules) > 0
assert status.modules[0].output is not None
assert "ConfigMissingError" in status.modules[0].output['full_text']
示例2: test_invalid_module_kwarg_shows_error
def test_invalid_module_kwarg_shows_error():
""" Ensure that when an invalid module kwarg is passed an error is shown in the bar. """
status = Status(standalone=False)
status.register("text", foo='bar')
assert len(status.modules) > 0
assert status.modules[0].output is not None
assert "ConfigKeyError" in status.modules[0].output['full_text']
示例3: Status
# -*- coding: utf-8 -*-
import subprocess
from i3pystatus import Status
from i3pystatus.mail import imap
status = Status(standalone=True)
status.register("pulseaudio",
format="♪ {volume_bar}",
multi_colors=True,
color_unmuted='#00ff00',
vertical_bar_width=2,
bar_type='vertical')
status.register("clock",
format="%a %d %b %I:%M:%S",)
# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load")
# Shows your CPU temperature, if you have a Intel CPU
status.register("temp",
format="{temp:.0f}°C",)
# The battery monitor has many formatting options, see README for details
# This would look like this:
# Discharging 6h:51m
示例4: Status
#!/bin/env python
import subprocess
from i3pystatus import Status
status = Status(standalone=True)
green="#1A8C01"
white="#FFFFFF"
purple="#D175FF"
red="#FF6600"
blue="#4581DD"
yellow="#DDDD11"
#Clock
status.register("clock", format="%a %d %R", color=white)
#Battery
status.register("battery",
color=yellow, charging_color=purple, full_color=green, critical_color=red,
format="❤: {percentage:02.0f}%", interval=1)
# CPU temperature
status.register("temp", color=white, format="{temp:.0f}°C")
# CPU usage (text)
# status.register("cpu_usage", format="▣ CPU: {usage_cpu1:02}% {usage_cpu1:02}% {usage_cpu2:02}% {usage_cpu3:02}%", interval=1)
status.register("cpu_usage", format="▣: {usage:02.0f}%", interval=1)
# RAM
status.register("mem", color=blue, format="≣: {percent_used_mem:02.0f}%", interval=1)
示例5: Status
# -*- coding: utf-8 -*-
import subprocess
from i3pystatus import Status
status = Status(standalone=True)
# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
# ^-- calendar week
status.register("clock",
format="%a %-d %b %X",)
status.register("weather",
location_code="GMXX0007",
colorize=True,
interval=20,
format="{current_temp} / {current_wind}",
)
# Shows pulseaudio default sink volume
#
# Note: requires libpulseaudio from PyPI
status.register("pulseaudio",
format="♪{volume}",)
# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load")
status.register("mem",
示例6: Status
# -*- coding: utf-8 -*-
import subprocess
from i3pystatus import Status
status = Status(standalone=True)
# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
# ^-- calendar week
status.register("clock",
format="%a %-d %b %X KW%V",)
# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load")
# Shows your CPU temperature, if you have a Intel CPU
status.register("temp",
format="{temp:.0f}°C",)
# The battery monitor has many formatting options, see README for details
# This would look like this, when discharging (or charging)
# ↓14.22W 56.15% [77.81%] 2h:41m
# And like this if full:
# =14.22W 100.0% [91.21%]
#
# This would also display a desktop notification (via dbus) if the percentage
# goes below 5 percent while discharging. The block will also color RED.
示例7: Status
darkred = "#cf9fa4"
green = "#68b782"
darkgreen = "#9acbad"
yellow = "#abb773"
darkyellow = "#c5cba4"
blue = "#7865c5"
darkblue = "#a396d9"
magenta = "#bb65b6"
darkmagenta = "#cf96cf"
cyan = "#68a8c5"
darkcyan = "#9ac1d9"
white = "#f1edfb"
darkwhite = "#f1edfb"
background = "#133B47"
status = Status(standalone=True)
status.register("clock",
format="%a %-d %b %X",)
# status.register("battery",
# format="{status} {percentage:.0f}% {remaining:%E%hh:%Mm}",
# alert=True,
# alert_percentage=5,
# color=white,
# critical_color=red,
# charging_color=yellow,
# full_color=white,
示例8: Status
# -*- coding: utf-8 -*-
import subprocess
from i3pystatus import Status
status = Status(standalone=True)
# Shows pulseaudio default sink volume
#
# Note: requires libpulseaudio from PyPI
status.register("pulseaudio",
format=" {volume}",
format_muted=" ")
# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
# ^-- calendar week
status.register("clock",
format=" %a %-d %b %X KW%V",)
# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load")
# Shows disk usage of /
# Format:
# 42/128G [86G]
status.register("disk",
path="/",
format=" {avail}G",)
示例9: Status
# -*- coding: utf-8 -*-
import subprocess
from i3pystatus import Status
status = Status(standalone=True)
# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
# ^-- calendar week
status.register("clock",
format="%a %-d %b %X",
color="#9a875f")
status.register("weather",
location_code="GMXX0007")
# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
# status.register("load")
# Shows your CPU temperature, if you have a Intel CPU
#status.register("temp",
# format="{temp:.0f}°C",)
# The battery monitor has many formatting options, see README for
# details
# This would look like this, when discharging (or charging)
示例10: __iter__
"""Return list of keys."""
return self._data.keys()
def __iter__(self):
return self._data.__iter__()
def __len__(self):
return len(self._data.keys())
# Load settings from ``$HOME/.i3/local_settings.json
my_settings = MySettings()
# Initialize i3pystatus instance
status = Status(standalone=True)
# Displays clock like this: # Tue 30 Jul 11:59:46 PM KW31
# ^-- calendar week
status.register("clock",
format=" %Y-%m-%d %H:%M KW%V ",
on_leftclick='gsimplecal',
)
# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load",
format=" {avg1},{avg5},{avg15},{tasks} ",)
# Shows your CPU temperature, if you have a Intel CPU
status.register("temp",
示例11: Status
# -*- coding: utf-8 -*-
import subprocess
from i3pystatus import Status
status = Status(standalone=True)
# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
# ^-- calendar week
status.register("clock",
format="%a %-d %b %X",)
# Shows your CPU temperature, if you have a Intel CPU
# status.register("temp",
# format="{temp:.0f}°C",)
status.register("cpu_usage",
format="{usage:02}%",)
# The battery monitor has many formatting options, see README for details
# This would look like this, when discharging (or charging)
# ↓14.22W 56.15% [77.81%] 2h:41m
# And like this if full:
# =14.22W 100.0% [91.21%]
#
# This would also display a desktop notification (via dbus) if the percentage
# goes below 5 percent while discharging. The block will also color RED.
status.register("battery",
format="{status} {consumption:.0f}W {percentage_design:.0f}% {remaining:%E%hh:%Mm}",
示例12: Status
from i3pystatus_custom_modules import CustomBackupsMonitor
from i3pystatus import Status
status = Status(standalone=True)
status.register("clock",
format="%Y-%m-%d %H:%M:%S",)
status.register("pomodoro",
sound="~/dotfiles/scripts/fire-pager.wav",)
# Shows pulseaudio default sink volume
# Note: requires libpulseaudio from PyPI
status.register("pulseaudio",
format="♪: {volume}%",)
status.register("backlight",
format="* {brightness}/{max_brightness}",
interval=2,
)
# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load",
critical_limit=4,
format="{avg1} {tasks}",
)
# Shows your CPU temperature, if you have a Intel CPU
# status.register("temp",
# format="{temp:.0f}°C",)
示例13: Status
#
# Docs: https://docs.enkore.de/i3pystatus/
from i3pystatus import Status
status = Status()
def dget(d, *path):
d2 = d
for p in path:
d2 = d2[p]
return d2
def dassoc(d, key, val):
assert isinstance(d, dict)
d2 = dict(d)
d2[key] = val
return d2
def dmerge(d, *dicts):
d2 = dict(d)
for d in dicts:
d2.update(d)
return d2
icon_color = "#dbe6ec"
sep_color = "#3f4f66"
# green
ok_color = "#a0ee9c"
# yellow
warn_color = "#eedd92"
# red
示例14: glob
#!/usr/bin/env python3
import os
from subprocess import run
from glob import glob
import netifaces
from i3pystatus import Status
terminal = 'gnome-terminal'
is_notebook = os.path.isdir('/proc/acpi/battery/') or glob('/sys/class/power_supply/BAT*')
status = Status(interval=1)
status.register('clock', format='%X')
status.register('clock', format='%a %-d %b W%V', interval=30)
#status.register('temp', format='{temp:.0f}°C')
if is_notebook:
batfmt = 'Bat: {status}{percentage:.2f}% {remaining:%E%hh:%Mm}'
status.register('battery', format=batfmt, alert=True, alert_percentage=10, status={'DIS': '↓', 'CHR': '↑', 'FULL': ''})
status.register('pulseaudio', format='♪{volume}')
status.register('load', format='{avg1} {avg5} {avg15}', on_leftclick=f'{terminal} -e "htop --sort-key=PERCENT_CPU"')
status.register('mem', format='Mem: {percent_used_mem:.2f}%', on_leftclick=f'{terminal} -e "htop --sort-key=PERCENT_MEM"')
ifaces = netifaces.interfaces()
ifaces = sorted(ifaces, key=len)
lan1 = next(( i for i in ifaces if i.startswith('enp')), None)
if lan1:
status.register('network', interface=lan1,
示例15: Status
#!/usr/bin/python3
from i3pystatus import Status
import locale
locale.setlocale(locale.LC_ALL, 'nb_NO.UTF-8')
status = Status(standalone=True)
# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
# ^-- calendar week
status.register("clock",
format="%a %d.%m %H:%M",
interval = 5)
# The battery monitor has many formatting options, see README for details
# This would look like this, when discharging (or charging)
# ↓14.22W 56.15% [77.81%] 2h:41m
# And like this if full:
# =14.22W 100.0% [91.21%]
#
# This would also display a desktop notification (via dbus) if the percentage
# goes below 5 percent while discharging. The block will also color RED.
#status.register("battery",
# format="{status} [{consumption:.1f}W ]{percentage:.0f}%[ {remaining:%E%hh:%Mm}]",
# alert=True,
# alert_percentage=5,
# status={
# "DIS": "↓",
# "CHR": "↑",
# "FULL": "⚡"