this post was submitted on 05 Jul 2024
20 points (100.0% liked)

Linux

48135 readers
644 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Problem -> When doing file transfers (mtp) or running some cli commands like nixos-rebuild, when the hyprlock kicks in they are pause at that point and only resume after unlock.

One thing I am kind of noticing that it may be the systemctl suspend command that is suspending the processes. But overall I am confused with the best combination of pairing both the two programs.

Here is the config (for hypridle)

general {
  before_sleep_cmd=loginctl lock-session
  lock_cmd=hyprlock
}

listener {
  on-timeout=suspend-script
  timeout=1800
}

(The suspend script)

      pw-cli i all 2>&1 | grep running -q
      # Only suspend if audio isn't running
      if [ $? == 1 ]; then
        systemctl suspend
      fi

Let me know if you have any solution. The link attached to this post is for my github hosting my nixos dotfiles, maybe that can also help.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 4 months ago* (last edited 4 months ago)

I guess OP could change the if statement to check if nixos-rebuild is running, not just check for music being played.

`

 music_is_playing=$(pw-cli i all 2>&1 | grep running -q)

  # Only suspend if audio isn't running

  if [ $music_is_playing == 1 ] && ! pidof nixos-rebuild; then

    systemctl suspend

  fi

` But I guess not using the script at all is also an option if putting the PC to sleep is a no-no.