fix the bloody tray
This commit is contained in:
@@ -29,8 +29,8 @@ teal = #8bd5ca
|
||||
green = #a6da95
|
||||
yellow = #eed49f
|
||||
peach = #f5a97f
|
||||
maroon = #ee99a0
|
||||
red = #ed8796
|
||||
maroon = #ee99a0
|
||||
mauve = #c6a0f6
|
||||
pink = #f5bde6
|
||||
flamingo = #f0c6c6
|
||||
|
||||
@@ -22,10 +22,8 @@ border-bottom-color = ${colors.background}
|
||||
|
||||
modules-left = i3 empty-space title
|
||||
modules-center = time
|
||||
modules-right = empty-space spotify empty-space wired-network network speedtest empty-space backlight colored-empty-space audio empty-space cpu temperature colored-empty-space memory empty-space battery
|
||||
modules-right = empty-space spotify battery backlight empty-space audio empty-space cpu temperature empty-space memory empty-space arrow
|
||||
|
||||
cursor-click = pointer
|
||||
cursor-scroll = ns-resize
|
||||
|
||||
# override-redirect = true
|
||||
|
||||
|
||||
@@ -4,7 +4,24 @@ pin-workspaces = true
|
||||
enable-click = true
|
||||
show-urgent = true
|
||||
|
||||
format = " <label-state> <label-mode> "
|
||||
ws-icon-0 = 1;♚
|
||||
ws-icon-1 = 2;♛
|
||||
ws-icon-2 = 3;♜
|
||||
ws-icon-3 = 4;♝
|
||||
ws-icon-4 = 5;♞
|
||||
ws-icon-5 = 6;♟
|
||||
ws-icon-6 = 7;♔
|
||||
ws-icon-7 = 8;♕
|
||||
ws-icon-8 = 9;♖
|
||||
ws-icon-9 = 10;♗
|
||||
|
||||
format = <label-state> <label-mode>
|
||||
|
||||
label-focused-padding = 0
|
||||
label-unfocused-padding = 0
|
||||
label-visible-padding = 0
|
||||
label-urgent-padding = 0
|
||||
label-separator-padding = 1
|
||||
|
||||
label-focused-background = ${colors.pink}
|
||||
label-focused-foreground = ${colors.base}
|
||||
@@ -15,6 +32,14 @@ label-urgent-foreground = ${colors.red}
|
||||
|
||||
# =======================================
|
||||
|
||||
[module/arrow]
|
||||
type = custom/script
|
||||
exec = echo ""
|
||||
click-left = $HOME/.config/polybar/scripts/tray.sh
|
||||
click-right = $HOME/.config/polybar/scripts/tray.sh
|
||||
|
||||
# =======================================
|
||||
|
||||
[module/title]
|
||||
type = internal/xwindow
|
||||
format = <label>
|
||||
@@ -46,8 +71,6 @@ date = %A, %d %b %y
|
||||
|
||||
format = <label>
|
||||
format-foreground = ${colors.pink}
|
||||
format-prefix = " "
|
||||
|
||||
label = %{A3:st -e tty-clock -cbt -C 4:} %date% %time% %{A}
|
||||
|
||||
# =======================================
|
||||
@@ -109,10 +132,8 @@ interface-type = wireless
|
||||
interval = 1
|
||||
format-connected = <label-connected>
|
||||
label-connected = %{A1:nm-connection-editor:} 直 %{A} %essid%
|
||||
;label-connected-foreground = #B5E8E0
|
||||
;label-connected-background = #1e1e2e
|
||||
label-disconnected = %{A1:nm-connection-editor:} 睊 %{A}
|
||||
;label-disconnected-background = #1e1e2e
|
||||
;label-connected-foreground = #B5E8E0
|
||||
;label-disconnected-foreground = #F28FAD
|
||||
|
||||
# =======================================
|
||||
@@ -127,15 +148,6 @@ label-connected = " "
|
||||
label-disconnected = " "
|
||||
label-connected-foreground = #B5E8E0
|
||||
;label-disconnected-foreground = #F28FAD
|
||||
;format-connected-background = #1e1e2e
|
||||
;format-disconnected-background = 1e1e2e
|
||||
|
||||
# =======================================
|
||||
|
||||
[module/speedtest]
|
||||
type = custom/script
|
||||
click-left = "~/.config/polybar/polybar-speedtest"
|
||||
format-prefix = 龍
|
||||
|
||||
# =======================================
|
||||
|
||||
@@ -145,26 +157,22 @@ battery = BAT0
|
||||
adapter = ADP1
|
||||
full-at = 99
|
||||
poll-interval = 0.5
|
||||
;format-background = #1e1e2e
|
||||
|
||||
format-charging = <animation-charging> <label-charging>
|
||||
label-charging = %percentage% %
|
||||
format-charging-foreground = ${colors.color4}
|
||||
format-charging-background = #1e1e2e
|
||||
format-charging-foreground = ${colors.red}
|
||||
|
||||
format-discharging = <ramp-capacity> <label-discharging>
|
||||
label-discharging = %percentage%%
|
||||
format-discharging-foreground = ${colors.color4}
|
||||
format-discharging-background = #1e1e2e
|
||||
format-discharging-foreground = ${colors.red}
|
||||
|
||||
format-full-prefix = " "
|
||||
format-full-prefix-foreground = #ABE9B3
|
||||
format-foreground = #ABE9B3
|
||||
format-full-background = #1e1e2e
|
||||
format-full-prefix-foreground = ${colors.green}
|
||||
format-foreground = ${colors.green}
|
||||
|
||||
label-discharging-foreground = #ABE9B3
|
||||
ramp-capacity-foreground = #ABE9B3
|
||||
label-charging-foreground = #ABE9B3
|
||||
label-discharging-foreground = ${colors.green}
|
||||
ramp-capacity-foreground = ${colors.green}
|
||||
label-charging-foreground = ${colors.green}
|
||||
|
||||
label-padding = 1
|
||||
|
||||
@@ -180,7 +188,7 @@ animation-charging-2 = " "
|
||||
animation-charging-3 = " "
|
||||
animation-charging-4 = " "
|
||||
|
||||
animation-charging-foreground = #ABE9B3
|
||||
animation-charging-foreground = ${colors.green}
|
||||
animation-charging-framerate = 750
|
||||
|
||||
format-charging-padding = 1
|
||||
@@ -210,6 +218,8 @@ enable-scroll = false
|
||||
format =" <ramp> <label>"
|
||||
label = "%percentage%%"
|
||||
|
||||
foreground = ${colors.mauve}
|
||||
|
||||
; only applies if <ramp> is used
|
||||
ramp-0 = " "
|
||||
ramp-1 = " "
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import argparse
|
||||
import speedtest
|
||||
|
||||
def get_formatted_speed(s,bytes=False):
|
||||
unit = ""
|
||||
if s > 1024**3:
|
||||
s = s / 1024**3
|
||||
unit = "G"
|
||||
elif s > 1024**2:
|
||||
s = s / 1024**2
|
||||
unit = "M"
|
||||
elif s > 1024:
|
||||
s = s / 1024
|
||||
unit = "K"
|
||||
if bytes:
|
||||
return f"{(s/8):.2f} {unit}iB/s"
|
||||
return f"{s:.2f} {unit}ib/s"
|
||||
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--upload', action="store_true")
|
||||
parser.add_argument('--bytes', action="store_true")
|
||||
args= parser.parse_args()
|
||||
|
||||
try:
|
||||
s = speedtest.Speedtest()
|
||||
except:
|
||||
exit(0)
|
||||
|
||||
if args.upload:
|
||||
s.upload(pre_allocate=False)
|
||||
print("▲ " + get_formatted_speed(s.results.upload,args.bytes))
|
||||
else:
|
||||
s.download()
|
||||
print("▼ " + get_formatted_speed(s.results.download,args.bytes))
|
||||
Binary file not shown.
2013
common/.config/polybar/scripts/speedtest-cli
Executable file
2013
common/.config/polybar/scripts/speedtest-cli
Executable file
File diff suppressed because it is too large
Load Diff
94
common/.config/polybar/scripts/speedtest.sh
Executable file
94
common/.config/polybar/scripts/speedtest.sh
Executable file
@@ -0,0 +1,94 @@
|
||||
while [[ $# -gt 1 ]]; do
|
||||
key="$1"
|
||||
case "$key" in
|
||||
-i|--inlabel)
|
||||
INLABEL="$2"
|
||||
shift;;
|
||||
-o|--outlabel)
|
||||
OUTLABEL="$2"
|
||||
shift;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[[ -z "$INLABEL" ]] && INLABEL="IN "
|
||||
[[ -z "$OUTLABEL" ]] && OUTLABEL="OUT "
|
||||
|
||||
# Use the provided interface, otherwise the device used for the default route.
|
||||
if [[ -z $INTERFACE ]] && [[ -n $BLOCK_INSTANCE ]]; then
|
||||
INTERFACE=$BLOCK_INSTANCE
|
||||
elif [[ -z $INTERFACE ]]; then
|
||||
INTERFACE=$(ip route | awk '/^default/ { print $5 ; exit }')
|
||||
fi
|
||||
|
||||
# Exit if there is no default route
|
||||
[[ -z "$INTERFACE" ]] && exit
|
||||
|
||||
# Issue #36 compliant.
|
||||
if ! [ -e "/sys/class/net/${INTERFACE}/operstate" ] || \
|
||||
(! [ "$TREAT_UNKNOWN_AS_UP" = "1" ] &&
|
||||
! [ "`cat /sys/class/net/${INTERFACE}/operstate`" = "up" ])
|
||||
then
|
||||
echo "$INTERFACE down"
|
||||
echo "$INTERFACE down"
|
||||
echo "#FF0000"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# path to store the old results in
|
||||
path="/tmp/$(basename $0)-${INTERFACE}"
|
||||
|
||||
# grabbing data for each adapter.
|
||||
read rx < "/sys/class/net/${INTERFACE}/statistics/rx_bytes"
|
||||
read tx < "/sys/class/net/${INTERFACE}/statistics/tx_bytes"
|
||||
|
||||
# get time
|
||||
time="$(date +%s)"
|
||||
|
||||
# write current data if file does not exist. Do not exit, this will cause
|
||||
# problems if this file is sourced instead of executed as another process.
|
||||
if ! [[ -f "${path}" ]]; then
|
||||
echo "${time} ${rx} ${tx}" > "${path}"
|
||||
chmod 0666 "${path}"
|
||||
fi
|
||||
|
||||
|
||||
# read previous state and update data storage
|
||||
read old < "${path}"
|
||||
echo "${time} ${rx} ${tx}" > "${path}"
|
||||
|
||||
# parse old data and calc time passed
|
||||
old=(${old//;/ })
|
||||
time_diff=$(( $time - ${old[0]} ))
|
||||
|
||||
# sanity check: has a positive amount of time passed
|
||||
[[ "${time_diff}" -gt 0 ]] || exit
|
||||
|
||||
# calc bytes transferred, and their rate in byte/s
|
||||
rx_diff=$(( $rx - ${old[1]} ))
|
||||
tx_diff=$(( $tx - ${old[2]} ))
|
||||
rx_rate=$(( $rx_diff / $time_diff ))
|
||||
tx_rate=$(( $tx_diff / $time_diff ))
|
||||
|
||||
# shift by 10 bytes to get KiB/s. If the value is larger than
|
||||
# 1024^2 = 1048576, then display MiB/s instead
|
||||
|
||||
# incoming
|
||||
echo -n "$INLABEL"
|
||||
rx_kib=$(( $rx_rate >> 10 ))
|
||||
if hash bc 2>/dev/null && [[ "$rx_rate" -gt 1048576 ]]; then
|
||||
printf '%sM' "`echo "scale=1; $rx_kib / 1024" | bc`"
|
||||
else
|
||||
echo -n "${rx_kib}K"
|
||||
fi
|
||||
|
||||
echo -n " "
|
||||
|
||||
# outgoing
|
||||
echo -n "$OUTLABEL"
|
||||
tx_kib=$(( $tx_rate >> 10 ))
|
||||
if hash bc 2>/dev/null && [[ "$tx_rate" -gt 1048576 ]]; then
|
||||
printf '%sM\n' "`echo "scale=1; $tx_kib / 1024" | bc`"
|
||||
else
|
||||
echo "${tx_kib}K"
|
||||
fi
|
||||
9
common/.config/polybar/scripts/tray.sh
Executable file
9
common/.config/polybar/scripts/tray.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
if pgrep -x "stalonetray" > /dev/null
|
||||
then
|
||||
killall stalonetray
|
||||
else
|
||||
stalonetray
|
||||
fi
|
||||
|
||||
142
common/.config/stalonetrayrc
Normal file
142
common/.config/stalonetrayrc
Normal file
@@ -0,0 +1,142 @@
|
||||
# vim:filetype=config:tw=80:et
|
||||
#
|
||||
# This is sample ~/.stalonetrayrc, resembling default configuration.
|
||||
# Remember: command line parameters take precedence.
|
||||
#
|
||||
# Directives introduced in @VERSION_STR@ are marked with "NEW in @VERSION_STR@"
|
||||
#
|
||||
####################################################################
|
||||
#
|
||||
# stalonetray understands following directives
|
||||
#
|
||||
####################################################################
|
||||
|
||||
# background <color> # color can be specified as an HTML hex triplet or
|
||||
# as a name from rgb.txt, note that '#' must be quoted
|
||||
background "#24273a"
|
||||
|
||||
# decorations <decspec> # set trays window decorations; possible values for
|
||||
# decspec are: all, title, border, none
|
||||
decorations none
|
||||
|
||||
# display <display name> # as usual
|
||||
|
||||
# dockapp_mode <mode> # set dockapp mode, which can be either simple (for
|
||||
# e.g. OpenBox, wmaker for WindowMaker, or none
|
||||
# (default). NEW in @VERSION_STR@.
|
||||
dockapp_mode none
|
||||
|
||||
# fuzzy_edges [<level>] # enable fuzzy edges and set fuzziness level. level
|
||||
# can be from 0 (disabled) to 3; this setting works
|
||||
# with tinting and/or transparent and/or pixmap
|
||||
# backgrounds
|
||||
fuzzy_edges 0
|
||||
|
||||
# geometry <geometry> # tray's geometry in standard X notation; width and
|
||||
# height are specified in slot_size multiples
|
||||
geometry 1x1+0+0
|
||||
|
||||
# grow_gravity <gravity> # one of N, S, E, W, NW, NE, SW, SE; tray will grow
|
||||
# in the direction opposite to one specified by
|
||||
# grow_gravity; if horizontal or vertical
|
||||
# direction is not specified, tray will not grow in
|
||||
# that direction
|
||||
grow_gravity SE
|
||||
|
||||
# icon_gravity <gravity> # icon placement gravity, one of NW, NE, SW, SE
|
||||
icon_gravity SE
|
||||
|
||||
# icon_size <int> # specifies dimensions of an icon
|
||||
icon_size 25
|
||||
|
||||
# slot_size <w>[x<h>] # specifies width and hight of an icon slot that
|
||||
# contains icon; must be larger than icon size;
|
||||
# height is set to width if it is omitted;
|
||||
# defaults to icon size
|
||||
slot_size 32x64
|
||||
|
||||
# log_level <level> # controls the amount of logging output, level can
|
||||
# be err (default), info, or trace (enabled only
|
||||
# when stalonetray configured with --enable-debug)
|
||||
# NEW in @VERSION_STR@.
|
||||
log_level err
|
||||
|
||||
# kludges kludge[,kludge] # enable specific kludges to work around
|
||||
# non-conforming WMs and/or stalonetray bugs.
|
||||
# NEW in @VERSION_STR@. Argument is a
|
||||
# comma-separated list of
|
||||
# * fix_window_pos - fix tray window position on
|
||||
# erroneous moves by WM
|
||||
# * force_icons_size - ignore resize events on all
|
||||
# icons; force their size to be equal to
|
||||
# icon_size
|
||||
# * use_icon_hints - use icon window hints to
|
||||
# dtermine icon size
|
||||
|
||||
# max_geometry <geometry> # maximal tray dimensions; 0 in width/height means
|
||||
# no limit
|
||||
max_geometry 0x0
|
||||
|
||||
# no_shrink [<bool>] # disables shrink-back mode
|
||||
no_shrink false
|
||||
|
||||
# parent_bg [<bool>] # whether to use pseudo-transparency
|
||||
# (looks better when reparented into smth like FvwmButtons)
|
||||
parent_bg false
|
||||
|
||||
# pixmap_bg <path_to_xpm> # use pixmap from specified xpm file for (tiled) background
|
||||
# pixmap_bg /home/user/.stalonetraybg.xpm
|
||||
|
||||
# scrollbars <mode> # enable/disable scrollbars; mode is either
|
||||
# vertical, horizontal, all or none (default)
|
||||
# NEW in @VERSION_STR@.
|
||||
scrollbars none
|
||||
|
||||
# scrollbars-size <size> # scrollbars step in pixels; default is slot_size / 4
|
||||
# scrollbars-step 8
|
||||
|
||||
# scrollbars-step <step> # scrollbars step in pixels; default is slot_size / 2
|
||||
# scrollbars-step 32
|
||||
|
||||
# slot_size <int> # specifies size of icon slot, defaults to
|
||||
# icon_size NEW in @VERSION_STR@.
|
||||
|
||||
# skip_taskbar [<bool>] # hide tray`s window from the taskbar
|
||||
skip_taskbar true
|
||||
|
||||
# sticky [<bool>] # make a tray`s window sticky across the
|
||||
# desktops/pages
|
||||
sticky true
|
||||
|
||||
# tint_color <color> # set tinting color
|
||||
tint_color white
|
||||
|
||||
# tint_level <level> # set tinting level; level ranges from 0 (disabled)
|
||||
# to 255
|
||||
tint_level 0
|
||||
|
||||
# transparent [<bool>] # whether to use root-transparency (background
|
||||
# image must be set with Esetroot or compatible utility)
|
||||
transparent false
|
||||
|
||||
# vertical [<bool>] # whether to use vertical layout (horisontal layout
|
||||
# is used by default)
|
||||
vertical false
|
||||
|
||||
# window_layer <layer> # set the EWMH-compatible window layer; one of:
|
||||
# bottom, normal, top
|
||||
window_layer normal
|
||||
|
||||
# window_strut <mode> # enable/disable window struts for tray window (to
|
||||
# avoid converting of tray window by maximized
|
||||
# windows); mode defines to which screen border tray
|
||||
# will be attached; it can be either top, bottom,
|
||||
# left, right, none or auto (default)
|
||||
window_strut auto
|
||||
|
||||
# window_type <type> # set the EWMH-compatible window type; one of:
|
||||
# desktop, dock, normal, toolbar, utility
|
||||
window_type toolbar
|
||||
|
||||
# xsync [<bool>] # whether to operate on X server synchronously (SLOOOOW)
|
||||
xsync false
|
||||
Reference in New Issue
Block a user