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

How to add an icon in the tray ? #56

Open
HanM23 opened this issue Apr 16, 2024 · 3 comments
Open

How to add an icon in the tray ? #56

HanM23 opened this issue Apr 16, 2024 · 3 comments

Comments

@HanM23
Copy link

HanM23 commented Apr 16, 2024

Hello,

Thanks for your applet, it allows me to display the battery level, in percentage, of my mouse (a razer one) as there is no possibility with openrazer/polychromatic.

image

Now, when i was using xfce, i had also the possibility with their genmon (generic monitor) to run a script like you did, but also to modify the appearance of what is displaying in the tray with some kind of pango markup, like adding an icon next to the text, changing the font, background color and so on.

In any way, is there a possibility to add an icon, say, next to my percentage ? I have tried with no success until now.

Thank you

@Zren
Copy link
Owner

Zren commented Apr 17, 2024

@Zren
Copy link
Owner

Zren commented Apr 17, 2024

If you really want an icon, you can copy ~/.local/share/plasma/plasmoids/com.github.zren.commandoutput/ and paste it as com.github.handm23.razerbattery. Then change the Id in metadata.json to match the folder name. Also change the Name so you can tell which widget it is.

https://github.com/Zren/plasma-applet-commandoutput/blob/master/package/metadata.json#L25

Then in main.qml edit the Text from:

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

		Text {
			id: output
			width: parent.width
			height: parent.height
			...
		}

to

		RowLayout {
			width: parent.width
			height: parent.height

			Kirigami.Icon {
				source: 'battery-full'
			}

			Text {
				id: output
				// width: parent.width
				// height: parent.height
				...
			}

		}

Install plasma-sdk and use the Icon Explorer app to find an icon. I recommend input-mouse or input-mouse-symbolic.

@HanM23
Copy link
Author

HanM23 commented Apr 17, 2024

Hi @Zren

Thank you a lot for your help, it works great ! i can display an icon of my choice. Nonetheless, i have difficulties to find the right parameter in main.qml to set the correct width. I have tried to play with itemWidth, preferredWidth, but it's stucked to the same default width apparently so that the icon is displayed very well but the percentage overlaps the date/time, like so:

image

Do you know how to set the width ?
Thank you

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

2 participants