DaemonForums  

Go Back   DaemonForums > Miscellaneous > General software and network

General software and network General OS-independent software and network questions, X11, MTA, routing, etc.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 7th June 2008
aleunix aleunix is offline
Real Name: Alessandro
Spam Deminer
 
Join Date: May 2008
Location: Italy
Posts: 224
Default How launch script or command from icewm?

How launch script or command from icewm?
I would launch a script or use a plain command line to take a screenshot but i haven't find a way on icewm.

$HOME/username/.icewm/keys
key "Print" xterm -e xwd | convert - screenshot.png

I have press the Print key but don't run.

I have also tried:
$HOME/username/.icewm/menu
prog Screenshot xwd xwd

But without result.
Reply With Quote
  #2   (View Single Post)  
Old 7th June 2008
lvlamb's Avatar
lvlamb lvlamb is offline
Real Name: Louis V. Lambrecht
Spam Deminer
 
Join Date: May 2008
Location: .be
Posts: 221
Default

In ~/.icewm/menu
prog Screenshot any_icon.png xwd -out screenshot.xwd
should do it.
Then. open the ~/screenshot.xwd in ImageMagick (display).

Dunnoh if you can pipe commands under ~/.icewm/keys or ~/.icewm/menu
but should be able to call a wrapper.
__________________
da more I know I know I know nuttin'
Reply With Quote
  #3   (View Single Post)  
Old 7th June 2008
aleunix aleunix is offline
Real Name: Alessandro
Spam Deminer
 
Join Date: May 2008
Location: Italy
Posts: 224
Default

Thanks it's work.

Also i have tried the pipe command but don't work.

Would be possible to specify the name after the capture of screen instead of using a name fixed?

This is to avoid trying to overwrite different screenshot and also to assign a meaningful name to the captured image.
Reply With Quote
  #4   (View Single Post)  
Old 8th June 2008
Meta_Ridley Meta_Ridley is offline
OFM Addict
 
Join Date: May 2008
Posts: 21
Default

You can use a named pipe (also known as a FIFO) to do this. First you create the named pipe with mkfifo pipe_name. Then send the output of the screen-capturing program to it. The safest way is to use stdout, which generally involves specifying "-" as the output file and using ">" to redirect the output to the pipe, like this,to use lvlamb's example:

prog Screenshot any_icon.png xwd -out - > pipe_name

Note that prog will freeze at this point ("blocked" in Unix parlance) until you "connect" the other end of the pipe. That part's easy:

cat pipe_name > your_screenshot.xwd.

Replace "your_screenshot" with the name you want to save it as. Once you use the cat command prog will continue. The result should be a screenshot with the name you want. It's sort of a hackish way of doing it, but it works.

If you're lucky then prog will know what to do with a named pipe, in which case the command you put in IceWM's menu will look like this:

prog ScreenShot any_icon.png xwd -out pipe_name

The cat command remains the same.

Last edited by Meta_Ridley; 8th June 2008 at 08:16 AM.
Reply With Quote
  #5   (View Single Post)  
Old 8th June 2008
aleunix aleunix is offline
Real Name: Alessandro
Spam Deminer
 
Join Date: May 2008
Location: Italy
Posts: 224
Default

Thanks.

Would be possible have a workaround to do everything in one step?
Reply With Quote
  #6   (View Single Post)  
Old 8th June 2008
Meta_Ridley Meta_Ridley is offline
OFM Addict
 
Join Date: May 2008
Posts: 21
Default

To my knowledge, not if you want to give every screenshot a unique name, unless you want to use a dialog box to name the file beforehand. Otherwise giving a unique name and doing it in one step from the window manager alone are mutually-exclusive.

Of course, if anyone else knows better feel free to correct me.
Reply With Quote
  #7   (View Single Post)  
Old 8th June 2008
aleunix aleunix is offline
Real Name: Alessandro
Spam Deminer
 
Join Date: May 2008
Location: Italy
Posts: 224
Default

Quote:
Originally Posted by Meta_Ridley View Post
.... unless you want to use a dialog box to name the file beforehand.
Would it be possible?

Everything should work from menu icem and scripts does not seem to be supported.
Reply With Quote
  #8   (View Single Post)  
Old 8th June 2008
lvlamb's Avatar
lvlamb lvlamb is offline
Real Name: Louis V. Lambrecht
Spam Deminer
 
Join Date: May 2008
Location: .be
Posts: 221
Default

make a directory ~/snapshots

you could write a one-liner wrapper as
Code:
xwd | convert - ~/snapshots/$(date -j +%Y%m%d%H%M%s).png
save this line as a file under your ~/bin directory (might need to create a ~/bin , ~/bin is in the search PATH) under any name as, "snapshot"
make this executable
chmod +x snapshot

then, just put the line in your ~/.icewm/menu file as
exec an_icon.png snapshot

date -j is OpenBSD specific (parse date without changing the clock), read man date for other OSes
__________________
da more I know I know I know nuttin'
Reply With Quote
  #9   (View Single Post)  
Old 8th June 2008
aleunix aleunix is offline
Real Name: Alessandro
Spam Deminer
 
Join Date: May 2008
Location: Italy
Posts: 224
Default

When i tried to use exec on menu the voice disappear.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
matts: a shell script to mail attachments from the command line J65nko Guides 7 3rd August 2022 03:13 AM
"free" command/perl script for freebsd unixdude FreeBSD General 0 17th November 2008 09:23 PM
firefox segfault in windowmaker and icewm davidgurvich FreeBSD General 4 25th August 2008 02:58 PM
my 1st sh script graudeejs Programming 12 18th August 2008 10:25 PM
Shell Script. bsdnewbie999 Programming 21 15th July 2008 07:54 AM


All times are GMT. The time now is 04:09 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick