feat: proxy-gui
No files matched your search
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Badged tray icons: every base state with a failed, busy or unknown badge in its bottom-right corner.
|
||||
|
||||
python3 badges.py <icon dir> <out dir>
|
||||
|
||||
proxy-suite-<state>[-symbolic].svg -> proxy-suite-<state>-<badge>[-symbolic].svg, next to copies of the bases.
|
||||
The shield is cut away around the badge, so it reads on any panel color.
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
STATES = ("disabled", "zapret", "proxy", "active", "tunnel")
|
||||
CX, CY = 18.5, 18.5
|
||||
CUT, DOT = 5.8, 4.8 # radius of the gap in the shield, and of the badge inside it
|
||||
|
||||
# badge -> (fill, stroke, glyph drawn in the glyph color)
|
||||
GLYPHS = {
|
||||
"failed": (
|
||||
"#D32F2F",
|
||||
"#7F0000",
|
||||
f'<path d="M {CX} {CY - 2.6} L {CX} {CY + 0.4}" stroke-width="1.5" stroke-linecap="round" fill="none"/>'
|
||||
f'<circle cx="{CX}" cy="{CY + 2.4}" r="0.85" stroke="none"/>',
|
||||
),
|
||||
"busy": (
|
||||
"#FFA000",
|
||||
"#8D5A00",
|
||||
"".join(f'<circle cx="{CX + dx}" cy="{CY}" r="0.85" stroke="none"/>' for dx in (-2.2, 0, 2.2)),
|
||||
),
|
||||
"unknown": (
|
||||
"#757575",
|
||||
"#424242",
|
||||
f'<path d="M {CX - 1.6} {CY - 1.2} C {CX - 1.6} {CY - 3.4} {CX + 1.8} {CY - 3.4} {CX + 1.8} {CY - 1.2} '
|
||||
f'C {CX + 1.8} {CY + 0.2} {CX} {CY} {CX} {CY + 1}" stroke-width="1.4" stroke-linecap="round" fill="none"/>'
|
||||
f'<circle cx="{CX}" cy="{CY + 2.7}" r="0.8" stroke="none"/>',
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def inner(svg):
|
||||
return re.search(r"<svg[^>]*>(.*)</svg>", svg, re.S).group(1)
|
||||
|
||||
|
||||
def badged(svg, badge, symbolic):
|
||||
fill, stroke, glyph = GLYPHS[badge]
|
||||
mask = (
|
||||
f'<mask id="cut"><rect width="24" height="24" fill="white"/>'
|
||||
f'<circle cx="{CX}" cy="{CY}" r="{CUT}" fill="black"/></mask>'
|
||||
)
|
||||
if symbolic:
|
||||
# One color: the badge is a disc with its glyph knocked out.
|
||||
mask += (
|
||||
f'<mask id="glyph"><rect width="24" height="24" fill="white"/>'
|
||||
f'<g stroke="black" fill="black">{glyph}</g></mask>'
|
||||
)
|
||||
badge_svg = f'<circle cx="{CX}" cy="{CY}" r="{DOT}" fill="currentColor" mask="url(#glyph)"/>'
|
||||
else:
|
||||
badge_svg = (
|
||||
f'<circle cx="{CX}" cy="{CY}" r="{DOT}" fill="{fill}" stroke="{stroke}" stroke-width="0.6"/>'
|
||||
f'<g stroke="#FFFFFF" fill="#FFFFFF">{glyph}</g>'
|
||||
)
|
||||
return (
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">\n'
|
||||
f" <defs>{mask}</defs>\n"
|
||||
f' <g mask="url(#cut)">{inner(svg)}</g>\n'
|
||||
f" {badge_svg}\n"
|
||||
"</svg>\n"
|
||||
)
|
||||
|
||||
|
||||
def main(src, out):
|
||||
os.makedirs(out, exist_ok=True)
|
||||
for state in STATES:
|
||||
for suffix in ("", "-symbolic"):
|
||||
base = os.path.join(src, f"proxy-suite-{state}{suffix}.svg")
|
||||
shutil.copyfile(base, os.path.join(out, os.path.basename(base)))
|
||||
with open(base) as f:
|
||||
svg = f.read()
|
||||
for badge in GLYPHS:
|
||||
with open(os.path.join(out, f"proxy-suite-{state}-{badge}{suffix}.svg"), "w") as f:
|
||||
f.write(badged(svg, badge, bool(suffix)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(*sys.argv[1:3])
|
||||
@@ -0,0 +1,22 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="128" height="128">
|
||||
<!-- Proxy Suite: the tray's shield, with a route through it -->
|
||||
<defs>
|
||||
<linearGradient id="shield" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#66BB6A"/>
|
||||
<stop offset="1" stop-color="#2E7D32"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="rim" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#9C27B0"/>
|
||||
<stop offset="1" stop-color="#4A148C"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path d="M 64 8 L 110 28 L 110 68 C 110 98 64 120 64 120 C 64 120 18 98 18 68 L 18 28 Z"
|
||||
fill="url(#rim)"/>
|
||||
<path d="M 64 17 L 101 33.5 L 101 68 C 101 92 64 110 64 110 C 64 110 27 92 27 68 L 27 33.5 Z"
|
||||
fill="url(#shield)"/>
|
||||
<path d="M 40 80 C 52 80 52 50 64 50 C 76 50 76 64 88 64"
|
||||
stroke="#FFFFFF" stroke-width="7" fill="none" stroke-linecap="round"/>
|
||||
<circle cx="40" cy="80" r="7" fill="#FFFFFF"/>
|
||||
<path d="M 84 54 L 94 64 L 84 74" stroke="#FFFFFF" stroke-width="7" fill="none"
|
||||
stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M 12 2 L 20 6 L 20 13 C 20 18 12 22 12 22 C 12 22 4 18 4 13 L 4 6 Z"
|
||||
fill="currentColor"/>
|
||||
<path d="M 9 13 L 11.5 15.5 L 15.5 9.5"
|
||||
stroke="white" stroke-width="1.4" fill="none"
|
||||
stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 354 B |
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<!-- Green shield: proxy + zapret both enabled -->
|
||||
<path d="M 12 2 L 20 6 L 20 13 C 20 18 12 22 12 22 C 12 22 4 18 4 13 L 4 6 Z"
|
||||
fill="#4CAF50" stroke="#2E7D32" stroke-width="0.8"/>
|
||||
<path d="M 9 13 L 11.5 15.5 L 15.5 9.5"
|
||||
stroke="#FFFFFF" stroke-width="1.4" fill="none"
|
||||
stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 440 B |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M 12 2 L 20 6 L 20 13 C 20 18 12 22 12 22 C 12 22 4 18 4 13 L 4 6 Z"
|
||||
fill="currentColor"/>
|
||||
<line x1="9" y1="9.5" x2="15" y2="15.5" stroke="white" stroke-width="1.4" stroke-linecap="round"/>
|
||||
<line x1="15" y1="9.5" x2="9" y2="15.5" stroke="white" stroke-width="1.4" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 403 B |
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<!-- Red shield: everything disabled -->
|
||||
<path d="M 12 2 L 20 6 L 20 13 C 20 18 12 22 12 22 C 12 22 4 18 4 13 L 4 6 Z"
|
||||
fill="#F44336" stroke="#B71C1C" stroke-width="0.8"/>
|
||||
<line x1="9" y1="9.5" x2="15" y2="15.5"
|
||||
stroke="#FFFFFF" stroke-width="1.4" stroke-linecap="round"/>
|
||||
<line x1="15" y1="9.5" x2="9" y2="15.5"
|
||||
stroke="#FFFFFF" stroke-width="1.4" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 497 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M 12 2 L 20 6 L 20 13 C 20 18 12 22 12 22 C 12 22 4 18 4 13 L 4 6 Z"
|
||||
fill="currentColor"/>
|
||||
<circle cx="12" cy="12.5" r="2.5" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 252 B |
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<!-- Orange shield: only proxy (SOCKS) enabled -->
|
||||
<path d="M 12 2 L 20 6 L 20 13 C 20 18 12 22 12 22 C 12 22 4 18 4 13 L 4 6 Z"
|
||||
fill="#FF9800" stroke="#E65100" stroke-width="0.8"/>
|
||||
<!-- Dot in center -->
|
||||
<circle cx="12" cy="12.5" r="2.5" fill="#FFFFFF"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 363 B |
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M 12 2 L 20 6 L 20 13 C 20 18 12 22 12 22 C 12 22 4 18 4 13 L 4 6 Z"
|
||||
fill="currentColor"/>
|
||||
<path d="M 12 15.5 L 12 9.5 M 9.5 12 L 12 9.5 L 14.5 12"
|
||||
stroke="white" stroke-width="1.4" fill="none"
|
||||
stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 371 B |
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<!-- Purple shield: TUN/TProxy active -->
|
||||
<path d="M 12 2 L 20 6 L 20 13 C 20 18 12 22 12 22 C 12 22 4 18 4 13 L 4 6 Z"
|
||||
fill="#9C27B0" stroke="#4A148C" stroke-width="0.8"/>
|
||||
<!-- Up arrow: traffic routed through tunnel -->
|
||||
<path d="M 12 15.5 L 12 9.5 M 9.5 12 L 12 9.5 L 14.5 12"
|
||||
stroke="#FFFFFF" stroke-width="1.4" fill="none"
|
||||
stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 499 B |
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<path d="M 12 2 L 20 6 L 20 13 C 20 18 12 22 12 22 C 12 22 4 18 4 13 L 4 6 Z"
|
||||
fill="currentColor"/>
|
||||
<path d="M 9 9 L 15 9 L 9 15 L 15 15"
|
||||
stroke="white" stroke-width="1.4" fill="none"
|
||||
stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 352 B |
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
|
||||
<!-- Blue shield: only zapret enabled -->
|
||||
<path d="M 12 2 L 20 6 L 20 13 C 20 18 12 22 12 22 C 12 22 4 18 4 13 L 4 6 Z"
|
||||
fill="#2196F3" stroke="#0D47A1" stroke-width="0.8"/>
|
||||
<!-- Z letter for Zapret -->
|
||||
<path d="M 9 9 L 15 9 L 9 15 L 15 15"
|
||||
stroke="#FFFFFF" stroke-width="1.4" fill="none"
|
||||
stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 460 B |