Commit 3c1ebc4c authored by akiraohgaki's avatar akiraohgaki Committed by GitHub
Browse files

Merge pull request #8 from xdgurl/development

1.0.0
parents 3f03ac3f 59e294de
# Install-type mapping
## https://www.app-addons.org/
Category | Install-type
---------|-------------
GnoMenu Skins | -
VLC Skins | -
XMMS Skins | -
Krita Resources | -
Amarok Themes | -
Knights Themes | -
Yakuake Skins | yakuake_skins
Kdenlive FX | -
ODF Templates | -
MPlayer Themes | -
## https://www.compiz-themes.org/
Category | Install-type
---------|-------------
Compiz Themes | emerald_themes / compiz_themes
Skydomes | -
Cubecaps | -
## https://www.e17-stuff.org/
Category | Install-type
---------|-------------
Enlightenment Themes | enlightenment_themes
E17 Entrance Themes | -
E17 Enlightenment Backgrounds | enlightenment_backgrounds
E17 Animated Backgrounds | enlightenment_backgrounds
## https://www.free-artwork.org/
Category | Install-type
---------|-------------
3D Renderings | -
Stock Images | -
Animations | -
Drawings | -
Cliparts | -
Paintings | -
Artwork Contest | -
Inkscape Templates | -
Scribus Templates | -
Logos | -
## https://www.box-look.org/
Category | Install-type
---------|-------------
Beryl/Emerald Themes | emerald_themes / beryl_themes
Metacity Window Decorations | themes / metacity_themes
Fluxbox Themes | fluxbox_styles
Openbox Themes | themes / openbox_themes
Pek-WM Themes | pekwm_themes
Ice-WM Themes | icewm_themes
FVWM Themes | -
Window-Maker Themes | -
## https://www.beryl-themes.org/
Category | Install-type
---------|-------------
Beryl/Emerald Themes | emerald_themes / beryl_themes
## https://www.cinnamon-look.org/
Category | Install-type
---------|-------------
Cinnamon Themes | themes / cinnamon_themes
GTK3 Themes | themes / gtk3_themes
MDM Themes | -
GNOME Icon Themes | icons
Cinnamon Applets | cinnamon_applets
Cinnamon Desklets | cinnamon_desklets
Cinnamon Extensions | cinnamon_extensions
## https://www.trinity-look.org/
Category | Install-type
---------|-------------
Wallpapers | wallpapers
KDE 3.x Window Decorations | -
KDE 3.x Themes | -
Kbfx Menu Themes | -
Karamba | -
KDM3 Themes | -
KDE 3 Splash Screens | -
## https://www.gnome-look.org/
Category | Install-type
---------|-------------
Wallpapers | wallpapers
Fonts | fonts
Mouse Themes | cursors
Metacity Window Decorations | themes / metacity_themes
Nautilus Scripts | nautilus_scripts
GnoMenu Skins | -
GDM Themes | -
GNOME 3.x Shell Themes | themes / gnome_shell_themes
GTK3 Themes | themes / gtk3_themes
GTK2 Themes | themes / gtk2_themes
Icon Themes | icons
Gnome Extensions | gnome_shell_extensions
Gnome Color Schemes | -
Gnome Other | -
Cairo Clock Themes | cairo_clock_themes
## https://www.mate-look.org/
Category | Install-type
---------|-------------
Mouse Themes | cursors
Metacity Window Decorations | themes / metacity_themes
GDM Themes | -
GNOME Icon Themes | icons
GTK2 Themes | themes / gtk2_themes
## https://www.xfce-look.org/
Category | Install-type
---------|-------------
Wallpapers | wallpapers
Mouse Themes | cursors
Compiz Themes | emerald_themes / compiz_themes
Beryl/Emerald Themes | emerald_themes / beryl_themes
GTK2 Themes | themes / gtk2_themes
XFCE Icon Themes | icons
XFCE/XFWM Themes | themes / xfwm4_themes
## https://www.kde-look.org/
Category | Install-type
---------|-------------
Plasma Look'n'Feel | plasma_look_and_feel / plasma5_look_and_feel
Plasma 5 Themes | plasma_desktopthemes / plasma5_desktopthemes
Plasma Widget Styles | -
Aurorae Themes | aurorae_themes
deKorator Themes | dekorator_themes
Kvantum Styles | themes / kvantum_themes
QtCurve Styles | qtcurve
Bespin Themes | -
Plasma Splash Screens | -
SDDM Themes | -
Plasma 5 Widgets | plasma_plasmoids / plasma5_plasmoids
Plasma Color Schemes | color_schemes / plasma_color_schemes
Mouse Cursors | cursors
Emoticons | emoticons
Conky Screenlets | -
Kwin Scripts | kwin_scripts
Kwin Switching Layouts | kwin_tabbox
Dolphin Service Menus | -
Amarok 2.x Scripts | amarok_scripts
Plasma Improvements | -
Plasma Comics | -
Yakuake Skins | yakuake_skins
Wallpapers | wallpapers
# xdgurl
\ No newline at end of file
# xdgurl
An install helper program for desktop stuff.
Copyright: 2016, Akira Ohgaki
License: GPL-3+
## How to install
For Ubuntu/Debian system,
you can use "install.sh" in the project to install the program.
$ sh install.sh
And you can use "uninstall.sh" to uninstall the program.
$ sh uninstall.sh
## How to use
#### From web browser
Open XDG-URL by click a links, or type XDG-URL in browser's address bar.
In firefox,
you can get a program selection window when first time to open XDG-URL,
and you can choose "xdgurl" as custom URL handler.
If you can not get a program selection window,
you need set the xdgurl program as custom URL handler for xdg:// scheme in browser's settings.
#### From command-line terminal
Execute xdgurl program with argument XDG-URL.
$ xdgurl "XDG-URL"
## XDG-URL
XDG-URL is a custom URL that represent the installation method for desktop stuff.
[scheme]://[command]?[query string]
For example:
xdg://install?url=http%3A%2F%2Fexample.com%2Ficons.tar.gz&type=icons
#### Scheme
* xdg
* xdgs
"xdgs" scheme is the same of the xdg scheme for now,
it's a reserved name for secure protocol in the future.
#### Command
* download
* install
Command "download" will download the file from specified URL to local destination of specified install-type.
Command "install" will make file downloading and trigger installation process.
#### Query string
XDG-URL's query string is an option of command.
*All query string values should be urlencoded.*
**url** = File URL of desktop stuff
Must be set.
**type** = Install-type
Optional.
Default is "downloads".
Available install-type:
Install-type | Local destination
-------------|------------------
downloads | ~/Downloads
documents | ~/Documents
pictures | ~/Pictures
music | ~/Music
videos | ~/Videos
wallpapers | ~/.local/share/wallpapers
fonts | ~/.fonts
cursors | ~/.icons
icons | ~/.local/share/icons
emoticons | ~/.local/share/emoticons
themes | ~/.themes
emerald_themes | ~/.emerald/themes
enlightenment_themes | ~/.e/e/themes
enlightenment_backgrounds | ~/.e/e/backgrounds
fluxbox_styles | ~/.fluxbox/styles
pekwm_themes | ~/.pekwm/themes
icewm_themes | ~/.icewm/themes
plasma_plasmoids | ~/.local/share/plasma/plasmoids
plasma_look_and_feel | ~/.local/share/plasma/look-and-feel
plasma_desktopthemes | ~/.local/share/plasma/desktoptheme
kwin_effects | ~/.local/share/kwin/effects
kwin_scripts | ~/.local/share/kwin/scripts
kwin_tabbox | ~/.local/share/kwin/tabbox
aurorae_themes | ~/.local/share/aurorae/themes
dekorator_themes | ~/.local/share/deKorator/themes
qtcurve | ~/.local/share/QtCurve
color_schemes | ~/.local/share/color-schemes
gnome_shell_extensions | ~/.local/share/gnome-shell/extensions
cinnamon_applets | ~/.local/share/cinnamon/applets
cinnamon_desklets | ~/.local/share/cinnamon/desklets
cinnamon_extensions | ~/.local/share/cinnamon/extensions
nautilus_scripts | ~/.local/share/nautilus/scripts
amarok_scripts | ~/.kde/share/apps/amarok/scripts
yakuake_skins | ~/.kde/share/apps/yakuake/skins
cairo_clock_themes | ~/.cairo-clock/themes
Available alias name of the install-type:
Alias | Install-type
------|-------------
gnome_shell_themes | themes
cinnamon_themes | themes
gtk2_themes | themes
gtk3_themes | themes
metacity_themes | themes
xfwm4_themes | themes
openbox_themes | themes
kvantum_themes | themes
compiz_themes | emerald_themes
beryl_themes | emerald_themes
plasma4_plasmoids | plasma_plasmoids
plasma5_plasmoids | plasma_plasmoids
plasma5_look_and_feel | plasma_look_and_feel
plasma5_desktopthemes | plasma_desktopthemes
plasma_color_schemes | color_schemes
**filename** = Alternative file name
Optional.
This option is useful if the download URL does not represent the file name.
#!/bin/sh
# Install
cd `dirname $0`
sudo apt-get install python
sudo apt-get install python-tk
sudo apt-get install desktop-file-utils
sudo install -D -m 755 src/xdgurl.py /usr/bin/xdgurl
sudo install -D -m 644 src/xdgurl.desktop /usr/share/applications/xdgurl.desktop
sudo update-desktop-database -q /usr/share/applications
# Maintainer: Akira Ohgaki <akiraohgaki@gmail.com>
pkgname=xdgurl
pkgver=1.0.0
pkgrel=1
pkgdesc="An install helper program for desktop stuff."
arch=('i686' 'x86_64')
url="https://github.com/xdgurl/xdgurl"
license=('GPL3')
depends=('tk')
#source=("$pkgname-$pkgver.tar.gz")
source=("$pkgname.tar.gz")
md5sums=() #autofill using updpkgsums
package() {
#cd "$pkgname-$pkgver"
cd $pkgname
install -D -m 755 "src/$pkgname.py" "$pkgdir/usr/bin/$pkgname"
install -D -m 644 "src/$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
}
#!/bin/sh
cd `dirname $0`
tar -czvf /tmp/xdgurl.tar.gz ../../../xdgurl
mv /tmp/xdgurl.tar.gz ./
updpkgsums
makepkg -s
#!/bin/sh
cd `dirname $0`
mkdir -p ~/rpmbuild/BUILD
mkdir -p ~/rpmbuild/SPECS
cp -r ../../../xdgurl ~/rpmbuild/BUILD/
cp xdgurl.spec ~/rpmbuild/SPECS/
rpmbuild -bb ~/rpmbuild/SPECS/xdgurl.spec
Summary: An install helper program for desktop stuff
Name: xdgurl
Version: 1.0.0
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Internet
URL: https://github.com/xdgurl/xdgurl
Source0: xdgurl.tar.gz
Requires: tkinter, python3-tkinter
%description
An install helper program for desktop stuff.
%build
install -D -m 755 xdgurl/src/xdgurl.py $RPM_BUILD_ROOT/%{_bindir}/xdgurl
install -D -m 644 xdgurl/src/xdgurl.desktop $RPM_BUILD_ROOT/%{_datadir}/applications/xdgurl.desktop
%files
%defattr(-,root,root)
%{_bindir}/xdgurl
%{_datadir}/applications/xdgurl.desktop
%changelog
* Wed Jul 06 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 1.0.0-1
- Initial release
#!/bin/sh
cd `dirname $0`
debuild -uc -us -b
#fakeroot debian/rules clean
xdgurl (1.0.0-0ubuntu1) xenial; urgency=low
* Initial release
-- Akira Ohgaki <akiraohgaki@gmail.com> Wed, 06 Jul 2016 20:23:29 +0000
Source: xdgurl
Section: web
Priority: optional
Maintainer: Akira Ohgaki <akiraohgaki@gmail.com>
Build-Depends: build-essential (>= 11), devscripts (>= 2.14), debhelper (>= 9), fakeroot (>= 1.20)
Standards-Version: 3.9.4
Package: xdgurl
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, python-tk (>= 2.7.0), python3-tk (>= 3.2.0)
Description: xdgurl
An install helper program for desktop stuff.
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: xdgurl
Upstream-Contact: Akira Ohgaki <akiraohgaki@gmail.com>
Source: https://github.com/xdgurl/xdgurl
Files: *
Copyright: 2016, Akira Ohgaki
License: GPL-3+
On Debian systems, the full text of the GNU General Public License version 3
can be found in the `/usr/share/common-licenses/GPL-3' file.
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_build:
install -D -m 755 ../../src/xdgurl.py usr/bin/xdgurl
install -D -m 644 ../../src/xdgurl.desktop usr/share/applications/xdgurl.desktop
override_dh_shlibdeps:
# ignore
usr/bin/xdgurl
usr/share/applications/xdgurl.desktop
[Desktop Entry]
Name=xdgurl
Exec=xdgurl %u
Type=Application
Terminal=false
NoDisplay=true
Categories=Network;Utility;
MimeType=x-scheme-handler/xdg;x-scheme-handler/xdgs;
#!/usr/bin/env python
"""xdgurl
An install helper program for desktop stuff.
Copyright: 2016, Akira Ohgaki
License: GPL-3+
https://github.com/xdgurl/xdgurl
"""
import sys
import os
import shutil
import json
import tempfile
import mimetypes
import subprocess
import argparse
if sys.version_info.major >= 3:
import urllib.request
import urllib.error
import urllib.parse
import tkinter
import tkinter.messagebox
else:
import urllib
import urlparse
import Tkinter
import tkMessageBox
class XdgUrl:
"""Core class of xdgurl"""
def __init__(self, xdg_url=''):
self.xdg_url = xdg_url
self.meta = self.parse()
self.temp_dir = tempfile.gettempdir()
self.home_dir = os.path.expanduser('~')
#self.config_dir = os.path.join(self.home_dir, '.config', 'xdgurl')
self.data_dir = os.path.join(self.home_dir, '.local', 'share')
self.kde_data_dir = os.path.join(self.home_dir, '.kde', 'share')
#self.config = {}
self.destinations = {
'downloads': os.path.join(self.home_dir, 'Downloads'),
'documents': os.path.join(self.home_dir, 'Documents'),
'pictures': os.path.join(self.home_dir, 'Pictures'),
'music': os.path.join(self.home_dir, 'Music'),
'videos': os.path.join(self.home_dir, 'Videos'),
'wallpapers': os.path.join(self.data_dir, 'wallpapers'),
'fonts': os.path.join(self.home_dir, '.fonts'),
'cursors': os.path.join(self.home_dir, '.icons'),
'icons': os.path.join(self.data_dir, 'icons'),
'emoticons': os.path.join(self.data_dir, 'emoticons'),
'themes': os.path.join(self.home_dir, '.themes'),
'emerald_themes': os.path.join(self.home_dir, '.emerald', 'themes'),
'enlightenment_themes': os.path.join(self.home_dir, '.e', 'e', 'themes'),
'enlightenment_backgrounds': os.path.join(self.home_dir, '.e', 'e', 'backgrounds'),
'fluxbox_styles': os.path.join(self.home_dir, '.fluxbox', 'styles'),
'pekwm_themes': os.path.join(self.home_dir, '.pekwm', 'themes'),
'icewm_themes': os.path.join(self.home_dir, '.icewm', 'themes'),
'plasma_plasmoids': os.path.join(self.data_dir, 'plasma', 'plasmoids'),
'plasma_look_and_feel': os.path.join(self.data_dir, 'plasma', 'look-and-feel'),
'plasma_desktopthemes': os.path.join(self.data_dir, 'plasma', 'desktoptheme'),
'kwin_effects': os.path.join(self.data_dir, 'kwin', 'effects'),
'kwin_scripts': os.path.join(self.data_dir, 'kwin', 'scripts'),
'kwin_tabbox': os.path.join(self.data_dir, 'kwin', 'tabbox'),
'aurorae_themes': os.path.join(self.data_dir, 'aurorae', 'themes'),
'dekorator_themes': os.path.join(self.data_dir, 'deKorator', 'themes'),
'qtcurve': os.path.join(self.data_dir, 'QtCurve'),
'color_schemes': os.path.join(self.data_dir, 'color-schemes'),
'gnome_shell_extensions': os.path.join(self.data_dir, 'gnome-shell', 'extensions'),
'cinnamon_applets': os.path.join(self.data_dir, 'cinnamon', 'applets'),
'cinnamon_desklets': os.path.join(self.data_dir, 'cinnamon', 'desklets'),
'cinnamon_extensions': os.path.join(self.data_dir, 'cinnamon', 'extensions'),
'nautilus_scripts': os.path.join(self.data_dir, 'nautilus', 'scripts'),
'amarok_scripts': os.path.join(self.kde_data_dir, 'apps', 'amarok', 'scripts'),
'yakuake_skins': os.path.join(self.kde_data_dir, 'apps', 'yakuake', 'skins'),
'cairo_clock_themes': os.path.join(self.home_dir, '.cairo-clock', 'themes')
}
self.destinations_alias = {
'gnome_shell_themes': self.destinations['themes'],
'cinnamon_themes': self.destinations['themes'],
'gtk2_themes': self.destinations['themes'],
'gtk3_themes': self.destinations['themes'],
'metacity_themes': self.destinations['themes'],
'xfwm4_themes': self.destinations['themes'],
'openbox_themes': self.destinations['themes'],
'kvantum_themes': self.destinations['themes'],
'compiz_themes': self.destinations['emerald_themes'],
'beryl_themes': self.destinations['emerald_themes'],
'plasma4_plasmoids': self.destinations['plasma_plasmoids'],
'plasma5_plasmoids': self.destinations['plasma_plasmoids'],
'plasma5_look_and_feel': self.destinations['plasma_look_and_feel'],
'plasma5_desktopthemes': self.destinations['plasma_desktopthemes'],
'plasma_color_schemes': self.destinations['color_schemes']
}
self.destinations.update(self.destinations_alias)
self.archive_types = {
'tar': [
'application/x-tar',
'application/x-gzip',
'application/gzip',
'application/x-bzip',
'application/x-bzip2',
'application/x-xz',
'application/x-lzma',
'application/x-lzip',
'application/x-compressed-tar',
'application/x-bzip-compressed-tar',
'application/x-bzip2-compressed-tar',
'application/x-xz-compressed-tar',
'application/x-lzma-compressed-tar',
'application/x-lzip-compressed-tar'
],
'zip': ['application/zip'],
'7z': ['application/x-7z-compressed'],
'rar': [
'application/x-rar',
'application/x-rar-compressed'
]
}
#self.config.update(self.read_config('config'))
#self.destinations.update(self.read_config('destinations'))
def read_config(self, name):
path = os.path.join(self.config_dir, name + '.json')
data = {}
if os.path.isfile(path):
f = open(path, 'r')
data = json.load(f)
f.close()
return data
def write_config(self, name, data):
if not os.path.isdir(self.config_dir):
os.makedirs(self.config_dir)
path = os.path.join(self.config_dir, name + '.json')
f = open(path, 'w')
json.dump(data, f)
f.close()
def parse(self):
meta = {
'command': 'download',
'url': '',
'type': 'downloads',
'filename': ''
}
if sys.version_info.major >= 3:
parse_result = urllib.parse.urlparse(self.xdg_url)
query = urllib.parse.parse_qs(parse_result.query)
else:
parse_result = urlparse.urlparse(self.xdg_url)
query = urlparse.parse_qs(parse_result.query)
if parse_result.netloc:
meta['command'] = parse_result.netloc
if 'url' in query and query['url'][0]:
if sys.version_info.major >= 3:
meta['url'] = urllib.parse.unquote(query['url'][0])
else: