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

Add suppport for KDE/Plasma #28

Merged
merged 6 commits into from Nov 22, 2017
Merged

Conversation

maxanier
Copy link
Contributor

On my linux system with Plasma (running Arch Linux/Manjaro) this tool does not work since neither gsettings nor gconftool-2 nor dcop work even though they are present.

This PR adds a working method using qdbus.

Without #27 or similar this does not really help as the other ones (gsettings ...) are present and used first.
As a workaround I just manually delete all other services from the lib/linux.js script for now.

lib/linux.js Outdated
set: ['org.kde.plasmashell',
'/PlasmaShell',
'org.kde.PlasmaShell.evaluateScript',
'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file://%s")}'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a template literal here for the code and format it properly, for readability reasons.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What JS engine and version is PlasmaShell running?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean with template literal here (haven't worked much with JS).
Also don't know much about the JS engine.
Just wanted to share my solution here after I managed to find/create a working command.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found them of course :D Just not sure how to apply them here.
Just use the multiline (without \n) functionality like follows or do some magic tricks with replacement and more?

set: ['org.kde.plasmashell',
		'/PlasmaShell',
		'org.kde.PlasmaShell.evaluateScript',
		`var allDesktops = desktops();
		//print (allDesktops);
		for (i=0;i<allDesktops.length;i++) {
		d = allDesktops[i];
		d.wallpaperPlugin = "org.kde.image";
		d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");
		d.writeConfig("Image", "file://%s");
		}` ]

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I was thinking, yes.

@sindresorhus
Copy link
Owner

this does not really help as the other ones (gsettings ...) are present and used first.

Can't we just change the order to prefer this if available over gsettings?

@maxanier
Copy link
Contributor Author

I think qdbus is available on (at least some) other systems (not running Plasma) as well, so it would be used instead of gsettings and thereby break the functionality.

@sindresorhus
Copy link
Owner

We could detect if Plasma is installed then.

@sindresorhus
Copy link
Owner

I did some formatting tweaks. Can you confirm it still works?

@maxanier
Copy link
Contributor Author

Yes, we could check for plasmashell for example. However, this would of course require a modification of the program structure as it currently checks the cmd for availability. So we have to add an additional check for an optional command.

As this probably affects other desktops as well I suggest doing this separate from this PR.

Will check your changes when I am home

@maxanier
Copy link
Contributor Author

Works

@sindresorhus sindresorhus merged commit 1c81c72 into sindresorhus:master Nov 22, 2017
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

Successfully merging this pull request may close these issues.

None yet

2 participants