https://github.com/jiri-otoupal/pycrosskit
Python Cross Platform Toolkit for Windows and Linux Environment Variables, Shortcuts and Start Menu Shortcuts
https://github.com/jiri-otoupal/pycrosskit
cross-platform environment-variables linux shortcuts shortcuts-on-desktops windows
Last synced: 18 days ago
JSON representation
Python Cross Platform Toolkit for Windows and Linux Environment Variables, Shortcuts and Start Menu Shortcuts
- Host: GitHub
- URL: https://github.com/jiri-otoupal/pycrosskit
- Owner: jiri-otoupal
- License: mit
- Created: 2021-02-27T14:02:51.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-03T09:15:13.000Z (8 months ago)
- Last Synced: 2024-10-03T09:23:51.919Z (8 months ago)
- Topics: cross-platform, environment-variables, linux, shortcuts, shortcuts-on-desktops, windows
- Language: Python
- Homepage:
- Size: 237 KB
- Stars: 19
- Watchers: 1
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Python Cross Platform Toolkit for Windows and Linux variables, shortcuts and start menu shortcuts
Simple Cross Platform creation of shortcuts and Persistent Environment Variables
[](https://pypi.org/project/pycrosskit/)
[](https://pypi.org/project/pycrosskit/)[](https://travis-ci.com/github/jiri-otoupal/pycrosskit)
[](https://pepy.tech/project/pycrosskit)## Installing
Install and update using [pip](https://pip.pypa.io/en/stable/quickstart/):
```bash
pip install pycrosskitor
pip3 install pycrosskit
```## Supported Platforms:
* Linux
* Windows## Shortcuts usage:
```python
from pycrosskit.shortcuts import Shortcut# Will Create shortcut
# * at Desktop if desktop is True
# * at Start Menu if start_menu is TrueShortcut(shortcut_name="My Spaghetti Shortcut", exec_path="/usr/bin/order_spaghetti", description="Such Yummy Spaghetti",
icon_path="/home/.../spaghetti.png", desktop=True, start_menu=True)# Will Delete shortcut
# * at Desktop if desktop is True
# * at Start Menu if start_menu is True
Shortcut.delete(shortcut_name="My Spaghetti Shortcut", desktop=True, start_menu=True)```
## Environment Variables usage:
Accessing and write to environment variables is automatically handled based on your system Lin/Win SysEnv class is
implemented as a singleton metaclass so don't be afraid about multiple instances**Support of Mac env variables on request**
```python
from pycrosskit.envariables import SysEnv### ** Linux **
# Will Set Persistent Value for Variable in Systems bashrc file or custom one that you can pass
SysEnv().set(key="spaghetti", value="boloneys", shell_file="~/.zsh")# Will Get Persistent Value for Variable in System
# * reg_path works only for windows as register path
# * registry works only for windows, if is False variable is obtained from User Environment Variables
SysEnv().get(key="spaghetti", shell_file="~/.zsh", shell="zsh")# Will unset variable from your environment or registry
SysEnv().unset(key="spaghetti", shell_file="~/.zsh")# For not having to override argument shell_file or shell
# This saves specs for every access, default arguments are ignored
SysEnv.save_shell_specs(shell="zsh", shell_file="~/.zsh")### ** Windows **
# Will Set Persistent Value for Variable in System
# * subkey works only for windows like file in folder
# * reg_path works only for windows as register path (is ignored if registry=False)
# * registry works only for windows, if is False variable is saved to User Environment Variables
SysEnv().set(key="spaghetti", value="bologna", subkey="italian_food", reg_path="HKEY-...\\CustomPath",
registry=True)# Will Get Persistent Value for Variable in System
# * reg_path works only for windows as register path
# * registry works only for windows, if is False variable is obtained from User Environment Variables
SysEnv().get(key="spaghetti", reg_path="HKEY-...\\CustomPath", registry=True)# Will unset variable from your environment or registry
SysEnv().unset(key="spaghetti", registry=True)
```## Develop
Clone the repository, then:
```sh
# install dependencies and package in editable mode
python -m pip install -U -r requirements.txt
# install development dependencies
python -m pip install -U -e .[dev]
# install git hooks
pre-commit install
```----
Did I made your life less painfull ?
Support my coffee addiction ;)
![]()