You are not logged in.

#1 2022-04-24 00:21:18

difri84
Member
Registered: 2021-12-09
Posts: 78

how to get power management feature "inhibit" in i3? [SOLVED]

I'm using i3 with polybar, i really need to be able to activate and deactivate the "presentation mode" (inhibit screenoff and suspend) in a fast and simple way

right now the best thing i've found is to use xfce4-power-manager:
It has a tray icon(not visible) with a right click that allows me to check the "presentation mode" box

so i get the function, but it's really ugly to see the empty space of a missing tray icon on the bar.

i'm open to any solution:
- make the xfce4-power-manager tray icon visilbe
- use another program to inhibit the power management
- use another power manager with a manual inhibit feature

what is the best thing to do?

thank you!

Last edited by difri84 (2022-04-26 00:18:43)

Offline

#2 2022-04-24 00:54:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,494
Website

Re: how to get power management feature "inhibit" in i3? [SOLVED]

"Best"?  It depends what you want.  Do you want a tray icon?  I'd just make key bindings that exec the relevant 'xset' commands.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2022-04-24 01:26:17

difri84
Member
Registered: 2021-12-09
Posts: 78

Re: how to get power management feature "inhibit" in i3? [SOLVED]

It would be nice to have a visual feed back to know if the inhibit is on or off.

The keybind is very good to use, but I also need a feedback about the state of the inhibition.

Offline

#4 2022-04-24 08:41:33

moson
Member
Registered: 2021-06-03
Posts: 10
Website

Re: how to get power management feature "inhibit" in i3? [SOLVED]

To fix the tray icon issue you can try applying this patch:

https://gitlab.xfce.org/xfce/xfce4-powe … issues/148

However, the icon is not different when inhibit is on or off.

Offline

#5 2022-04-24 22:23:10

difri84
Member
Registered: 2021-12-09
Posts: 78

Re: how to get power management feature "inhibit" in i3? [SOLVED]

having the xfce4 power manager icon showing would be awesome, i can click and see the check about inhibition!
not sure about how to use the icon_fix.patch file they say... could be some patch to put into the source code? or is it some form of script to run?

Offline

#6 2022-04-25 00:46:42

difri84
Member
Registered: 2021-12-09
Posts: 78

Re: how to get power management feature "inhibit" in i3? [SOLVED]

ok guys i dedicedet to go for a totally different approach, forget power manager from GUI that sometimes works better sometimes worse.
i wan to set this totally from command line config files, i dont need to change the timer really often i just need:

- 5min turn screen off                         xset dpms 0 0 300
-15min suspend                                   still no idea, i'm searching though
- chance to inhibit this behaviour     xset -dpms

as you can see the bigger problem is that in my mind i have no command to make the suspend after 15 min idle.

once these purerely CLI command are going to start working, i will start to script a polybar module to toggle the inhibit.

this seems all very nice to me but i'm impressed by the amount of time i dedicated to find a way  to say "suspend if idle for 15min" informations are really difficult to find!

Offline

#7 2022-04-25 04:11:22

progandy
Member
Registered: 2012-05-17
Posts: 5,320

Re: how to get power management feature "inhibit" in i3? [SOLVED]

This should probably work:

systemd-inhibit --what "sleep:idle" --mode=block --why="Presentation mode" -- sh -c "echo Press Enter to stop idle inhibition ; read"

Last edited by progandy (2022-04-25 04:13:49)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#8 2022-04-25 13:47:59

difri84
Member
Registered: 2021-12-09
Posts: 78

Re: how to get power management feature "inhibit" in i3? [SOLVED]

Solved with a polybar module and a xautolock call in i3/config

i3/config

exec --no-startup-id xautolock -time 5 -locker "xset dpms force off" -killtime 15 -killer "systemctl suspend" -detectsleep

polybar/config.ini

[module/inhibit-ipc]
type = custom/ipc

hook-0 = echo %{F#0099ff}      #color (awesomefont) powersave on
hook-1 = echo %{F#A54242}      #color (awesomefont) powersave off

click-left = "xautolock -enable && polybar-msg action inhibit-ipc hook 0"
click-right = "xautolock -disable && polybar-msg action inhibit-ipc hook 1"
initial = 1

the computer starts with 5min monitoroff and 15min suspend, blue power icon on polybar

if i rightclick the icon, it becomes red and deactivacte the powersave
if i leftclick the icon, it comes back blue and reactivate the powersave

EDIT:
this is not working about suspend, why not? do anyone have a clue what's wrong in:

xautolock -time 5 -locker "xset dpms force off" -killtime 15 -killer "systemctl suspend" -detectsleep

EDIT2:
i discovered the problem is the timer, if i set suspend after 2 minutes it works, if i set it after 15 min it doesnt, that means there's something breaking the idle status in background.. how do i discover what is it?

EDIT3:
apparently the killer feature of xautolock doen't work so well so this was my solutiont and it's working 100%

i3

#autostart powersaving
exec --no-startup-id xset s off && xset s 0 0
exec --no-startup-id xset dpms 0 0 300
exec --no-startup-id xautolock -time 15 -locker "systemctl suspend" -detectsleep 

polybar

[module/inhibit-ipc]
type = custom/ipc

hook-0 = echo %{F#0099ff}
hook-1 = echo %{F#A54242}

click-left = "xautolock -enable && xset +dpms && polybar-msg action inhibit-ipc hook 0"
click-right = "xautolock -disable && xset -dpms &&polybar-msg action inhibit-ipc hook 1"
initial = 1

Last edited by difri84 (2022-04-26 00:17:52)

Offline

#9 2022-11-08 13:15:03

asklow
Member
Registered: 2022-11-07
Posts: 68

Re: how to get power management feature "inhibit" in i3? [SOLVED]

I'm using xidlehook

exec --no-startup-id xidlehook \
	--detect-sleep \
	--not-when-audio \
	--not-when-fullscreen \
	--timer 180 'xset dpms force standby' '' \
	--timer 180 'i3lock' '' \
	--timer 360 'systemctl suspend' '' &

Offline

Board footer

Powered by FluxBB