From 0f114c3bbacf451ea7e84be99c25b8f1b1e85d10 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Wed, 15 May 2024 18:51:59 +0200 Subject: [PATCH] add lf-dbus service --- .local/libexec/daemons/lf-dbus | 46 ++++++++++++++++++++++++++++ .local/share/service/lf-dbus/log/run | 2 ++ .local/share/service/lf-dbus/run | 6 ++++ 3 files changed, 54 insertions(+) create mode 100755 .local/libexec/daemons/lf-dbus create mode 100755 .local/share/service/lf-dbus/log/run create mode 100755 .local/share/service/lf-dbus/run diff --git a/.local/libexec/daemons/lf-dbus b/.local/libexec/daemons/lf-dbus new file mode 100755 index 00000000..3da6ddde --- /dev/null +++ b/.local/libexec/daemons/lf-dbus @@ -0,0 +1,46 @@ +#!/bin/env python3 + +import subprocess +import urllib.parse + +from gi.repository import GLib +from pydbus import SessionBus + +terminal_cmd = ["st", "-e"] + + +class FMService(object): + """ + + + + + + + + + + + + + + + + + """ + + def ShowItems(self, uris, startup_id): + uri = urllib.parse.unquote(uris[0]).replace("file://", "") + subprocess.Popen([*terminal_cmd, "lf", uri]) + + def ShowFolders(self, uris, startup_id): + self.ShowItems(uris, startup_id) + + def ShowItemProperties(self, uris, startup_id): + self.ShowItems(uris, startup_id) + + +session_bus = SessionBus() +session_bus.publish("org.freedesktop.FileManager1", FMService()) +loop = GLib.MainLoop() +loop.run() diff --git a/.local/share/service/lf-dbus/log/run b/.local/share/service/lf-dbus/log/run new file mode 100755 index 00000000..ad70fb02 --- /dev/null +++ b/.local/share/service/lf-dbus/log/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec vlogger -t lf-dbus diff --git a/.local/share/service/lf-dbus/run b/.local/share/service/lf-dbus/run new file mode 100755 index 00000000..896340e9 --- /dev/null +++ b/.local/share/service/lf-dbus/run @@ -0,0 +1,6 @@ +#!/bin/sh +exec 2>&1 + +. "$XDG_STATE_HOME/dbus" + +exec $HOME/.local/libexec/daemons/lf-dbus