Skip to content

Commit

Permalink
Merge pull request forabi#2 from alexander255/master
Browse files Browse the repository at this point in the history
Nemo file manager support
  • Loading branch information
forabi committed Feb 21, 2016
2 parents b544ca2 + bc1aaf6 commit 50a4f05
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 7 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}"
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,19 @@ Installation
-------------
In addition to [KDE Connect](https://community.kde.org/KDEConnect), this extension requires [nautilus-python](https://wiki.gnome.org/Projects/NautilusPython) and libnotify. Following are the instructions for Arch Linux:

1. On your PC, install `kdeconnect-git`, `kde-cli-tools`, `python2-nautilus` and `libnotify`.
1. On your PC, install `kdeconnect-git`, `kde-cli-tools`, `python2-nautilus` and `libnotify-bin`.
2. Install the KDE Connect companion app for Android, available on [Google Play](https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp) and [F-Droid](https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp).
3. Launch KDE Connect on your PC and on your Android device. Pair the two devices and enable the sharing plugin.
4. Clone this repository and install the extension: `git clone https://github.com/forabi/nautilus-kdeconnect && cd nautilus-kdeconnect && make`.
4. Clone this repository and install the extension: `git clone https://github.com/forabi/nautilus-kdeconnect && make -C nautilus-kdeconnect install`.

### Nemo file manager

*nautilus-kdeconnect* can also be used with the Nemo file manager:

1. On your PC, install the `kdeconnect`, `kde-cli-tools`, `python-nemo` and `libnotify-bin` packages.
* If you are using some Debian-based distribution that is not *Linux Mint*, you won't find the `python-nemo` package in the software repositories:
1. Download and install the [`python-nemo` package](https://packages.linuxmint.com/pool/backport/n/nemo-python/) from the *Linux Mint* package archive site.
2. Run `sudo ln -s /usr/lib/nemo/extensions-3.0/libnemo-python.so /usr/lib/x86_64-linux-gnu/nemo/extensions-3.0/` to create a compatibility symlink to newly installed the extension file.
2. Install the KDE Connect app for Android as mentioned above ([Google Play](https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp) / [F-Droid](https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp)).
3. Launch KDE Connect on your PC and on your Android device. Pair the two devices and enable the sharing plugin.
4. Clone this repository and install the extension with the `Nemo` target: `git clone https://github.com/forabi/nautilus-kdeconnect nemo-kdeconnect && make -C nemo-kdeconnect install TARGET=Nemo`.
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 50a4f05

Please sign in to comment.