fix up truncation

This commit is contained in:
Daylin Morgan 2025-01-14 16:27:52 -06:00
parent 509aec191a
commit a378428744
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -1,6 +1,6 @@
import std/[ import std/[
os, osproc, strformat, strutils, os, osproc, strformat, strutils,
streams, tables, net, sugar, times streams, tables, net, sugar, times, unicode
] ]
import ./[lib, swww] import ./[lib, swww]
import yaml, jsony import yaml, jsony
@ -102,9 +102,11 @@ proc writeEwwClasses*() =
for id in openWorkspaces(monitors): for id in openWorkspaces(monitors):
workspaces[id - 1].class.add " ws-button-open" workspaces[id - 1].class.add " ws-button-open"
# truncate icons at 3 windows
for ws in workspaces.mitems: for ws in workspaces.mitems:
if ws.icon.len > 10: if ws.icon.runeLen > 3:
ws.icon = ws.icon[0..7] & "..." ws.icon =
($(ws.icon.toRunes()[0..2]) & "+")
var ewwClasses = var ewwClasses =
collect: collect: