Skip to content

Instantly share code, notes, and snippets.

@kLabz
Last active May 22, 2022 13:14
Show Gist options
  • Save kLabz/16cc23ab553357d99f9ebb9fe0c32032 to your computer and use it in GitHub Desktop.
Save kLabz/16cc23ab553357d99f9ebb9fe0c32032 to your computer and use it in GitHub Desktop.
# Mode: Screenshot
# ---------------------------
set $monitorGeom $(monitor-geom)
set $maimCopy | xclip -selection clipboard -t image/png
set $maimFilename ~/Pictures/Screenshots/$(date +%Y-%m-%d-%H:%M-%S-%N).png
set $mode_screenshot Screenshot mode: (w) Window ⋅ (x) All screens ⋅ (s) Selection ⋅ (d) Desktop ⋅ (w/x/s/d + Shift) Use clipboard | (c) Color picker
mode "$mode_screenshot" {
# Save screenshot to file
bindsym w exec --no-startup-id maim -i $(xdotool getactivewindow) $maimFilename, mode "default"
bindsym x exec --no-startup-id maim $maimFilename, mode "default"
bindsym d exec --no-startup-id maim -g $monitorGeom $maimFilename, mode "default"
bindsym s exec --no-startup-id maim -s $maimFilename, mode "default"
# Copy screenshot
bindsym Shift+w exec --no-startup-id maim -i $(xdotool getactivewindow) $maimCopy, mode "default"
bindsym Shift+x exec --no-startup-id maim $maimCopy, mode "default"
bindsym Shift+d exec --no-startup-id maim -g $monitorGeom $maimCopy, mode "default"
bindsym Shift+s exec --no-startup-id maim -s $maimCopy, mode "default"
# Color picker
bindsym c exec --no-startup-id slickpicker, mode "default"
# Exit to the default mode
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+Shift+Print mode "default"
bindsym $mod+End mode "default"
}
# Default: current desktop
bindsym $mod+Print exec --no-startup-id maim -g $monitorGeom $maimFilename
bindsym $mod+Shift+Print mode "$mode_screenshot"
bindsym $mod+End mode "$mode_screenshot"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment