Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Diego Juliao
Diego Juliao

Posted on • Edited on

     

i3wm Screenshot Shortcuts

Have excellent screenshot shortcuts in youri3wm.

FeatureShortcut
Full ScreenPrtScrn
SelectionShift +PrtScrn
Active WindowSuper +PrtScrn
Clipboard Full ScreenCtrl +PrtScrn
Clipboard SelectionCtrl +Shift +PrtScrn
Clipboard Active WindowCtrl +Super +PrtScrn

All the screenshots are saved on~/Pictures/CURRENT_DATE.
The keysuper refers to the modifier key (window/command or alt by default depending on config).

Requirements

  • maim
  • xclip
  • xdotool

Set-up

Set this on your i3 config file~/.i3/config.

## Screenshotsbindsym Print exec --no-startup-id maim "/home/$USER/Pictures/$(date)"bindsym $mod+Print exec --no-startup-id maim --window $(xdotool getactivewindow) "/home/$USER/Pictures/$(date)"bindsym Shift+Print exec --no-startup-id maim --select "/home/$USER/Pictures/$(date)"## Clipboard Screenshotsbindsym Ctrl+Print exec --no-startup-id maim | xclip -selection clipboard -t image/pngbindsym Ctrl+$mod+Print exec --no-startup-id maim --window $(xdotool getactivewindow) | xclip -selection clipboard -t image/pngbindsym Ctrl+Shift+Print exec --no-startup-id maim --select | xclip -selection clipboard -t image/png
Enter fullscreen modeExit fullscreen mode

You may want to remove the default or any other screenshot shortcuts to prevent errors.
Don't forget to reload your window managersuper+shift+c.


The source of this information is from my gistMy i3 shortcuts to take screenshots.

Top comments(7)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
dacr profile image
Crosson David
  • Joined

I made some changes, and I had to provide explicitly the format to use in order for the clipboard cases to work.

# For screenshots install :# apt-get install maim xclip copyq##  Screenshots in filesbindsym Print exec --no-startup-id maim --format=png "/home/$USER/Pictures/screenshot-$(date -u +'%Y%m%d-%H%M%SZ')-all.png"bindsym $mod+Print exec --no-startup-id maim --format=png --window $(xdotool getactivewindow) "/home/$USER/Pictures/screenshot-$(date -u +'%Y%m%d-%H%M%SZ')-current.png"bindsym Shift+Print exec --no-startup-id maim --format=png --select "/home/$USER/Pictures/screenshot-$(date -u +'%Y%m%d-%H%M%SZ')-selected.png"## Screenshots in clipboardsbindsym Ctrl+Print exec --no-startup-id maim --format=png | xclip -selection clipboard -t image/pngbindsym Ctrl+$mod+Print exec --no-startup-id maim --format=png --window $(xdotool getactivewindow) | xclip -selection clipboard -t image/pngbindsym Ctrl+Shift+Print exec --no-startup-id maim --format=png --select | xclip -selection clipboard -t image/png
Enter fullscreen modeExit fullscreen mode
CollapseExpand
 
dacr profile image
Crosson David
  • Joined

thanks for sharing :)

CollapseExpand
 
nemipune profile image
Artemis
  • Joined

Hello, thanks for the script ! Really useful
However I like to have my screenshots both saved to a specific directory and copied to clipboard, it seems it's one or the other, is there a way to do both ?
Thanks !

CollapseExpand
 
dianjuar profile image
Diego Juliao
FullStack JavaScript Engineer👨‍💻.OSS Contributor.Dog person🐶🐶.Adrenaline Junkie 🚲⛰️🥾🧗.ISTJ/A 🧠
  • Location
    Medellín, Colombia 🇨🇴
  • Work
    Senior Software Engineer at HeroDevs
  • Joined

The key bindings are designed to have both.
When you use theCtrl key, it will store your screenshot on your clipboard.

CollapseExpand
 
ericway1024 profile image
Yuhang "Eric" Wei
  • Joined

Thanks for sharing! I would like to add

apt install xdotool
Enter fullscreen modeExit fullscreen mode

for your script to work.

CollapseExpand
 
victorlicht profile image
Victor Licht
Building a Better World
  • Location
    Algeria, Batna
  • Education
    Last Year Bachelor Computer Science
  • Joined

Thanks for that

CollapseExpand
 
uciharis profile image
the hengker
sharelok tak parani
  • Location
    sumatra island
  • Pronouns
    ndasmu
  • Joined

thank you alot, this work for me too. you save my pain brooooo

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

FullStack JavaScript Engineer👨‍💻.OSS Contributor.Dog person🐶🐶.Adrenaline Junkie 🚲⛰️🥾🧗.ISTJ/A 🧠
  • Location
    Medellín, Colombia 🇨🇴
  • Work
    Senior Software Engineer at HeroDevs
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp