lipido / kargos

KDE Plasma port of GNOME Argos and OSX BitBar
GNU General Public License v3.0
126 stars 13 forks source link

trimming only the end of the string, for alignment #39

Closed jvonhoff closed 4 years ago

jvonhoff commented 4 years ago

I only needed this change because I have some multi-line entries (upload & download speeds, with \n in the string) that would not line up in kargos the way they did in argos.

I left the other trim() statements alone, as I didn't want to break the submenu functionality.

Let me know if it needs any other cleanup.

Thanks!

shocklateboy92 commented 4 years ago

The code itself seems fine, but I would like to understand the change a little better before I merge it. You have a case where lines begin with a \n, and you don't want them to be stripped out?

Any chance you could post before and after screenshots?

jvonhoff commented 4 years ago

Certainly.

I know I could have split it up into 2 lines, but I really like having the upload/download combined on one line. Honestly, I'm not sure why the need to trim() at all, but ?? I recently moved over from Gnome, and I believe Argos utilizes the trim=false parameter you see, but I can't swear to it.

This code below should demonstrate the issue. Basically, I have a line feed in the middle of the string, so that I only show one icon and one button.

As an aside, you can see where my free disk space section raised my Matrix question regarding <table> tags... I got that sorted just by hard-coding some spaces into my script, but was trying to make it fancy!

Thanks!

#!/usr/bin/env bash
UPSPEED=101.2
DOWNSPEED=802.3
txt="$(printf %7.2f $UPSPEED)↑\n$(printf %7.2f $DOWNSPEED)↓"
echo "$txt | iconName=network-transmit-receive-symbolic font=monospace trim=false"

Before Before After After