### Example Python Script Call in QML Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/uv/README.md This example shows how a Python script is invoked from a QML process, passing arguments that include shell-escaped strings. Ensure the Python script is executable and within the activated virtual environment. ```qml Process { id: imageDetectionProcess command: ["bash", "-c", `${Directories.scriptPath}/images/find_regions.py ` + `--hyprctl ` + `--image '${StringUtils.shellSingleQuoteEscape(panelWindow.screenshotPath)}' ` + `--max-width ${Math.round(panelWindow.screen.width * root.falsePositivePreventionRatio)} ` ``` -------------------------------- ### Non-NixOS GPU setup script Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/dist-nix/README.md This bash script, executed after enabling GPU support in home-manager on non-NixOS, sets up a systemd service to ensure GPU access for Nix-managed packages. It links the service file and enables/restarts it. ```bash #!/nix/store/-bash-/bin/bash set -e # Install the systemd service file and ensure that the store path won't be # garbage-collected as long as it's installed. unit_path=/etc/systemd/system/non-nixos-gpu.service ln -sf /nix/store/-non-nixos-gpu/resources/non-nixos-gpu.service "$unit_path" ln -sf "$unit_path" "/nix/var/nix"/gcroots/non-nixos-gpu.service systemctl daemon-reload systemctl enable non-nixos-gpu.service systemctl restart non-nixos-gpu.service ``` -------------------------------- ### Enable GPU support on non-NixOS with home-manager Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/dist-nix/README.md To enable GPU acceleration for packages installed via home-manager on non-NixOS distributions, set `targets.genericLinux.enable = true;` in your configuration. This will prompt a manual command execution for GPU setup. ```nix targets.genericLinux.enable = true; ``` -------------------------------- ### Launch Hyprland after TTY Login Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/dist-gentoo/README.md This script is designed to be placed in a user's interactive shell configuration (e.g., .config/fish/config.fish) to automatically start necessary services like DBus and PipeWire before launching Hyprland when logging into TTY1. It ensures the XDG_RUNTIME_DIR is set and services are running. ```fish if status --is-interactive; and [ (tty) = "/dev/tty1" ] # Start DBus session if not running if not set -q DBUS_SESSION_BUS_ADDRESS dbus-launch --sh-syntax | sed 's/^/set -gx /; s/=/ /' | source end # Start PipeWire if not running pgrep -x pipewire >/dev/null; or pipewire & pgrep -x pipewire-pulse >/dev/null; or pipewire-pulse & pgrep -x wireplumber >/dev/null; or wireplumber & # Launch Hyprland with DBus session exec Hyprland end ``` -------------------------------- ### Activate Python Virtual Environment Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/uv/README.md Activate the virtual environment to use installed Python packages. This command modifies the PATH to prioritize the venv's Python executable. ```bash source $(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate ``` -------------------------------- ### Run Python Package Command within Bash Script Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/uv/README.md Execute a command provided by an installed Python package directly from a bash script. The virtual environment must be activated prior to running the command and deactivated afterward. ```bash source "$(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate" kde-material-you-colors "$mode_flag" --color "$color" -sv "$sv_num" deactivate ``` -------------------------------- ### Compile requirements.in to requirements.txt Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/uv/README.md Use this command to generate a locked dependency file from your requirements.in. This ensures stability and reproducibility. ```bash uv pip compile requirements.in -o requirements.txt ``` -------------------------------- ### Fix Wi-Fi Details Crash in Fedora Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/dist-fedora/README.md Apply this diff to `~/.config/illogical-impulse/config.json` to resolve an issue where the right column crashes when clicking the 'Details' button in Wi-Fi mode. ```diff @@ 44,3 44,3 @@ - "apps": { - "bluetooth": "kcmshell6 kcm_bluetooth", - "network": "kitty -1 fish -c nmtui", + "apps": { + "bluetooth": "kcmshell6 kcm_bluetooth", + "network": "plasmawindowed org.kde.plasma.networkmanagement", ``` -------------------------------- ### QML Process Command for Bash Wrapper Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/uv/README.md This QML code snippet demonstrates how to invoke a bash wrapper script for a Python tool within a QML Process component. It correctly escapes arguments for shell execution. ```qml Process { id: imageDetectionProcess command: ["bash", "-c", `${Directories.scriptPath}/images/find-regions-venv.sh ` + `--hyprctl ` + `--image '${StringUtils.shellSingleQuoteEscape(panelWindow.screenshotPath)}' ` + `--max-width ${Math.round(panelWindow.screen.width * root.falsePositivePreventionRatio)} ` ``` -------------------------------- ### Run Python Script with Virtual Environment Activation (Shebang) Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/uv/README.md This shebang line activates the virtual environment and executes the Python script within it. It's suitable for simple scripts but may have limitations with complex arguments or when the script is called directly via the Python interpreter. ```python #!/usr/bin/env -S\_/bin/sh\_-c_"source\_$(eval\_echo\_$ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate&&exec\_python\_-E\_"$0"\_"$@" ``` -------------------------------- ### Bash Wrapper for Python Script with Virtual Environment Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/uv/README.md Use this bash script to wrap a Python script, ensuring it runs within a specified virtual environment. It activates the environment, executes the Python script with provided arguments, and then deactivates the environment. ```bash #!/usr/bin/env bash # Specify the path of the python script. # The example below only applies when `find_regions.py` and this wrapper script are under the same folder. PY_SCRIPT="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)/find_regions.py" source $(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate "$PY_SCRIPT" "$@" deactivate ``` -------------------------------- ### Deactivate Python Virtual Environment Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/uv/README.md Use this command to exit the activated virtual environment and restore the system's default Python environment. ```bash deactivate ``` -------------------------------- ### Run Python Script within Bash Script Source: https://github.com/end-4/dots-hyprland/blob/main/sdata/uv/README.md Execute a Python script from within a bash script, ensuring the virtual environment is activated before execution and deactivated afterward. This is useful for integrating Python scripts into larger bash workflows. ```bash source "$(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate" python3 "$SCRIPT_DIR/generate_colors_material.py" "${generate_colors_material_args[@]}" \ > "$STATE_DIR"/user/generated/material_colors.scss "$SCRIPT_DIR"/applycolor.sh ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.