You are not logged in.

#26 2019-11-17 04:06:25

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,936
Website

Re: Alarm clock scripts

damo wrote:

No gui with...

mpv "$SOUND"

Tricky, it will gui if the file has some sort of cover art embedded. mpv --no-video seems to work.

Last edited by brontosaurusrex (2019-11-17 04:06:54)

Offline

#27 2019-11-17 04:20:25

damo
....moderator....
Registered: 2015-08-20
Posts: 5,272

Re: Alarm clock scripts

This is where I've got to so far:

I incorporated misko's titlebar timer into the script - nice one smile
I also added some tests, and the option to use YAD or notify-send for the desktop alert.

yad-alarm5.jpg

[NB If you use a different name for the script, then there are several places in the code where it needs to match]

#!/bin/bash
#
# alert_clock: an Alarm Clock script using YAD dialog
#
# Author: D.M-Wilhelm (Leiche)
# Email: meisssw01 at gmail.com
# Licence: GPL
#
# Updated and enhanced by @misko_2083 and @damo, of the Bunsenlabs community
# November 2019
#
########################################################################
Encoding=UTF-8
#
# i18n - Internationalization
export TEXTDOMAIN=alert_clock
export TEXTDOMAINDIR="/usr/share/locale"
#
# define some variables
#
TITLE="Alarm Clock"
ICON="/usr/share/icons/Papirus/64x64/apps/alarm-clock.svg"
#ICON="/usr/share/icons/Paper/48x48/apps/alarm-clock.png"
SOUNDFILE="/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga"

# Choose whether to use YAD dialog or system notification for Alarm alert
ALERT="YAD_ALERT"
#ALERT="SYSTEM_ALERT"

win_class="timer_class"

### Check default icon and sound file ###
[[ ! -f "$ICON" ]] && echo "$ICON not found"
[[ ! -f "$SOUNDFILE" ]] && echo "Default soundfile, $SOUNDFILE, not found"

### Test for mpv player
if ! hash mpv; then
    echo "$0: mpv binary is missing. Please issue 'sudo apt-get install mpv'." >&2
    exit 1
fi

#--------------------
# change title to current time
#--------------------
function change_title {
declare yad_xid

# need some time to register window class with X
while [[ ${yad_xid} == "" ]]; do
   # get Xwindow id
   yad_xid="$(wmctrl -lx | grep -e "yad.${win_class}" |  grep -oE "[0-9a-z]{10}")"
done

# convert to decimal number
yad_xid="$(echo $((${yad_xid})))"

while true
 do
   wmctrl -i -r "${yad_xid}" -N "$TITLE : $(date '+%T')" 2>/dev/null || break
   sleep 1
done
}

### main dialog ###
function menu {
    change_title &
    
    MAX_MINUTES=12000
    COUNTDOWN=$(yad --class="${win_class}" --title="$TITLE :  $(date '+%T')" \
                    --window-icon="$ICON" \
                    --image="$ICON" \
                    --borders=15 \
                    --button="Change alarm sound:2" \
                    --button="Test:3" \
                    --button="gtk-ok:0" \
                    --button="gtk-cancel:1" \
                    --height=180 \
                    --form  --align=right --center \
                    --field "\tEnter minutes until alarm...\t\n \
                        \t(1-$MAX_MINUTES)":NUM  "1!1..$MAX_MINUTES")

    ret=$?
    COUNTDOWN="${COUNTDOWN%"|"*}"
    
    [[ $ret -eq 1 ]] && exit 0
    #
    ### Change sound dialog ###
    #
    if [[ $ret -eq 2 ]]; then
        CHANGE=$(yad --title="$TITLE" --window-icon=$ICON \
            --file --width=600 --height=500 --center \
            --button="gtk-ok:0" --button="gtk-cancel:1" \
            --filename="/usr/share/sounds/" \
            --text="\n\t<b>Choose an audio file for the alert</b>\n") 
    
            if [ -z "$CHANGE" ];then 
                exec alert_clock
                exit 0
            else
                # check soundfile exists
                if [ -f "$CHANGE" ];then
                    mkdir -p "$HOME/.config/alert-clock"
                    rm -rf "$HOME/.config/alert-clock/alert"
                    sleep 1
                    ln -s "$CHANGE" "$HOME/.config/alert-clock/alert"
                    yad --title "$TITLE" \
                        --button="gtk-ok:0" \
                        --width 300 --borders=15 --center \
                        --window-icon="$ICON" \
                        --text="\nAlarm sound now in use is:\n\n<i>$CHANGE</i>"
                else
                    yad --title "$TITLE" \
                         --button="gtk-ok:0" \
                         --width 350 --borders=15 --center \
                         --window-icon="$ICON" --image-on-top \
                         --image="gtk-dialog-warning" \
                         --text="\t<big>You need to choose a\n\tsound file!</big>"
    
                    exec alert_clock
                    exit
                fi
            fi
        menu        
    fi
    #
    ### Test sound dialog ###
    #
    if [[ $ret -eq 3 ]]; then
        if [ -f $HOME/.config/alert-clock/alert ]; then
            SOUND="$HOME/.config/alert-clock/alert"
        else
            SOUND="$SOUNDFILE"
        fi
        mpv --no-video "$SOUND" | yad --title "$TITLE" \
                         --button="gtk-ok:0" \
                         --width 300 --center --borders=15 \
                         --window-icon="$ICON" \
                         --text="\n\t...Exit sound test"
#        killall mpv
          pkill -xf "mpv --no-video $SOUND"

        menu                 
    fi
}
menu

[[ "$COUNTDOWN" == 1 ]] && MINS="minute" || MINS="minutes"

if [ -z "$COUNTDOWN" ];then
    exit
else
    echo You entered "$COUNTDOWN $MINS"
    TIMER=$(echo $((COUNTDOWN*60)))
    TASK1=$(date -s "+$TIMER seconds" 2>/dev/null | cut -d " " -f4)
    temp=$(mktemp -u --tmpdir alarm.XXXXXXXX)
    
    mkfifo $temp
    
    exec 3<> $temp
    
    timeout --preserve-status $TIMER yad --notification  --listen <&3 & _pid=$!
    echo tooltip: "\nAlarm clock was set to <big><b>$COUNTDOWN</b></big> $MINS \
        \n\nAlarm will be at <big><b>$TASK1</b></big> \
        \n\nLMB or MMB to quit, RMB for menu" >&3
    echo "action:quit" >&3
    echo "menu:About!yad --about!gtk-info|Quit!quit!gtk-exit" >&3
    echo "icon:${ICON}" >&3
    
    wait $_pid
    [[ $? -eq 0 || $? -eq 252 ]] && rm $temp && exit
    
    rm $temp
    exec 3>&-
    
    #check which sound
    #
    if [ -f "$HOME/.config/alert-clock/alert" ]; then
        SOUND="$HOME/.config/alert-clock/alert"
    else
        SOUND="$SOUNDFILE"  # use default soundfile
    fi

    if [ "$ALERT" == "YAD_ALERT" ];then
        ### Using YAD ##########
        (mpv --no-video "$SOUND") | yad --title "$TITLE" --undecorated --center \
                         --no-buttons --sticky --escape-ok --on-top \
                         --width 300 --image="$ICON" \
                         --window-icon="$ICON" \
                         --borders=15 \
                         --timeout=10 \
                         --text="\n\t<big><b>Time is up!</b></big>"
                         exit
    else
        ### Using notify-send ###
        mpv --no-video "$SOUND" &
        notify-send -i "$ICON" "Time is up! "
        exit
    fi
fi

exit

I don't like the killall mpv command though - it would be a bummer if something else was playing at the same time. Maybe use pkill -xf instead?

EDIT: now using instead...

        pkill -xf "mpv --no-video $SOUND"

EDIT2: If aplay is used, we can have --file-filter="sounds|*.wav" in the file chooser, to only display wav files smile

Last edited by damo (2019-11-17 04:49:04)


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#28 2019-11-17 05:02:27

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,097
Website

Re: Alarm clock scripts

(bl-mpv is a sort of substitute GUI app with some tweaked settings, that can replace VLC or... or... as a player with a window. A user who opens a player from a menu with no file expects a window they can do something with. bl-mpv gives the mpv pseudo-gui which at least allows drag & drop, and give a couple of controls.)

But it would be nice if we could make this script usable on all BL systems without forcing a new media player install. aplay comes with alsa-utils so most people will have it, but right it doesn't support many file types. Is that important for an alarm clock?

damo wrote:

If aplay is used, we can have --file-filter="sounds|*.wav" in the file chooser, to only display wav files

+1 As long as we can find some suitable wav files.

PS any chance of being able to set a clock time as an alternative to so-many-minutes-later?
Even a date?
(At supports a lot of time settings.)

Last edited by johnraff (2019-11-17 05:04:28)


John
--------------------
( a boring Japan blog, idle Twitterings and GitStuff )
In case you forget, the rules.

Offline

#29 2019-11-17 05:29:26

damo
....moderator....
Registered: 2015-08-20
Posts: 5,272

Re: Alarm clock scripts

There are probably a gazillion suitable wav files out there, so I guess it depends how many we would want to supply. Wavs are a similar size to images AFAICS, so not too much overhead to provide half-a-dozen I guess. I'll search out a few and try aplay instead of mpv.

(Thinks.... you could pass script parameters to set the media player you want to use? Then set different file filters from arrays, depending on what the player can utilize. Ooops, bloat-creep is starting again! Let's just use aplay and wavs smile)

I have been working on getting this script together into a useable state for now (impossible without misko's work!). I haven't even started thinking about bronto's at approach yet  monkey

And yes, setting a time instead of an interval is an aspiration of course wink


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#30 2019-11-17 05:48:28

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,097
Website

Re: Alarm clock scripts

It all looks like a great addition to the tint2 clock, right-click isn't used atm. cool


John
--------------------
( a boring Japan blog, idle Twitterings and GitStuff )
In case you forget, the rules.

Offline

#31 2019-11-17 09:56:54

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,936
Website

Re: Alarm clock scripts

Gui stuff

I've added yad input for 'reason' in mine, it will popup when the thing is launched from gmrun/obmenu for example.

The reaction to right-click clock could be a menu with

~/bin/beepmein.txt.menu

beepmein ~ 1, beepmein 1
beepmein ~ 5, beepmein 5
beepmein ~ 15, beepmein 15
beepmein ~ 30, beepmein 30
beepmein ~ 60, beepmein 60
beepmein &lt;time&gt;, gmrun beepmein
beepmein --alarm &lt;time&gt;, gmrun 'beepmein --alarm '
killall beepmein noises, killall beepmein

Gmrun could/shall be replaced with something better for time input (what?).
Note: Tilda (~) is used for display to denote 'approximate'.

and in tint2rc

clock_rclick_command = cat ~/bin/beepmein.txt.menu | jgmenu --simple --icon-size=0

and in jgmenurc

position_mode = pointer

jgmenu --version

jgmenu v3.5

Yields
conceptc5b053c3a0f94163.th.png

And a dynamic version (jgmenu simple pipe) of menu
scrot12376.th.png
Mic Drop.

Last edited by brontosaurusrex (2019-11-17 20:37:46)

Offline

#32 2019-11-18 01:35:04

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: Alarm clock scripts

damo wrote:

And yes, setting a time instead of an interval is an aspiration of course wink

It is possible.
I came across this JavaScript Alarm clock:  http://www.javascriptkit.com/script/script2/alarm.shtml
Some hacks were required to make the submit (aka set alarm) button work with Yad's html dialog. I realized that yad only reacts  when a link is mouse-clicked.
First had to create the link with the href value of the set time in the JavaScript.
Then had to simulate mouse click on that link.
Here is explained how to simulate mouseclick: https://stackoverflow.com/questions/415 … pt#4176116
The link doesn't even has to be realized on the webpage to simulate mouse click on that link. Crazy, ha? smile
I also have a small neat JavaScript from the previous project that prevents the context menu to pop on right mouse click.

So we same this html page as set-alarm.html

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">

<!--CSS for the page-->
<style>
.body, .html {
  overflow-y: hidden;
  cursor: default;
  #background-color: #CECECE;
}

#jsalarmclock{
font-weight: bold;
font-size: 14px;
}

#jsalarmclock div{
margin-bottom: 0.8em;
}

#jsalarmclock div.leftcolumn{
float: left;
width: 150px;
font-size: 14px;
clear: left;
}

#jsalarmclock span{
margin-right: 10px;
}

</style>

<!--Script to prevent right click menu-->
<script type="text/javascript">
    if (document.addEventListener) { // IE >= 9; other browsers
        document.addEventListener('contextmenu', function(e) {
            //here you do nothing
            e.preventDefault();
        }, false);
    } else { // IE < 9
        document.attachEvent('oncontextmenu', function() {
            alert("You've tried to open context menu");
            window.event.returnValue = false;
        });
    }
</script>


<script type="text/javascript">

/***********************************************

* JavaScript Alarm Clock- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more

***********************************************/

var jsalarm={
	padfield:function(f){
		return (f<10)? "0"+f : f
	},
	showcurrenttime:function(){
		var dateobj=new Date()
		var ct=this.padfield(dateobj.getHours())+":"+this.padfield(dateobj.getMinutes())+":"+this.padfield(dateobj.getSeconds())
		this.ctref.innerHTML=ct
		this.ctref.setAttribute("title", ct)
	},
	init:function(){
		var dateobj=new Date()
		this.ctref=document.getElementById("jsalarm_ct")
		this.submitref=document.getElementById("submitbutton")
		this.submitref.onclick=function(){
			jsalarm.setalarm()
			this.value="Alarm Set"
			this.disabled=true
			return false
		}
		var selections=document.getElementsByTagName("select")
		this.hourselect=selections[0]
		this.minuteselect=selections[1]
		this.secondselect=selections[2]
		for (var i=0; i<60; i++){
			if (i<24) //If still within range of hours field: 0-23
			this.hourselect[i]=new Option(this.padfield(i), this.padfield(i), false, dateobj.getHours()==i)
			this.minuteselect[i]=new Option(this.padfield(i), this.padfield(i), false, dateobj.getMinutes()==i)
			this.secondselect[i]=new Option(this.padfield(i), this.padfield(i), false, dateobj.getSeconds()==i)

		}
		jsalarm.showcurrenttime()
		jsalarm.timer=setInterval(function(){jsalarm.showcurrenttime()}, 1000)
	},
	setalarm:function(){
		this.hourwake=this.hourselect.options[this.hourselect.selectedIndex].value
		this.minutewake=this.minuteselect.options[this.minuteselect.selectedIndex].value
		this.secondwake=this.secondselect.options[this.secondselect.selectedIndex].value
                var a = document.createElement('a');
                var linkText = document.createTextNode("Go");
                a.appendChild(linkText);
                a.title = "fake link";
                a.href = this.hourselect.options[this.hourselect.selectedIndex].value+":"+this.minuteselect.options[this.minuteselect.selectedIndex].value+":"+this.secondselect.options[this.secondselect.selectedIndex].value;
                // DOM 2 Events
                var dispatchMouseEvent = function(target, var_args) {
                  var e = document.createEvent("MouseEvents");
                  // If you need clientX, clientY, etc., you can call
                  // initMouseEvent instead of initEvent
                  e.initEvent.apply(e, Array.prototype.slice.call(arguments, 1));
                  target.dispatchEvent(e);
                };
                dispatchMouseEvent(a, 'mouseover', true, true);
                dispatchMouseEvent(a, 'mousedown', true, true);
                dispatchMouseEvent(a, 'click', true, true);
                dispatchMouseEvent(a, 'mouseup', true, true);
		this.hourselect.disabled=true
		this.minuteselect.disabled=true
		this.secondselect.disabled=true
	}
}

</script>
</head>
<body class="body">

 <form action="" method="">
  <div id="jsalarmclock">
  <div><div class="leftcolumn">Current Time:</div> <span id="jsalarm_ct" style="letter-spacing: 2px"></span></div>
  <div><div class="leftcolumn">Set Alarm:</div> <span><select></select> Hour</span> <span><select></select> Minutes</span> <span><select></select> Seconds</span></div>
  <div>
  <input type="submit" value="Set Alarm!" id="submitbutton" />
  </div>
</form>


<script type="text/javascript">

jsalarm.init()

</script>
</body>
</html>

And this script for the yad html

#!/bin/bash

# Change this!
YURI="/home/misko/Documents/set-alarm.html"

# Main window
function _yad_ui(){
    # Set the line buffering with stdbuf
    stdbuf -oL -eL yad --title="Set Alarm" --width=550 --height=150 \
    --html --uri="${YURI}" --no-buttons --print-uri 2>&1 & echo $!
}

# Main Function
function _do_stuff(){
    # fetch yad process id
    read YAD_PID

    # read yad stdout line by line
    while read -r line
    do  
        if [[ "${line##*/}" == [0-9][0-9]:[0-9][0-9]:[0-9][0-9] ]]; then
            kill -SIGUSR1 $YAD_PID
            echo "Alarm set to: ${line##*/}"
            # Here we set alarm Damo
        fi
    done
}

_yad_ui | _do_stuff & wait $! 2>/dev/null

exit 0

So far it's only a demonstration, the script only prints the selected alarm time to the terminal.
https://i.imgur.com/snDy1OW.gif

Offline

#33 2019-11-18 06:20:46

damo
....moderator....
Registered: 2015-08-20
Posts: 5,272

Re: Alarm clock scripts

I've got a bash yad time/date version working after a fashion, using at and aplay. It is proof-of-concept ATM. and not for public view  ops


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#34 2019-11-18 06:34:06

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,097
Website

Re: Alarm clock scripts

Just throwing stuff in here, please ignore if you wish:

*) At alarm time, turn the volume up if it's down?

*) Alternative, extreme visual alert, like flash the whole screen on and off?


John
--------------------
( a boring Japan blog, idle Twitterings and GitStuff )
In case you forget, the rules.

Offline

#35 2019-11-18 10:38:28

clusterF
Member
Registered: 2019-05-07
Posts: 319

Re: Alarm clock scripts

johnraff wrote:

Just throwing stuff in here, please ignore if you wish:

*) Alternative, extreme visual alert, like flash the whole screen on and off?

Possibly with the use of xscreensaver maybe?


"Common sense is like deodorant, those who need it the most never use it."

git: clusterF

Offline

#36 2019-11-18 11:13:47

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,936
Website

Re: Alarm clock scripts

johnraff wrote:

*) Alternative, extreme visual alert, like flash the whole screen on and off?

Improved version of this should blink on some systems.

p.s. Combined with xbacklight might make a more universal solution.

edit: If someone want's to improve on this (not me), probably redshift sources might be the way to find how-to

redshift -m list
Available adjustment methods:
  drm
  randr
  vidmode
  dummy

*) At alarm time, turn the volume up if it's down?

Unmute or ...?

amixer sset Master unmute # ?

edit: ^ Probably a bad idea to mess with peoples volume at any point in time.

Last edited by brontosaurusrex (2019-11-19 08:41:18)

Offline

#37 2019-11-18 17:38:50

damo
....moderator....
Registered: 2015-08-20
Posts: 5,272

Re: Alarm clock scripts

brontosaurusrex wrote:

...
edit: ^ Probably a bad idea to mess with peoples volume at any point in time.

So a pulsing screen, or pop-up, could help with that.

I guess you could re-set the sound values after the alarm has finished, but there would always be a problem if something is already playing (although that would be an alert in itself!)


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#38 2019-11-18 20:37:23

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,936
Website

Re: Alarm clock scripts

^The problem would also be if something is playing and user would mute that on purpose, only to be overridden by reminder.

I improved the blink script a bit and it runs surprisingly smooth (seems to be in sync with monitor refresh) on my old nvidia and surprisingly out-of-sync (visible tearing) on an old integrated intel graphics. edit: Added slight sleep into gradation itself which seems to reduce tearing on intel, but shall probably decrease smoothness on nvidia.

edit:
- Also the way it is done right now is that on faster machines it will blink faster than on slower ones (but the difference should be small, so could be a nonissue)
- According to xrandr docs it appears there is possibility that no monitor is marked as primary (to research) edit: It shall now search for name of the 'primary AND connected' or else '1st connected' will do.
(Because I found a version where my primary is not connected..., I assume there are more ways that this could fail).

And I incorporated blink script as function to beepmein (and it's not working there, possibly due to 'at' environment ...), fixed by adding 'DISPLAY=${DISPLAY}' at start of the exported job.

Last edited by brontosaurusrex (2019-11-19 09:24:27)

Offline

#39 2019-11-19 01:07:28

cog
brushpopper
From: New Mexico, USA
Registered: 2015-10-27
Posts: 343
Website

Re: Alarm clock scripts

Wow guys this is really turning into a cool project.  I don’t know if I’ll use it much since I occasionally use alarms and just on my phone but will definitely kick the tires once y’all are done.


It is another beautiful day at the Red Pony Saloon and continual soiree.  - Henry Standing Bear

Offline

#40 2019-11-19 04:48:29

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,097
Website

Re: Alarm clock scripts

I think I actually might use this myself. Phone is usually switched off, and often forget something I have to do, getting deep into some trivia...


John
--------------------
( a boring Japan blog, idle Twitterings and GitStuff )
In case you forget, the rules.

Offline

#41 2019-11-19 13:35:24

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: Alarm clock scripts

johnraff wrote:

I think I actually might use this myself. Phone is usually switched off, and often forget something I have to do, getting deep into some trivia...

Oh, brother, I know how you feel. I'm also a multitasker, I can listen, ingnore and forget at the same time. smile

Offline

#42 2019-11-20 11:19:30

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,936
Website

Re: Alarm clock scripts

So I was awoken by 'mpv' playing axelF.mod this morning, but there are 'speaker-test' beeps that will be triggered if
- script is not configured to find sample
- mpv is not present

Also there is now some defense in the field of 'user not getting at syntax right'.

beepmein yesterday
at time format error. # and double beep.

More user testing would be needed before I can call this ok for general consumption thought.

btw: What is expected to happen on --reaction:
- sample or beep
- notification
- screen blink (on some systems)

Last edited by brontosaurusrex (2019-11-20 12:15:38)

Offline

#43 2019-11-29 19:54:01

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,936
Website

Re: Alarm clock scripts

Some changes to beepmein.

changelog wrote:

    fixed --help a bit
    --set-alarm && --set-remind, also with yad --file selector (idea by Damo)

One can now say

beepmein --set-alarm /path/to/file.flac

or

beepmein --set-alarm

and yad --file selector should pop-up.

Last edited by brontosaurusrex (2019-11-29 20:23:48)

Offline

#44 2019-12-03 18:45:15

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: Alarm clock scripts

When using "at" app DISPLAY env variable needs to be set to run Yad or some other gui apps.
"At" doesn't set DISPLAY and some other variables.
>> notify-send << works without that var.

I've posted an animated gif of alarm in puppy linux forums and the members there started their own alarm UI.
It's looking good and they have realy good ideas but it's not stoping the alarm on my machine. http://murga-linux.com/puppy/viewtopic. … 29#1043429

And tried some tricks with the yad's HTML dialog.
https://www.youtube.com/watch?v=K_htGC3H2Dc

Offline

#45 2019-12-03 19:43:29

bigbenaugust
Member
From: unc.edu / the 919 / KIGX
Registered: 2017-05-20
Posts: 171

Re: Alarm clock scripts

Back in the day, I used to just use:

at 06:00 mpg123 -m some_mp3_file.mp3

lol

This is infinitely more sophisticated.


--Ben
BL / MX / Raspbian... and a whole bunch of RHEL boxes. :)

Offline

#46 2019-12-03 21:45:41

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,936
Website

Re: Alarm clock scripts

changelog wrote:

--list at jobs
beepmein relative to now shortcut 'beepmein <minutes>' is now the only one that has precision in seconds

todo: why not in nanoseconds

sleep "$(date +%_S.%N)"
misko_2083 wrote:

When using "at" app DISPLAY env variable needs to be set to run Yad or some other gui apps.
"At" doesn't set DISPLAY and some other variables.

True that.

beepmein --list | sort
617 Wed Dec  4 07:00:00 2019 a b | sleep 0; DISPLAY=:0 beepmein --reaction --alarm 'Wake up.'
619 Wed Dec  4 07:30:00 2019 a b | sleep 0; DISPLAY=:0 beepmein --reaction --alarm 'Really?'

Last edited by brontosaurusrex (2019-12-04 07:23:10)

Offline

#47 2019-12-04 06:28:10

cog
brushpopper
From: New Mexico, USA
Registered: 2015-10-27
Posts: 343
Website

Re: Alarm clock scripts

Lol, lookin' like beepmein is relentless & will get your butt up.  Nice work @Brex


It is another beautiful day at the Red Pony Saloon and continual soiree.  - Henry Standing Bear

Offline

#48 2019-12-04 20:55:16

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,936
Website

Re: Alarm clock scripts

@cog, thanks.

So I've added the delay in (nano)seconds to this specific beepmein-custom-setter, this delay is actually added to job itself and should (the purpose) bring 'in seconds precision' to short-timed-relative-to-now events, like 'beepmein 5', however if the user says 'beepmein now + 5 minutes' that will not happen (we are in 'at' land). < is there a short way to explain all this in --help?

Last edited by brontosaurusrex (2019-12-04 20:57:06)

Offline

#49 2019-12-04 21:14:14

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: Alarm clock scripts

brontosaurusrex wrote:
changelog wrote:

--list at jobs
beepmein relative to now shortcut 'beepmein <minutes>' is now the only one that has precision in seconds

todo: why not in nanoseconds

sleep "$(date +%_S.%N)"

That's for serious science.
So nice of you for having CERN in mind. smile
A minute or in some cases half a minute is precise enough for me.
Date has this undocumented feature.
Miliseconds
date +%s%3N
Microseconds
date +%s%6N
Nanoseconds
date +%s%9N

Offline

#50 2019-12-05 06:55:03

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,936
Website

Re: Alarm clock scripts

I'am thinking spaghetti actually, and how they need exactly 12 minutes. (Pretty sure they eat them in CERN as well)

Last edited by brontosaurusrex (2019-12-05 07:05:09)

Offline

Board footer

Powered by FluxBB