lipido / kargos

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

Irregular Visibility of Drop-Down Button #12

Open AndydeCleyre opened 7 years ago

AndydeCleyre commented 7 years ago

kargos 0.6.0 latte-dock 0.6.0.r316.g85eae84 plasma-desktop 5.10.0 qt5-base 5.8.0

With "Dropdown always visible" unchecked, the following behaviors are observed:

  1. Display dropdown button when and only when the dropdown is activated: demo
  2. Start like (1), but then always display the button: demo

I know (2) is not as intended, but I'm not sure about (1).

lipido commented 7 years ago

Cannot reproduce it. (1) is correct. (2) is not correct, the dropdown should not start like (1), it should be always visible from start. In my case, this is the behavior I observe.

Can you paste your kargos script? Could you try without latte-dock?

My environment is Kubuntu 16.04 LTS: plasma-desktop 5.5.5 qt5: 5.5.1

AndydeCleyre commented 7 years ago

Sure, I created an empty panel and added a kargos applet with default settings except for the script:

image

Here's the script:

#!/usr/bin/env python3
from time import localtime, strftime

from donuts import Donut

fmt = " | font=Iosevka size=24"

lt = localtime()
hour, minute = lt[3:5]

anchor = Donut(hour + minute / 60)
surplus = minute % 5
anchor += Donut('.1') if surplus else 0
lead = f"{5 - surplus}→" if surplus else ''
print(f"{lead}{(anchor % 12).places(1, True)}{fmt}")
print('---')
print(f"{strftime('%I:%M %p', lt)}{fmt}")
AndydeCleyre commented 7 years ago

I do wish the button could be hidden altogether, as displaying it on each click as in (1) disrupts the location of every other item on that panel.

lipido commented 7 years ago

I'm not python expert, I get

  File "./script.py", line 15
    lead = f"{5 - surplus}→" if surplus else ''
                           ^
SyntaxError: invalid syntax
lipido commented 7 years ago

When:

The dropdown button appears and displaces other widgets. The only alternative is an always visible dropdown button, like the one in the "Status & Notifications" widget, whose dropdown button is always visible.

AndydeCleyre commented 7 years ago

Sorry, I didn't realize you wanted to run my script, I didn't include a custom library it uses anyway. But I get the same behavior with:

#!/bin/bash
echo "1→2.5 | font=Iosevka size=24"
echo "---"
echo "2:24 | font=Iosevka size=24"

The only alternative is an always visible dropdown button

Is it a specific design decision to rule out a never-visible dropdown button?

lipido commented 7 years ago

Ok, I have tested it.

I've set Dropdown always visible to true. I addition, I did

killall plasmashell
plasmashell

And the dropdown button appears from the very beginning.

When you restart plasmashell from the console, a lot of output is seen (logs from every widgets of plasma). Can you paste this log to see if there is something strange?

AndydeCleyre commented 6 years ago

I'm no longer experiencing this bug. ¯\_(ツ)_/¯

AndydeCleyre commented 6 years ago

Shoot, it just re-appeared. I have the box unchecked, but the icon appears sometimes when the cursor starts or stops hovering.

https://streamable.com/kgxf6

Interestingly, this behavior stopped while I disabled compositing, and resumed when I re-enabled it.

Right now I'm using this script, with rotation at 8 and preferred height at 300:

now_playing.5s.py:

#!/usr/bin/env python3
from plumbum.cmd import playerctl
from plumbum import ProcessExecutionError
fmt = " | font='Iosevka Light' size=21"
get = playerctl['metadata']
def resize(txt, size, pre='» ', post=' «', ellipsis='center'):
    free = size - len(txt)
    if free >= 0:
        a, b = divmod(free, 2)
        return f"{pre}{' ' * a}{txt}{' ' * (a + b)}{post}"
    elif ellipsis == 'end':
        return f"{pre}{txt[:size - 1]}…{post}"
    elif ellipsis == 'center':
        a, b = divmod(size - 1, 2)
        return f"{pre}{txt[:a + b]}…{txt[-a:]}{post}"
try:
    title, artist = get('title'), get('artist')
except ProcessExecutionError:
    print(f"{fmt} iconName=spotify-indicator bash=spotify onclick=bash")
else:
    size = min(15, max(len(artist), len(title)))
    print(f"{resize(artist, size)}{fmt}")
    print(f"{resize(title,  size)}{fmt}")
    print('---')
    print(f"{title}       {fmt}", "iconName=media-album-track")
    print(f"{artist}      {fmt}", "iconName=view-media-artist")
    print(f"{get('album')}{fmt}", "iconName=media-album-cover")