Useful Things You Can Do with FVWM
Suppose we want a simple way of saving a screenshot of the current window, so that when we select the correct option from a menu, a screenshot is saved to the file /tmp/screenshot. We can achieve this by adding the following line to the end of the AddToMenu command listed above:
+ "Take screenshot" Exec xwd -id $w -out /tmp/screenshot
Let's examine how this works. As already explained, the first two elements of the line are a plus sign and a label. Then comes the FVWM command, which in this case is:
Exec xwd -id $w -out /tmp/screenshot
The command name is Exec, which allows one to execute an external command. Its arguments are the external command, followed by the external command's arguments. In this case, the external command is xwd, and the arguments passed to it by FVWM are -id $w -out /tmp/screenshot.
The notation $w in these arguments needs some explanation. It's a special FVWM variable that stands for the window ID of the current window. When FVWM runs the above xwd command, it replaces the argument $w with the relevant window ID.
What is a window ID? The X Window System needs a way of identifying and referring to windows. It does so by assigning each window a unique number, known as the window ID.
For our purposes, you don't need to understand xwd's other arguments just yet. For now, all you need to know is that the command given above causes xwd to put a screenshot of the current window in the file /tmp/screenshot.
At this point, you may be asking, FVWM has many menus; how do I identify the one I need to modify? The answer is the correct one probably is the one called Window-Ops2, but it all depends on whoever packaged and configured FVWM for you. The best way to find the correct menu is to search your FVWM config file for a menu that uses all or most of the following functions: Move, Resize, Raise, Lower, Iconify, Close. If you find such a menu, it's almost certainly the right one.
We've completed the preliminaries and now are ready to start looking at the promised solution. It involves a program I call savescreenshot. To have FVWM run it to take a screenshot, we add the following line to the appropriate AddToMenu command:
+ "Take screens&hot" Exec savescreenshot $w + "Take &named screenshot" Exec savescreenshot -n $w
You need to make sure savescreenshot can be found by searching the PATH that was defined when FVWM was invoked. If it can't, you can use an absolute pathname for savescreenshot. Also, notice that the above labels make H and N into hotkeys.
To actually take the screenshot, savescreenshot relies on xwd. Although several screenshot utilities exist, I chose xwd because it comes packaged with X. xwd's basic usage is as follows:
xwd [-id window_ID] [-out output_file]
where window_ID and output_file should be replaced by the actual names of the window ID and output file, respectively.
The -out option, as the summary above suggests, directs xwd's output to the specified output file; if you don't supply it, xwd writes to its standard output. The -id option tells xwd to use the window with the specified window ID. If you don't supply it, xwd changes the mouse pointer's shape to indicate that it wants you to click in a window to select it. When you've done so, it takes a screenshot of that window.
xwd uses its own special image format. This format doesn't use compression, so output files often are quite large. You usually want to convert the output file to a format such as PNG; I'll cover this in a minute.
To view xwd's output files, you can use xwud, which also comes packaged with X. You can specify an input file with the -in option. The command xwud -in browser-window would display the screenshot stored in the file browser-window.
To convert files in xwd format, you can use convert from the ImageMagick suite. The following commands convert an image to various common formats and should be self-explanatory:
convert browser-window browser-window.png convert browser-window browser-window.jpg
If you want to use the netpbm tools, the following two commands correspond to the two commands above:
xwdtopnm < browser-window | pnmtopng > browser-window.png xwdtopnm < browser-window | pnmtojpeg > browser-window.jpg
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- Stunnel Security for Oracle
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Managing Linux Using Puppet
- My +1 Sword of Productivity
- SUSE LLC's SUSE Manager
- Parsing an RSS News Feed with a Bash Script
- Doing for User Space What We Did for Kernel Space
- SuperTuxKart 0.9.2 Released
- Google's SwiftShader Released
- SourceClear Open
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide