LINUX.ORG.RU

История изменений

Исправление Im_not_a_robot, (текущая версия) :

Ну, вот например так у меня реализовано меню для скриншотов:

#!/bin/sh

SCREENSHOT_DIR="${HOME}/Pictures/Screenshots"
BASE_NAME=$(date +%Y-%m-%d_%H-%M-%S.%3N)
CHOICES="1 Fullscreen|2 Select|3 Window"

cmd=$(echo -e $CHOICES | rofi -p "Screenshot" -i -width 300 -lines 6 -theme solarized_alternate -dmenu -sep "|")

case $cmd in
    "1 Fullscreen")
	maim -d 0.5 ${SCREENSHOT_DIR}/${BASE_NAME}.png
	notify-send --expire-time=3000 "Screenshot saved ${SCREENSHOT_DIR}/${BASE_NAME}.png"
	;;
    "2 Select")
	maim -s --bordersize=2 ${SCREENSHOT_DIR}/${BASE_NAME}_sel.png
	notify-send --expire-time=3000 "Screenshot saved ${SCREENSHOT_DIR}/${BASE_NAME}_sel.png"
	;;
    "3 Window")
        maim -d 0.5 -i $(xdotool getactivewindow) ${SCREENSHOT_DIR}/${BASE_NAME}_win.png
	notify-send --expire-time=3000 "Screenshot saved ${SCREENSHOT_DIR}/${BASE_NAME}_win.png"
	;;
esac

Меню для выключения/лока/сна:

#!/bin/sh

#LOCKER="xkblayout-state set 0 && i3lock -c 000000 -e -f && sleep 1"
LOCKER="lock"
CHOICES="1 Lock|2 Logout|3 Suspend|4 Hibernate|5 Reboot|6 Shutdown"

cmd=$(echo -e $CHOICES | rofi -i -width 300 -lines 6 -theme solarized_alternate -dmenu -sep "|")

case $cmd in
    "1 Lock")
        eval $LOCKER
	;;
    "2 Logout")
	i3-msg "exit"
	;;
    "3 Suspend")
        systemctl suspend && eval $LOCKER
	;;
    "4 Hibernate")
	systemctl hibernate && eval $LOCKER
	;;
    "5 Reboot")
	systemctl reboot
	;;
    "6 Shutdown")
	systemctl poweroff -i
	;;
esac

Исходная версия Im_not_a_robot, :

Ну, вот например так у меня реализовано меню для скриншотов:

#!/bin/sh

SCREENSHOT_DIR="${HOME}/Pictures/Screenshots"
BASE_NAME=$(date +%Y-%m-%d_%H-%M-%S.%3N)
CHOICES="1 Fullscreen|2 Select|3 Window"

cmd=$(echo -e $CHOICES | rofi -p "Screenshot" -i -width 300 -lines 6 -theme solarized_alternate -dmenu -sep "|")

case $cmd in
    "1 Fullscreen")
		maim -d 0.5 ${SCREENSHOT_DIR}/${BASE_NAME}.png
		notify-send --expire-time=3000 "Screenshot saved ${SCREENSHOT_DIR}/${BASE_NAME}.png"
	;;
    "2 Select")
		maim -s --bordersize=2 ${SCREENSHOT_DIR}/${BASE_NAME}_sel.png
		notify-send --expire-time=3000 "Screenshot saved ${SCREENSHOT_DIR}/${BASE_NAME}_sel.png"
	;;
    "3 Window")
        maim -d 0.5 -i $(xdotool getactivewindow) ${SCREENSHOT_DIR}/${BASE_NAME}_win.png
		notify-send --expire-time=3000 "Screenshot saved ${SCREENSHOT_DIR}/${BASE_NAME}_win.png"
	;;
esac

Меню для выключения/лока/сна:

#!/bin/sh

#LOCKER="xkblayout-state set 0 && i3lock -c 000000 -e -f && sleep 1"
LOCKER="lock"
CHOICES="1 Lock|2 Logout|3 Suspend|4 Hibernate|5 Reboot|6 Shutdown"

cmd=$(echo -e $CHOICES | rofi -i -width 300 -lines 6 -theme solarized_alternate -dmenu -sep "|")

case $cmd in
    "1 Lock")
        eval $LOCKER
	;;
    "2 Logout")
	i3-msg "exit"
	;;
    "3 Suspend")
        systemctl suspend && eval $LOCKER
	;;
    "4 Hibernate")
	systemctl hibernate && eval $LOCKER
	;;
    "5 Reboot")
	systemctl reboot
	;;
    "6 Shutdown")
	systemctl poweroff -i
	;;
esac