Qtile macOS-Style Screenshot Utility

gabyword2 pts0 comments

dot-screenshot/README.md at main ยท cesarleaz/dot-screenshot ยท GitHub

//blob/show" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

//blob/show;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

cesarleaz

dot-screenshot

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

FilesExpand file tree

main

/README.md

Copy path

Blame<br>More file actions

Blame<br>More file actions

Latest commit

History<br>History<br>History

163 lines (126 loc) ยท 4.32 KB

main

/README.md

Top

File metadata and controls<br>Preview

Code

Blame

163 lines (126 loc) ยท 4.32 KB

Raw<br>Copy raw file<br>Download raw file

OutlineEdit and raw actions

๐Ÿ“ธ Qtile macOS-Style Screenshot Utility

A minimalist, fast, and aesthetically pleasing method for taking partial screenshots in the Qtile window manager. It replicates the look and behavior of macOS floating notifications (positioned at the bottom-right corner, clean borders, and a 3-second auto-dismiss timeout).

This script fixes the classic X11 clipboard corruption issues when copying raw images and avoids complex quote-escaping conflicts within Qtile's config.py.

๐Ÿ› ๏ธ Prerequisites

Ensure you have the required tools installed on your Linux system (X11):

Arch Linux / EndeavourOS:

sudo pacman -S scrot xclip dunst libnotify

Ubuntu / Debian / Pop!_OS:

sudo apt install scrot xclip dunst libnotify-bin

๐Ÿ“‚ File Structure

To keep your dotfiles organized, structure the files inside your configuration directory as follows:

~/.config/<br>โ”œโ”€โ”€ dunst/<br>โ”‚ โ””โ”€โ”€ dunstrc # macOS-style visual layout<br>โ””โ”€โ”€ qtile/<br>โ”œโ”€โ”€ config.py # Keybinding and autostart hook<br>โ””โ”€โ”€ scripts/<br>โ””โ”€โ”€ captura.sh # Executable screenshot script

๐Ÿš€ Step-by-Step Setup

1. The Screenshot Script (captura.sh)

Create the script at ~/.config/qtile/scripts/captura.sh and add the following code:

#!/bin/sh

# Create a unique temporary file path<br>ARCHIVO="/tmp/screenshot_$(date +%F_%T).png"

# 1. Capture the selected area (-f freezes the screen to prevent window artifacts)<br>scrot -s -f "$ARCHIVO"

# If the user cancels the selection (Esc or right-click), exit cleanly<br>if [ ! -f "$ARCHIVO" ]; then<br>exit 0<br>fi

# 2. Copy the actual image data to the X11 clipboard<br>xclip -selection clipboard -t image/png -i "$ARCHIVO"

# 3. Trigger the macOS-style notification<br>notify-send "Screenshot" "Image copied to clipboard" -i image-x-generic

# 4. Wait a brief moment before removing the file to avoid clipboard data loss<br>sleep 0.5<br>rm "$ARCHIVO"

โš ๏ธ CRITICAL STEP: You must grant execution permissions to the script by running:

chmod +x ~/.config/qtile/scripts/captura.sh

2. Notification Aesthetics (dunstrc)

To achieve the premium Apple-like look in the bottom-right corner, paste this into ~/.config/dunst/dunstrc:

%s\n%b"<br>alignment = left

# Icons Configuration<br>icon_position = left<br>min_icon_size = 36<br>max_icon_size = 48

[urgency_low]<br>background = "#1E1E1EFA"<br>foreground = "#FFFFFF"<br>frame_color = "#333333"<br>timeout = 2

[urgency_normal]<br>background = "#1E1E1EFA"<br>foreground = "#FFFFFF"<br>frame_color = "#333333"<br>timeout = 3

[urgency_high]<br>background = "#1E1E1EFA"<br>foreground = "#FFFFFF"<br>frame_color = "#555555"<br>timeout = 3">[global]<br># macOS Position Style (Bottom - Right)<br>monitor = 0<br>follow = mouse<br>width = 360<br>height = 110<br>origin = bottom-right<br>offset = 24x24<br>notification_limit = 2

# macOS Aesthetics (No color-coded borders, highly rounded corners)<br>progress_bar = true<br>progress_bar_height = 4<br>progress_bar_frame_width = 0<br>frame_width = 1<br>corner_radius = 14<br>padding = 16<br>horizontal_padding = 18<br>text_icon_padding = 14<br>separator_height = 4<br>separator_color = "frame"

# Typography and Text Layout<br>font = SF Pro Display, Inter, Sans 10<br>line_height = 4<br>format = "%s\n%b"<br>alignment = left

# Icons Configuration<br>icon_position = left<br>min_icon_size = 36<br>max_icon_size = 48

[urgency_low]<br>background = "#1E1E1EFA"<br>foreground = "#FFFFFF"<br>frame_color = "#333333"<br>timeout = 2

[urgency_normal]<br>background = "#1E1E1EFA"<br>foreground = "#FFFFFF"<br>frame_color = "#333333"<br>timeout = 3

[urgency_high]<br>background = "#1E1E1EFA"<br>foreground = "#FFFFFF"<br>frame_color = "#555555"<br>timeout = 3

3. Qtile Integration (config.py)

Open your ~/.config/qtile/config.py file.

Make sure you import the os module at the top of the...

file qtile config screenshot macos timeout

Related Articles