Screenlock and swayidle problems

Hi there,

I am having usabilitiy problems with sway edition. The screenlock/sleep interferes frequently and I want to regulate this behaviour myself. It is not a big deal when sway lock jumps in every 10 minutes or so. However, this is annoying at times; e.g. when I watch videos either in my browser or on the video player or when I read on my laptop.

I have a temporary fix by setting swayidle to kick in after 3 hours or inactivity in the system wide configuration files. However, I am seeking to have a better solution. I know there is Caffeine in the repositories; however, it seems to be using python2, which I don’t want to install and I do not want caffeine to even autostart as python 2 is dated/out of development.

Is there another way I can fix this? If I can completely disable automatic sleep/screenlocking and make it triggered only when I chooose “Lock” from the shutdown menu, I will be ok with this too; instead of using Caffeine like software.

Would appreciate any help.

Searching the sway repos on GH gives us some hints here…

First of all there is a way to configure certain applications in a way to prevent the lock screen as long as they are running (in the GH issue it was Steam Games): Gaming peripherals do not reset the idle timer · Issue #68 · swaywm/swayidle · GitHub.

On the other hand there seems to be a way (haven’t figured it out yet) to tell Sway to disable the idle/lock timer on global scope: RFE: Ability to temporarily disable timeouts · Issue #31 · swaywm/swayidle · GitHub.

If anyone has experience with the latter please let me know.

Regards,
Andreas

Eventually it might be this option: sway/sway.5.scd at master · swaywm/sway · GitHub.

Have to see out how to configure it properly and introduce a new hot key for that.

Adjusting applications in a way to prevent the lock screen may not work the best; say, you adjusted firefox with that behaviour. But there may be users preferring Chromium or another browser; so, they would still have the annoyance again.

Personally, I am not a fan of automatic screen locking and turning of monitor in a laptop, although I understand its rationale. I was doing this manually whenever I need to by using Caffeine extension in my old Gnome system. Caffeine was set to on by default in my old system.

I hope this could be fixed/adjusted in Manjaro Sway.

Anything that you install on top of the default installation is eventually something that you will have to take care of (and configure on your own anyway)…

The only other option in Sway (check man page) is to trigger a hotkey to mark the current active application as inhibit_idle and as such preventing the lock screen to appear as long as it is running.

Ah ok, good to know.

I am new to Sway. I had a brief experience of setting it up myself on a Fedora Gnome machine. I will try to see if I can manage to find the appropriate setting.

It’s basically this line in the doc: sway/sway.5.scd at master · swaywm/sway · GitHub.

Ok, thank you.

Looks like there is a Waybar module to show the current idle_inhibitor status…

I’ve added this module to the waybar configuration: [sway] add idle inhibitor status to waybar (d8987d3d) · Commits · manjaro-arm / applications / arm-profiles · GitLab. And it looks like you can toggle the status with a mouse-click on the icon in the waybar.

If I got the details on GH, forums right this might be all you need to do to prevent the swayidle/swaylock to get triggered (assuming you activated the idle_inhibitor module in the waybar).

Would be great if you able to test this behaviour…

I would give this a try. I just need to know where the waybar config file is to append the snippet. The only config file I am aware in my local folders is the sway config.

Please let me know which file to use.

Ok, I found the waybar config and copied the item starting with “idle_inhibitor”. Saved the file and refresched with Mod+Shift+c. I don’t see any icons on the waybar.

Sorry, I can’t confirm as I don’t see any icon. Perhaps the snippet I copied from the git needs to be edited?

I guess otherwise, it seems to be what we are looking for. Very comparable to Caffeine and Presentation mode of XFCE.

Hey, I created a new Sway image based on the recent changes to the profile settings and the stable package updates published today.

You can find it here for Pinebook Pro and Raspberry Pi4: Manjaro ARM Sway Profile builds Project Top Page - OSDN

I flashed the image and tested it briefly. Waybar didn’t launch; so, I logged into a system without a panel. Wofi seems to be working; but terminal application problem with wofi seems to be persisting; I still can’t confirm that waybar module for presentation mode is working.

I have updated my system this morning with the stable updates and my system feels stable for my workflow.

I guess I will likely stay with sway. The other editions (XFCE, Kde and i3) were all problematic.

Hhmm just checked the source files in repo against my local development copy and there are no differences for the waybar config.

At the moment I’m not able to test myself as I still have to find my microSD after the relocation… :frowning:

If you could do me a favor and boot from the newly flashed image and attach the content of the .config/waybar folder here so I can investigate?!

Thanks!

Ok, found a small spare microSD that was big enough for a test run… I also uploaded a new image containing the recent change for the terminal applications via wofi: Downloading File / - Manjaro ARM Sway Profile builds - OSDN

For me waybar is looking fine:

Yes, I downloaded and flashed the new image; this time waybar showed up. I can confirm I see the idle indicator.

I also tested wofi against terminal based applications like ranger, htop, neovim etc. I can confirm it is working too.

I have two issues; I am not sure if any of them could be fixed as they seem to depend on developers of the corresponding software:

  1. Neovim: I launch Neovim using wofi; there is the welcome screen; I close it using :q!. Then I launch Neovim using wofi again. Neovim launches on quarter of the display space provided by termite, which is odd. Additionally, the welcome screen of Neovim does not show up this time. Can this be fixed? If not, would another text editor be under consideration? I am ok using simple text editors like nano or gtk3 based geany or vim/emacs.

  2. Idle indicator: I activate the idle indicator, then I reboot and idle indicator does not preserve the status. So, I have to enable it again. I understand that this is likely an issue with sway; so I guess it is ok to leave it like this. Caffeine was giving me the choice to make my choice persistent across boots. This is a minor problem and I can adapt accordingly.

Overall, I think the image is good. I didn’t make a long test because I flashed into a test card; however, it seems very usable.

1 Like

Hmmm that might depend on changes to termite I guess… not sure if this is already being addressed. Something I noticed though: when you force a refresh of the terminal window it usually updates itself…

You can try the following:

  • if the terminal is active press ALT+Shift+Space (this should make the terminal window with neovim inside a floating one)
  • press ALT+Shift+Space again (to disable the floating) and the neovim should now use the whole space inside the terminal window

Tried it a couple of times here with much success.

Ok, thank you for the tip. I will use it as a workaround.

I think something might be wrong with the way neovim is launching. I would expect to see the welcome screen of neovim everytime I close it, then launch it. Or launch a new instance. The way neovim/vim passes to the buffer without welcome screen is only when neovim/vim is already open and you launch a new instance. At least this has been my experience with gvim, which is gtk3 based.