Tuesday 5 February 2013

Taking Screenshots in DWM

Taking screenshots in DWM using Debian GNU/Linux 6. "Print Scrn" key takes a scrot of the whole desktop, "Shift+Print Scrn" key combination takes a scrot of the focused window, and "Control+Print Scrn" key combination takes a scrot of a selected section of the desktop.
  • requires the scrot package.
  • DWM v6 config.h:
    
    /* commands */
    static const char *scrotcmd[]  = { "scrot", "-t", "25", NULL };
    static const char *scrotfocusedcmd[]  = { "scrot", "--focused", NULL };
    
    /* modifier     key         function    argument */
    { 0,            XK_Print,   spawn,      {.v = scrotcmd } },
    { ShiftMask,    XK_Print,   spawn,      {.v = scrotfocusedcmd } },
    { ControlMask,  XK_Print,   spawn,      SHCMD("sleep 1s;scrot --select") },
    
  • Reference:
    https://bbs.archlinux.org/viewtopic.php?pid=1219944#p1219944