From 2931a00500fa523cb8e91bb7bc6a08d1d26ff416 Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Sat, 22 Feb 2020 15:16:09 +0100 Subject: [PATCH] Initial import --- README.md | 17 +++++++++++++++++ tabcounter/__init__.py | 30 ++++++++++++++++++++++++++++++ tabcounter/metadata.desktop | 11 +++++++++++ 3 files changed, 58 insertions(+) create mode 100644 README.md create mode 100644 tabcounter/__init__.py create mode 100644 tabcounter/metadata.desktop diff --git a/README.md b/README.md new file mode 100644 index 0000000..7d1fe2a --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# tabCounter +Plugin for [Falkon](https://www.falkon.org/) web browser. + +## Description +A basic python plugin for Falkon + +## Installation +### Automatic +Go to [Falkon store](https://store.falkon.org/) press `Install` and follow the instructions. + +### Manual +Copy the `tabcounter` directory into `~/.config/falkon/plugins/` + +With Falkon 3.1 and lower copy the `tabcounter` directory into Falkon global plugin directory. +e.g. `/usr/lib/qt/plugins/falkon/python/` + +> It will only work if Python support is enabled and functional. diff --git a/tabcounter/__init__.py b/tabcounter/__init__.py new file mode 100644 index 0000000..c104065 --- /dev/null +++ b/tabcounter/__init__.py @@ -0,0 +1,30 @@ +import Falkon +from PySide2 import QtCore + + +class tabCounter(Falkon.PluginInterface, QtCore.QObject): + def init(self, state, settingsPath): + plugins = Falkon.MainApplication.instance().plugins() + + plugins.mainWindowCreated.connect(self.onMainWindowCreated) + plugins.mainWindowDeleted.connect(self.mainWindowDeleted) + + if state == Falkon.PluginInterface.LateInitState: + for window in Falkon.MainApplication.instance().windows(): + self.onMainWindowCreated(window) + + def unload(self): + for window in Falkon.MainApplication.instance().windows(): + self.mainWindowDeleted(window) + + def testPlugin(self): + return True + + def onMainWindowCreated(self, window): + pass + + def mainWindowDeleted(self, window): + pass + + +Falkon.registerPlugin(tabCounter()) diff --git a/tabcounter/metadata.desktop b/tabcounter/metadata.desktop new file mode 100644 index 0000000..bf383a9 --- /dev/null +++ b/tabcounter/metadata.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=tabCounter +Comment=A basic python plugin for Falkon + +Type=Service +X-Falkon-Type=Extension/Python + +X-Falkon-Author=Example name +X-Falkon-Email=python@example.com +X-Falkon-Version=1.0.0 +X-Falkon-Settings=false