Skip to main content

desktop-file is a tool to create desktop shortcuts for windows and linux.

Project description

Desktop File

About

desktop-file is a tool to create desktop shortcuts for windows and linux.

Installation

To install desktop-file you need python 3 or later with pip installed.
Then you can install it by typing pip install desktop_file or by cloning or downloading this repository on github and executing python setup.py install

Usage

Python

You can use it in your python script like this:

>>> import desktop_file
>>> # get desktop and start menu folders
>>> desktop_file.getDesktopPath()
/home/PyRectangle/Desktop
>>> desktop_file.getMenuPath()
/home/PyRectangle/.local/share/applications
>>> # create a xterm shortcut
>>> shortcut = desktop_file.Shortcut("/home/PyRectangle/Desktop", "xterm", "/usr/bin/xterm")
>>> # Setting the title causes the file to have a different name instead of the file name (only affects linux)
>>> shortcut.setTitle("XTerm")
>>> shortcut.setWorkingDirectory("/home/PyRectangle")
>>> shortcut.setComment("A desktop file to start xterm")
>>> # Only files that contain icons work on Windows
>>> shortcut.setIcon("/usr/share/pixmaps/mini.xterm_48x48.xpm")
>>> # Categories don't have any effects on Windows
>>> shortcut.setCategories("System;")
>>> shortcut.save()

You will find a working shortcut named "XTerm" in the folder "/home/PyRectangle/Desktop"

Command

You can use python -m desktop_file or desktop-file to create shortcuts like this:

desktop-file --exec /usr/bin/xterm --workpath /home/PyRectangle --title XTerm --comment "A desktop file to start xterm" --icon /usr/share/pixmaps/mini.xterm_48x48.xpm --categories "System;" /home/PyRectangle/Desktop/xterm.desktop

You will need to type ".lnk" instead of ".desktop" if you are on Windows.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

desktop_file-1.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file desktop_file-1.2-py3-none-any.whl.

File metadata

  • Download URL: desktop_file-1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for desktop_file-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7e2c26c34c276ffa501391d1a1784348928f6bed46c2ae7fae8874c2f02163e
MD5 05230184344000d725ea7b5bba74e2d5
BLAKE2b-256 9ffe320896f8ea3792d899acd7cdce82f45c9dcca3296592b282b4f65ce2d59e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page