# Budgie applet - core template (python)

**URL:** <https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044>\
**Category:** General\
**Created:** [February 9, 2020, 2:31am UTC](https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044 "2020-02-09T02:31:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![codic](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.ubuntubudgie.org/codic/32/2569_2.png) [@codic](https://discourse.ubuntubudgie.org/u/codic)\
**Post date:** [February 9, 2020, 2:31am UTC](https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044/1 "2020-02-09T02:31:45Z")

</div>

I need a file which sets up an applet called `rephere` with the logo as `img/rephere.svg`, and the applet should have nothing inside 😛 lol  
it should be in python, but Vala and C templates would also be very appreciated.  
I’m writing a Go program that bootstraps creating Budgie Applets and creates an ‘install.sh’ script to install them (how do you install an applet from source anyways?)

---

<div class="post-metadata">

**Author:** ![fossfreedom](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.ubuntubudgie.org/fossfreedom/32/1405_2.png) [@fossfreedom](https://discourse.ubuntubudgie.org/u/fossfreedom)\
**Post date:** [February 9, 2020, 7:28am UTC](https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044/2 "2020-02-09T07:28:58Z")

</div>

> **[UbuntuBudgie/budgie-extras](https://github.com/UbuntuBudgie/budgie-extras/tree/master/budgie-rotation-lock)**
>
> additional Budgie Desktop enhancements for the user experience - UbuntuBudgie/budgie-extras

Installs to a folder underneath /usr/lib/budgie-desktop/plugins/

Have a look… it should be preinstalled.

---

<div class="post-metadata">

**Author:** ![codic](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.ubuntubudgie.org/codic/32/2569_2.png) [@codic](https://discourse.ubuntubudgie.org/u/codic)\
**Post date:** [February 9, 2020, 3:29pm UTC](https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044/3 "2020-02-09T15:29:53Z")

</div>

Thanks!  
what would that look like without the responding to clicks part?

---

<div class="post-metadata">

**Author:** ![fossfreedom](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.ubuntubudgie.org/fossfreedom/32/1405_2.png) [@fossfreedom](https://discourse.ubuntubudgie.org/u/fossfreedom)\
**Post date:** [February 9, 2020, 4:18pm UTC](https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044/4 "2020-02-09T16:18:31Z")

</div>

Suggest try and play with it.

---

<div class="post-metadata">

**Author:** ![codic](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.ubuntubudgie.org/codic/32/2569_2.png) [@codic](https://discourse.ubuntubudgie.org/u/codic)\
**Post date:** [February 9, 2020, 5:37pm UTC](https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044/5 "2020-02-09T17:37:19Z")

</div>

Ok, I’ll try soon when I get the chance.  
Any templates for C and Vala, so i also can add support for them?

---

<div class="post-metadata">

**Author:** ![codic](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.ubuntubudgie.org/codic/32/2569_2.png) [@codic](https://discourse.ubuntubudgie.org/u/codic)\
**Post date:** [February 9, 2020, 5:51pm UTC](https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044/6 "2020-02-09T17:51:54Z")

</div>

```python
import gi.repository

gi.require_version('Budgie', '1.0')
from gi.repository import Budgie, GObject, Gtk, Gio
import os

"""
RotationLock
Author: David Mohammed
Copyright © 2017-2020 Ubuntu Budgie Developers
Website=https://ubuntubudgie.org
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or any later version. This
program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details. You
should have received a copy of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>.

screenlock icons
Icons made by Google from https://www.flaticon.com is licensed by
http://creativecommons.org/licenses/by/3.0/
"""

class BudgieRotationLock(GObject.GObject, Budgie.Plugin):
    """ This is simply an entry point into your Budgie Applet implementation.
        Note you must always override Object, and implement Plugin.
    """

    # Good manners, make sure we have unique name in GObject type system
    __gtype_name__ = "BudgieRotationLock"

    def __init__ (self):
        """ Initialisation is important.
        """
        GObject.Object. __init__ (self)

    def do_get_panel_widget(self, uuid):
        """ This is where the real fun happens. Return a new Budgie.Applet
            instance with the given UUID. The UUID is determined by the
            BudgiePanelManager, and is used for lifetime tracking.
        """
        return BudgieRotationLockApplet(uuid)

class BudgieRotationLockApplet(Budgie.Applet):
    """ Budgie.Applet is in fact a Gtk.Bin """
    manager = None

    def __init__ (self, uuid):
        Budgie.Applet. __init__ (self)
        self.box = Gtk.EventBox()
        self.lockicon = Gtk.Image.new_from_icon_name(
            "budgie-rotation-lock-button-symbolic",
            Gtk.IconSize.MENU,
        )

        self.unlockicon = Gtk.Image.new_from_icon_name(
            "budgie-rotation-button-symbolic",
            Gtk.IconSize.MENU,
        )

        if Gtk.get_major_version() == 3 and \
                Gtk.get_minor_version() == 18:
            # GTK+3.18
            schema = "org.gnome.settings-daemon.plugins.orientation"
            self.key = "active"
        else:
            # > GTK+3.18
            schema = "org.gnome.settings-daemon.peripherals.touchscreen"
            self.key = "orientation-lock"

        self.settings = Gio.Settings.new(schema)

        if self.settings.get_boolean(self.key):
            if self.key == "active":
                self.displayicon = self.unlockicon
            else:
                self.displayicon = self.lockicon
        else:
            if self.key == "active":
                self.displayicon = self.lockicon
            else:
                self.displayicon = self.unlockicon

        self.box.add(self.displayicon)
        self.add(self.box)
        self.box.show_all()
        self.show_all()
  

```

something like this?

---

<div class="post-metadata">

**Author:** ![codic](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.ubuntubudgie.org/codic/32/2569_2.png) [@codic](https://discourse.ubuntubudgie.org/u/codic)\
**Post date:** [February 9, 2020, 5:52pm UTC](https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044/7 "2020-02-09T17:52:41Z")

</div>

I’ll play around more to get rid of the icon change

---

<div class="post-metadata">

**Author:** ![fossfreedom](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.ubuntubudgie.org/fossfreedom/32/1405_2.png) [@fossfreedom](https://discourse.ubuntubudgie.org/u/fossfreedom)\
**Post date:** [February 9, 2020, 6:04pm UTC](https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044/8 "2020-02-09T18:04:36Z")

</div>

I am not aware of any C based templates that are current.

For vala use this [https://github.com/UbuntuBudgie/experimental/tree/master/development\_only/templates](https://github.com/UbuntuBudgie/experimental/tree/master/development_only/templates)

---

<div class="post-metadata">

**Author:** ![Rinzwind](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.ubuntubudgie.org/rinzwind/32/1152_2.png) [@Rinzwind](https://discourse.ubuntubudgie.org/u/Rinzwind)\
**Post date:** [February 10, 2020, 12:56pm UTC](https://discourse.ubuntubudgie.org/t/budgie-applet-core-template-python/3044/9 "2020-02-10T12:56:47Z")

</div>

Looks cool. I am in the middle of this kind of thing too and noticed something in the docs:

> Deprecated: Use Box instead, which is a very quick and easy change. But we recommend switching to Grid, since Box will go away eventually.

I would advice to use grid.
