Skip to content

Commit

Permalink
Add support for Nemo file manager (compile time switch)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntninja committed Feb 21, 2016
1 parent b544ca2 commit 0c14d3e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
33 changes: 30 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
all:
mkdir -p ~/.local/share/nautilus-python/extensions && cp *.py ~/.local/share/nautilus-python/extensions
echo "Done. Please restart Nautilus."
TARGET ?= Nautilus

# To lower case function
lc = $(shell echo "$1" | tr '[:upper:]' '[:lower:]')

# File manager extension directory
directory-ext := ${HOME}/.local/share/$(call lc,${TARGET})-python/extensions
directory-build := build

.PHONY: all
all: build

# Copy files to build directory and substitute %%TARGET%% for the given target name
.PHONY: build
build:
mkdir -p "${directory-build}"
cp $(wildcard *.py) "${directory-build}/"
sed -i "s/%%TARGET%%/$(call lc,${TARGET})/g" "${directory-build}"/*

# Copy files from build directory to the target's python extension directory
.PHONY: install
install: build
mkdir -p "${directory-ext}"
cp "${directory-build}"/* "${directory-ext}/"
@echo "Done. Please restart ${TARGET}."

# Remove build directory
.PHONY: clean
clean:
rm -rf "${directory-build}"
8 changes: 7 additions & 1 deletion kdeconnect-ext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from gi.repository import Nautilus, GObject
import importlib

from gi.repository import GObject
from kdeconnect import send_files, get_available_devices

TARGET = "%%TARGET%%".title()
Nautilus = importlib.import_module("gi.repository.{}".format(TARGET))


class KDEConnectExtension(GObject.GObject, Nautilus.MenuProvider):
def __init__(self):
pass
Expand Down
1 change: 0 additions & 1 deletion kdeconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def send_files(files, device_id, device_name):
# return results

def get_available_devices():
# return [ {"name": "Xperia Z", "id": "stuff"} ]
devices_a=[]
devices = check_output(["kdeconnect-cli", "-a"]).strip().split("\n")
devices.pop()
Expand Down

0 comments on commit 0c14d3e

Please sign in to comment.