Polybar - A new poweroff button

Hi!
I’ve needed a poweoff button by one click on the polybar.
I’ve found a configuration for that.
I share my module.conf for the polybar:

;;;;;;;;;;;;;;;;;;;;
;; Poweroff ;;
;;;;;;;;;;;;;;;;;;;;
[module/poweroff]
type = custom/script
exec = echo " put here your buton logo "
click-left = rofr.sh -l

After, you hate to put “poweroff” in the config file like that:
modules-right = pkg memory temperature coreuse network volume poweroff

My example:
ArchLabs_2018-03-05-40_615x236

10 Likes

I had done something like that in the past, but it turned out not working for me, once I would some times accidentally shut-down my computer. I tend to missclick/random click a lot :frowning:

Lol, I know that one. I like to keep my computer on and just turn off the display. With older machine, you tend to want to keep the CPU on, unless of course you’re talking about a laptop. But I only have a desktop so…

1 Like

I’m no a laptop and I tend to keep it on during night. I just reboot it like once per week just for the lolz. I don’t mind closing the PC, I mind closing the PC when I have 100 tabs open of Firefox and unsaved work :stuck_out_tongue:

1 Like

Lol, I hear ya! Or how about before you have saved hours of work and you forgot to save it but instead you hit the stupid powerbutton!::scream:

where this is
rofr.sh -l
thank

rofr.sh is a shell in ~/bin/
In the openbox menu, when you want to logout, this program is also executed.
I don’t know if i did a good answer :grin:

I’m not there, maybe I’m in the new relase
thank

If you want, you can replace “rofr.sh -l” by “systemctl poweroff” and the poweroff on your computer will be done by a click-left on the logo! :grinning:

1 Like

In openbox all you have to do is right-click scroll to the bottom of the menu and click “Exit Openbox” and you’re given a selection of how you want to leave Archlabs.

Very cool! Thank you for sharing.

I used to use something similar but my way of using Polybar and Openbox have changed over the last few months.

Thanks.
Finally, I chose this solution, because we can switch off the computer with only one click on the of mouse:
ArchLabs_2018-03-06-10_328x156

1 Like

Yeah that’s a better option.

I added a couple of options

;;;;;;;;;;;;;;;
;; Power Off ;;
;;;;;;;;;;;;;;;
[module/poweroff]
type = custom/script
exec = echo " "
click-left = systemctl poweroff
click-right = i3lock-fancy -pg &
click-middle = systemctl restart

Yeah, great, it’s a good idea! Thanks a lot!

Finally, here ma configuration:

;;;;;;;;;;;;;;
;; Poweroff ;;
;;;;;;;;;;;;;;
[module/poweroff]
type = custom/script
exec = echo "  "
click-left = systemctl poweroff
click-right = systemctl reboot

I have to do reboot instead of restart and i do Super+L for lock the screen. Thanks for your idea Dobbie03!

1 Like

I prefer to launch the menu that is triggered with win+x

;;;;;;;;;;;;;;;;;;;;
;; Poweroff ;;
;;;;;;;;;;;;;;;;;;;;
[module/poweroff]
type = custom/script
exec =  echo "  "
click-left = rofi-logout

Choices, choices, choices. Lol there are a lot of ways to accomplish this according to one’s preferences. It’s pretty cool to see the creativity of individuals and how they come at an issue from different angles. If it works, then it isn’t wrong. So go with it. Happy creating!

1 Like

That’s the coolest thing, the options are endless.

2 Likes

I changed this up a bit again as I was accidentally shutting down.

[module/poweroff]
type = custom/script
exec = echo "  "
click-left = "jgmenu_run >/dev/null 2>&1 &"
click-right = i3lock-fancy -pg &
click-middle = /usr/bin/rofi-logout
1 Like