Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| apps:xfce4-screenshooter:custom-actions [2025/01/15 23:11] – Add summary of custom action and note re:imgur terms of service kevinbowen | apps:xfce4-screenshooter:custom-actions [2026/11/22 16:34] (current) – Refresh custom actions page epetriglia | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| {{ : | {{ : | ||
| ====== xfce4-screenshooter - Custom Actions ====== | ====== xfce4-screenshooter - Custom Actions ====== | ||
| + | |||
| + | Custom actions let you process a screenshot with any program or script right after it is captured: for example to edit it, extract its text, read a QR code or upload it to an online service. Once configured, they appear in the window shown after capturing (see [[: | ||
| + | |||
| + | Custom actions are available both in the application and in the [[: | ||
| * **[[#Adding custom actions|Adding custom actions]]** | * **[[#Adding custom actions|Adding custom actions]]** | ||
| + | * **[[#How commands are executed|How commands are executed]]** | ||
| * **[[# | * **[[# | ||
| * **[[# | * **[[# | ||
| * **[[#Read QR Code|Read QR Code]]** | * **[[#Read QR Code|Read QR Code]]** | ||
| * **[[# | * **[[# | ||
| + | |||
| + | ---- | ||
| ===== Adding custom actions ===== | ===== Adding custom actions ===== | ||
| + | |||
| + | Custom actions are added, removed and edited in the {gui> | ||
| + | |||
| + | * Add: click on the plus (+) button. A new blank custom action is added at the bottom of the list. | ||
| + | * Remove: select a custom action and click on the minus (-) button. | ||
| + | * Edit: select a custom action and change its name and command. Changes are saved when the {gui> | ||
| + | |||
| + | Each custom action is composed of: | ||
| + | |||
| + | * Name: a friendly name that will be shown in the drop-down list of the Actions dialog. | ||
| + | * Command: the command to be executed. It can be an inline command or a call to a script. Use '' | ||
| <figure " | <figure " | ||
| Line 15: | Line 33: | ||
| </ | </ | ||
| - | Custom actions can be added, removed and editing in the Preferences dialog. | + | [[|Back to Top]] |
| - | * Add: click on the plus(+) button and a new blank custom action is added at the bottom of the list. | + | ---- |
| - | * Remove: click on the minus(-) button and the selected custom action will be removed. | + | |
| - | * Edit: add a new custom action or select an existing one, changes made to the name and command entries are saved as soon as the preferences dialog is closed. | + | |
| - | Custom actions | + | ===== How commands |
| - | * Name: a friendly name that will be shown in the Actions dialog. | + | |
| - | * Command: | + | * '' |
| + | * Environment variables such as '' | ||
| + | * The command | ||
| + | * Programs without a full path are searched in '' | ||
| + | * Only the command line is stored, not the script it calls. The script is run again on every use, so changes to it take effect immediately, | ||
| + | |||
| + | [[|Back to Top]] | ||
| ---- | ---- | ||
| Line 29: | Line 51: | ||
| ===== Examples ===== | ===== Examples ===== | ||
| - | The following examples assume the necessary dependencies are already installed. | + | The following examples assume the necessary dependencies are already installed. The clipboard examples use '' |
| ==== Extract text with OCR ==== | ==== Extract text with OCR ==== | ||
| - | '' | + | Set as command: |
| + | |||
| + | [[|Back to Top]] | ||
| ---- | ---- | ||
| Line 39: | Line 63: | ||
| ==== Read QR Code ==== | ==== Read QR Code ==== | ||
| - | Save the following script somewhere and set as command: ''< | + | Save the following script somewhere, make it executable ('' |
| - | < | + | < |
| #!/bin/bash | #!/bin/bash | ||
| Line 62: | Line 86: | ||
| ==== Hosting on Imgur™ ==== | ==== Hosting on Imgur™ ==== | ||
| - | ! This custom action allows you to host your screenshot on this free online hosting service, so that you can share it easily with other people. Imgur automatically generates a tiny, medium, and full-size image of your screenshot, which can be used to create thumbnails pointing to the full size screenshot. | + | This custom action allows you to host your screenshot on this free online hosting service, so that you can share it easily with other people. Imgur automatically generates a tiny, medium, and full-size image of your screenshot, which can be used to create thumbnails pointing to the full size screenshot. |
| + | <note important> | ||
| - | <note important> | + | You need to register at Imgur and obtain your client ID. Then save the following script somewhere, make it executable ('' |
| + | <note warning> | ||
| - | Save the following script somewhere and set as command: '' | + | <code bash imgur.sh> |
| - | For the time being, screenshooter provides its own client id as '' | + | #!/usr/bin/env bash |
| - | + | ||
| - | <code> | + | |
| - | #!/bin/sh | + | |
| URL=' | URL=' | ||
| Line 83: | Line 106: | ||
| fi | fi | ||
| - | #RESPONSE=' | + | if ! command -v jq >&2; then |
| - | # | + | zenity --error --text="jq: command not found!" |
| - | RESPONSE=$(curl --silent --location " | + | |
| + | fi | ||
| + | |||
| + | RESPONSE=$(curl --silent --location " | ||
| + | | ||
| + | | ||
| + | tee >(zenity --progress --pulsate --no-cancel --auto-close --text=" | ||
| STATUS=$(echo " | STATUS=$(echo " | ||
| - | if [ -z " | + | if [ -z " |
| ERROR=$(echo " | ERROR=$(echo " | ||
| zenity --error --text=" | zenity --error --text=" | ||
| Line 100: | Line 129: | ||
| # Add link to clipboard | # Add link to clipboard | ||
| - | echo " | + | echo " |
| # Add links to log | # Add links to log | ||
| Line 117: | Line 146: | ||
| </ | </ | ||
| - | The dialog below will give you the links to delete | + | After the upload, the dialog below shows the link to the image and the link to delete it from the Imgur website. |
| <figure "Imgur Deletion Dialog Window"> | <figure "Imgur Deletion Dialog Window"> | ||
| {{: | {{: | ||
| </ | </ | ||
| - | |||
| [[|Back to Top]] | [[|Back to Top]] | ||
| ---- | ---- | ||
| - | [[: | + | [[:apps:xfce4-screenshooter: |