add lf-dbus service
This commit is contained in:
parent
d56309ee82
commit
866d5ed847
3 changed files with 54 additions and 0 deletions
46
.local/libexec/daemons/lf-dbus
Executable file
46
.local/libexec/daemons/lf-dbus
Executable file
|
@ -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):
|
||||
"""
|
||||
<node>
|
||||
<interface name='org.freedesktop.FileManager1'>
|
||||
<method name='ShowFolders'>
|
||||
<arg type='as' name='URIs' direction='in'/>
|
||||
<arg type='s' name='StartupId' direction='in'/>
|
||||
</method>
|
||||
<method name='ShowItems'>
|
||||
<arg type='as' name='URIs' direction='in'/>
|
||||
<arg type='s' name='StartupId' direction='in'/>
|
||||
</method>
|
||||
<method name='ShowItemProperties'>
|
||||
<arg type='as' name='URIs' direction='in'/>
|
||||
<arg type='s' name='StartupId' direction='in'/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
"""
|
||||
|
||||
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()
|
2
.local/share/service/lf-dbus/log/run
Executable file
2
.local/share/service/lf-dbus/log/run
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
exec vlogger -t lf-dbus
|
6
.local/share/service/lf-dbus/run
Executable file
6
.local/share/service/lf-dbus/run
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
exec 2>&1
|
||||
|
||||
. "$XDG_STATE_HOME/dbus"
|
||||
|
||||
exec $HOME/.local/libexec/daemons/lf-dbus
|
Loading…
Add table
Reference in a new issue