Skip to content

Commit

Permalink
Add reload-all-desklets@rcalixte (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcalixte authored Dec 6, 2023
1 parent ef0c324 commit 807cd83
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 0 deletions.
4 changes: 4 additions & 0 deletions reload-all-desklets@rcalixte/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

### 1.0

* Initial release
21 changes: 21 additions & 0 deletions reload-all-desklets@rcalixte/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
RELOAD ALL DESKLETS
===================

Reload all enabled desklets in Cinnamon.

DESCRIPTION
-----------

This action will reload all desklets that are enabled on the Cinnamon desktop.
The need to do this can arise from situations that may cause desklets to
freeze such as resuming from standby/hibernation, stuck desklets, or even the
occasional disappearing desklet.

COMPATIBILITY
-------------

Due to the nature of Actions, this will only be guaranteed to be compatible up
to the latest versions of Cinnamon. Earlier versions of Cinnamon will be
supported on a best efforts basis.

As of now, this Action supports Cinnamon 5.4+.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"description": "Reload all enabled desklets in Cinnamon",
"uuid": "reload-all-desklets@rcalixte",
"name": "Reload All Desklets",
"author": "rcalixte",
"version": "1.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Reload All Desklets
# Copyright (C) 2023
# Rick Calixte <[email protected]>, 2023.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-06 15:54-0500\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.4\n"

#. metadata.json->description
msgid "Reload all enabled desklets in Cinnamon"
msgstr ""

#. metadata.json->name
#. Name
msgid "Reload All Desklets"
msgstr ""

#. Comment
msgid "Reload all enabled Desklets"
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3

import sys
import time

from gi.repository import Gio, GLib

BUS_TYPE: Gio.BusType = Gio.BusType.SESSION
DBUS_PATH: str = 'org.Cinnamon'
DESKLET: str = 'DESKLET'
FLAG: Gio.DBusProxyFlags = Gio.DBusProxyFlags.NONE
GSETTING: str = '/org/Cinnamon'
KEY: str = 'enabled-desklets'
SETTINGS: str = 'org.cinnamon'


def main():
settings: Gio.Settings = Gio.Settings.new(SETTINGS)
enabled_desklets: set = {x.split(':')[0] for x in settings.get_strv(KEY)}

try:
proxy: Gio.DBusProxy = Gio.DBusProxy.new_for_bus_sync(BUS_TYPE, FLAG,
None, DBUS_PATH,
GSETTING,
DBUS_PATH, None)
except GLib.Error:
return

if not proxy:
sys.exit(1)

for desklet in enabled_desklets:
proxy.ReloadXlet('(ss)', desklet, DESKLET)
time.sleep(0.05)
proxy.ReloadXlet('(ss)', desklet, DESKLET)
time.sleep(0.01)


if __name__ == "__main__":
main()
3 changes: 3 additions & 0 deletions reload-all-desklets@rcalixte/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"author": "rcalixte"
}
8 changes: 8 additions & 0 deletions reload-all-desklets@rcalixte/[email protected]_action.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Nemo Action]
_Name=Reload All Desklets
_Comment=Reload all enabled Desklets
Exec=<reload-all-desklets@rcalixte/[email protected]>
Icon-Name=mail-send-receive-symbolic
Selection=None
Extensions=any;
Conditions=desktop;

0 comments on commit 807cd83

Please sign in to comment.