From 534c3b09958b9f903e5ed0a2a03c5aae9f10f422 Mon Sep 17 00:00:00 2001 From: piotr Date: Fri, 17 Feb 2023 03:07:46 +0100 Subject: [PATCH] cut username if too long --- nwg_panel/processes.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nwg_panel/processes.py b/nwg_panel/processes.py index 22e47a3..b9119fc 100644 --- a/nwg_panel/processes.py +++ b/nwg_panel/processes.py @@ -94,7 +94,10 @@ def list_processes(widget): lbl.set_xalign(0) grid.attach(lbl, 2, idx, 1, 1) - lbl = Gtk.Label.new(processes[pid]["username"]) + owner = processes[pid]["username"] + if len(owner) > W_OWNER: + owner = "{}…".format(owner[:W_OWNER - 1]) + lbl = Gtk.Label.new(owner) lbl.set_width_chars(W_OWNER) lbl.set_xalign(0) grid.attach(lbl, 3, idx, 1, 1) @@ -214,10 +217,6 @@ def main(): desc_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) wrapper.pack_start(desc_box, False, True, 0) - # lbl = Gtk.Label() - # lbl.set_markup(" ") - # lbl.set_width_chars(W_KILL) - # lbl.set_xalign(0) img = Gtk.Image() img.set_property("name", "img-empty") desc_box.pack_start(img, False, False, 0)