Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: add an icon you can modify through the command #28

Open
tubbadu opened this issue May 17, 2021 · 4 comments
Open

feature request: add an icon you can modify through the command #28

tubbadu opened this issue May 17, 2021 · 4 comments

Comments

@tubbadu
Copy link

tubbadu commented May 17, 2021

Hi, it would be great if you could add the possibility to add an icon that you could modify after the command has been launched, something like
on click command: "do something; new_icon='~/images/icon.png' "
others widgets automatically change it like a "on/off", but sometimes I need to evaluate the situation with a command and, reading the output, changing the icon with the more appropriate one
(I tried to do this by myself modifying this and other plugins but I miserably failed XD)

@Zren
Copy link
Owner

Zren commented May 17, 2021

If https://store.kde.org/p/1297839/ isn't useful, then you can just edit the widget to something like:

https://github.com/Zren/plasma-applet-commandoutput/blob/master/package/contents/ui/main.qml#L199

Plasmoid.fullRepresentation: Item {
	id: panelItem
	PlasmaCore.IconItem {
		anchors.fill: parent
		source: widget.outputText == "ON" ? "icon-on" : "icon-off"
	}
	Text { 
		id: output
		visible: false
	}
}

See the widget documentation for help: https://develop.kde.org/docs/plasma/widget/

@tubbadu
Copy link
Author

tubbadu commented May 18, 2021

that works perfectly, thank you very much! I set the icon to the value returned by the script, so that any command just has to return the path to an icon and the widget will change its icon.
I also had to change line 79 to made the icon changeable by the click and the scrolled commands.
Now it works exactly as I wanted!
Will you ever implement this feature "officially"?

@Zren
Copy link
Owner

Zren commented May 19, 2021

Will you ever implement this feature "officially"?

No. While related, the widget is named command output. There already exists a widget that changes state based on the command output. There's also the more complicated kargos widget for full custom behavior based on the output.

I'm glad you got it working for yourself.

@Sadi58
Copy link

Sadi58 commented Dec 11, 2022

Could you please clarify if that code block should be added after line 199, and before the block regarding "Terminal colors", and how "on" and "off" icons can be used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants