feat: add dmenu screenshot script

This commit is contained in:
Max Hohlfeld 2023-05-15 09:57:12 +02:00
parent 7df593f721
commit 80c8527ce3
3 changed files with 20 additions and 4 deletions

View File

@ -0,0 +1,14 @@
#! /usr/bin/env sh
# Changed a bit from Luke Smith https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/maimpick
# A dmenu for selecting a screenshot option as listed below. Requires maim, xdotool and dmenu.
DEST="/home/max/bilder/screenshots/screenshot_$(date +%Y-%m-%d_%T).png"
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (to clipboard)\\ncurrent window (to clipboard)\\nfull screen (to clipboard)" | dmenu -i -p "Screenshot which area?")" in
"a selected area") maim -u -s $DEST ;;
"current window") maim -u -i "$(xdotool getactivewindow)" $DEST ;;
"full screen") maim -u -B -d '0.8' --quiet $DEST ;;
"a selected area (to clipboard)") maim -s -u | xclip -selection clipboard -t image/png ;;
"current window (to clipboard)") maim -u -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;;
"full screen (to clipboard)") maim | xclip -selection clipboard -t image/png ;;
esac

View File

@ -5,6 +5,8 @@
- tectonic - tectonic
- pandoc - pandoc
- ttf-liberation - ttf-liberation
- maim
- xdotool
state: present state: present
become: true become: true
tags: pc tags: pc
@ -25,4 +27,5 @@
- { src: compiledoc, dest: ~/.local/bin/compiledoc } - { src: compiledoc, dest: ~/.local/bin/compiledoc }
- { src: inline_code.tex, dest: ~/.local/bin/inline_code.tex } - { src: inline_code.tex, dest: ~/.local/bin/inline_code.tex }
- { src: open_editor_in_new_shell, dest: ~/.local/bin/open_editor_in_new_shell } - { src: open_editor_in_new_shell, dest: ~/.local/bin/open_editor_in_new_shell }
- { src: dmenu_screenshot, dest: ~/.local/bin/dmenu_screenshot }
tags: pc tags: pc

View File

@ -155,10 +155,9 @@ myAdditionalKeys =
, ("M-.", sendMessage ToggleStruts) , ("M-.", sendMessage ToggleStruts)
-- dmenu prompts -- dmenu prompts
, ("M-<Return>", spawn "dm-recent-aliases") , ("M-<Return>", spawn "dmenu_run")
, ("M-p s", spawn "dm-screenshot") , ("M-p s", spawn "dmenu_screenshot")
, ("M-p k", spawn "dm-kill") , ("M-p k", spawn "dm-kill")
, ("M-p p", shellPrompt topicPrompt)
-- scratchpads -- scratchpads
, ("M-n", namedScratchpadAction myScratchpads "nnn") , ("M-n", namedScratchpadAction myScratchpads "nnn")
@ -269,7 +268,7 @@ myStartupHook = do
main = do main = do
xmproc0 <- spawnPipe "xmobar -x 0 /home/max/.config/xmobar/xmobarrc" xmproc0 <- spawnPipe "xmobar -x 0 /home/max/.config/xmobar/xmobarrc"
xmproc1 <- spawnPipe "xmobar -x 1 /home/max/.config/xmobar/xmobarrc" xmproc1 <- spawnPipe "xmobar -x 1 /home/max/.config/xmobar/xmobarrc"
xmonad $ spawnExternalProcess def $ docks def { xmonad $ ewmh . spawnExternalProcess def $ docks def {
-- simple stuff -- simple stuff
terminal = myTerminal, terminal = myTerminal,
borderWidth = myBorderWidth, borderWidth = myBorderWidth,