I have recently started using Kupfer again as my application launcher in Ubuntu MATE, and I found it lacked the ability to suspend the computer.
Here is the plugin I wrote to support this.
To install it, quit Kupfer, create a directory in your home dir called .local/share/kupfer/plugins, and create this file suspend.py inside:
__kupfer_name__ = _("Power management")
__kupfer_sources__ = ("PowerManagementItemsSource", )
__description__ = _("Actions to suspend the computer")
__version__ = "2021-05-05"
__author__ = "Andy Balaam "
from kupfer.plugin import session_support as support
class Suspend (support.CommandLeaf):
def __init__(self, commands):
support.CommandLeaf.__init__(self, commands, "Suspend")
def get_description(self):
return _("Suspend the computer")
def get_icon_name(self):
return "system-suspend"
class PowerManagementItemsSource (support.CommonSource):
def __init__(self):
support.CommonSource.__init__(self, _("Power management"))
def get_items(self):
return (Suspend((["systemctl", "suspend"],)),)
# Copyright 2021 Andy Balaam, released under the MIT license.
Now restart Kupfer, go to Preferences, Plugins, and tick “Power management”.
You should now see a “Suspend” item if you search for it in the Kupfer interface.
Inspired by: Mate Session Management – Kupfer Plugin.
Reference docs: Kupfer Plugin API