Pause Folder Sync Using CMD
Hi,
i was trying to modify the NextCloud desktop client code so i can pause sync such as here

but from outside the GUI, such as CMD (or any other place in the code out side nextcloud project) , i know the code to pause and start syncing are this code
FolderMan *folderMan = FolderMan::
auto alias = selectedFolderAlias();
Folder *f = folderMan->folder(alias);
f->setSyncPaused(!currentlyPaused);
this code is in the accountsetting.cpp the problem is with the function selectedFolderAlias() if i want to call it i have to initialize accountsettings, and to initialize it i need accountState, and all there stuff depend on GUI
assume i have only one user, that means i have only one synced folder, how can i get the selected folder alias in this case?
Thanks
UPDATE: since in my case only one user is allowed per client, i think i can get the alias from the file nextcloud.cfg, can't i? if this is a part of the nextcloud.cfg, which is the alias?
[Accounts]
0\Folders\1\localPath=C:/Users/test/s/
version=2
0\Folders\1\journalPath=._sync_41bf84ac176a.db
0\url=http://**************
0\Folders\1\targetPath=/
0\serverVersion=14.0.0.0
0\Folders\1\paused=false
0\http_user=userM
0\Folders\1\ignoreHiddenFiles=true
0\authType=http
0\user=userM
i think here 1 is the alias correct? which before the localPath
i'm also interested in getting this feature - is it possible to have D-Bus call?
This request did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!
Any update on this issue?
Why not just use the command line client? https://docs.nextcloud.com/desktop/2.5/advancedusage.html#nextcloud-command-line-client
@michaelstingl because you haven't understood the problem he want's to solve
For the Linux desktop client, I found a way to do this through D-Bus with gdbus. If you have multiple accounts, you may need to change the 0 in the object-path.
$ gdbus call --session --dest=com.nextcloudgmbh.Nextcloud --object-path /com/nextcloudgmbh/Nextcloud/Folder/0 --method org.gtk.Actions.Activate pause '[]' '{}'
This command simulates a click of the "pause" button, so it toggles the pause state. It is also possible to query the current pause state with
$ gdbus call --session --dest=com.nextcloudgmbh.Nextcloud --object-path /com/nextcloudgmbh/Nextcloud/Folder/0 --method org.gtk.Actions.Describe pause
Output:
((true, signature '', [<false>]),)
OR
((true, signature '', [<true>]),)
Together, I put together this script that allows explicit pause and resume requests from the CLI.
Let's consolidate this with #5649, since that's the one that has the votes on it.