UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Automatic mute for night mode

    Scheduled Pinned Locked Moved App Development
    4 Posts 3 Posters 303 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • U Offline
        uxes
        last edited by

        Now, i had issues with different servicies sending emails around 4AM waking me up, so I am currently playing with mute service, there are commands I am trying just muting the DEFAULT_SINK, not sure if correct way, since it is not toggle-able with the switch in ayatana indicators šŸ˜•

        nano ~/.config/systemd/user/mute-audio.service with

        [Unit]
        Description=Mute Audio
        
        [Service]
        Type=oneshot
        ExecStart=/usr/bin/pactl set-sink-mute @DEFAULT_SINK@ 1
        

        nano /.config/systemd/user/unmute-audio.service with

        [Unit]
        Description=Unmute Audio
        
        [Service]
        Type=oneshot
        ExecStart=/usr/bin/pactl set-sink-mute @DEFAULT_SINK@ 0
        

        nano /.config/systemd/user/mute-audio.timer with

        [Unit]
        Description=Timer to mute audio at 8 PM
        
        [Timer]
        OnCalendar=*-*-* 20:00:00
        Persistent=true
        
        [Install]
        WantedBy=timers.target
        

        nano /.config/systemd/user/unmute-audio.timer with

        [Unit]
        Description=Timer to unmute audio at 7 AM
        
        [Timer]
        OnCalendar=*-*-* 07:00:00
        Persistent=true
        
        [Install]
        WantedBy=timers.target
        

        systemctl --user daemon-reload
        systemctl --user enable mute-audio.timer
        systemctl --user enable unmute-audio.timer
        systemctl --user start mute-audio.timer
        systemctl --user start unmute-audio.timer

        systemctl --user list-timers

        SalahS 1 Reply Last reply Reply Quote 2
        • U Offline
          uxes
          last edited by

          after week of using, I am really happy with this solution, works just as it should.

          I can imagine some simple application that edits this timer file or doing disable/enable, could also be managable from system-settings.

          KenedaK 1 Reply Last reply Reply Quote 2
          • KenedaK Offline
            Keneda @uxes
            last edited by Keneda

            @uxes
            Yes, that would be a very usefull feature to have in system settings.

            Ideal would be to be able to set as much mute scenarios as we need, like for alarm clock (and possibly, coupled with), in order to allow for muting depending on sleep periods, for instance for people shift working.

            2015-2023 : Meizu MX4 ā˜ ļøāš°ļøāœļø
            2023-2024 : Nexus 5 ā˜ ļøāš°ļøāœļø
            2024-***** : FPOS Fairphone 5 waiting UT for freedom šŸ˜‰
            šŸ‡²šŸ‡«šŸ‡¬šŸ‡§

            1 Reply Last reply Reply Quote 0
            • SalahS Offline
              Salah @uxes
              last edited by

              @uxes Your idea is pretty amazing and would love to see it as an application soon.

              Thumbs Up...

              " Our Business, Is Life Itself,, "

              • Iphone X => Daily Use
              • Nokia N900 => Secondary Device for Experiments and Mods. LOVE THIS DEVICE...
              • Google Pixel 3a XL => Using This Device as Secondary Device -- UT 20.04 Version
              1 Reply Last reply Reply Quote 0
              • First post
                Last post