#!/bin/bash print_options () { cat <<EOF suspend reboot shutdown reload i3 configuration in-place restart i3 exit i3 EOF } # Colors from i3-nagbar: https://github.com/i3/i3/blob/a5da4d54f315e830e2a901b8e75ae7e478401c6e/i3-nagbar/main.c#L492-L496 CHOICE="$(print_options | dmenu -i -fn 'DejaVu Sans' -nb '#900000' -nf white -sb '#680a0a' -sf white)" case "$CHOICE" in suspend) sleep 5; systemctl suspend-then-hibernate ;; reboot) systemctl reboot ;; shutdown) shutdown now ;; "reload i3 configuration in-place") i3-msg reload ;; "restart i3") i3-msg restart ;; "exit i3") i3-msg exit ;; *) exit 1 ;; esac