Git Product home page Git Product logo

kargos's Introduction

kargos

kargos logo

A Plasma port of Argos and BitBar plugins to fast create custom plasmoids.

Note: This is an alpha project. By now, it only was tested on Kubuntu 16.04 LTS.

What is implemented

  • Submenus nesting ('--').
  • "href" attribute.
  • "bash" attribute.
  • "size" attribute.
  • "refresh" attribute.
  • "iconName" attribute (it should be a valid KDE icon name)
  • "font" attribute.
  • "color" attribute.
  • "dropdown" attribute.
  • "image" attribute (base64 encoded image).
  • "imageURL" attribute (non BitBar, kargos only). A URL for the image.
  • "imageWidth", "imageHeight" attributes (non BitBar, kargos only). Max size for the image. If only one is provided, aspect ratio is preserved.
  • "terminal" attribute.
  • "onclick" attribute (non BitBar, kargos only). Possible values: bash or href. What to execute if you click on the line, that is, to run the command indicated in the bash attribute or go to the web indicated by the href attribute. The corresponding "Go" or "Run" button will not appear.
  • HTML support. Only the subset supported by QML.
  • Interval detection on the command filename. A custom interval option is available.

Extras / Extensions

We've added a few extensions to the BitBar/Argos protocol, for extra features the authors wanted. All of these are prefixed with kargos..

Icons from Font Awesome

When writing quick bash scripts for personal use, coming up with icons that look decent on various screen sizes/densities is a pain. Using plasma's icons look beautiful, but they are a rather limited selection.

Font Awesome on the other hand, have a vast library of icons that are, well... awesome!
You can use them with the kargos.fa_icon attribute, like so:

#!/bin/bash

# Note: font awesome icon size is determined by font size
echo "Hello world! | kargos.fa_icon=globe size=16";

This would cause Kargos to render:
Kargos examples/font-awesome.sh screenshot

Note that this uses font awesome version 4.7, so make sure you filter by that version if you use their gallery. Furthermore, some of their icons are not free and can't be used in Kargos. Refer to the plasmoid/contents/vendor/FontAwesome/FontAwesome.qml file for an authoritative list of icons that can be used in Kargos.

Installation

To get and install the latest version:

git clone [email protected]:lipido/kargos.git
cd kargos
kpackagetool5 -t Plasma/Applet --install plasmoid

Also, you can find a release of kargos in kde-look.org, so you can install it directly from your desktop by choosing "Get new widgets"

If you're using Arch Linux, there's also an AUR pacakge for it.

Example plugin

kargos follows (part of) the BitBar plugin standard, which is very simple. To create a plugin, all you have to do is to create an executable program (in any language) that produces standard output following an specific format.

For example, this is the examples/kargos_plugin.1s.sh file (1s means that the plasmoid will re-render every 1 second):

#!/bin/bash
echo "$(date)"
echo "---"
echo "Launch Gimp | bash=/usr/bin/gimp iconName=applications-graphics"
echo "Kernel: $(uname -r) | iconName=system-settings iconName=applications-development"
echo "Go to <i>Google</i> | href=http://www.google.com size=4 iconName=applications-internet" 
TOP_OUTPUT=$(top -b -n 1 | head -n 20 | awk 1 ORS="\\\\n")
echo "$TOP_OUTPUT | font=monospace iconName=applications-system"

You need to configure this file in your plasmoid options: kargos options panel

And then it will produce the following contents in your plasmoid: kargos example plasmoid

That's all. You can add the a kargo plasmoid to your panel. You have to configure it to indicate the command or executable.

Another example: a RSS reader

This a tribute to the KDE 3 KNewsTicker. There are many RSS readers, but the concept of KNewsTicker was unique for me. I do not like to open a RSS client or take any action to read feeds because, although I can do this the first days, in a few days I am not checking them anymore. However, with KNewsTicker, news are rotating continuously and in a discrete fashion. However, you will be aware of them sooner or later.

KNewsTicker was discontinued and no longer available since KDE 4. But you can implement it easily with kargos and Python!

You can find an example of plugin to read your favourite RSS feeds. News will be rotating in your panel and, if you dropdown, you can read all the news.

Here are the results!

kargos RSS plugin

Discussion / Contributing

Have questions, ideas, or just wanna talk about Kargos? Come join us at #kargos:kde.org.

Note that this is a matrix channel, not IRC. Matrix is (in many ways) the successor to IRC and KDE is already using it. The KDE wiki has a nice guide for getting started if you've never used matrix client before.

kargos's People

Contributors

fatalis avatar jvonhoff avatar lipido avatar roachsinai avatar shocklateboy92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kargos's Issues

Allow easy use of Font Awesome icons

The longest part of writing kargos scripts personally has been coming up with a decent looking icon, sizing it correctly and adding it somewhere I can easy reference it from my script.

There's over 7000 cool, high quality icons as part of Font Awesome. If Kargos already had them already integrated a script just needed to reference it, that would make the process much nicer.

Of course, Material Design Icons should also be a consideration.

Overhaul handling of spaces and quotes in arguments

I've never used BitBar and don't know if I'm breaking compatibility by doing this, but here's how I think arguments should be parsed.

| arg1=value1 arg2=value\ 2 "arg3=value 3" arg4="value 4" and arg5=value" 5" 'arg 6=value 6'

Should all break down into argN=value N, kind of like how a shell would do. (I don't plan to have any keys with spaces in them, but the argument parser shouldn't care).

Gathering some feedback before I take a crack at implementing it.

Multiline Capability

Currently Kargos displays only in a single line, would be nice to have it display in user configurable ammount of lines

Vertical-align and margin are not nice.

It's like the "Vertical-align" isn't aligned to the middle, and the left/right margin is a little too far. See the screenshot below:

screenshot

The .sh file:

#!/bin/bash
echo "en | font=HackBold size=13"

How to update when click on title

Hi

How can I execute a script or refresh the current one when I click on the title of the widget?
In Gnome ARGOS, you can know if you were clicked with the condition:
"if [" $ ARGOS_MENU_OPEN "==" true "]; then", is there something equivalent in KARGOS?

Python scripy font set not work.

123

I set font-family Hack which is a monospace font on both taskbar and dropdown, but only works on taskbar. Pic above shows the numbers are not monospace.

URLs do not show up

The URLs don't show in the drop down box at all. Even the example rssnews.30m.sh doesn't show clickable link for google.com, for instance.
KDE Plasma 5.13.3
KDE Frameworks 5.48.0
Kargos latest from Github

multi line

Greetings and thank You for great plasmoid.

I wonder, would it be possibe in architecture of concept to implement multiple lines in main item at least?
for example a clock with date below:
9:20
02/08/2017

or for media info:
Band
Songname

Script colorized output

Support for the color= option, as it doesn't seem to work at the moment.

Example:

echo "test | size=11 color=#ff0000" prints test with font size 11 in normal color, instead of the given color.

bitbar's API

Irregular Visibility of Drop-Down Button

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).

Missing icons and images

Kargos doesn't seem to be able to load images correctly.
in the plugin demo (rotating items) only image I see is the "dialog-ok" icon.
I see lot of these in item labels: (href, icon, onclick=href), which I think should be replaced with proper variables, and not showing on screen?

screenshot

also, I seem to be unable to put any icons on title bar.. it's just text that shows up even if I add |iconName=dialog-ok forexample in the first echoed line.

I'm using Kargos from git.
this is Kubuntu 17.04

Multi-script version

I once started using this to display a series of icons with counts (that were pretty easy to fetch from various sources in bash scripts) and the (second) most time consuming thing was adding the widget and choosing the script.

It would be nice if there was a version of this applet that takes a directory, and executes all the scripts in it as they were separate instances of Kargos.

A question about `bash` attribute.

How can I pass kdialog --msgbox Test to bash attribute?
Tried the below echo but nothing works:

echo "This bash doesn't run | bash='kdialog --msgbox Test'"

cmd="kdialog --msgbox Test"
echo "This bash doesn't run too | bash=$cmd"

I could create another .sh file to place into the bash attribute. But could you improve the parser of kargos in this case?

command produces blank window

Hello, i tried to use "nvidia-smi" with this widget and it for some reason displays just a blank window. Its similar to a program that doesnt return a value straight away (such as htop) being used but this command runs and stops similar to top.

Convention for new arguments

I wanted to start the discussion regarding our procedure for adding new arguments (hopefully without minimizing BitBar/Argos compatibility).

This came up when I started thinking about what argument/key to use when implementing #31. My two initial ideas were as follows:

  1. Prefix all our extensions with a kargos. E.g. kargos.fa_icon=bug
  2. Keep the same keys, but distinguish based on values, I.e. icon=fa:bug

What do people think? I'll update the readme once we settle on this.

didn't respect the size on next startup

Every time it is started at a large size, looks random, sometimes bigger than before....I guess it is influencied by othes widgets and position on screen.
Anyway, After it is started, I resize it back to an usuable size, big enought to display the fixed content without scrollbars.
Next time plasma shell is started, kargos start with a large size.

Keyboard navigation.

Hi.

Just realized, that even I call plasmoid with hotkey its impossible to select items via keyboard, with mouse only.
It would be useful feature, i believe )

Configurable tooltip

@trmdi suggested "It would be more flexible if the tooltip could be changed, for example users could hover over the time icon to see the date, no need to click to display the submenu, it is similar to the default Time date widget." #2

Request: compact width.

I run 3 script use kargos. This is great.

But the margin on the right is wide.

Sorry that I can't make a screenshot for popup on KDE(don't know why).

Is ther a way to align the content show in popup or cut the right margin?

Need a new maintainer?

Hey @lipido,

It looks like this project hasn't had any activity in about 2 years. If your priorities have changed and don't have time for this anymore, please make me a maintainer. I'd like to revive this project (I have a few improvements in mind).

Cheers,
Lasath

Some UI suggestions

@lipido

  1. Could you give an option to display Run/Go button or display just a hover effect like the Share button, or even no effect at all.
  2. It would be more flexible if the tooltip could be changed, for example users could hover over the time icon to see the date, no need to click to display the submenu, it is similar to the default Time date widget.

Request: Dropdown never visible mode

Panel space is precious, so I would prefer not to take up extra space just for the dropdown button, which is a visual cue but acts the same as any other part of the my applet when clicked.

The current hidden-mode behavior of showing the dropdown icon whenever the dropdown is shown and hiding again when the dropdown is hidden makes the entire panel resize with each click, which is really jarring and unpleasant and affects many other applets.

"refresh" should run after "bash" if both attributes are set for an item

Per bitbar API:

refresh=.. to make the item refresh the plugin it belongs to. If the item runs a script, refresh is performed after the script finishes. eg. refresh=true

This make sense for some use cases like a Trello todo list. When a "done" submenu item is clicked, it runs a script that make an HTTP PUT request to move the item to a designated list for done items, then the whole widget refreshes to remove the done item.

However, I think such behaviour is currently not possible for kargos, either for the "IconifiableButton" (the button you get without onclick defined) or for direct clicking of the item when onclick=bash. I have looked at the source code (sorry not familiar with qml), and it seems that the "IconifiableButton" does not honor any refresh attribute. And for the case when onclick is defined, the widget is updated before running bash

It would be nice if you could implement such behaviour. Thanks a lot!

Edit: after testing it seems that refresh works when onclick=bash. Therefore this problem only applies to the "IconifiableButton".

kargos version environment variable

I would like to write plugins that are compatible with kargos as well as other BitBar implementations like Argos, xbar, or SwiftBar. As such it would be nice to have an environment variable to be able to identify the app running the plugin as kargos, ideally with version info, e.g. KARGOS_VERSION=x.y.z. That way I would be able to make full use of the features available in the given implementation and version, with graceful fallbacks for unsupported features.

Request: adding fixed-width mode for kargos on the panel

Like the title says, could you add this mode to kargos?
If the label is too long, you could truncate it in order to fit the fixed width. And the tooltip would support to display the full text, with a picture, for example...

// Thank you for good listening. Have a nice weekend!

Change button's look

@trmdi suggested in #3:

About the buttons effect, can you make it like this:

  • The arrow button: exactly like the one of the system tray widget. (no border at all)
  • The Run/Go button: remove all the border, set the alpha color (alpha in #rgba) about 90% when the mouse is outside the button, and 100% when the mouse is inside.

How to set font family of stuff shows on taskbar?

Follow the instructions in #22 , I can let kargos show two rows on taskbar. But even I set Monospace font by face in tag, seems the face setting not work. Like 1 is thin than other numbers which makes stuff shows on kargos floating left to right, right to left.

Clicking on image not do bash/href action

echo "| bash='$base_dir/ibus_switch.sh' onclick=bash imageURL=$icon size=5"

I want to create a non-title instance of kargos like this one (without a title before |). But in this case clicking on the image cause nothing to happen.

Please add support for this.

Request: specify font weight (counterpart to QML's font.weight)

Hi,

Thanks for this great project. I noticed that the 0.6.0 supports spaces in attributes by using single quotes, but I have been unable to get it to use a font style "Iosevka Light," trying as follows:

fmt = " | font='Iosevka Light' size=24"

Iosevka (regular) works without problem.

$ fc-match "iosevka light"
iosevka-custom-light.ttf: "Iosevka" "Light"

How to install it?

$ plasmapkg2 -t plasmoid --install .plasmoid
produces the following error:
Error: Installation of failed: No such file:

How to compile the .plasmoid file?

Edit: it works with kpackagetool5 -t Plasma/Applet --install plasmoid. If it's right please update the README

Request: Add color gradient to text

It would be a nice addition to an already great plasmoid.
Below is an example and code of gradient text. I am not that knowledgeable in QML to figure out how to add it to the project. Thanks for all the great work.

gradient

import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0

PlasmaComponents.Label {
    Rectangle {
        id: gradientRect;
        width: 10
        height: 10
        gradient: Gradient {
            GradientStop { position: 0; color: "red" }
            GradientStop { position: 1; color: "orange" }
        }
        visible: false;
        layer.enabled: true;
        layer.smooth: true
    }

    Text {
        id: txt
        anchors.centerIn: parent
        text: "Hello, world"
        font.pixelSize: 16
        layer.enabled: true
        layer.samplerName: "maskSource"
        layer.effect: ShaderEffect {
            property var colorSource: gradientRect;
            fragmentShader: "
                        uniform lowp sampler2D colorSource;
                        uniform lowp sampler2D maskSource;
                        uniform lowp float qt_Opacity;
                        varying highp vec2 qt_TexCoord0;
                        void main() {
                            gl_FragColor =
                                texture2D(colorSource, qt_TexCoord0)
                                * texture2D(maskSource, qt_TexCoord0).a
                                * qt_Opacity;
                        }
                    "
            }   
        }
    
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.