Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 20 Sep 2014, 10:10
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Terminal command with button
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
ip71sr

Joined: 04 Jan 2012
Posts: 23

PostPosted: Fri 10 May 2013, 03:29    Post subject:  Terminal command with button  

How to run a terminal command with a button?

I want to run the command for suspend (acpitool -s) with a button.
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Fri 10 May 2013, 08:18    Post subject:  

By "button" do you mean a keyboard key, a button in a GUI or what?
Back to top
View user's profile Send private message 
ip71sr

Joined: 04 Jan 2012
Posts: 23

PostPosted: Fri 10 May 2013, 11:12    Post subject:  

This is great! Smile Well, in the meanwhile I discovered that you can short this task with "Gexec execute a command" when you push the button Smile Menu > Utility. How to do this operation shorter with an icon shortcut on the desk (or shortcut key)?
Back to top
View user's profile Send private message 
GustavoYz


Joined: 07 Jul 2010
Posts: 896
Location: .ar

PostPosted: Fri 10 May 2013, 12:18    Post subject:  

If you're using OpenBox there are plenty of tutorials that explain how to bind an action to a combination of keys (or just one).
"Action" can easily be your script.
This is an example.

You can create a custom script.desktop file to make a desktop icon and lauch the script by double click.
I know there are apps for doing those files and creating your own, but you can just copy & edit one from /usr/share/applications.

_________________

Back to top
View user's profile Send private message 
ip71sr

Joined: 04 Jan 2012
Posts: 23

PostPosted: Fri 10 May 2013, 16:20    Post subject:  

GustavoYz wrote:
If you're using OpenBox there are plenty of tutorials that explain how to bind an action to a combination of keys (or just one).
"Action" can easily be your script.
This is an example.

OpenBox is another window manager? I guess you have suggested that because in this default lightweight one it is not easy to make an shortcut for a command in the terminal.
Quote:
You can create a custom script.desktop file to make a desktop icon and lauch the script by double click.
I know there are apps for doing those files and creating your own, but you can just copy & edit one from /usr/share/applications.

Can you describe this a little bit more? I opened one as txt but I do not know what and how to change it.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Fri 10 May 2013, 18:27    Post subject:  

Code:
[Desktop Entry]
Encoding=UTF-8
Name=SHUTDOWN into RAM Sleep
Icon=wizard16.xpm
Comment=ACPI G1 S3
Exec=acpitool -s
Terminal=false
Type=Application
Categories=X-DesktopApplets
GenericName=acpitool -s

and after that run
fixmenus
jwm -reload || jwm -restart

_________________
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal Razz
Back to top
View user's profile Send private message Visit poster's website 
ip71sr

Joined: 04 Jan 2012
Posts: 23

PostPosted: Sat 11 May 2013, 05:19    Post subject:  

It works well, thank you.
I believe the next logical step would be how this task can be activated after a period of inactivity of the computer? Smile
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Sat 11 May 2013, 07:06    Post subject:  

Then look into the
/sbin/pup_event_frontend_d
file .
Somewhere near the end there should be some line like
Code:
[ $MOUSECNT -gt $POWERTIMEOUT ] && wmpoweroff &

change that wmpoweroff & to whatever code you want ie acpitool -s &

Of course you need to putin the POWERTIMEOUT into the /etc/eventmanager file ie :
Quote:
#this parameter is read by /sbin/pup_event_frontend_d...
#power-off PC if mouse inactive for this many minutes (0 means never)...
POWERTIMEOUT=60

Note : am not sure if the pup_event_frontend_d keeps running after wake up .

To check it run
Code:
pidof pup_event_frontend_d

in the console.

Note > Needs restartwm aka restart X server after making these changes to relaunch the pup_event_frontend_d .
Back to top
View user's profile Send private message Visit poster's website 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11068
Location: Arizona USA

PostPosted: Sat 11 May 2013, 08:33    Post subject:  

Could this script be modified to do what you want?
Back to top
View user's profile Send private message 
ip71sr

Joined: 04 Jan 2012
Posts: 23

PostPosted: Sat 11 May 2013, 09:52    Post subject:  

It looks very nice. Than you!

@Karl Godt
"POWERTIMEOUT" can also be directly set in Puppy Event Manager but in this way it doesn't work.
Don't matter, the last script looks fine. (It was always boring with sleep during e.g. video in another distribution).
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0598s ][ Queries: 11 (0.0035s) ][ GZIP on ]