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 [2024/02/04 22:59] – Add examples andreldm | apps:xfce4-screenshooter:custom-actions [2026/11/22 16:34] (current) – Refresh custom actions page epetriglia | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ~~NOTOC~~ | ~~NOTOC~~ | ||
| - | {{ :xfce:xfce.screenshooter.png? | + | {{ :apps:xfce4-screenshooter.png? |
| ====== 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]]** | ||
| + | * **[[#How commands are executed|How commands are executed]]** | ||
| + | * **[[# | ||
| + | * **[[# | ||
| + | * **[[#Read QR Code|Read QR Code]]** | ||
| + | * **[[# | ||
| + | |||
| + | ---- | ||
| ===== Adding custom actions ===== | ===== Adding custom actions ===== | ||
| - | TODO | + | 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 " | ||
| + | {{: | ||
| + | </ | ||
| + | |||
| + | [[|Back to Top]] | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== How commands are executed ===== | ||
| + | |||
| + | * '' | ||
| + | * Environment variables such as '' | ||
| + | * The command is executed directly, this means pipes ('' | ||
| + | * 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]] | ||
| + | |||
| + | ---- | ||
| ===== 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: |
| - | **Read QR Code** | + | [[|Back to Top]] |
| - | Save the following script somewhere and set as command: ''< | + | ---- |
| - | < | + | ==== Read QR Code ==== |
| + | |||
| + | Save the following script somewhere, make it executable ('' | ||
| + | |||
| + | < | ||
| #!/bin/bash | #!/bin/bash | ||
| Line 34: | Line 80: | ||
| </ | </ | ||
| - | ** Host on Imgur™ ** | + | [[|Back to Top]] |
| - | Save the following script somewhere and set as command: ''< | + | ---- |
| - | For the time being, screenshooter provides its own client id as '' | + | |
| + | ==== 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. | ||
| + | |||
| + | <note important> | ||
| + | |||
| + | You need to register at Imgur and obtain your client ID. Then save the following script somewhere, make it executable ('' | ||
| + | |||
| + | <note warning> | ||
| + | |||
| + | <code bash imgur.sh> | ||
| + | # | ||
| - | < | ||
| URL=' | URL=' | ||
| SCREENSHOT_PATH=$1 | SCREENSHOT_PATH=$1 | ||
| Line 49: | 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 62: | Line 125: | ||
| LINK=" | LINK=" | ||
| DELETE=" | DELETE=" | ||
| - | LOG_DIRECTORY=" | + | LOG_DIRECTORY=" |
| LOG=" | LOG=" | ||
| # Add link to clipboard | # Add link to clipboard | ||
| - | echo " | + | echo " |
| # Add links to log | # Add links to log | ||
| Line 82: | Line 145: | ||
| $LOG" | $LOG" | ||
| </ | </ | ||
| + | |||
| + | After the upload, the dialog below shows the link to the image and the link to delete it from the Imgur website. Both links are copied to a log file ('' | ||
| + | |||
| + | <figure "Imgur Deletion Dialog Window"> | ||
| + | {{: | ||
| + | </ | ||
| + | |||
| + | [[|Back to Top]] | ||
| + | |||
| + | ---- | ||
| + | [[: | ||
| + | |||