plasma-applet-commandoutput icon indicating copy to clipboard operation
plasma-applet-commandoutput copied to clipboard

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

Open tubbadu opened this issue 4 years ago • 4 comments

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)

tubbadu avatar May 17 '21 11:05 tubbadu

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/

Zren avatar May 17 '21 23:05 Zren

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"?

tubbadu avatar May 18 '21 09:05 tubbadu

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.

Zren avatar May 19 '21 01:05 Zren

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?

Sadi58 avatar Dec 11 '22 16:12 Sadi58