示例#1
0
    def __init__(self, conf_file, layout):
        self.conf = Config(conf_file, layout)
        self.entities = []
        self.bar = Status(standalone=True)

        for e in self.conf.entities:
            self.entities.append(ModFacade(e, self.conf.config))
示例#2
0
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']
示例#3
0
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']
示例#4
0
def nerdfont(status: Status, text: str, size: str = "xx-large") -> None:
    status.register(
        "text",
        text=f'<span font_size="{size}" color="white">{text}</span>',
        hints={
            "markup": "pango",
            "separator": False,
            "separator_block_width": 5
        },
    )
示例#5
0
def conkysymbol(status: Status, text: str) -> None:
    status.register(
        "text",
        text=
        f'<span font="ConkySymbols" font_size="large" color="white">{text}</span>',
        hints={
            "markup": "pango",
            "separator": False,
            "separator_block_width": 5
        },
    )
示例#6
0
class Bar:
    def __init__(self, conf_file, layout):
        self.conf = Config(conf_file, layout)
        self.entities = []
        self.bar = Status(standalone=True)

        for e in self.conf.entities:
            self.entities.append(ModFacade(e, self.conf.config))

    def run(self):
        for ent in self.entities:
            [ m.register(self.bar) for m in ent.get_mods() ]
        self.bar.run()
示例#7
0
from i3pystatus import Status
status = Status()

status.register("clock",
    format="%a %-d %b %X",)

status.register("load")

status.register("temp",
    format="{temp:.0f}°C",)

status.register("disk",
    path="/",
    format="{used}/{total}G [{avail}G]",)

status.register("pulseaudio",
    format="♪{volume}",)

status.run()
示例#8
0
# -*- 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
0
# -*- coding: utf-8 -*-

import subprocess
from i3pystatus import Status

status = Status(standalone=True)

# audio
status.register("pulseaudio",
                # color="#000000",
                color_muted="#c57b0e",
                format_muted="♪: M",)

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
                # color="#000000",
                format="%a %-d %b %X",)

# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load",
                # color="#000000",
                critical_color="#c57b0e",)

# Shows the current memory usage by the system in MiB
status.register("mem",
                color="#3eb0d1",
                warn_color="#c57b0e",
                alert_color="#c57b0e",
示例#10
0
##import i3pystatus
#This does not work for some reason
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 W%W", "%X")
    format="%a %-d.%b %H:%M:%S Week:%W")

# 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%]
#
示例#11
0
# -*- coding: utf-8 -*-
#
import subprocess
import os
import os.path

from i3pystatus import Status
# from i3pystatus.updates import pacman, cower
from i3pystatus.weather import weathercom

status = Status()

###################################
# color
###################################

# Base16 Eighties
base00 = "#2d2d2d"
base01 = "#393939"
base02 = "#515151"
base03 = "#747369"
base04 = "#a09f93"
base05 = "#d3d0c8"
base06 = "#e8e6df"
base07 = "#f2f0ec"
base08 = "#f2777a"
base09 = "#f99157"
base0A = "#ffcc66"
base0B = "#99cc99"
base0C = "#66cccc"
base0D = "#6699cc"
示例#12
0
#!/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)
示例#13
0
#!/usr/bin/env python3

from i3pystatus import Status
from i3pystatus.mail import maildir
import os

status = Status()

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
                format="%Y-%m-%d %H:%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")

status.register("cpu_usage",
                format="CPU {usage:3.0f}%")

# Shows your CPU temperature, if you have a Intel CPU
status.register("temp",
                alert_temp=70,
                file="/sys/class/hwmon/hwmon1/temp1_input",
                format="Core: {temp:.0f}°C",)
status.register("temp",
                alert_temp=70,
                format="{temp:.0f}°C",)

示例#14
0
from i3pystatus import Status

status = Status()

# 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 D-Bus) if the percentage
# goes below 5 percent while discharging. The block will also color RED.
# If you don't have a desktop notification demon yet, take a look at dunst:
#   http://www.knopwob.org/dunst/
示例#15
0
from i3pystatus import Status

status = Status()

status.register(
    "battery",
    format="{status} {percentage:.2f}% {remaining:%E%hh:%Mm}",
    alert=True,
    alert_percentage=10,
    status={
        "DIS": "↓",
        "CHR": "↑",
        "FULL": "FULL",
    },
)

status.register(
    "network",
    interface="wlp2s0",
    format_up="IP: {v4cidr}",
)

status.register(
    "network",
    interface="wlan0",
    format_up="{essid} {quality:03.0f}%",
)

status.register(
    "disk",
    path="/",
示例#16
0
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,
示例#17
0
"""i3 bar config file"""

from i3pystatus import Status

status = Status()  # pylint: disable=I0011,C0103

status.register(
    "clock",
    format="%a %-d %b %X",
)

status.register(
    "mem",
    format="{avail_mem}",
)

status.register(
    "load",
    format="{avg1}",
)

status.register(
    "network",
    interface="eno1",
    format_up="{v4cidr}",
    format_down="",
)

status.register(
    "network",
    interface="wlp2s0",
示例#18
0
    interval = 5
    up_face = '◕ ◡ ◕'
    down_face = '◕︵◕'

    def run(self):
        try:
            networks = os.listdir('/var/run/juniper')
        except OSError:
            networks = []
        self.output = {
            'full_text': '{} {}'.format(self.up_face, ' '.join(networks))
                         if networks else self.down_face,
        }


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 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",)
示例#19
0
def main():
    # Register from right to left.
    status = Status()
    status.register('clock', format=('🌍 %H:%M', 'Europe/Dublin'))
    status.register('clock',
                    format=(' / %H:%M', 'America/New_York'),
                    hints={'separator': False})
    status.register('clock',
                    format=('🌎 %H:%M', 'America/Los_Angeles'),
                    hints={
                        'separator': False,
                        'separator_block_width': 0
                    })
    status.register('clock',
                    format=('🌏 %H:%M', 'Asia/Hong_Kong'),
                    hints={'separator': False})
    status.register('shell',
                    command='~/.config/i3/i3status/today.py',
                    hints={'separator': False})
    status.register('shell', command='~/.config/i3/i3status/weather.sh')

    status.register('battery',
                    format='{status} {percentage:.1f}%',
                    charging_color='#F8F8F8',
                    full_color='#F8F8F8',
                    status={
                        'CHR': '🔌',
                        'DIS': '🔋',
                        'DPL': 'DPL',
                        'FULL': '⚡',
                    })
    status.register('pulseaudio',
                    format='🔉 {volume}%',
                    format_muted='🔇 Muted',
                    color_muted='#AB4642',
                    hints={'separator': False},
                    on_leftclick='switch_mute')
    status.run()
示例#20
0
#!/usr/bin/env python3
from i3pystatus import Status
from collections import defaultdict
from string import Formatter
from i3pystatus.weather import weathercom
from i3pystatus import IntervalModule

status = Status()

status.register("shell",
                command="/usr/local/bin/zshn",
                color="#FA7A94",
                interval=300)

status.register("shell",
                command="/usr/local/bin/vscoden",
                color="#0FC0FF",
                interval=300)

status.register("shell",
                command="/usr/local/bin/vimn",
                color="#99AAFF",
                interval=300)

status.register("shell",
                command="/usr/local/bin/torn",
                color="#CA30B2",
                interval=300)

status.register("shell",
                command="/usr/local/bin/adeptn",
示例#21
0
from i3pystatus import Status
from i3pystatus.updates import pacman
"""
Python packet dependency:
colour
netifaces
basiciw
psutil
"""

status = Status(standalone=True)

status.register("clock",
                format="%d %B %H:%M",
                hints={"color": "#ffffff"},
                on_leftclick="xdg-open https://calendar.google.com")

status.register(
    "battery",
    hints={"color": "#ffffff"},
    format=
    "{status} {consumption:.0f}W {percentage:.2f}% {remaining:%E%hh:%Mm}",
    alert_percentage=15,
    charging_color="#F2FF00",
    status={
        "DIS": "",
        "CHR": "",
        "FULL": "",
    })

status.register("pulseaudio",
示例#22
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from i3pystatus import Status
from i3pystatus.updates import aptget

COLAU = "#66AAFF"
COLAU2 = "#7799FF"
COLHW = "#999999"
COLIN = "#FFFFFF"

status = Status()

status.register("clock",
                color=COLIN,
                format="%a %-d %B %Y %T",)

status.register("online",
                hints = {"separator": False, "separator_block_width": 1},
                format_online="",
                color=COLAU,
                format_offline="",
                color_offline="#ff0000")

status.register("shell",
                hints = {"separator": False, "separator_block_width": 1},
                ignore_empty_stdout=True,
                color=COLIN,
                command="i3pystatus-commands wifi",
                interval=2)

status.register("keyboard_locks",
示例#23
0
from i3pystatus import Status

status = Status()

# Clock
status.register(
    "clock",
    hints={"markup": "pango"},
    format=['%a %b %-d %b %X', '%X'],
)

# 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 D-Bus) if the percentage
# goes below 5 percent while discharging. The block will also color RED.
# If you don't have a desktop notification demon yet, take a look at dunst:
#   http://www.knopwob.org/dunst/
status.register(
    "battery",
    hints={"markup": "pango"},
    format=
    "{status}/{consumption:.2f}W {percentage:.2f}% [{percentage_design:.2f}%] {remaining:%E%hh:%Mm} ",
    alert=True,
    alert_percentage=5,
    status={
        "DIS": "↓",
示例#24
0
# -*- coding: utf-8 -*-

from i3pystatus import Status

status = Status(standalone=True)

# Displays clock like this:
# So 27 Dez 23:41:20
status.register(
    "clock",
    format="%a %-d %b %X",
)

# 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}", critical_limit=3)

# Shows your CPU temperature, if you have a Intel CPU
status.register("temp",
                format="{Package_id_0}°C",
                lm_sensors_enabled=True,
                dynamic_color=True)

status.register("solaar", nameOfDevice="MX Ergo")

# This would look like this:
# Discharging 6h:51m
status.register(
    "battery",
    format="{status} {remaining:%E%hh:%Mm} {percentage:.2f}%",
    alert=True,
示例#25
0
 def register(self, *args, **kwargs):
     module = Status.register(self, *args, **kwargs)
     if module:
         module.on_change = self.run
     return module
示例#26
0
# -*- 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
示例#27
0
#!/usr/bin/env python3

import os
from glob import glob

import netifaces
from i3pystatus import Status

terminal = 'kitty'

is_notebook = os.path.isdir('/proc/acpi/battery/') or glob(
    '/sys/class/power_supply/BAT*')

status = Status(interval=1)
status.register('clock', format='%X', interval=1)
status.register('clock', format='%a %-d %b W%V', interval=30)
#status.register('temp', format='{temp:.0f}°C')

if is_notebook:
    status.register(
        'battery',
        # format='{bar} {percentage_design:.2f}%{remaining:%E %hh:%Mm}',
        format='Bat: {status}{percentage:.2f}% {remaining:%E%hh:%Mm}',
        alert=True,
        alert_percentage=15,
        interval=10,
        status={
            'DIS': '↓',
            'CHR': '↑',
            'FULL': ''
        })
示例#28
0
        self.data = self.te.__dict__
        self.output = {
            "full_text":
            "{limit:.0f}% R:{remaining}d ({remper:.0f}%)".format(
                limit=percent,
                remaining=mobiledata['remainingDaysForRenewal'],
                remper=remainingpercent),
            'color':
            color
        }

    def refresh(self):
        self.run()


status = Status(standalone=True, logfile='$HOME/.cache/i3pystatus.log')
dategroup = Group()
dategroup.register("clock",
                   on_rightclick='rofi -modi "Clock:roficlock" -show Clock',
                   format="%H:%M")
dategroup.register("clock", on_rightclick='mycal', format="%a %-d %b %Y")
status.register(dategroup)
status.register("pulseaudio",
                format="♪{volume}",
                bar_type="horizontal",
                multi_colors=True)
status.register('now_playing', status={'play': '', 'pause': '', 'stop': ''})
status.register(
    "temp",
    format="{temp:.0f}°C",
)
示例#29
0
from i3pystatus import Status
from i3pystatus.updates import pacman, cower
from i3pystatus.weather import weathercom

import socket

host = socket.gethostname()
isLaptop = False

if host == "PaCC-RST":
    isLaptop = True

COLOR_RED = '#af3a03'
COLOR_NORMAL = '#fdf4c1'

status = Status(standalone=True)

# Displays clock like this:
status.register(
    "clock",
    format="  %a %-d.%m.%Y   %X",
)

if isLaptop:
    status.register(
        'battery',
        format=
        ' {consumption} [{status} ]{percentage_design:.2f}% {remaining}',
        alert=True,
        alert_percentage=15,
        status={
示例#30
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import subprocess

from i3pystatus import Status

status = Status(standalone=True)

status.register("clock",
    format="\uf133 %Y-%m-%d \uf017 %T",)

# 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",)

status.register("battery",
    format="{status} {percentage_design:.2f}% {remaining:%E%hh:%Mm}",
    alert=True,
    alert_percentage=5,
    status={
        "DIS": "\uf0e7",
        "CHR": "\uf1e6",
        "FULL": "\uf0e7",
    },)

status.register("network",
示例#31
0
#!/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": "⚡"
示例#32
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from i3pystatus import Status
from i3pystatus.mail import thunderbird

status = Status(standalone=True)

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("disk",
    path="/",
    critical_limit = 5,
    format = "root: {avail}GB/{total}GB",
    )
status.register("disk",
    path="/boot",
    critical_limit = 20,
    divisor = 1024 ** 2,
    format = "boot: {avail}MB/{total}MB",
    )
status.register("disk",
    path="/home",
    critical_limit = 20,
    format = "home: {avail}GB/{total}GB",
    )
status.register("usb",
    hints = {"markup": "pango"},
    )
status.register("mpd",
示例#33
0
#!/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,
示例#34
0
from i3pystatus import Status

status = Status(standalone=True)

# Screensaver inhibitor
status.register("dpms",
    format="▒▒",
    color="#ffffff",
    color_disabled="#de935f",)

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM
status.register("clock",
    format=" %a %-d %b %l:%M:%S %p ",)

# Battery
status.register("battery",
    format="{status} {remaining} {bar}",
    color="#b4b7b4",
    full_color="#b4b7b4",
    charging_color="#b4b7b4",
    critical_color="#cc6666",
    status={'CHR': 'CHR', 'DIS': 'DIS', 'FULL': 'BAT', 'DPL': 'DPL'},)
    
# Network graph & traffic speed
# Requires: colour, netifaces, psutil, basiciw
status.register("network",
    interface="wlp3s0",
    format_up="{interface} @ {essid} [{quality}%]",
    format_down="{interface}: DOWN",
    dynamic_color=False,
示例#35
0
# 
# 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
示例#36
0
import subprocess

from i3pystatus import Status

#from i3pystatus.core 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",
)
# status.reti

# 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(
    "weather",
    city_code="PLXX0049",
)

status.register(
    "disk",
    path="/var",
    format="/var [free {avail}G]",
)
示例#37
0
from i3pystatus import Status
from i3pystatus import get_module
from i3pystatus.core.command import run_through_shell

status = Status()

# Displays clock
status.register("clock",
        format="%a %-d %b %H:%M",)

# Shows the average load of the last minute and the last 5 minutes
status.register("load")

status.register("battery",
    format="{status} {percentage:.2f}% {remaining:%E%hh:%Mm}",
    alert=True,
    alert_percentage=10,
    status={
        "DIS": "🔋",
        "CHR": "🔌",
        "FULL": "🔥",
    },)

# Note: requires both netifaces and basiciw (for essid and quality)
status.register("network",
    interface="wlp58s0",
    format_up="📶 {essid} {quality:3.0f}%",)

status.register("openvpn",
    vpn_name="nordvpn_au298_udp",
    use_new_service_name=True,)
示例#38
0
# -*- 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")

# 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%]
#
示例#39
0
#!/usr/bin/env python3
from i3pystatus import Status
from collections import defaultdict
from string import Formatter
from i3pystatus.weather import weathercom
from i3pystatus import IntervalModule

status = Status()

status.register("clock", format="%A %d %B %Y %r")

status.register("disk",
                path="/data",
                round_size=1,
                format="/data {used}/{total}G")

status.register("disk", path="/", round_size=1, format="/ {used}/{total}G")

status.register("mem",
                format="RAM {used_mem}/{total_mem}G",
                color="#FFFFFF",
                divisor=1073741824,
                round_size=3)

status.register("load", format="Load {avg1}")

status.register("cpu_usage", format="CPU {usage}%")

status.register("temp",
                format="{Core_0}°C {Core_1}°C {Core_2}°C {Core_3}°C",
                hints={"markup": "pango"},
示例#40
0
from i3pystatus import Status
from get_colors import colors

special = colors["special"]
colors = colors["colors"]

status = Status(logfile='$HOME/.config/i3pystatus/log.txt')

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register("clock",
    hints = {"markup": "pango", "separator_block_width": 0, "separator": False},

    format = f"<span color='{colors['color2']}' background='{colors['color3']}'>\ue0ba</span>" +\
             f"<span color='{special['background']}' background='{colors['color2']}'> \uf455 %d.%m.%y </span>" +\
             f"<span color='{colors['color1']}' background='{colors['color2']}'>\ue0ba</span>" +\
             f"<span color='{special['background']}' background='{colors['color1']}'> \uf64f %H:%M </span>"

    #format = "%A %d %b %y - %X"
                )

# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load",
    hints = {"markup": "pango", "separator_block_width": 0, "separator": False},
    format = f"<span color='{colors['color3']}' background='{colors['color4']}'>\ue0ba</span>" +\
             f"<span color='{special['background']}' background='{colors['color3']}'> \ue266 {{avg1}} </span>"
                )

# Shows your CPU temperature, if you have a Intel CPU
示例#41
0
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",)
示例#42
0
文件: i3py.py 项目: kadamski/dotconf
#!/home/k/virtualenvs/i3pystatus/bin/python3
from i3pystatus import Status
from i3pystatus.mail import imap
import locale
import os.path
import configparser
locale.setlocale(locale.LC_ALL, 'pl_PL')

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,
                on_leftclick = "zenity --calendar")

# 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,
示例#43
0
BASE01 = '#586e75'
BASE00 = '#657b83'
BASE0 = '#839496'
BASE1 = '#93a1a1'
BASE2 = '#eee8d5'
BASE3 = '#fdf6e3'
YELLOW = '#b58900'
ORANGE = '#cb4b16'
RED = '#dc322f'
MAGENTA = '#d33682'
VIOLET = '#6c71c4'
BLUE = '#268bd2'
CYAN = '#2aa198'
GREEN = '#859900'

status = Status(standalone=True)

# Displays clock like this:
# Tue 30 Jul 23:59
status.register(
    'clock',
    color=BASE0,
    format=' %a %b %-d %H:%M',
    on_leftclick='i3-msg "workspace 4: cal"',
)

# Fake iStat Menus
# CPU
status.register(
    'cpu_usage_graph',
    interval=2,
示例#44
0
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,
示例#45
0
# -*- 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}",
示例#46
0
# -*- 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.
示例#47
0
from i3pystatus import Status
import os
import netifaces

status = Status(standalone=True)


def format_label(label, text):
    return "<span color=\"#FFDD00\">" + label + "</span> " + text


status.register("text", text="")

status.register("clock",
                format=format_label("DATE", "%a %-d %b %X"),
                hints={"markup": "pango"})

for interface in ['wlp4s0', 'enp7s0']:
    if interface in netifaces.interfaces():
        status.register("network",
                        interface=interface,
                        format_up=format_label("NET", "{v4}"),
                        format_down="NET DOWN",
                        color_up="#FFFFFF",
                        color_down="#FF0000",
                        hints={"markup": "pango"})

for power_supply in os.listdir("/sys/class/power_supply/"):
    type_file = open("/sys/class/power_supply/" + power_supply + "/type", "r")
    if type_file.readline().startswith("Battery"):
        type_file.close()
示例#48
0
文件: bar.py 项目: coderiot/dotfiles
# -*- 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",
示例#49
0
        """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",
示例#50
0
文件: status.py 项目: Shinmera/.i3
from i3pystatus import Status
import os
import netifaces

status = Status(standalone=True)

def format_label(label, text):
    return "<span color=\"#FFDD00\">"+label+"</span> "+text

status.register("text", text="")

status.register("clock",
                format=format_label("DATE","%a %-d %b %X"),
                hints={"markup":"pango"})

for interface in ['wlp4s0','enp7s0']:
    if interface in netifaces.interfaces():
        status.register("network",
                        interface=interface,
                        format_up=format_label("NET","{v4}"),
                        format_down="NET DOWN",
                        color_up="#FFFFFF",
                        color_down="#FF0000",
                        hints={"markup":"pango"})

if os.listdir("/sys/class/power_supply/") != []: 
    status.register("battery",
                    format=format_label("BAT","{percentage:.2f}%{status} {remaining:%E%hh:%Mm} {consumption:.2f}W"),
                    alert=True,
                    alert_percentage=5,
                    status={"DIS":"↓", "CHR":"↑", "FULL":"="},
示例#51
0
# -*- 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)
示例#52
0
# -*- coding: utf-8 -*-

import subprocess
import os

from i3pystatus import Status

status = Status(standalone=True)

# Clock
status.register("clock",
    format="⌚ %Y-%m-%d %H:%M",)

# CPU temperature
status.register("temp",
    file="/sys/class/thermal/thermal_zone1/temp",
    format="{temp:.0f}°C",
    interval=3,)

# Battery
status.register("battery",
    battery_ident="BAT",
    format="{percentage_design:.1f} % ({status})",
    alert=True,
    alert_percentage=10,
    status={
        "DIS": "↓",
        "CHR": "↑",
        "FULL": "=",
    },)
示例#53
0
# -*- 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 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",)


# Displays whether a DHCP client is running
#status.register("runwatch",
#    name="DHCP",
#    path="/var/run/dhclient*.pid",)

# Shows the address and up/down state of eth0. If it is up the address is shown in
# green (the default value of color_up) and the CIDR-address is shown
# (i.e. 10.10.10.42/24).
示例#54
0
""" status i3wm """
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from i3pystatus import Status
# from colour import Color

status = Status()

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register(
    "clock",
    format="%a %-d %b %X",
)

# Shows the average load of the last minute and the last 5 minutes
# (the default value for format is used)
status.register("load")

# 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 D-Bus) if the percentage
# goes below 5 percent while discharging. The block will also color RED.
# If you don't have a desktop notification demon yet, take a look at dunst:
#   http://www.knopwob.org/dunst/
# status.register("battery",
示例#55
0
# -*- coding: utf-8 -*-

#import subprocess

import os

from i3pystatus import Status
import netifaces

green = "#8ae234"
yellow = "#fce94f"
orange = "#f57900"
red = "#ef2929"
gray = "#aaaaaa"

status = Status(standalone=True)

status.register("keyboard_locks", format="{caps}", caps_off="", caps_on=" CAPS", color="#ff0000")

status.register("clock", format="   %a %d/%m %X ",)

if os.uname()[1] == 'stark':
    status.register("battery",
                    format=" {status}  {percentage:.1f}% {remaining:%E%h:%M} ",
                    alert=True, alert_percentage=5,
                    status={ "DIS": "", "CHR": "", "FULL": "", },
                    not_present_text = "  ",
                    full_color=green,
                    charging_color=yellow,
                    critical_color=red,
                    not_present_color=gray,
示例#56
0
from i3pystatus import Status
from i3pystatus.calendar.khal_calendar import Khal
from i3pystatus.calendar.lightning import Lightning

status = Status()

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week
status.register(
    "clock",
    format="%a %-d %b %X KW%V",
)

# nah does not work
#status.register("calendar",
#            format="{title} {remaining}",
#            update_interval=10,
#            urgent_blink=True,
#            backend=Lightning(database_path=path, days=2))

# 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",
)
示例#57
0
from i3pystatus import Status

status = Status(standalone=True)

# Shows pulseaudio default sink volume
#
# Note: requires libpulseaudio from PyPI
status.register("pulseaudio",)

status.register("backlight", 
    backlight="intel_backlight", 
    format="{percentage}",)

# 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