Skip to content

Instantly share code, notes, and snippets.

@naranyala
Created October 21, 2023 09:31
Show Gist options
  • Save naranyala/919338b13b0aacbd017b0ea485ba64c3 to your computer and use it in GitHub Desktop.
Save naranyala/919338b13b0aacbd017b0ea485ba64c3 to your computer and use it in GitHub Desktop.
rofi launcher feature to show screenshot option
#!/bin/bash
options=("Full Screen" "Selected Area" "Active Window")
selected_option=$(printf '%s\n' "${options[@]}" | rofi -dmenu -p "Screenshot Mode:")
case "$selected_option" in
"Full Screen")
notify-send "Taking full-screen screenshot..."
maim ~/Pictures/screenshot-$(date +"%Y-%m-%d_%H-%M-%S").png
notify-send "Screenshot saved as ~/screenshot-$(date +"%Y-%m-%d_%H-%M-%S").png"
;;
"Selected Area")
notify-send "Select an area for screenshot..."
maim -s ~/Pictures/screenshot-$(date +"%Y-%m-%d_%H-%M-%S").png
notify-send "Screenshot saved as ~/screenshot-$(date +"%Y-%m-%d_%H-%M-%S").png"
;;
"Active Window")
notify-send "Taking screenshot of the active window..."
maim -i $(xdotool getactivewindow) ~/Pictures/screenshot-$(date +"%Y-%m-%d_%H-%M-%S").png
notify-send "Screenshot saved as ~/screenshot-$(date +"%Y-%m-%d_%H-%M-%S").png"
;;
*)
notify-send "Invalid option"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment