Skip to content

Instantly share code, notes, and snippets.

@pawamoy
Last active April 26, 2023 04:11
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pawamoy/6fe205525fc653474e88bad582ef90fa to your computer and use it in GitHub Desktop.
Save pawamoy/6fe205525fc653474e88bad582ef90fa to your computer and use it in GitHub Desktop.
conky porn post
[general]
targets = github_pawamoy
shorten = True
inline_links = False
annotation_links = True
annotation_comments = False
legacy_matching = False
log.level = DEBUG
description_length = 120
annotation_length = 120
[github_pawamoy]
service = github
github.username = pawamoy
github.login = pawamoy
github.token = <YOUR_TOKEN>
github.include_user_issues = True
github.include_user_repos = True
github.include_closed_issues = True
github.involved_issues = False
github.query = author:pawamoy archived:false state:all type:all
github.project_template = git.{{githubrepo.lower().replace('.', '-').replace('/', '.')}}
# Files
data.location=~/.task
# Color theme (uncomment one to use)
include /usr/share/taskwarrior/dark-blue-256.theme
# Custom priority values
uda.priority.values=H,M,,L
# Custom reports
report.todo.description=Todo
report.todo.columns=id,project,description.count
report.todo.labels=ID,Project,Text
report.todo.sort=priority-,urgency-,project+,id+
report.todo.filter=status:pending -ACTIVE -WAITING -BLOCKED -OVERDUE description.hasnt:"(GH)"
report.doing.description=In progress
report.doing.columns=id,description.count
report.doing.labels=ID,Text
report.doing.sort=priority-,id+
report.doing.filter=status:pending +ACTIVE
report.github.description=GitHub issues
report.github.columns=id,githuburl,description.count
report.github.labels=ID,URL,Text
report.github.sort=entry-,githuburl+
report.github.filter=status:pending -ACTIVE -WAITING -BLOCKED -OVERDUE description.has:"(GH)"
# Bugwarrior UDAs
uda.githubrepo.label=Github Repo Slug
uda.githubrepo.type=string
uda.githubnumber.label=Github Issue/PR #
uda.githubnumber.type=numeric
uda.githubnamespace.label=Github Namespace
uda.githubnamespace.type=string
uda.githubupdatedat.label=Github Updated
uda.githubupdatedat.type=date
uda.githubtype.label=Github Type
uda.githubtype.type=string
uda.githubuser.label=Github User
uda.githubuser.type=string
uda.githubcreatedon.label=Github Created
uda.githubcreatedon.type=date
uda.githubclosedon.label=Github Closed
uda.githubclosedon.type=date
uda.githubtitle.label=Github Title
uda.githubtitle.type=string
uda.githubbody.label=Github Body
uda.githubbody.type=string
uda.githuburl.label=Github URL
uda.githuburl.type=string
uda.githubmilestone.label=Github Milestone
uda.githubmilestone.type=string
uda.githubstate.label=Github State
uda.githubstate.type=string
# END Bugwarrior UDAs
#!/usr/bin/env bash
esc="$(echo -ne "\033")"
sp="$(printf "\xE2\x96\x88")"
sed -r "s/\[48([^ ${esc}]+) /[38\1${sp}/g;: loop s/${sp} /${sp}${sp}/; t loop"
#!/bin/bash
main() {
local dir len file size lines
dir="${1%/}"
len="${#dir}"
lines="${2:-5}"
find "${dir}" -type f -size +100M -exec du -Sh {} + | sort -rh | head -n "${lines}" | while read -r size file; do
file="${file:$((len+1))}"
if [ ${#file} -gt 38 ]; then
file="...${file: -38}"
fi
echo "${file}\${alignr}${size}"
done
}
## \usage conky-biggest-files DIRECTORY [LINES]
main "$@"
#!/usr/bin/env bash
main() {
local dir len file size total lines
dir="${1%/}"
len="${#dir}"
lines="${2:-5}"
total="$(du -s --block-size=1 "${dir}" | cut -f1)"
echo "${dir}"
find "${dir}" -mindepth 1 -maxdepth 1 -exec du -s --block-size=1 {} \; | sort -rn | head -n "${lines}" | while read -r size file; do
echo "${file:$((len+1))}\${alignr}$(numfmt --to=iec-i --suffix=B ${size}) \${execbar echo $(printf "%.2f" "$(echo "${size}/${total}*100" | bc -l)")}"
done
echo
}
## \usage conky-directory-usage DIRECTORY [LINES]
main "$@"
#!/usr/bin/env bash
main() {
local disk
for disk in / $(df | grep -o ' /media.*'); do
echo -n "\${if_existing ${disk}}"
echo -n "\${font} $(basename "${disk}") \${alignr}\${fs_used ${disk}} / \${fs_size ${disk}} (\${fs_used_perc ${disk}}%) "
echo -n "\${if_match \${fs_used_perc ${disk}} >= 90}\${color #CD5C5C}\${else}"
echo -n "\${if_match \${fs_used_perc ${disk}} >= 70}\${color #FFC274}\${else}"
echo -n "\${if_match \${fs_used_perc ${disk}} >= 50}\${color #5F9EA0}\${endif}\${endif}\${endif}"
echo -n "\${fs_bar ${disk}}\${color}\${endif}"
echo
done
}
main "$@"
#!/usr/bin/env bash
main() {
local partition
for partition in $(echo /dev/sd?); do
echo -n "\${if_existing ${partition}}"
echo -n "\${font}${partition} io-read: \${diskio_read ${partition}} \${alignr}io-write: \${diskio_write ${partition}}"
echo
echo -n "\${font}\${diskiograph_read ${partition} 25,140 C0C0C0 5F9EA0 -t}\${alignr}\${diskiograph_write ${partition} 25,140 C0C0C0 5F9EA0 -t}"
echo -n "\${endif}"
echo
done
}
main "$@"
#!/bin/bash
summarize() {
local repo branch status
repo="$1"
cd "${repo}" || exit 1
branch=$(git branch -vv | grep -o '\[[^]]*: [^]]*\]' | sed 's/^\[/ /;s/\]//')
status=$(git status -s)
if [ -n "${branch}" ] || [ -n "${status}" ]; then
echo "${repo#$DEV_HOME/}"
fi
if [ -n "${branch}" ]; then
echo "${branch}"
fi
if [ -n "${status}" ]; then
symbols="$(echo "${status}" | sed 's/^ *//' | cut -d' ' -f1)"
unique_symbols="$(echo "${symbols}" | sort -u)"
while read -r unique_symbol; do
symbol_count="$(echo "${symbols}" | grep -c "^${unique_symbol}")"
echo " \${color #5F9EA0}${unique_symbol}\${color}: ${symbol_count} files"
done <<<"${unique_symbols}"
fi
if [ -n "${branch}" ] || [ -n "${status}" ]; then
echo
fi
}
main() {
local repo all n_lines screen_height top_padding conky_line_size
screen_height=$(xdpyinfo | grep 'dimensions:' | awk '{print $2}' | cut -dx -f2)
top_padding=45
conky_line_size=8
all="$(conky-status-all.sh)"
n_lines="$(echo "${all}" | wc -l)"
if [ $(( n_lines * conky_line_size )) -gt $(( screen_height - top_padding )) ]; then
for repo in $(all-repo); do
( summarize "${repo}" )
done
else
echo "${all}"
fi
}
main "$@"
#!/bin/bash
main() {
local repo status line symbol
for repo in $(all-repo); do
(
cd "${repo}" || exit 1
status="$(git status -s)"
if [ -n "${status}" ]; then
echo "\${alignr}\${color white}${repo#$DEV_HOME/}\${color}"
while read -r line; do
symbol="${line:0:2}"
symbol="${symbol// /}"
echo "\${alignr}${line:2} \${color #5F9EA0}${symbol}\${color}"
done <<<"${status}"
echo
fi
)
done
}
main "$@"
#!/usr/bin/env bash
percent() {
# completed total
printf "%.0f" "$(bc -l <<<"$1/$2*100")"
}
project_list() {
task all rc.report.all.{labels,columns}:project rc.verbose:nothing 2>/dev/null | sort -u
}
project_completed() {
task project:"$1" +COMPLETED count 2>/dev/null
}
project_pending() {
task project:"$1" -COMPLETED count 2>/dev/null
}
echo_sortable_line() {
# project completed total
echo "$(percent "$2" "$3") $2 $3 ${1:-<none>}"
}
echo_conky_line() {
echo "$1\${alignr}$2/$3 $4% \${execbar echo '$4'}"
}
iterate_projects() {
local project completed pending total
{ echo; project_list; } | while read -r project; do
completed="$(project_completed "${project}")"
pending="$(project_pending "${project}")"
total=$(( completed + pending ))
echo_sortable_line "${project}" "${completed}" "${total}"
done
}
echo_for_conky() {
local project completed total percent
while read -r percent completed total project; do
echo_conky_line " ${project}" "${completed}" "${total}" "${percent}"
done
}
main() {
SORT=true
FILTER_PROJECTS=(
projects to filter out
one per line
)
FILTER_COMPLETED=true
FILTER_ONE_TASK_PROJECTS=true
LIMIT=10
if ${SORT}; then
apply_sort() { sort -k1 -gr; }
else
apply_sort() { cat; }
fi
if ${FILTER_COMPLETED}; then
filter_completed() { grep -v '^100'; }
else
filter_completed() { cat; }
fi
if ${FILTER_NOT_STARTED}; then
filter_not_started() { grep -v '^0 '; }
else
filter_not_started() { cat; }
fi
filter_projects() {
grep -v $(for p in "${FILTER_PROJECTS[@]}"; do printf -- "-e %s " "$p"; done)
}
apply_filters() {
filter_projects | filter_completed | filter_not_started
}
iterate_projects | apply_filters | apply_sort | head -n${LIMIT} | echo_for_conky
}
main "$@"
conky.config={
background=true,
border_inner_margin=5,
border_outer_margin=0,
border_width=2,
default_bar_height=5,
default_bar_width=80,
default_color="C0C0C0",
default_graph_height=25,
default_graph_width=200,
default_outline_color="000000",
default_shade_color="000000",
double_buffer=true,
draw_borders=false,
draw_graph_borders=false,
draw_outline=false,
draw_shades=false,
font="DejaVu Sans:size=8",
maximum_width=300,
minimum_width=300,
no_buffers=true,
override_utf8_locale=true,
own_window_class="conky",
own_window_hints="undecorated,below,skip_taskbar,skip_pager,sticky",
own_window_transparent=true,
own_window=true,
own_window_type="desktop",
stippled_borders=0,
text_buffer_size=6144,
total_run_times=0,
update_interval=5,
uppercase=false,
use_spacer="none",
use_xft=true,
xftalpha=0.8,
};
conky.text=[[
${font Aerial:style=Bold:pixelsize=10}GIT STATUS ${hr 2}${font}
${execpi 20 conky-git-status.sh}
]]
conky.config={
background=true,
border_inner_margin=5,
border_outer_margin=0,
border_width=2,
cpu_avg_samples=2,
default_bar_height=5,
default_bar_width=80,
default_color="C0C0C0",
default_graph_height=25,
default_graph_width=200,
default_outline_color="000000",
default_shade_color="000000",
diskio_avg_samples=2,
double_buffer=true,
draw_borders=false,
draw_graph_borders=false,
draw_outline=false,
draw_shades=false,
font="DejaVu Sans:size=8",
maximum_width=300,
minimum_width=300,
net_avg_samples=2,
no_buffers=true,
override_utf8_locale=true,
own_window_class="conky",
own_window_hints="undecorated,below,skip_taskbar,skip_pager,sticky",
own_window_transparent=true,
own_window=true,
own_window_type="desktop",
stippled_borders=0,
text_buffer_size=6144,
top_cpu_separate=true,
top_name_width=25,
total_run_times=0,
update_interval=5,
uppercase=false,
use_spacer="none",
use_xft=true,
xftalpha=0.8,
--Network Template
template3=[[${if_up \1}${font}\1 down: ${downspeed \1} (${totaldown \1}) ${alignr}up: ${upspeed \1} (${totalup \1})\n${font}${downspeedgraph \1 25,140 C0C0C0 5F9EA0 -t} ${alignr}${upspeedgraph \1 25,140 C0C0C0 5F9EA0 -t}\n${endif}]]
};
conky.text=[[
${font Aerial:style=Bold:pixelsize=10}SYSTEM ${hr 2}${font}
${font}${alignr}${cpugraph cpu0 40,92 C0C0C0 5F9EA0 -t}
${font}${alignr}${memgraph 10,92 C0C0C0 5F9EA0 -t}${voffset -65}
${font} CPU1${tab}${cpubar cpu1 5,80} ${cpu cpu1}% ${platform coretemp.0/hwmon/hwmon1 temp 1}°C
${font} CPU2${tab}${cpubar cpu2 5,80} ${cpu cpu2}% ${platform coretemp.0/hwmon/hwmon1 temp 2}°C
${font} CPU3${tab}${cpubar cpu3 5,80} ${cpu cpu3}% ${platform coretemp.0/hwmon/hwmon1 temp 3}°C
${font} CPU4${tab}${cpubar cpu4 5,80} ${cpu cpu4}% ${platform coretemp.0/hwmon/hwmon1 temp 4}°C
${font} RAM${tab}${membar 5,80} ${memperc}% ${mem}
${font Aerial:style=Bold:pixelsize=10}DISK USAGE ${hr 2}${font}
${texecpi 120 conky-diskio.sh}
${texecpi 120 conky-disk-usage.sh}
${font Aerial:style=Bold:pixelsize=10}NETWORK ${hr 2}${font}
${font}${alignr}Local IP address: ${addr enp3s0}
${template3 enp3s0}\
${template3 wlp3s0}\
${font Aerial:style=Bold:pixelsize=10}PROCESSES ${hr 2}${font}
${top_cpu_separate=false}NAME ${alignr}PID CPU MEM
${top name 1} ${alignr}${top pid 1} ${top cpu 1} ${top mem 1}
${top name 2} ${alignr}${top pid 2} ${top cpu 2} ${top mem 2}
${top name 3} ${alignr}${top pid 3} ${top cpu 3} ${top mem 3}
${top name 4} ${alignr}${top pid 4} ${top cpu 4} ${top mem 4}
${top name 5} ${alignr}${top pid 5} ${top cpu 5} ${top mem 5}
${font Aerial:style=Bold:pixelsize=10}BIG FILES ${hr 2}${font}
${texecpi 30 conky-biggest-files.sh ~}
${font Aerial:style=Bold:pixelsize=10}DIRECTORY USAGE ${hr 2}${font}
${texecpi 30 conky-directory-usage.sh ~}
]]
conky.config={
background=true,
border_inner_margin=5,
border_outer_margin=0,
border_width=2,
default_bar_height=5,
default_bar_width=80,
default_color="C0C0C0",
default_graph_height=25,
default_graph_width=200,
default_outline_color="000000",
default_shade_color="000000",
double_buffer=true,
draw_borders=false,
draw_graph_borders=false,
draw_outline=false,
draw_shades=false,
font="DejaVu Sans Mono:size=7.8",
maximum_width=500,
minimum_width=500,
no_buffers=true,
override_utf8_locale=true,
own_window_class="conky",
own_window_hints="undecorated,below,skip_taskbar,skip_pager,sticky",
own_window_transparent=true,
own_window=true,
own_window_type="desktop",
stippled_borders=0,
text_buffer_size=6144,
total_run_times=0,
update_interval=5,
uppercase=false,
use_spacer="none",
use_xft=true,
xftalpha=0.8,
};
conky.text=[[
${font Aerial:style=Bold:pixelsize=10}DOING ${hr 2}${font}
${texecpi 60 flock /home/pawamoy/.task task limit:10 rc.defaultwidth:80 rc._forcecolor:on rc.verbose:affected,blank doing | ansito - | sed -r 's/([^ ])#/\1\\#/g'}
${font Aerial:style=Bold:pixelsize=10}TODO ${hr 2}${font}
${texecpi 60 flock /home/pawamoy/.task task limit:10 rc.defaultwidth:80 rc._forcecolor:on rc.verbose:affected,blank todo | ansito - | sed -r 's/([^ ])#/\1\\#/g'}
${font Aerial:style=Bold:pixelsize=10}BURNDOWN ${hr 2}${font}
${font FreeMono:style=Bold:size=8}${texecpi 120 flock /home/pawamoy/.task task rc._forcecolor:on burndown.monthly | tail -n+2 | head -n-2 | conky-bg-space-to-fg.sh | ansito - | sed -r 's/([^ ])#/\1\\#/g'}${font}
${font Aerial:style=Bold:pixelsize=10}PROGRESS ${hr 2}${font}
${font DejaVu Sans:size=8}${texecpi 180 flock /home/pawamoy/.task conky-task-progress.sh}${font}
]]
@pawamoy
Copy link
Author

pawamoy commented Mar 2, 2019

  • ansito is available here: https://github.com/pawamoy/ansito
  • conky-bg-space-to-fg uses sed to replace ANSI codes for background color on spaces with codes for foreground color, which ansito can then convert to conky color formatting.
  • conky-task-progress is a bit slow with a lot of tasks, could use refactor, or be rewritten in another language
  • the github.include_closed_issues = True line of bugwarrior config is part of a PR on bugwarrior: GothenburgBitFactory/bugwarrior#626. I should really finish it :)
  • you must of course replace occurrences of pawamoy in conky_task_progress.lua with your own username
  • flock is used to prevent data corruption with task
  • the git conky calls conky-git-status.sh which does the following: check if its output would overflow the current height of the screen (obtained with xdpyinfo), and if yes, output a status summary for each repo instead of full status. To get the list of all repositories, I call all-repo, which is a script of mine: you should change this to suit your needs (iterate on a variable, write your own all-repo script, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment