<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=6382&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / Simple Countdown Timer]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=6382</link>
		<description><![CDATA[The most recent posts in Simple Countdown Timer.]]></description>
		<lastBuildDate>Sun, 21 Jul 2024 15:41:16 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=51268#p51268</link>
			<description><![CDATA[<p>the oneliner</p><div class="codebox"><pre><code>user@host ~ % sleep 60 ; echo &quot;\a&quot;  &amp; </code></pre></div><p>should do, whatever you need <br />60 is time in seconds so put 3600 for an hour</p><p>with the &amp; you can close the terminal</p>]]></description>
			<author><![CDATA[dummy@example.com (bai4Iej2need)]]></author>
			<pubDate>Sun, 21 Jul 2024 15:41:16 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=51268#p51268</guid>
		</item>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=49796#p49796</link>
			<description><![CDATA[<p>Philosopher Amnesiac wrote:</p><div class="quotebox"><blockquote><div><p>Warning!!! Whatever sound file you choose, it will play the entire sound file. So, you might want to choose a file that&#039;s only a few seconds long.</p></div></blockquote></div><p>I learned a new bash command today - &#039;trap&#039; . And to make the sound stop playing when you close the timer window you can add:</p><div class="codebox"><pre><code>trap &#039;killall aplay&#039; EXIT</code></pre></div><p>at the beginning of the original script.</p>]]></description>
			<author><![CDATA[dummy@example.com (swanson)]]></author>
			<pubDate>Fri, 03 May 2024 16:18:04 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=49796#p49796</guid>
		</item>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=47934#p47934</link>
			<description><![CDATA[<p>@stultumanto ahh, thank you! Now I&#039;ve got something to do this snowy day too! <img src="https://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (swanson)]]></author>
			<pubDate>Thu, 08 Feb 2024 09:44:50 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=47934#p47934</guid>
		</item>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=47910#p47910</link>
			<description><![CDATA[<p>I think the problem is you put a &#039;&amp;&#039; on the command line between setting the variable and executing your script. I tested it myself. I created a minimal test script:</p><div class="codebox"><pre><code>#!/usr/bin/bash
xterm -e &quot;bash -c \&quot;echo $TIME; read\&quot;&quot;</code></pre></div><p>Then I ran it like this:</p><div class="codebox"><pre><code>$ TIME=3 countdown.sh</code></pre></div><p>and it opened an xterm window and printed the number &#039;3&#039;.<br />Then I ran it your way, like this:</p><div class="codebox"><pre><code>$ TIME=3 &amp; countdown.sh</code></pre></div><p>And it opened an empty window. I think when you insert a &#039;&amp;&#039; it breaks up the simple command and makes it into two commands, so the variable is no longer set in the environment for the second command. It shouldn&#039;t be a problem to take out the &#039;&amp;&#039; because setting a variable is non-blocking.</p>]]></description>
			<author><![CDATA[dummy@example.com (stultumanto)]]></author>
			<pubDate>Tue, 06 Feb 2024 16:16:07 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=47910#p47910</guid>
		</item>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=47888#p47888</link>
			<description><![CDATA[<p>I&#039;ve modified the yad script a bit, to also pop-op a countdown timer, so as to know when it&#039;s finished. <br />But, I can not get the code to pass a variable to the next script. I&#039;ve tried a bunch of stuff like several different kinds of single AND double quotes. I&#039;ve tried to define the variable TIME and and then read it in in the next script, but it all seems to be above my pay grade (or IQ rather). <img src="https://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>My altered code:<br />snip...</p><div class="codebox"><pre><code>--field=&quot;   3 Minutes!/home/USER/alarm_96_icon.png&quot;:fbtn &quot;bash -c &#039;/home/USER/bin/newtimerwindow3 &amp;  sleep 3m ; aplay /home/USER/alarm-1000.wav&#039;&quot; \</code></pre></div><p> ...end snip.</p><p>I would like to pass the variable TIME to this script:</p><div class="codebox"><pre><code>#!/bin/bash
##script to open new countdown from newtimer script (yad)

xterm -fa &#039;Monospace&#039; -fs 48 -geometry 20x4 -e &#039;bash -c &quot;/home/USER/bin/countdowntimer 3&quot;</code></pre></div><p>Instead of &quot;..countdowntimer 3&quot;, I&#039;ve tested &quot;..countdowntimer $TIME&quot; - no luck.</p><p>As you see, it&#039;s all very crude, but fun and maybe even a bit functional.</p><p>Crude example: </p><div class="codebox"><pre><code>--field=&quot;   3 Minutes!/home/USER/alarm_96_icon.png&quot;:fbtn &quot;bash -c &#039;TIME=3 &amp; /home/USER/bin/newtimerwindow &amp;  sleep 3m ; aplay /home/USER/alarm-1000.wav&#039;&quot; \</code></pre></div><p>In the receiving script I use $TIME , but it throws everything off, and nothing opens or happens. Like this:</p><div class="codebox"><pre><code>cat bin/countdowntimer
#!/bin/bash

hour=0
## min=&quot;$1&quot;
min=&quot;$TIME&quot; 
sec=0
        while [ $hour -ge 0 ]; do
                 while [ $min -ge 0 ]; do
                         while [ $sec -ge 0 ]; do
                                 echo -ne &quot;$hour:$min:$sec\033[0K\r&quot;
                                 let &quot;sec=sec-1&quot;
                                 sleep 1
                         done
                         sec=59
                         let &quot;min=min-1&quot;
                 done
                 min=59
                 let &quot;hour=hour-1&quot;
         done</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (swanson)]]></author>
			<pubDate>Mon, 05 Feb 2024 10:53:28 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=47888#p47888</guid>
		</item>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=47711#p47711</link>
			<description><![CDATA[<p><img src="https://dev1galaxy.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[dummy@example.com (The-Amnesiac-Philosopher)]]></author>
			<pubDate>Sat, 27 Jan 2024 14:18:50 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=47711#p47711</guid>
		</item>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=47708#p47708</link>
			<description><![CDATA[<p>Nice script!!! Thank You!</p><p>If you want a different theme/look you can add this at the top of the script:</p><p>export GTK_THEME=&quot;Clearlooks-Phenix-Sapphire&quot;</p><p>Of course, chosen theme is up to taste. Or no taste. <img src="https://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (swanson)]]></author>
			<pubDate>Sat, 27 Jan 2024 12:45:32 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=47708#p47708</guid>
		</item>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=47706#p47706</link>
			<description><![CDATA[<div class="quotebox"><cite>golinux wrote:</cite><blockquote><div><p>Memory is just detritus that clogs the mind</p></div></blockquote></div><p>detritus </p><p>If I were to use that word, I&#039;d pillage and plunder it and make it <em>detritusimus</em>&#160; <img src="https://dev1galaxy.org/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" />&#160; <img src="https://dev1galaxy.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></description>
			<author><![CDATA[dummy@example.com (The-Amnesiac-Philosopher)]]></author>
			<pubDate>Sat, 27 Jan 2024 11:29:16 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=47706#p47706</guid>
		</item>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=47691#p47691</link>
			<description><![CDATA[<p>Memory is just detritus that clogs the mind . . . there is only the present moment . . . <img src="https://dev1galaxy.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[dummy@example.com (golinux)]]></author>
			<pubDate>Sat, 27 Jan 2024 04:03:58 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=47691#p47691</guid>
		</item>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=47685#p47685</link>
			<description><![CDATA[<p>Thanks, but I won&#039;t remember what I did tomorrow... <img src="https://dev1galaxy.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></description>
			<author><![CDATA[dummy@example.com (The-Amnesiac-Philosopher)]]></author>
			<pubDate>Sat, 27 Jan 2024 02:37:13 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=47685#p47685</guid>
		</item>
		<item>
			<title><![CDATA[Re: Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=47684#p47684</link>
			<description><![CDATA[<p>You are too clever!</p>]]></description>
			<author><![CDATA[dummy@example.com (golinux)]]></author>
			<pubDate>Sat, 27 Jan 2024 01:46:13 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=47684#p47684</guid>
		</item>
		<item>
			<title><![CDATA[Simple Countdown Timer]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=47682#p47682</link>
			<description><![CDATA[<p><strong><em>If you&#039;re interested in this...</em></strong></p><p>...as the title says, it&#039;s a simple countdown timer that I made for myself and my work. You can adjust the times in the code for your own needs. They&#039;re pretty self-explanatory. <img src="https://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>After choosing a timer, you can close the window.</p><p><strong>Dependencies: bash yad papirus-icon-theme</strong></p><p><em>If you don&#039;t have papirus-icons, the icons may not show up on the GUI due to how they are named. You can change it in the code if needed. Just replace <span style="color: red"><strong>clock-applet-symbolic</strong></span> with your chosen icon&#039;s name in the code.</em></p><p>This is what the GUI looks like (on my systems). Click on a timer and close the window. The timer will still count down and sound off when it&#039;s finished despite closing the window. <img src="https://dev1galaxy.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p><span class="postimg"><img src="https://i.ibb.co/ZHyYN1Y/2024-01-26-171128-278x360-scrot.png" alt="2024-01-26-171128-278x360-scrot.png" /></span></p><p>If using alsa-only (<span class="bbc">aplay</span>...as shown in the code below), you must use a <span class="bbc">.wav</span> sound file. If using pulseaudio, you can use just about any type of sound file. </p><p>If you&#039;re using pulseaudio, replace <span class="bbc">aplay</span> with <span class="bbc">paplay</span> (adjust the code to your needs). I know nothing about pipewire, so I&#039;m not sure what would be needed for that. <img src="https://dev1galaxy.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p><p>I didn&#039;t make a desktop.file for it; I just have the script in my file manager and execute it when needed. Sorry.</p><p>In the code below, you will also need to replace the path to the sound file that you want to use for the alarm. </p><p><strong>Warning!!!</strong> Whatever sound file you choose, it will play the entire sound file. So, you might want to choose a file that&#039;s only a few seconds long. <img src="https://dev1galaxy.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /> <img src="https://dev1galaxy.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>The code...</p><div class="codebox"><pre><code>#!/usr/bin/env bash

yad --form --columns=1 --width=260 --borders=5 --title=&quot;Timer&quot; --no-buttons --height=250 --width=270 --window-icon=&quot;/usr/share/icons/Papirus-Light/24x24/panel/alarm-clock-panel.svg&quot; --center --text-align=center --text=&quot;
Choose a countdown timer.
&quot; \
--field=&quot;  1 Minute!clock-applet-symbolic&quot;:fbtn &quot;bash -c &#039;sleep 1m ; aplay /home/tap/Music/acdc.wav&#039;&quot; \
--field=&quot;  3 Minutes!clock-applet-symbolic&quot;:fbtn &quot;bash -c &#039;sleep 3m ; aplay /home/tap/Music/acdc.wav&#039;&quot; \
--field=&quot;  15 Minutes!clock-applet-symbolic&quot;:fbtn &quot;bash -c &#039;sleep 15m ; aplay /home/tap/Music/acdc.wav&#039;&quot; \
--field=&quot;  30 Minutes!clock-applet-symbolic&quot;:fbtn &quot;bash -c &#039;sleep 30m ; aplay /home/tap/Music/acdc.wav&#039;&quot; \
--field=&quot;  45 Minutes!clock-applet-symbolic&quot;:fbtn &quot;bash -c &#039;sleep 45m ; aplay /home/tap/Music/acdc.wav&#039;&quot; \
--field=&quot;  60 Minutes!clock-applet-symbolic&quot;:fbtn &quot;bash -c &#039;sleep 60m ; aplay /home/tap/Music/acdc.wav&#039;&quot; \</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (The-Amnesiac-Philosopher)]]></author>
			<pubDate>Fri, 26 Jan 2024 23:06:56 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=47682#p47682</guid>
		</item>
	</channel>
</rss>
