The script layout_img.py contains the path_color_layout
function that takes as single argument an hexcolor-like string like
"FF0000" and returns a path that may be used as custom layout
icon dir. in CurrentLayout official widget.
Currently, the script uses /tmp to create colored icons.
For example, two icons using "4989BC" color:
If an error occured during process, the script returns default directory of qtile resources, so the widget remains white colored.
In your config.py file:
from widgets.layout_img import path_color_layout # line to customize...
...
layout_icons_dir = path_color_layout("FF0000")
...
mywidgets = [
...
widget.CurrentLayout(mode='icon',
scale=.9,
custom_icon_paths=[layout_icons_dir]),
...
]
...This module contains a class you should use to access (x,y) coordinates in your widget.
In your new own widget file:
from .click_coords import Click_coords_mixin
class My_new_widget(Click_coords_mixin, base._Widget):
...
def __init__(self, *args, **config):
super().__init__(length=0, **config)
#
self.set_click_handler(self.on_click)
# now whatever you want in your widget
...
def on_click(self, x, y):
# whatever you want to do using x and y
...These widgets access to some default variables set in widget_defaults variable, as font, fontsize, padding and foreground. Please, pay attention to set these default variables if you wish to use widgets defined in this page.
Default options example (use gap=1 option if needed):
Image with 2 years and ice colormap with reversed colors:
The Ghcw widget needs click_coords.py file and the ghcw.py file.
Install them using a git clone command or just in copying the file in a ~/.config/qtile/widgets/ directory (and create in it a __init__.py empty file).
You will also need the aiohttp and colormaps libraries : pip install aiohttp colormaps.
You have to get a token from the official github site. It's an easy task (via settings and developer settings menus), I recommand to create a new token for just that widget purpose. You'll need a classic token and the read:user permission.
For example, in your config.py :
frow widgets import ghcw # if you put ghcw.py in a `widgets` dir.
...
my_bar_widgets = [
...
ghcw.Ghcw("YOUR GITHUB TOKEN", idgithub="torvalds"),
...
]
...Unlike original Github diagram, the week begins on Monday.
Currently 6 options:
colors: a five hex RGB colors string tab using"000000"for black and"ffffff"for white. Default isNoneas default config uses athemedefault.empty_cell_color: RGB color string for 0 contrib. Useful to set according to qtile bar background. Default isNoneas default config uses athemedefault.gap: distance in pixel between two squares. Default isNone, in this casegapis calculated. Best visual results with small values as1.idgithub: the Github username you want to access. Default is'cobacdavid'.nweeks: number of weeks i.e. columns to display. Default is 52 (a full year).revcolors: boolean value to reverse colors order. Default isFalse.theme: a color palette to use. Default is'ghcw_gho', github usual palette. You can use a colormap name form colormaps libray.
If you use a predefined theme, colors option will be ignored but empty_cell_color will replace the first RGB color of the theme palette.
- Left click sends a notification on the day you click on for example:
Sun 11 Jan 26: 2 contributions. - Middle click on the widget opens the username github page.
- Right click switch current theme with embeded themes:
ghcw_lgt,ghcw_drk,ghcw_gho,ghcw_ghd,ghcw_bdx,ghcw_redandghcw_blu.
The widget offers a 10x10 square pixels matrix. According to a value in [0-100] interval, the widgets lights up pixels.
Pixels are chosen randomly. For example, with a battery charge: 100% lights up every pixel, while 50% lights up half of the pixels.
The value comes from a shell command or a Python function.
The Matrix widget is in the matrix.py standalone file.
Install it using a git clone command or just in copying the file in a ~/.config/qtile/widgets/ directory (and create in it a __init__.py empty file).
For example, in your config.py :
frow widgets import matrix # if you put matrix.py in a `widgets` dir.
...
my_bar_widgets = [
...
matrix.Matrix(inmargin=0, cmd=r"cat /sys/class/power_supply/BAT0/capacity"),
...
]
...ìnmargin(int): margin all around the square. Default is2(pixels) ;update_interval(int): delay in seconds between two refreshs of the widget. Default is300(seconds=5 minutes) ;cmd(str): shell command to execute to get the value. The command has to return a number between 0 and 100. Default isr"echo $(( RANDOM % 101 ))". Note: The string resulting will be stripped if it contains unwanted blank spaces. So don't worry about extra spaces...execshell(str): path to shell to be used. Default is"/usr/bin/bash".pyfunc(function): a Python function returning a number between 0 and 100. Default isNone.
If pyfunc is not None, the shell command will be ignored.
No interaction.
The widget offers a tixy experience (https://tixy.land/) associated with net UP or DOWN. Animation continues if UP else animation stops.
The Tixynet widget is in the tixynet.py standalone file.
Install it using a git clone command or just in copying the file in a ~/.config/qtile/widgets/ directory (and create in it a __init__.py empty file).
For example, in your config.py :
frow widgets import tixynet # if you put tixynet.py in a `widgets` dir.
...
my_bar_widgets = [
...
tixynet.Tixynet(iface="enp3s0"),
...
]
...iface(str): network interface. Default is"eth0".iface_interval(int): delay in seconds between two net UP check. Default is5.colors(list[str, str]): colors array, first element for positive color, second d for negative. Default is["ffffff", "ff0000"].force_step(float): Forces fake timetstep. Can be useful using greatupdate_intervalto get a slow animation. Default isNone.ìnmargin(int): margin all around the widget. Default is2(pixels) ;pyfunc(function): a Python function returning a number between -1 and 1. Default is"lambda t,i,x,y: math.sin(y/8+t)".update_interval(int): delay in seconds between two refreshs of the widget. This controls thetparameter. Default is1(refresh every second).wandhcontrol number of cells, respectively in width and height. Default values are respectively20and10.
No interaction.
An alternative clock with 4 available layouts.
The Clock widget is in the clock.py standalone file.
Install it using a git clone command or just in copying the file in a ~/.config/qtile/widgets/ directory (and create in it a __init__.py empty file).
For example, in your config.py :
frow widgets import clock # if you put clock.py in a `widgets` dir.
...
my_bar_widgets = [
...
clock.Clock(),
...
]
...fmts(list[str, str]): two usual time string formats. Default is["%d/%m", "%H:%M"].gapy(int): vertical space between the two displays in pixels, uisng state 0 or 1. Default is2pixels.state(int): 0, 1, 2 or 3. Default is0.0: 1st format above 2nd1: 2nd format above 1st2: 1st format only3: 2nd format only
Left and right click change state.
An alternative volume with 2 available layouts.
The Volume widget is in the volume.py standalone file.
Install it using a git clone command or just in copying the file in a ~/.config/qtile/widgets/ directory (and create in it a __init__.py empty file).
For example, in your config.py :
frow widgets import volume # if you put volume.py in a `widgets` dir.
...
my_bar_widgets = [
...
volume.Volume(),
...
]
...bar_bg(str): color of bar background. Default is"cccccc".bar_length(int): for"h"orientation only. Widget length. Default is40pixels.bar_width(int): bar thickness. Default is10.cellgap(int|float): space between two cells. Default is1. Ignored noncellsoption.execshell(str): shell to use to executeamixercommands. Default is"/usr/bin/bash".ncells(int): number of cells to draw. Default isNone. If notNone, the volume bar is drawn using cells.orient(str):"h"or"v"for horizontal or vertical mode. Default isv.step(int): when increasing or decreasing volume withamixer, amount of volume measure. Default is1000.ymargin(int): y margin in pixels. Default is2.
Left click toggle mute mode, volume bar is no more filled but outlined. Using wheel increases or decreases volume.
An alternative versatile percentage widget.
The Pct widget is available with pct.py and flower_pbar.py files. You also need the colormaps libraries : pip install colormaps.
Install them using a git clone command or just in copying the files in a ~/.config/qtile/widgets/ directory (and create in it a __init__.py empty file).
For example, in your config.py :
frow widgets import pct # if you put pct.py in a `widgets` dir.
...
my_bar_widgets = [
...
pct.Pct(),
...
]
...Below a complete example of a volume control widget using Pct:
def volume_exec(cmd):
import subprocess
subprocess.run(cmd, text=True, shell=True, executable="/usr/bin/bash")
def mute(obj):
volume_exec("amixer set Master mute")
obj.draw_method = "stroke"
def unmute(obj):
volume_exec("amixer set Master unmute")
obj.draw_method = "fill"
def inc_v(obj):
volume_exec("amixer set Master 5%+")
def dec_v(obj):
volume_exec("amixer set Master 5%-")
...
pct.Pct(cmd="amixer get Master "
"| awk -F'[][]' 'END{print $2}' | tr -d '%'",
colors=[flower_active, flower_inactive],
text="vol",
nsectors=20,
update_interval=.2,
button1=mute,
button3=unmute,
button4=inc_v,
button5=dec_v)
...button[1-7](str): optional python callback functions for interactive use. Default isNone.center_text(bool): it displays the progressbar and the text centered. Default isTrue.cmd(str): command to execute to get the value to represent. Default is"awk '/MemTotal/ {t=$2} /MemAvailable/ {a=$2} END {printf \"%.0f\\n\", ((t-a)/t)*100}' /proc/meminfo", it returns RAM memory currently used.colormap(str): colormap fromcolormapslib. Default isNone.colormap_rev(bool): boolean to reverse colormap. Default isFalse.colors(list[str, str]): colors array, first element for positive color, second d for negative. Default is["ffffff", "ff0000"].execshell(str): shell to use to executeamixercommands. Default is"/usr/bin/bash".inradius(float): if given respect inner radius in pixels. Default isNone, in this case, the value is 10% of bar height.hide_text(bool): do not show the text. Default isFalse.max(float): max of values. Default is100.min(float): min of values. Default is0.nsectors(int): number of sectors to use. Default is10, min is2.rev(bool): clockwise (False) or not (True). Default isTrue.text(str): the text to display. Default is"mem".text_size(int): Fontsize to use. Default is10.update_interval(int): delay in seconds between two refreshs of the widget. If set to0, no updates will occur, unless usingbutton[1-7](at least one) with a callback function. Default is1(refresh every second).ymargin(int): y margin in pixels. Default is2.
Left click (button1) sends a notification of current value. You can bind options button[1-7] to python functions.
A xeyes-like widget.
The Xeyes widget is in the xeyes.py standalone file.
Install it using a git clone command or just in copying the file in a ~/.config/qtile/widgets/ directory (and create in it a __init__.py empty file).
For example, in your config.py :
frow widgets import xeyes # if you put volume.py in a `widgets` dir.
...
my_bar_widgets = [
...
xeyes.Xeyes(),
...
]
...eye_color(str): color of eye. Default is"ffffff"(white).eye_radius(int): eye radius. Default is10pixels.gap(int): space between eyes. Default is3pixels.padding(int): horizontal space with widget's edge. Default is0pixel.pupil_radius(str): pupil radius. Default is3pixels.pupil_color(str): color of pupil. Default is"000000"(black).update_interval(float): delay between two refreshs. Default is0.04(25 fps).
None
















