├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── aclocal.m4 ├── configure ├── configure.in ├── depcomp ├── install-sh ├── main.c ├── missing ├── mkinstalldirs └── wmctrl.1 /AUTHORS: -------------------------------------------------------------------------------- 1 | Tomas Styblo 2 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/software-revive/wmctrl-rv/c5c5eb8ba66526dbceb8755155ecfcc540f7fe29/ChangeLog -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software 2 | Foundation, Inc. 3 | 4 | This file is free documentation; the Free Software Foundation gives 5 | unlimited permission to copy, distribute and modify it. 6 | 7 | Basic Installation 8 | ================== 9 | 10 | These are generic installation instructions. 11 | 12 | The `configure' shell script attempts to guess correct values for 13 | various system-dependent variables used during compilation. It uses 14 | those values to create a `Makefile' in each directory of the package. 15 | It may also create one or more `.h' files containing system-dependent 16 | definitions. Finally, it creates a shell script `config.status' that 17 | you can run in the future to recreate the current configuration, and a 18 | file `config.log' containing compiler output (useful mainly for 19 | debugging `configure'). 20 | 21 | It can also use an optional file (typically called `config.cache' 22 | and enabled with `--cache-file=config.cache' or simply `-C') that saves 23 | the results of its tests to speed up reconfiguring. (Caching is 24 | disabled by default to prevent problems with accidental use of stale 25 | cache files.) 26 | 27 | If you need to do unusual things to compile the package, please try 28 | to figure out how `configure' could check whether to do them, and mail 29 | diffs or instructions to the address given in the `README' so they can 30 | be considered for the next release. If you are using the cache, and at 31 | some point `config.cache' contains results you don't want to keep, you 32 | may remove or edit it. 33 | 34 | The file `configure.ac' (or `configure.in') is used to create 35 | `configure' by a program called `autoconf'. You only need 36 | `configure.ac' if you want to change it or regenerate `configure' using 37 | a newer version of `autoconf'. 38 | 39 | The simplest way to compile this package is: 40 | 41 | 1. `cd' to the directory containing the package's source code and type 42 | `./configure' to configure the package for your system. If you're 43 | using `csh' on an old version of System V, you might need to type 44 | `sh ./configure' instead to prevent `csh' from trying to execute 45 | `configure' itself. 46 | 47 | Running `configure' takes awhile. While running, it prints some 48 | messages telling which features it is checking for. 49 | 50 | 2. Type `make' to compile the package. 51 | 52 | 3. Optionally, type `make check' to run any self-tests that come with 53 | the package. 54 | 55 | 4. Type `make install' to install the programs and any data files and 56 | documentation. 57 | 58 | 5. You can remove the program binaries and object files from the 59 | source code directory by typing `make clean'. To also remove the 60 | files that `configure' created (so you can compile the package for 61 | a different kind of computer), type `make distclean'. There is 62 | also a `make maintainer-clean' target, but that is intended mainly 63 | for the package's developers. If you use it, you may have to get 64 | all sorts of other programs in order to regenerate files that came 65 | with the distribution. 66 | 67 | Compilers and Options 68 | ===================== 69 | 70 | Some systems require unusual options for compilation or linking that 71 | the `configure' script does not know about. Run `./configure --help' 72 | for details on some of the pertinent environment variables. 73 | 74 | You can give `configure' initial values for configuration parameters 75 | by setting variables in the command line or in the environment. Here 76 | is an example: 77 | 78 | ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix 79 | 80 | *Note Defining Variables::, for more details. 81 | 82 | Compiling For Multiple Architectures 83 | ==================================== 84 | 85 | You can compile the package for more than one kind of computer at the 86 | same time, by placing the object files for each architecture in their 87 | own directory. To do this, you must use a version of `make' that 88 | supports the `VPATH' variable, such as GNU `make'. `cd' to the 89 | directory where you want the object files and executables to go and run 90 | the `configure' script. `configure' automatically checks for the 91 | source code in the directory that `configure' is in and in `..'. 92 | 93 | If you have to use a `make' that does not support the `VPATH' 94 | variable, you have to compile the package for one architecture at a 95 | time in the source code directory. After you have installed the 96 | package for one architecture, use `make distclean' before reconfiguring 97 | for another architecture. 98 | 99 | Installation Names 100 | ================== 101 | 102 | By default, `make install' will install the package's files in 103 | `/usr/local/bin', `/usr/local/man', etc. You can specify an 104 | installation prefix other than `/usr/local' by giving `configure' the 105 | option `--prefix=PATH'. 106 | 107 | You can specify separate installation prefixes for 108 | architecture-specific files and architecture-independent files. If you 109 | give `configure' the option `--exec-prefix=PATH', the package will use 110 | PATH as the prefix for installing programs and libraries. 111 | Documentation and other data files will still use the regular prefix. 112 | 113 | In addition, if you use an unusual directory layout you can give 114 | options like `--bindir=PATH' to specify different values for particular 115 | kinds of files. Run `configure --help' for a list of the directories 116 | you can set and what kinds of files go in them. 117 | 118 | If the package supports it, you can cause programs to be installed 119 | with an extra prefix or suffix on their names by giving `configure' the 120 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 121 | 122 | Optional Features 123 | ================= 124 | 125 | Some packages pay attention to `--enable-FEATURE' options to 126 | `configure', where FEATURE indicates an optional part of the package. 127 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 128 | is something like `gnu-as' or `x' (for the X Window System). The 129 | `README' should mention any `--enable-' and `--with-' options that the 130 | package recognizes. 131 | 132 | For packages that use the X Window System, `configure' can usually 133 | find the X include and library files automatically, but if it doesn't, 134 | you can use the `configure' options `--x-includes=DIR' and 135 | `--x-libraries=DIR' to specify their locations. 136 | 137 | Specifying the System Type 138 | ========================== 139 | 140 | There may be some features `configure' cannot figure out 141 | automatically, but needs to determine by the type of machine the package 142 | will run on. Usually, assuming the package is built to be run on the 143 | _same_ architectures, `configure' can figure that out, but if it prints 144 | a message saying it cannot guess the machine type, give it the 145 | `--build=TYPE' option. TYPE can either be a short name for the system 146 | type, such as `sun4', or a canonical name which has the form: 147 | 148 | CPU-COMPANY-SYSTEM 149 | 150 | where SYSTEM can have one of these forms: 151 | 152 | OS KERNEL-OS 153 | 154 | See the file `config.sub' for the possible values of each field. If 155 | `config.sub' isn't included in this package, then this package doesn't 156 | need to know the machine type. 157 | 158 | If you are _building_ compiler tools for cross-compiling, you should 159 | use the `--target=TYPE' option to select the type of system they will 160 | produce code for. 161 | 162 | If you want to _use_ a cross compiler, that generates code for a 163 | platform different from the build platform, you should specify the 164 | "host" platform (i.e., that on which the generated programs will 165 | eventually be run) with `--host=TYPE'. 166 | 167 | Sharing Defaults 168 | ================ 169 | 170 | If you want to set default values for `configure' scripts to share, 171 | you can create a site shell script called `config.site' that gives 172 | default values for variables like `CC', `cache_file', and `prefix'. 173 | `configure' looks for `PREFIX/share/config.site' if it exists, then 174 | `PREFIX/etc/config.site' if it exists. Or, you can set the 175 | `CONFIG_SITE' environment variable to the location of the site script. 176 | A warning: not all `configure' scripts look for a site script. 177 | 178 | Defining Variables 179 | ================== 180 | 181 | Variables not defined in a site shell script can be set in the 182 | environment passed to `configure'. However, some packages may run 183 | configure again during the build, and the customized values of these 184 | variables may be lost. In order to avoid this problem, you should set 185 | them in the `configure' command line, using `VAR=value'. For example: 186 | 187 | ./configure CC=/usr/local2/bin/gcc 188 | 189 | will cause the specified gcc to be used as the C compiler (unless it is 190 | overridden in the site shell script). 191 | 192 | `configure' Invocation 193 | ====================== 194 | 195 | `configure' recognizes the following options to control how it 196 | operates. 197 | 198 | `--help' 199 | `-h' 200 | Print a summary of the options to `configure', and exit. 201 | 202 | `--version' 203 | `-V' 204 | Print the version of Autoconf used to generate the `configure' 205 | script, and exit. 206 | 207 | `--cache-file=FILE' 208 | Enable the cache: use and save the results of the tests in FILE, 209 | traditionally `config.cache'. FILE defaults to `/dev/null' to 210 | disable caching. 211 | 212 | `--config-cache' 213 | `-C' 214 | Alias for `--cache-file=config.cache'. 215 | 216 | `--quiet' 217 | `--silent' 218 | `-q' 219 | Do not print messages saying which checks are being made. To 220 | suppress all normal output, redirect it to `/dev/null' (any error 221 | messages will still be shown). 222 | 223 | `--srcdir=DIR' 224 | Look for the package's source code in directory DIR. Usually 225 | `configure' can determine that directory automatically. 226 | 227 | `configure' also accepts some other, not widely useful, options. Run 228 | `configure --help' for more details. 229 | 230 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | AM_CFLAGS = -Wall 3 | AM_CPPFLAGS = @X_CFLAGS@ @GLIB_CFLAGS@ 4 | LDADD = @X_LIBS@ @X_PRE_LIBS@ -lX11 -lXmu @X_EXTRA_LIBS@ @GLIB_LIBS@ 5 | 6 | bin_PROGRAMS = wmctrl 7 | wmctrl_SOURCES = main.c 8 | man_MANS = wmctrl.1 9 | EXTRA_DIST = $(man_MANS) 10 | -------------------------------------------------------------------------------- /Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.7.6 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 5 | # Free Software Foundation, Inc. 6 | # This Makefile.in is free software; the Free Software Foundation 7 | # gives unlimited permission to copy and/or distribute it, 8 | # with or without modifications, as long as this notice is preserved. 9 | 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 | # PARTICULAR PURPOSE. 14 | 15 | @SET_MAKE@ 16 | 17 | srcdir = @srcdir@ 18 | top_srcdir = @top_srcdir@ 19 | VPATH = @srcdir@ 20 | pkgdatadir = $(datadir)/@PACKAGE@ 21 | pkglibdir = $(libdir)/@PACKAGE@ 22 | pkgincludedir = $(includedir)/@PACKAGE@ 23 | top_builddir = . 24 | 25 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 26 | INSTALL = @INSTALL@ 27 | install_sh_DATA = $(install_sh) -c -m 644 28 | install_sh_PROGRAM = $(install_sh) -c 29 | install_sh_SCRIPT = $(install_sh) -c 30 | INSTALL_HEADER = $(INSTALL_DATA) 31 | transform = $(program_transform_name) 32 | NORMAL_INSTALL = : 33 | PRE_INSTALL = : 34 | POST_INSTALL = : 35 | NORMAL_UNINSTALL = : 36 | PRE_UNINSTALL = : 37 | POST_UNINSTALL = : 38 | ACLOCAL = @ACLOCAL@ 39 | AMDEP_FALSE = @AMDEP_FALSE@ 40 | AMDEP_TRUE = @AMDEP_TRUE@ 41 | AMTAR = @AMTAR@ 42 | AUTOCONF = @AUTOCONF@ 43 | AUTOHEADER = @AUTOHEADER@ 44 | AUTOMAKE = @AUTOMAKE@ 45 | AWK = @AWK@ 46 | CC = @CC@ 47 | CCDEPMODE = @CCDEPMODE@ 48 | CFLAGS = @CFLAGS@ 49 | CPP = @CPP@ 50 | CPPFLAGS = @CPPFLAGS@ 51 | CYGPATH_W = @CYGPATH_W@ 52 | DEFS = @DEFS@ 53 | DEPDIR = @DEPDIR@ 54 | ECHO_C = @ECHO_C@ 55 | ECHO_N = @ECHO_N@ 56 | ECHO_T = @ECHO_T@ 57 | EXEEXT = @EXEEXT@ 58 | GLIB_CFLAGS = @GLIB_CFLAGS@ 59 | GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ 60 | GLIB_LIBS = @GLIB_LIBS@ 61 | GLIB_MKENUMS = @GLIB_MKENUMS@ 62 | GOBJECT_QUERY = @GOBJECT_QUERY@ 63 | INSTALL_DATA = @INSTALL_DATA@ 64 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 65 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 66 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 67 | LDFLAGS = @LDFLAGS@ 68 | LIBOBJS = @LIBOBJS@ 69 | LIBS = @LIBS@ 70 | LTLIBOBJS = @LTLIBOBJS@ 71 | MAKEINFO = @MAKEINFO@ 72 | OBJEXT = @OBJEXT@ 73 | PACKAGE = @PACKAGE@ 74 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 75 | PACKAGE_NAME = @PACKAGE_NAME@ 76 | PACKAGE_STRING = @PACKAGE_STRING@ 77 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 78 | PACKAGE_VERSION = @PACKAGE_VERSION@ 79 | PATH_SEPARATOR = @PATH_SEPARATOR@ 80 | PKG_CONFIG = @PKG_CONFIG@ 81 | SET_MAKE = @SET_MAKE@ 82 | SHELL = @SHELL@ 83 | STRIP = @STRIP@ 84 | VERSION = @VERSION@ 85 | X_CFLAGS = @X_CFLAGS@ 86 | X_EXTRA_LIBS = @X_EXTRA_LIBS@ 87 | X_LIBS = @X_LIBS@ 88 | X_PRE_LIBS = @X_PRE_LIBS@ 89 | ac_ct_CC = @ac_ct_CC@ 90 | ac_ct_STRIP = @ac_ct_STRIP@ 91 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ 92 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ 93 | am__include = @am__include@ 94 | am__leading_dot = @am__leading_dot@ 95 | am__quote = @am__quote@ 96 | bindir = @bindir@ 97 | build_alias = @build_alias@ 98 | datadir = @datadir@ 99 | exec_prefix = @exec_prefix@ 100 | host_alias = @host_alias@ 101 | includedir = @includedir@ 102 | infodir = @infodir@ 103 | install_sh = @install_sh@ 104 | libdir = @libdir@ 105 | libexecdir = @libexecdir@ 106 | localstatedir = @localstatedir@ 107 | mandir = @mandir@ 108 | oldincludedir = @oldincludedir@ 109 | prefix = @prefix@ 110 | program_transform_name = @program_transform_name@ 111 | sbindir = @sbindir@ 112 | sharedstatedir = @sharedstatedir@ 113 | sysconfdir = @sysconfdir@ 114 | target_alias = @target_alias@ 115 | 116 | AM_CFLAGS = -Wall 117 | AM_CPPFLAGS = @X_CFLAGS@ @GLIB_CFLAGS@ 118 | LDADD = @X_LIBS@ @X_PRE_LIBS@ -lX11 -lXmu @X_EXTRA_LIBS@ @GLIB_LIBS@ 119 | 120 | bin_PROGRAMS = wmctrl 121 | wmctrl_SOURCES = main.c 122 | man_MANS = wmctrl.1 123 | EXTRA_DIST = $(man_MANS) 124 | subdir = . 125 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 126 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 127 | CONFIG_CLEAN_FILES = 128 | bin_PROGRAMS = wmctrl$(EXEEXT) 129 | PROGRAMS = $(bin_PROGRAMS) 130 | 131 | am_wmctrl_OBJECTS = main.$(OBJEXT) 132 | wmctrl_OBJECTS = $(am_wmctrl_OBJECTS) 133 | wmctrl_LDADD = $(LDADD) 134 | wmctrl_DEPENDENCIES = 135 | wmctrl_LDFLAGS = 136 | 137 | DEFAULT_INCLUDES = -I. -I$(srcdir) 138 | depcomp = $(SHELL) $(top_srcdir)/depcomp 139 | am__depfiles_maybe = depfiles 140 | @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/main.Po 141 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 142 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 143 | CCLD = $(CC) 144 | LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 145 | DIST_SOURCES = $(wmctrl_SOURCES) 146 | 147 | NROFF = nroff 148 | MANS = $(man_MANS) 149 | DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ 150 | Makefile.in NEWS aclocal.m4 configure configure.in depcomp \ 151 | install-sh missing mkinstalldirs 152 | SOURCES = $(wmctrl_SOURCES) 153 | 154 | all: all-am 155 | 156 | .SUFFIXES: 157 | .SUFFIXES: .c .o .obj 158 | 159 | am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ 160 | configure.lineno 161 | $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 162 | cd $(top_srcdir) && \ 163 | $(AUTOMAKE) --gnu Makefile 164 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 165 | cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) 166 | 167 | $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 168 | $(SHELL) ./config.status --recheck 169 | $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) 170 | cd $(srcdir) && $(AUTOCONF) 171 | 172 | $(ACLOCAL_M4): configure.in 173 | cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) 174 | binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 175 | install-binPROGRAMS: $(bin_PROGRAMS) 176 | @$(NORMAL_INSTALL) 177 | $(mkinstalldirs) $(DESTDIR)$(bindir) 178 | @list='$(bin_PROGRAMS)'; for p in $$list; do \ 179 | p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ 180 | if test -f $$p \ 181 | ; then \ 182 | f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ 183 | echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ 184 | $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ 185 | else :; fi; \ 186 | done 187 | 188 | uninstall-binPROGRAMS: 189 | @$(NORMAL_UNINSTALL) 190 | @list='$(bin_PROGRAMS)'; for p in $$list; do \ 191 | f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 192 | echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ 193 | rm -f $(DESTDIR)$(bindir)/$$f; \ 194 | done 195 | 196 | clean-binPROGRAMS: 197 | -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) 198 | wmctrl$(EXEEXT): $(wmctrl_OBJECTS) $(wmctrl_DEPENDENCIES) 199 | @rm -f wmctrl$(EXEEXT) 200 | $(LINK) $(wmctrl_LDFLAGS) $(wmctrl_OBJECTS) $(wmctrl_LDADD) $(LIBS) 201 | 202 | mostlyclean-compile: 203 | -rm -f *.$(OBJEXT) core *.core 204 | 205 | distclean-compile: 206 | -rm -f *.tab.c 207 | 208 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ 209 | 210 | distclean-depend: 211 | -rm -rf ./$(DEPDIR) 212 | 213 | .c.o: 214 | @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ 215 | @am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ 216 | @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ 217 | @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ 218 | @am__fastdepCC_TRUE@ fi 219 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 220 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ 221 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 222 | @am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< 223 | 224 | .c.obj: 225 | @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ 226 | @am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ 227 | @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ 228 | @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ 229 | @am__fastdepCC_TRUE@ fi 230 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 231 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ 232 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 233 | @am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` 234 | uninstall-info-am: 235 | 236 | man1dir = $(mandir)/man1 237 | install-man1: $(man1_MANS) $(man_MANS) 238 | @$(NORMAL_INSTALL) 239 | $(mkinstalldirs) $(DESTDIR)$(man1dir) 240 | @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ 241 | l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ 242 | for i in $$l2; do \ 243 | case "$$i" in \ 244 | *.1*) list="$$list $$i" ;; \ 245 | esac; \ 246 | done; \ 247 | for i in $$list; do \ 248 | if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ 249 | else file=$$i; fi; \ 250 | ext=`echo $$i | sed -e 's/^.*\\.//'`; \ 251 | case "$$ext" in \ 252 | 1*) ;; \ 253 | *) ext='1' ;; \ 254 | esac; \ 255 | inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ 256 | inst=`echo $$inst | sed -e 's/^.*\///'`; \ 257 | inst=`echo $$inst | sed '$(transform)'`.$$ext; \ 258 | echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ 259 | $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ 260 | done 261 | uninstall-man1: 262 | @$(NORMAL_UNINSTALL) 263 | @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ 264 | l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ 265 | for i in $$l2; do \ 266 | case "$$i" in \ 267 | *.1*) list="$$list $$i" ;; \ 268 | esac; \ 269 | done; \ 270 | for i in $$list; do \ 271 | ext=`echo $$i | sed -e 's/^.*\\.//'`; \ 272 | case "$$ext" in \ 273 | 1*) ;; \ 274 | *) ext='1' ;; \ 275 | esac; \ 276 | inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ 277 | inst=`echo $$inst | sed -e 's/^.*\///'`; \ 278 | inst=`echo $$inst | sed '$(transform)'`.$$ext; \ 279 | echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ 280 | rm -f $(DESTDIR)$(man1dir)/$$inst; \ 281 | done 282 | 283 | ETAGS = etags 284 | ETAGSFLAGS = 285 | 286 | CTAGS = ctags 287 | CTAGSFLAGS = 288 | 289 | tags: TAGS 290 | 291 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 292 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 293 | unique=`for i in $$list; do \ 294 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 295 | done | \ 296 | $(AWK) ' { files[$$0] = 1; } \ 297 | END { for (i in files) print i; }'`; \ 298 | mkid -fID $$unique 299 | 300 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 301 | $(TAGS_FILES) $(LISP) 302 | tags=; \ 303 | here=`pwd`; \ 304 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 305 | unique=`for i in $$list; do \ 306 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 307 | done | \ 308 | $(AWK) ' { files[$$0] = 1; } \ 309 | END { for (i in files) print i; }'`; \ 310 | test -z "$(ETAGS_ARGS)$$tags$$unique" \ 311 | || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 312 | $$tags $$unique 313 | 314 | ctags: CTAGS 315 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 316 | $(TAGS_FILES) $(LISP) 317 | tags=; \ 318 | here=`pwd`; \ 319 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 320 | unique=`for i in $$list; do \ 321 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 322 | done | \ 323 | $(AWK) ' { files[$$0] = 1; } \ 324 | END { for (i in files) print i; }'`; \ 325 | test -z "$(CTAGS_ARGS)$$tags$$unique" \ 326 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 327 | $$tags $$unique 328 | 329 | GTAGS: 330 | here=`$(am__cd) $(top_builddir) && pwd` \ 331 | && cd $(top_srcdir) \ 332 | && gtags -i $(GTAGS_ARGS) $$here 333 | 334 | distclean-tags: 335 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 336 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 337 | 338 | top_distdir = . 339 | distdir = $(PACKAGE)-$(VERSION) 340 | 341 | am__remove_distdir = \ 342 | { test ! -d $(distdir) \ 343 | || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ 344 | && rm -fr $(distdir); }; } 345 | 346 | GZIP_ENV = --best 347 | distuninstallcheck_listfiles = find . -type f -print 348 | distcleancheck_listfiles = find . -type f -print 349 | 350 | distdir: $(DISTFILES) 351 | $(am__remove_distdir) 352 | mkdir $(distdir) 353 | @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ 354 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ 355 | list='$(DISTFILES)'; for file in $$list; do \ 356 | case $$file in \ 357 | $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ 358 | $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ 359 | esac; \ 360 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 361 | dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ 362 | if test "$$dir" != "$$file" && test "$$dir" != "."; then \ 363 | dir="/$$dir"; \ 364 | $(mkinstalldirs) "$(distdir)$$dir"; \ 365 | else \ 366 | dir=''; \ 367 | fi; \ 368 | if test -d $$d/$$file; then \ 369 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 370 | cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ 371 | fi; \ 372 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ 373 | else \ 374 | test -f $(distdir)/$$file \ 375 | || cp -p $$d/$$file $(distdir)/$$file \ 376 | || exit 1; \ 377 | fi; \ 378 | done 379 | -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ 380 | ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ 381 | ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ 382 | ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ 383 | || chmod -R a+r $(distdir) 384 | dist-gzip: distdir 385 | $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz 386 | $(am__remove_distdir) 387 | 388 | dist dist-all: distdir 389 | $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz 390 | $(am__remove_distdir) 391 | 392 | # This target untars the dist file and tries a VPATH configuration. Then 393 | # it guarantees that the distribution is self-contained by making another 394 | # tarfile. 395 | distcheck: dist 396 | $(am__remove_distdir) 397 | GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - 398 | chmod -R a-w $(distdir); chmod a+w $(distdir) 399 | mkdir $(distdir)/_build 400 | mkdir $(distdir)/_inst 401 | chmod a-w $(distdir) 402 | dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ 403 | && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ 404 | && cd $(distdir)/_build \ 405 | && ../configure --srcdir=.. --prefix="$$dc_install_base" \ 406 | $(DISTCHECK_CONFIGURE_FLAGS) \ 407 | && $(MAKE) $(AM_MAKEFLAGS) \ 408 | && $(MAKE) $(AM_MAKEFLAGS) dvi \ 409 | && $(MAKE) $(AM_MAKEFLAGS) check \ 410 | && $(MAKE) $(AM_MAKEFLAGS) install \ 411 | && $(MAKE) $(AM_MAKEFLAGS) installcheck \ 412 | && $(MAKE) $(AM_MAKEFLAGS) uninstall \ 413 | && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ 414 | distuninstallcheck \ 415 | && chmod -R a-w "$$dc_install_base" \ 416 | && ({ \ 417 | (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ 418 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ 419 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ 420 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ 421 | distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ 422 | } || { rm -rf "$$dc_destdir"; exit 1; }) \ 423 | && rm -rf "$$dc_destdir" \ 424 | && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ 425 | && rm -f $(distdir).tar.gz \ 426 | && $(MAKE) $(AM_MAKEFLAGS) distcleancheck 427 | $(am__remove_distdir) 428 | @echo "$(distdir).tar.gz is ready for distribution" | \ 429 | sed 'h;s/./=/g;p;x;p;x' 430 | distuninstallcheck: 431 | @cd $(distuninstallcheck_dir) \ 432 | && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ 433 | || { echo "ERROR: files left after uninstall:" ; \ 434 | if test -n "$(DESTDIR)"; then \ 435 | echo " (check DESTDIR support)"; \ 436 | fi ; \ 437 | $(distuninstallcheck_listfiles) ; \ 438 | exit 1; } >&2 439 | distcleancheck: distclean 440 | @if test '$(srcdir)' = . ; then \ 441 | echo "ERROR: distcleancheck can only run from a VPATH build" ; \ 442 | exit 1 ; \ 443 | fi 444 | @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ 445 | || { echo "ERROR: files left in build directory after distclean:" ; \ 446 | $(distcleancheck_listfiles) ; \ 447 | exit 1; } >&2 448 | check-am: all-am 449 | check: check-am 450 | all-am: Makefile $(PROGRAMS) $(MANS) 451 | 452 | installdirs: 453 | $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) 454 | install: install-am 455 | install-exec: install-exec-am 456 | install-data: install-data-am 457 | uninstall: uninstall-am 458 | 459 | install-am: all-am 460 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 461 | 462 | installcheck: installcheck-am 463 | install-strip: 464 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 465 | INSTALL_STRIP_FLAG=-s \ 466 | `test -z '$(STRIP)' || \ 467 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 468 | mostlyclean-generic: 469 | 470 | clean-generic: 471 | 472 | distclean-generic: 473 | -rm -f Makefile $(CONFIG_CLEAN_FILES) 474 | 475 | maintainer-clean-generic: 476 | @echo "This command is intended for maintainers to use" 477 | @echo "it deletes files that may require special tools to rebuild." 478 | clean: clean-am 479 | 480 | clean-am: clean-binPROGRAMS clean-generic mostlyclean-am 481 | 482 | distclean: distclean-am 483 | -rm -f $(am__CONFIG_DISTCLEAN_FILES) 484 | distclean-am: clean-am distclean-compile distclean-depend \ 485 | distclean-generic distclean-tags 486 | 487 | dvi: dvi-am 488 | 489 | dvi-am: 490 | 491 | info: info-am 492 | 493 | info-am: 494 | 495 | install-data-am: install-man 496 | 497 | install-exec-am: install-binPROGRAMS 498 | 499 | install-info: install-info-am 500 | 501 | install-man: install-man1 502 | 503 | installcheck-am: 504 | 505 | maintainer-clean: maintainer-clean-am 506 | -rm -f $(am__CONFIG_DISTCLEAN_FILES) 507 | -rm -rf $(top_srcdir)/autom4te.cache 508 | maintainer-clean-am: distclean-am maintainer-clean-generic 509 | 510 | mostlyclean: mostlyclean-am 511 | 512 | mostlyclean-am: mostlyclean-compile mostlyclean-generic 513 | 514 | pdf: pdf-am 515 | 516 | pdf-am: 517 | 518 | ps: ps-am 519 | 520 | ps-am: 521 | 522 | uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man 523 | 524 | uninstall-man: uninstall-man1 525 | 526 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ 527 | clean-generic ctags dist dist-all dist-gzip distcheck distclean \ 528 | distclean-compile distclean-depend distclean-generic \ 529 | distclean-tags distcleancheck distdir distuninstallcheck dvi \ 530 | dvi-am info info-am install install-am install-binPROGRAMS \ 531 | install-data install-data-am install-exec install-exec-am \ 532 | install-info install-info-am install-man install-man1 \ 533 | install-strip installcheck installcheck-am installdirs \ 534 | maintainer-clean maintainer-clean-generic mostlyclean \ 535 | mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ 536 | tags uninstall uninstall-am uninstall-binPROGRAMS \ 537 | uninstall-info-am uninstall-man uninstall-man1 538 | 539 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 540 | # Otherwise a system limit (for SysV at least) may be exceeded. 541 | .NOEXPORT: 542 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/software-revive/wmctrl-rv/c5c5eb8ba66526dbceb8755155ecfcc540f7fe29/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | 2 | wmctrl 3 | A command line tool to interact with an EWMH/NetWM compatible X Window Manager. 4 | 5 | To compile and install the program, run the following commands: 6 | 7 | ./configure 8 | make 9 | (become root) 10 | make install 11 | 12 | 13 | After installation you may run "wmctrl -h" to view the documentation. 14 | 15 | 16 | The program is based on the EWMH specification: 17 | 18 | http://www.freedesktop.org/standards/wm-spec/ 19 | 20 | Please note that wmctrl only works with window managers which implement 21 | this specification. 22 | 23 | 24 | The homepage of wmctrl: 25 | 26 | http://sweb.cz/tripie/utils/wmctrl/ 27 | 28 | 29 | I recommend you to check out Zenity, which is an excellent 30 | tool to integrate the GUI and the command line. 31 | 32 | http://ftp.acc.umu.se/pub/GNOME/sources/zenity/ 33 | 34 | 35 | Author, current maintainer: Tomas Styblo 36 | Copyright (C) 2003 37 | 38 | This program is free software which I release under the GNU General Public 39 | License. You may redistribute and/or modify this program under the terms 40 | of that license as published by the Free Software Foundation; either 41 | version 2 of the License, or (at your option) any later version. 42 | 43 | This program is distributed in the hope that it will be useful, 44 | but WITHOUT ANY WARRANTY; without even the implied warranty of 45 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 46 | GNU General Public License for more details. 47 | 48 | To get a copy of the GNU General Puplic License, write to the 49 | Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 50 | -------------------------------------------------------------------------------- /aclocal.m4: -------------------------------------------------------------------------------- 1 | # generated automatically by aclocal 1.7.6 -*- Autoconf -*- 2 | 3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 4 | # Free Software Foundation, Inc. 5 | # This file is free software; the Free Software Foundation 6 | # gives unlimited permission to copy and/or distribute it, 7 | # with or without modifications, as long as this notice is preserved. 8 | 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 11 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 12 | # PARTICULAR PURPOSE. 13 | 14 | # Do all the work for Automake. -*- Autoconf -*- 15 | 16 | # This macro actually does too much some checks are only needed if 17 | # your package does certain things. But this isn't really a big deal. 18 | 19 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 20 | # Free Software Foundation, Inc. 21 | 22 | # This program is free software; you can redistribute it and/or modify 23 | # it under the terms of the GNU General Public License as published by 24 | # the Free Software Foundation; either version 2, or (at your option) 25 | # any later version. 26 | 27 | # This program is distributed in the hope that it will be useful, 28 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30 | # GNU General Public License for more details. 31 | 32 | # You should have received a copy of the GNU General Public License 33 | # along with this program; if not, write to the Free Software 34 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 35 | # 02111-1307, USA. 36 | 37 | # serial 10 38 | 39 | AC_PREREQ([2.54]) 40 | 41 | # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow 42 | # the ones we care about. 43 | m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl 44 | 45 | # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) 46 | # AM_INIT_AUTOMAKE([OPTIONS]) 47 | # ----------------------------------------------- 48 | # The call with PACKAGE and VERSION arguments is the old style 49 | # call (pre autoconf-2.50), which is being phased out. PACKAGE 50 | # and VERSION should now be passed to AC_INIT and removed from 51 | # the call to AM_INIT_AUTOMAKE. 52 | # We support both call styles for the transition. After 53 | # the next Automake release, Autoconf can make the AC_INIT 54 | # arguments mandatory, and then we can depend on a new Autoconf 55 | # release and drop the old call support. 56 | AC_DEFUN([AM_INIT_AUTOMAKE], 57 | [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl 58 | AC_REQUIRE([AC_PROG_INSTALL])dnl 59 | # test to see if srcdir already configured 60 | if test "`cd $srcdir && pwd`" != "`pwd`" && 61 | test -f $srcdir/config.status; then 62 | AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) 63 | fi 64 | 65 | # test whether we have cygpath 66 | if test -z "$CYGPATH_W"; then 67 | if (cygpath --version) >/dev/null 2>/dev/null; then 68 | CYGPATH_W='cygpath -w' 69 | else 70 | CYGPATH_W=echo 71 | fi 72 | fi 73 | AC_SUBST([CYGPATH_W]) 74 | 75 | # Define the identity of the package. 76 | dnl Distinguish between old-style and new-style calls. 77 | m4_ifval([$2], 78 | [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl 79 | AC_SUBST([PACKAGE], [$1])dnl 80 | AC_SUBST([VERSION], [$2])], 81 | [_AM_SET_OPTIONS([$1])dnl 82 | AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl 83 | AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl 84 | 85 | _AM_IF_OPTION([no-define],, 86 | [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) 87 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl 88 | 89 | # Some tools Automake needs. 90 | AC_REQUIRE([AM_SANITY_CHECK])dnl 91 | AC_REQUIRE([AC_ARG_PROGRAM])dnl 92 | AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) 93 | AM_MISSING_PROG(AUTOCONF, autoconf) 94 | AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) 95 | AM_MISSING_PROG(AUTOHEADER, autoheader) 96 | AM_MISSING_PROG(MAKEINFO, makeinfo) 97 | AM_MISSING_PROG(AMTAR, tar) 98 | AM_PROG_INSTALL_SH 99 | AM_PROG_INSTALL_STRIP 100 | # We need awk for the "check" target. The system "awk" is bad on 101 | # some platforms. 102 | AC_REQUIRE([AC_PROG_AWK])dnl 103 | AC_REQUIRE([AC_PROG_MAKE_SET])dnl 104 | AC_REQUIRE([AM_SET_LEADING_DOT])dnl 105 | 106 | _AM_IF_OPTION([no-dependencies],, 107 | [AC_PROVIDE_IFELSE([AC_PROG_CC], 108 | [_AM_DEPENDENCIES(CC)], 109 | [define([AC_PROG_CC], 110 | defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl 111 | AC_PROVIDE_IFELSE([AC_PROG_CXX], 112 | [_AM_DEPENDENCIES(CXX)], 113 | [define([AC_PROG_CXX], 114 | defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl 115 | ]) 116 | ]) 117 | 118 | 119 | # When config.status generates a header, we must update the stamp-h file. 120 | # This file resides in the same directory as the config header 121 | # that is generated. The stamp files are numbered to have different names. 122 | 123 | # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the 124 | # loop where config.status creates the headers, so we can generate 125 | # our stamp files there. 126 | AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], 127 | [# Compute $1's index in $config_headers. 128 | _am_stamp_count=1 129 | for _am_header in $config_headers :; do 130 | case $_am_header in 131 | $1 | $1:* ) 132 | break ;; 133 | * ) 134 | _am_stamp_count=`expr $_am_stamp_count + 1` ;; 135 | esac 136 | done 137 | echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) 138 | 139 | # Copyright 2002 Free Software Foundation, Inc. 140 | 141 | # This program is free software; you can redistribute it and/or modify 142 | # it under the terms of the GNU General Public License as published by 143 | # the Free Software Foundation; either version 2, or (at your option) 144 | # any later version. 145 | 146 | # This program is distributed in the hope that it will be useful, 147 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 148 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 149 | # GNU General Public License for more details. 150 | 151 | # You should have received a copy of the GNU General Public License 152 | # along with this program; if not, write to the Free Software 153 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 154 | 155 | # AM_AUTOMAKE_VERSION(VERSION) 156 | # ---------------------------- 157 | # Automake X.Y traces this macro to ensure aclocal.m4 has been 158 | # generated from the m4 files accompanying Automake X.Y. 159 | AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) 160 | 161 | # AM_SET_CURRENT_AUTOMAKE_VERSION 162 | # ------------------------------- 163 | # Call AM_AUTOMAKE_VERSION so it can be traced. 164 | # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. 165 | AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], 166 | [AM_AUTOMAKE_VERSION([1.7.6])]) 167 | 168 | # Helper functions for option handling. -*- Autoconf -*- 169 | 170 | # Copyright 2001, 2002 Free Software Foundation, Inc. 171 | 172 | # This program is free software; you can redistribute it and/or modify 173 | # it under the terms of the GNU General Public License as published by 174 | # the Free Software Foundation; either version 2, or (at your option) 175 | # any later version. 176 | 177 | # This program is distributed in the hope that it will be useful, 178 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 179 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 180 | # GNU General Public License for more details. 181 | 182 | # You should have received a copy of the GNU General Public License 183 | # along with this program; if not, write to the Free Software 184 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 185 | # 02111-1307, USA. 186 | 187 | # serial 2 188 | 189 | # _AM_MANGLE_OPTION(NAME) 190 | # ----------------------- 191 | AC_DEFUN([_AM_MANGLE_OPTION], 192 | [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) 193 | 194 | # _AM_SET_OPTION(NAME) 195 | # ------------------------------ 196 | # Set option NAME. Presently that only means defining a flag for this option. 197 | AC_DEFUN([_AM_SET_OPTION], 198 | [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) 199 | 200 | # _AM_SET_OPTIONS(OPTIONS) 201 | # ---------------------------------- 202 | # OPTIONS is a space-separated list of Automake options. 203 | AC_DEFUN([_AM_SET_OPTIONS], 204 | [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) 205 | 206 | # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) 207 | # ------------------------------------------- 208 | # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 209 | AC_DEFUN([_AM_IF_OPTION], 210 | [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) 211 | 212 | # 213 | # Check to make sure that the build environment is sane. 214 | # 215 | 216 | # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. 217 | 218 | # This program is free software; you can redistribute it and/or modify 219 | # it under the terms of the GNU General Public License as published by 220 | # the Free Software Foundation; either version 2, or (at your option) 221 | # any later version. 222 | 223 | # This program is distributed in the hope that it will be useful, 224 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 225 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 226 | # GNU General Public License for more details. 227 | 228 | # You should have received a copy of the GNU General Public License 229 | # along with this program; if not, write to the Free Software 230 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 231 | # 02111-1307, USA. 232 | 233 | # serial 3 234 | 235 | # AM_SANITY_CHECK 236 | # --------------- 237 | AC_DEFUN([AM_SANITY_CHECK], 238 | [AC_MSG_CHECKING([whether build environment is sane]) 239 | # Just in case 240 | sleep 1 241 | echo timestamp > conftest.file 242 | # Do `set' in a subshell so we don't clobber the current shell's 243 | # arguments. Must try -L first in case configure is actually a 244 | # symlink; some systems play weird games with the mod time of symlinks 245 | # (eg FreeBSD returns the mod time of the symlink's containing 246 | # directory). 247 | if ( 248 | set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` 249 | if test "$[*]" = "X"; then 250 | # -L didn't work. 251 | set X `ls -t $srcdir/configure conftest.file` 252 | fi 253 | rm -f conftest.file 254 | if test "$[*]" != "X $srcdir/configure conftest.file" \ 255 | && test "$[*]" != "X conftest.file $srcdir/configure"; then 256 | 257 | # If neither matched, then we have a broken ls. This can happen 258 | # if, for instance, CONFIG_SHELL is bash and it inherits a 259 | # broken ls alias from the environment. This has actually 260 | # happened. Such a system could not be considered "sane". 261 | AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken 262 | alias in your environment]) 263 | fi 264 | 265 | test "$[2]" = conftest.file 266 | ) 267 | then 268 | # Ok. 269 | : 270 | else 271 | AC_MSG_ERROR([newly created file is older than distributed files! 272 | Check your system clock]) 273 | fi 274 | AC_MSG_RESULT(yes)]) 275 | 276 | # -*- Autoconf -*- 277 | 278 | 279 | # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. 280 | 281 | # This program is free software; you can redistribute it and/or modify 282 | # it under the terms of the GNU General Public License as published by 283 | # the Free Software Foundation; either version 2, or (at your option) 284 | # any later version. 285 | 286 | # This program is distributed in the hope that it will be useful, 287 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 288 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 289 | # GNU General Public License for more details. 290 | 291 | # You should have received a copy of the GNU General Public License 292 | # along with this program; if not, write to the Free Software 293 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 294 | # 02111-1307, USA. 295 | 296 | # serial 3 297 | 298 | # AM_MISSING_PROG(NAME, PROGRAM) 299 | # ------------------------------ 300 | AC_DEFUN([AM_MISSING_PROG], 301 | [AC_REQUIRE([AM_MISSING_HAS_RUN]) 302 | $1=${$1-"${am_missing_run}$2"} 303 | AC_SUBST($1)]) 304 | 305 | 306 | # AM_MISSING_HAS_RUN 307 | # ------------------ 308 | # Define MISSING if not defined so far and test if it supports --run. 309 | # If it does, set am_missing_run to use it, otherwise, to nothing. 310 | AC_DEFUN([AM_MISSING_HAS_RUN], 311 | [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 312 | test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" 313 | # Use eval to expand $SHELL 314 | if eval "$MISSING --run true"; then 315 | am_missing_run="$MISSING --run " 316 | else 317 | am_missing_run= 318 | AC_MSG_WARN([`missing' script is too old or missing]) 319 | fi 320 | ]) 321 | 322 | # AM_AUX_DIR_EXPAND 323 | 324 | # Copyright 2001 Free Software Foundation, Inc. 325 | 326 | # This program is free software; you can redistribute it and/or modify 327 | # it under the terms of the GNU General Public License as published by 328 | # the Free Software Foundation; either version 2, or (at your option) 329 | # any later version. 330 | 331 | # This program is distributed in the hope that it will be useful, 332 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 333 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 334 | # GNU General Public License for more details. 335 | 336 | # You should have received a copy of the GNU General Public License 337 | # along with this program; if not, write to the Free Software 338 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 339 | # 02111-1307, USA. 340 | 341 | # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets 342 | # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to 343 | # `$srcdir', `$srcdir/..', or `$srcdir/../..'. 344 | # 345 | # Of course, Automake must honor this variable whenever it calls a 346 | # tool from the auxiliary directory. The problem is that $srcdir (and 347 | # therefore $ac_aux_dir as well) can be either absolute or relative, 348 | # depending on how configure is run. This is pretty annoying, since 349 | # it makes $ac_aux_dir quite unusable in subdirectories: in the top 350 | # source directory, any form will work fine, but in subdirectories a 351 | # relative path needs to be adjusted first. 352 | # 353 | # $ac_aux_dir/missing 354 | # fails when called from a subdirectory if $ac_aux_dir is relative 355 | # $top_srcdir/$ac_aux_dir/missing 356 | # fails if $ac_aux_dir is absolute, 357 | # fails when called from a subdirectory in a VPATH build with 358 | # a relative $ac_aux_dir 359 | # 360 | # The reason of the latter failure is that $top_srcdir and $ac_aux_dir 361 | # are both prefixed by $srcdir. In an in-source build this is usually 362 | # harmless because $srcdir is `.', but things will broke when you 363 | # start a VPATH build or use an absolute $srcdir. 364 | # 365 | # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, 366 | # iff we strip the leading $srcdir from $ac_aux_dir. That would be: 367 | # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` 368 | # and then we would define $MISSING as 369 | # MISSING="\${SHELL} $am_aux_dir/missing" 370 | # This will work as long as MISSING is not called from configure, because 371 | # unfortunately $(top_srcdir) has no meaning in configure. 372 | # However there are other variables, like CC, which are often used in 373 | # configure, and could therefore not use this "fixed" $ac_aux_dir. 374 | # 375 | # Another solution, used here, is to always expand $ac_aux_dir to an 376 | # absolute PATH. The drawback is that using absolute paths prevent a 377 | # configured tree to be moved without reconfiguration. 378 | 379 | # Rely on autoconf to set up CDPATH properly. 380 | AC_PREREQ([2.50]) 381 | 382 | AC_DEFUN([AM_AUX_DIR_EXPAND], [ 383 | # expand $ac_aux_dir to an absolute path 384 | am_aux_dir=`cd $ac_aux_dir && pwd` 385 | ]) 386 | 387 | # AM_PROG_INSTALL_SH 388 | # ------------------ 389 | # Define $install_sh. 390 | 391 | # Copyright 2001 Free Software Foundation, Inc. 392 | 393 | # This program is free software; you can redistribute it and/or modify 394 | # it under the terms of the GNU General Public License as published by 395 | # the Free Software Foundation; either version 2, or (at your option) 396 | # any later version. 397 | 398 | # This program is distributed in the hope that it will be useful, 399 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 400 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 401 | # GNU General Public License for more details. 402 | 403 | # You should have received a copy of the GNU General Public License 404 | # along with this program; if not, write to the Free Software 405 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 406 | # 02111-1307, USA. 407 | 408 | AC_DEFUN([AM_PROG_INSTALL_SH], 409 | [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 410 | install_sh=${install_sh-"$am_aux_dir/install-sh"} 411 | AC_SUBST(install_sh)]) 412 | 413 | # AM_PROG_INSTALL_STRIP 414 | 415 | # Copyright 2001 Free Software Foundation, Inc. 416 | 417 | # This program is free software; you can redistribute it and/or modify 418 | # it under the terms of the GNU General Public License as published by 419 | # the Free Software Foundation; either version 2, or (at your option) 420 | # any later version. 421 | 422 | # This program is distributed in the hope that it will be useful, 423 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 424 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 425 | # GNU General Public License for more details. 426 | 427 | # You should have received a copy of the GNU General Public License 428 | # along with this program; if not, write to the Free Software 429 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 430 | # 02111-1307, USA. 431 | 432 | # One issue with vendor `install' (even GNU) is that you can't 433 | # specify the program used to strip binaries. This is especially 434 | # annoying in cross-compiling environments, where the build's strip 435 | # is unlikely to handle the host's binaries. 436 | # Fortunately install-sh will honor a STRIPPROG variable, so we 437 | # always use install-sh in `make install-strip', and initialize 438 | # STRIPPROG with the value of the STRIP variable (set by the user). 439 | AC_DEFUN([AM_PROG_INSTALL_STRIP], 440 | [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl 441 | # Installed binaries are usually stripped using `strip' when the user 442 | # run `make install-strip'. However `strip' might not be the right 443 | # tool to use in cross-compilation environments, therefore Automake 444 | # will honor the `STRIP' environment variable to overrule this program. 445 | dnl Don't test for $cross_compiling = yes, because it might be `maybe'. 446 | if test "$cross_compiling" != no; then 447 | AC_CHECK_TOOL([STRIP], [strip], :) 448 | fi 449 | INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" 450 | AC_SUBST([INSTALL_STRIP_PROGRAM])]) 451 | 452 | # -*- Autoconf -*- 453 | # Copyright (C) 2003 Free Software Foundation, Inc. 454 | 455 | # This program is free software; you can redistribute it and/or modify 456 | # it under the terms of the GNU General Public License as published by 457 | # the Free Software Foundation; either version 2, or (at your option) 458 | # any later version. 459 | 460 | # This program is distributed in the hope that it will be useful, 461 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 462 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 463 | # GNU General Public License for more details. 464 | 465 | # You should have received a copy of the GNU General Public License 466 | # along with this program; if not, write to the Free Software 467 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 468 | # 02111-1307, USA. 469 | 470 | # serial 1 471 | 472 | # Check whether the underlying file-system supports filenames 473 | # with a leading dot. For instance MS-DOS doesn't. 474 | AC_DEFUN([AM_SET_LEADING_DOT], 475 | [rm -rf .tst 2>/dev/null 476 | mkdir .tst 2>/dev/null 477 | if test -d .tst; then 478 | am__leading_dot=. 479 | else 480 | am__leading_dot=_ 481 | fi 482 | rmdir .tst 2>/dev/null 483 | AC_SUBST([am__leading_dot])]) 484 | 485 | # serial 5 -*- Autoconf -*- 486 | 487 | # Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 488 | 489 | # This program is free software; you can redistribute it and/or modify 490 | # it under the terms of the GNU General Public License as published by 491 | # the Free Software Foundation; either version 2, or (at your option) 492 | # any later version. 493 | 494 | # This program is distributed in the hope that it will be useful, 495 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 496 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 497 | # GNU General Public License for more details. 498 | 499 | # You should have received a copy of the GNU General Public License 500 | # along with this program; if not, write to the Free Software 501 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 502 | # 02111-1307, USA. 503 | 504 | 505 | # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be 506 | # written in clear, in which case automake, when reading aclocal.m4, 507 | # will think it sees a *use*, and therefore will trigger all it's 508 | # C support machinery. Also note that it means that autoscan, seeing 509 | # CC etc. in the Makefile, will ask for an AC_PROG_CC use... 510 | 511 | 512 | 513 | # _AM_DEPENDENCIES(NAME) 514 | # ---------------------- 515 | # See how the compiler implements dependency checking. 516 | # NAME is "CC", "CXX", "GCJ", or "OBJC". 517 | # We try a few techniques and use that to set a single cache variable. 518 | # 519 | # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was 520 | # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular 521 | # dependency, and given that the user is not expected to run this macro, 522 | # just rely on AC_PROG_CC. 523 | AC_DEFUN([_AM_DEPENDENCIES], 524 | [AC_REQUIRE([AM_SET_DEPDIR])dnl 525 | AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl 526 | AC_REQUIRE([AM_MAKE_INCLUDE])dnl 527 | AC_REQUIRE([AM_DEP_TRACK])dnl 528 | 529 | ifelse([$1], CC, [depcc="$CC" am_compiler_list=], 530 | [$1], CXX, [depcc="$CXX" am_compiler_list=], 531 | [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], 532 | [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], 533 | [depcc="$$1" am_compiler_list=]) 534 | 535 | AC_CACHE_CHECK([dependency style of $depcc], 536 | [am_cv_$1_dependencies_compiler_type], 537 | [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then 538 | # We make a subdir and do the tests there. Otherwise we can end up 539 | # making bogus files that we don't know about and never remove. For 540 | # instance it was reported that on HP-UX the gcc test will end up 541 | # making a dummy file named `D' -- because `-MD' means `put the output 542 | # in D'. 543 | mkdir conftest.dir 544 | # Copy depcomp to subdir because otherwise we won't find it if we're 545 | # using a relative directory. 546 | cp "$am_depcomp" conftest.dir 547 | cd conftest.dir 548 | # We will build objects and dependencies in a subdirectory because 549 | # it helps to detect inapplicable dependency modes. For instance 550 | # both Tru64's cc and ICC support -MD to output dependencies as a 551 | # side effect of compilation, but ICC will put the dependencies in 552 | # the current directory while Tru64 will put them in the object 553 | # directory. 554 | mkdir sub 555 | 556 | am_cv_$1_dependencies_compiler_type=none 557 | if test "$am_compiler_list" = ""; then 558 | am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` 559 | fi 560 | for depmode in $am_compiler_list; do 561 | # Setup a source with many dependencies, because some compilers 562 | # like to wrap large dependency lists on column 80 (with \), and 563 | # we should not choose a depcomp mode which is confused by this. 564 | # 565 | # We need to recreate these files for each test, as the compiler may 566 | # overwrite some of them when testing with obscure command lines. 567 | # This happens at least with the AIX C compiler. 568 | : > sub/conftest.c 569 | for i in 1 2 3 4 5 6; do 570 | echo '#include "conftst'$i'.h"' >> sub/conftest.c 571 | : > sub/conftst$i.h 572 | done 573 | echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf 574 | 575 | case $depmode in 576 | nosideeffect) 577 | # after this tag, mechanisms are not by side-effect, so they'll 578 | # only be used when explicitly requested 579 | if test "x$enable_dependency_tracking" = xyes; then 580 | continue 581 | else 582 | break 583 | fi 584 | ;; 585 | none) break ;; 586 | esac 587 | # We check with `-c' and `-o' for the sake of the "dashmstdout" 588 | # mode. It turns out that the SunPro C++ compiler does not properly 589 | # handle `-M -o', and we need to detect this. 590 | if depmode=$depmode \ 591 | source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ 592 | depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ 593 | $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ 594 | >/dev/null 2>conftest.err && 595 | grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && 596 | grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && 597 | ${MAKE-make} -s -f confmf > /dev/null 2>&1; then 598 | # icc doesn't choke on unknown options, it will just issue warnings 599 | # (even with -Werror). So we grep stderr for any message 600 | # that says an option was ignored. 601 | if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else 602 | am_cv_$1_dependencies_compiler_type=$depmode 603 | break 604 | fi 605 | fi 606 | done 607 | 608 | cd .. 609 | rm -rf conftest.dir 610 | else 611 | am_cv_$1_dependencies_compiler_type=none 612 | fi 613 | ]) 614 | AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) 615 | AM_CONDITIONAL([am__fastdep$1], [ 616 | test "x$enable_dependency_tracking" != xno \ 617 | && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) 618 | ]) 619 | 620 | 621 | # AM_SET_DEPDIR 622 | # ------------- 623 | # Choose a directory name for dependency files. 624 | # This macro is AC_REQUIREd in _AM_DEPENDENCIES 625 | AC_DEFUN([AM_SET_DEPDIR], 626 | [AC_REQUIRE([AM_SET_LEADING_DOT])dnl 627 | AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl 628 | ]) 629 | 630 | 631 | # AM_DEP_TRACK 632 | # ------------ 633 | AC_DEFUN([AM_DEP_TRACK], 634 | [AC_ARG_ENABLE(dependency-tracking, 635 | [ --disable-dependency-tracking Speeds up one-time builds 636 | --enable-dependency-tracking Do not reject slow dependency extractors]) 637 | if test "x$enable_dependency_tracking" != xno; then 638 | am_depcomp="$ac_aux_dir/depcomp" 639 | AMDEPBACKSLASH='\' 640 | fi 641 | AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) 642 | AC_SUBST([AMDEPBACKSLASH]) 643 | ]) 644 | 645 | # Generate code to set up dependency tracking. -*- Autoconf -*- 646 | 647 | # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. 648 | 649 | # This program is free software; you can redistribute it and/or modify 650 | # it under the terms of the GNU General Public License as published by 651 | # the Free Software Foundation; either version 2, or (at your option) 652 | # any later version. 653 | 654 | # This program is distributed in the hope that it will be useful, 655 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 656 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 657 | # GNU General Public License for more details. 658 | 659 | # You should have received a copy of the GNU General Public License 660 | # along with this program; if not, write to the Free Software 661 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 662 | # 02111-1307, USA. 663 | 664 | #serial 2 665 | 666 | # _AM_OUTPUT_DEPENDENCY_COMMANDS 667 | # ------------------------------ 668 | AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], 669 | [for mf in $CONFIG_FILES; do 670 | # Strip MF so we end up with the name of the file. 671 | mf=`echo "$mf" | sed -e 's/:.*$//'` 672 | # Check whether this is an Automake generated Makefile or not. 673 | # We used to match only the files named `Makefile.in', but 674 | # some people rename them; so instead we look at the file content. 675 | # Grep'ing the first line is not enough: some people post-process 676 | # each Makefile.in and add a new line on top of each file to say so. 677 | # So let's grep whole file. 678 | if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then 679 | dirpart=`AS_DIRNAME("$mf")` 680 | else 681 | continue 682 | fi 683 | grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue 684 | # Extract the definition of DEP_FILES from the Makefile without 685 | # running `make'. 686 | DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` 687 | test -z "$DEPDIR" && continue 688 | # When using ansi2knr, U may be empty or an underscore; expand it 689 | U=`sed -n -e '/^U = / s///p' < "$mf"` 690 | test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" 691 | # We invoke sed twice because it is the simplest approach to 692 | # changing $(DEPDIR) to its actual value in the expansion. 693 | for file in `sed -n -e ' 694 | /^DEP_FILES = .*\\\\$/ { 695 | s/^DEP_FILES = // 696 | :loop 697 | s/\\\\$// 698 | p 699 | n 700 | /\\\\$/ b loop 701 | p 702 | } 703 | /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ 704 | sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do 705 | # Make sure the directory exists. 706 | test -f "$dirpart/$file" && continue 707 | fdir=`AS_DIRNAME(["$file"])` 708 | AS_MKDIR_P([$dirpart/$fdir]) 709 | # echo "creating $dirpart/$file" 710 | echo '# dummy' > "$dirpart/$file" 711 | done 712 | done 713 | ])# _AM_OUTPUT_DEPENDENCY_COMMANDS 714 | 715 | 716 | # AM_OUTPUT_DEPENDENCY_COMMANDS 717 | # ----------------------------- 718 | # This macro should only be invoked once -- use via AC_REQUIRE. 719 | # 720 | # This code is only required when automatic dependency tracking 721 | # is enabled. FIXME. This creates each `.P' file that we will 722 | # need in order to bootstrap the dependency handling code. 723 | AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], 724 | [AC_CONFIG_COMMANDS([depfiles], 725 | [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], 726 | [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) 727 | ]) 728 | 729 | # Check to see how 'make' treats includes. -*- Autoconf -*- 730 | 731 | # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. 732 | 733 | # This program is free software; you can redistribute it and/or modify 734 | # it under the terms of the GNU General Public License as published by 735 | # the Free Software Foundation; either version 2, or (at your option) 736 | # any later version. 737 | 738 | # This program is distributed in the hope that it will be useful, 739 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 740 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 741 | # GNU General Public License for more details. 742 | 743 | # You should have received a copy of the GNU General Public License 744 | # along with this program; if not, write to the Free Software 745 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 746 | # 02111-1307, USA. 747 | 748 | # serial 2 749 | 750 | # AM_MAKE_INCLUDE() 751 | # ----------------- 752 | # Check to see how make treats includes. 753 | AC_DEFUN([AM_MAKE_INCLUDE], 754 | [am_make=${MAKE-make} 755 | cat > confinc << 'END' 756 | am__doit: 757 | @echo done 758 | .PHONY: am__doit 759 | END 760 | # If we don't find an include directive, just comment out the code. 761 | AC_MSG_CHECKING([for style of include used by $am_make]) 762 | am__include="#" 763 | am__quote= 764 | _am_result=none 765 | # First try GNU make style include. 766 | echo "include confinc" > confmf 767 | # We grep out `Entering directory' and `Leaving directory' 768 | # messages which can occur if `w' ends up in MAKEFLAGS. 769 | # In particular we don't look at `^make:' because GNU make might 770 | # be invoked under some other name (usually "gmake"), in which 771 | # case it prints its new name instead of `make'. 772 | if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then 773 | am__include=include 774 | am__quote= 775 | _am_result=GNU 776 | fi 777 | # Now try BSD make style include. 778 | if test "$am__include" = "#"; then 779 | echo '.include "confinc"' > confmf 780 | if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then 781 | am__include=.include 782 | am__quote="\"" 783 | _am_result=BSD 784 | fi 785 | fi 786 | AC_SUBST([am__include]) 787 | AC_SUBST([am__quote]) 788 | AC_MSG_RESULT([$_am_result]) 789 | rm -f confinc confmf 790 | ]) 791 | 792 | # AM_CONDITIONAL -*- Autoconf -*- 793 | 794 | # Copyright 1997, 2000, 2001 Free Software Foundation, Inc. 795 | 796 | # This program is free software; you can redistribute it and/or modify 797 | # it under the terms of the GNU General Public License as published by 798 | # the Free Software Foundation; either version 2, or (at your option) 799 | # any later version. 800 | 801 | # This program is distributed in the hope that it will be useful, 802 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 803 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 804 | # GNU General Public License for more details. 805 | 806 | # You should have received a copy of the GNU General Public License 807 | # along with this program; if not, write to the Free Software 808 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 809 | # 02111-1307, USA. 810 | 811 | # serial 5 812 | 813 | AC_PREREQ(2.52) 814 | 815 | # AM_CONDITIONAL(NAME, SHELL-CONDITION) 816 | # ------------------------------------- 817 | # Define a conditional. 818 | AC_DEFUN([AM_CONDITIONAL], 819 | [ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], 820 | [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl 821 | AC_SUBST([$1_TRUE]) 822 | AC_SUBST([$1_FALSE]) 823 | if $2; then 824 | $1_TRUE= 825 | $1_FALSE='#' 826 | else 827 | $1_TRUE='#' 828 | $1_FALSE= 829 | fi 830 | AC_CONFIG_COMMANDS_PRE( 831 | [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then 832 | AC_MSG_ERROR([conditional "$1" was never defined. 833 | Usually this means the macro was only invoked conditionally.]) 834 | fi])]) 835 | 836 | # Configure paths for GLIB 837 | # Owen Taylor 1997-2001 838 | 839 | dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) 840 | dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or 841 | dnl gthread is specified in MODULES, pass to pkg-config 842 | dnl 843 | AC_DEFUN([AM_PATH_GLIB_2_0], 844 | [dnl 845 | dnl Get the cflags and libraries from pkg-config 846 | dnl 847 | AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], 848 | , enable_glibtest=yes) 849 | 850 | pkg_config_args=glib-2.0 851 | for module in . $4 852 | do 853 | case "$module" in 854 | gmodule) 855 | pkg_config_args="$pkg_config_args gmodule-2.0" 856 | ;; 857 | gobject) 858 | pkg_config_args="$pkg_config_args gobject-2.0" 859 | ;; 860 | gthread) 861 | pkg_config_args="$pkg_config_args gthread-2.0" 862 | ;; 863 | esac 864 | done 865 | 866 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 867 | 868 | no_glib="" 869 | 870 | if test x$PKG_CONFIG != xno ; then 871 | if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then 872 | : 873 | else 874 | echo *** pkg-config too old; version 0.7 or better required. 875 | no_glib=yes 876 | PKG_CONFIG=no 877 | fi 878 | else 879 | no_glib=yes 880 | fi 881 | 882 | min_glib_version=ifelse([$1], ,2.0.0,$1) 883 | AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) 884 | 885 | if test x$PKG_CONFIG != xno ; then 886 | ## don't try to run the test against uninstalled libtool libs 887 | if $PKG_CONFIG --uninstalled $pkg_config_args; then 888 | echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" 889 | enable_glibtest=no 890 | fi 891 | 892 | if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then 893 | : 894 | else 895 | no_glib=yes 896 | fi 897 | fi 898 | 899 | if test x"$no_glib" = x ; then 900 | GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` 901 | GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` 902 | GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` 903 | 904 | GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` 905 | GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` 906 | glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ 907 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 908 | glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ 909 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 910 | glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ 911 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 912 | if test "x$enable_glibtest" = "xyes" ; then 913 | ac_save_CFLAGS="$CFLAGS" 914 | ac_save_LIBS="$LIBS" 915 | CFLAGS="$CFLAGS $GLIB_CFLAGS" 916 | LIBS="$GLIB_LIBS $LIBS" 917 | dnl 918 | dnl Now check if the installed GLIB is sufficiently new. (Also sanity 919 | dnl checks the results of pkg-config to some extent) 920 | dnl 921 | rm -f conf.glibtest 922 | AC_TRY_RUN([ 923 | #include 924 | #include 925 | #include 926 | 927 | int 928 | main () 929 | { 930 | int major, minor, micro; 931 | char *tmp_version; 932 | 933 | system ("touch conf.glibtest"); 934 | 935 | /* HP/UX 9 (%@#!) writes to sscanf strings */ 936 | tmp_version = g_strdup("$min_glib_version"); 937 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { 938 | printf("%s, bad version string\n", "$min_glib_version"); 939 | exit(1); 940 | } 941 | 942 | if ((glib_major_version != $glib_config_major_version) || 943 | (glib_minor_version != $glib_config_minor_version) || 944 | (glib_micro_version != $glib_config_micro_version)) 945 | { 946 | printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 947 | $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, 948 | glib_major_version, glib_minor_version, glib_micro_version); 949 | printf ("*** was found! If pkg-config was correct, then it is best\n"); 950 | printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); 951 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); 952 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); 953 | printf("*** required on your system.\n"); 954 | printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); 955 | printf("*** to point to the correct configuration files\n"); 956 | } 957 | else if ((glib_major_version != GLIB_MAJOR_VERSION) || 958 | (glib_minor_version != GLIB_MINOR_VERSION) || 959 | (glib_micro_version != GLIB_MICRO_VERSION)) 960 | { 961 | printf("*** GLIB header files (version %d.%d.%d) do not match\n", 962 | GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); 963 | printf("*** library (version %d.%d.%d)\n", 964 | glib_major_version, glib_minor_version, glib_micro_version); 965 | } 966 | else 967 | { 968 | if ((glib_major_version > major) || 969 | ((glib_major_version == major) && (glib_minor_version > minor)) || 970 | ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) 971 | { 972 | return 0; 973 | } 974 | else 975 | { 976 | printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", 977 | glib_major_version, glib_minor_version, glib_micro_version); 978 | printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", 979 | major, minor, micro); 980 | printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); 981 | printf("***\n"); 982 | printf("*** If you have already installed a sufficiently new version, this error\n"); 983 | printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); 984 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); 985 | printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); 986 | printf("*** correct copy of pkg-config. (In this case, you will have to\n"); 987 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); 988 | printf("*** so that the correct libraries are found at run-time))\n"); 989 | } 990 | } 991 | return 1; 992 | } 993 | ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 994 | CFLAGS="$ac_save_CFLAGS" 995 | LIBS="$ac_save_LIBS" 996 | fi 997 | fi 998 | if test "x$no_glib" = x ; then 999 | AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) 1000 | ifelse([$2], , :, [$2]) 1001 | else 1002 | AC_MSG_RESULT(no) 1003 | if test "$PKG_CONFIG" = "no" ; then 1004 | echo "*** A new enough version of pkg-config was not found." 1005 | echo "*** See http://www.freedesktop.org/software/pkgconfig/" 1006 | else 1007 | if test -f conf.glibtest ; then 1008 | : 1009 | else 1010 | echo "*** Could not run GLIB test program, checking why..." 1011 | ac_save_CFLAGS="$CFLAGS" 1012 | ac_save_LIBS="$LIBS" 1013 | CFLAGS="$CFLAGS $GLIB_CFLAGS" 1014 | LIBS="$LIBS $GLIB_LIBS" 1015 | AC_TRY_LINK([ 1016 | #include 1017 | #include 1018 | ], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], 1019 | [ echo "*** The test program compiled, but did not run. This usually means" 1020 | echo "*** that the run-time linker is not finding GLIB or finding the wrong" 1021 | echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" 1022 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 1023 | echo "*** to the installed location Also, make sure you have run ldconfig if that" 1024 | echo "*** is required on your system" 1025 | echo "***" 1026 | echo "*** If you have an old version installed, it is best to remove it, although" 1027 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], 1028 | [ echo "*** The test program failed to compile or link. See the file config.log for the" 1029 | echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) 1030 | CFLAGS="$ac_save_CFLAGS" 1031 | LIBS="$ac_save_LIBS" 1032 | fi 1033 | fi 1034 | GLIB_CFLAGS="" 1035 | GLIB_LIBS="" 1036 | GLIB_GENMARSHAL="" 1037 | GOBJECT_QUERY="" 1038 | GLIB_MKENUMS="" 1039 | ifelse([$3], , :, [$3]) 1040 | fi 1041 | AC_SUBST(GLIB_CFLAGS) 1042 | AC_SUBST(GLIB_LIBS) 1043 | AC_SUBST(GLIB_GENMARSHAL) 1044 | AC_SUBST(GOBJECT_QUERY) 1045 | AC_SUBST(GLIB_MKENUMS) 1046 | rm -f conf.glibtest 1047 | ]) 1048 | 1049 | -------------------------------------------------------------------------------- /configure.in: -------------------------------------------------------------------------------- 1 | 2 | AC_INIT(main.c) 3 | AM_INIT_AUTOMAKE(wmctrl, 1.07) 4 | AC_PROG_CC 5 | AC_PATH_XTRA 6 | AM_PATH_GLIB_2_0 7 | AC_OUTPUT(Makefile) 8 | -------------------------------------------------------------------------------- /depcomp: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # depcomp - compile a program generating dependencies as side-effects 4 | # Copyright 1999, 2000 Free Software Foundation, Inc. 5 | 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2, or (at your option) 9 | # any later version. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | # 02111-1307, USA. 20 | 21 | # As a special exception to the GNU General Public License, if you 22 | # distribute this file as part of a program that contains a 23 | # configuration script generated by Autoconf, you may include it under 24 | # the same distribution terms that you use for the rest of that program. 25 | 26 | # Originally written by Alexandre Oliva . 27 | 28 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then 29 | echo "depcomp: Variables source, object and depmode must be set" 1>&2 30 | exit 1 31 | fi 32 | # `libtool' can also be set to `yes' or `no'. 33 | 34 | if test -z "$depfile"; then 35 | base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` 36 | dir=`echo "$object" | sed 's,/.*$,/,'` 37 | if test "$dir" = "$object"; then 38 | dir= 39 | fi 40 | # FIXME: should be _deps on DOS. 41 | depfile="$dir.deps/$base" 42 | fi 43 | 44 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 45 | 46 | rm -f "$tmpdepfile" 47 | 48 | # Some modes work just like other modes, but use different flags. We 49 | # parameterize here, but still list the modes in the big case below, 50 | # to make depend.m4 easier to write. Note that we *cannot* use a case 51 | # here, because this file can only contain one case statement. 52 | if test "$depmode" = hp; then 53 | # HP compiler uses -M and no extra arg. 54 | gccflag=-M 55 | depmode=gcc 56 | fi 57 | 58 | if test "$depmode" = dashXmstdout; then 59 | # This is just like dashmstdout with a different argument. 60 | dashmflag=-xM 61 | depmode=dashmstdout 62 | fi 63 | 64 | case "$depmode" in 65 | gcc3) 66 | ## gcc 3 implements dependency tracking that does exactly what 67 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like 68 | ## it if -MD -MP comes after the -MF stuff. Hmm. 69 | "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 70 | stat=$? 71 | if test $stat -eq 0; then : 72 | else 73 | rm -f "$tmpdepfile" 74 | exit $stat 75 | fi 76 | mv "$tmpdepfile" "$depfile" 77 | ;; 78 | 79 | gcc) 80 | ## There are various ways to get dependency output from gcc. Here's 81 | ## why we pick this rather obscure method: 82 | ## - Don't want to use -MD because we'd like the dependencies to end 83 | ## up in a subdir. Having to rename by hand is ugly. 84 | ## (We might end up doing this anyway to support other compilers.) 85 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 86 | ## -MM, not -M (despite what the docs say). 87 | ## - Using -M directly means running the compiler twice (even worse 88 | ## than renaming). 89 | if test -z "$gccflag"; then 90 | gccflag=-MD, 91 | fi 92 | "$@" -Wp,"$gccflag$tmpdepfile" 93 | stat=$? 94 | if test $stat -eq 0; then : 95 | else 96 | rm -f "$tmpdepfile" 97 | exit $stat 98 | fi 99 | rm -f "$depfile" 100 | echo "$object : \\" > "$depfile" 101 | alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 102 | ## The second -e expression handles DOS-style file names with drive letters. 103 | sed -e 's/^[^:]*: / /' \ 104 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 105 | ## This next piece of magic avoids the `deleted header file' problem. 106 | ## The problem is that when a header file which appears in a .P file 107 | ## is deleted, the dependency causes make to die (because there is 108 | ## typically no way to rebuild the header). We avoid this by adding 109 | ## dummy dependencies for each header file. Too bad gcc doesn't do 110 | ## this for us directly. 111 | tr ' ' ' 112 | ' < "$tmpdepfile" | 113 | ## Some versions of gcc put a space before the `:'. On the theory 114 | ## that the space means something, we add a space to the output as 115 | ## well. 116 | ## Some versions of the HPUX 10.20 sed can't process this invocation 117 | ## correctly. Breaking it into two sed invocations is a workaround. 118 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 119 | rm -f "$tmpdepfile" 120 | ;; 121 | 122 | hp) 123 | # This case exists only to let depend.m4 do its work. It works by 124 | # looking at the text of this script. This case will never be run, 125 | # since it is checked for above. 126 | exit 1 127 | ;; 128 | 129 | sgi) 130 | if test "$libtool" = yes; then 131 | "$@" "-Wp,-MDupdate,$tmpdepfile" 132 | else 133 | "$@" -MDupdate "$tmpdepfile" 134 | fi 135 | stat=$? 136 | if test $stat -eq 0; then : 137 | else 138 | rm -f "$tmpdepfile" 139 | exit $stat 140 | fi 141 | rm -f "$depfile" 142 | 143 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 144 | echo "$object : \\" > "$depfile" 145 | 146 | # Clip off the initial element (the dependent). Don't try to be 147 | # clever and replace this with sed code, as IRIX sed won't handle 148 | # lines with more than a fixed number of characters (4096 in 149 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 150 | # the IRIX cc adds comments like `#:fec' to the end of the 151 | # dependency line. 152 | tr ' ' ' 153 | ' < "$tmpdepfile" \ 154 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 155 | tr ' 156 | ' ' ' >> $depfile 157 | echo >> $depfile 158 | 159 | # The second pass generates a dummy entry for each header file. 160 | tr ' ' ' 161 | ' < "$tmpdepfile" \ 162 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 163 | >> $depfile 164 | else 165 | # The sourcefile does not contain any dependencies, so just 166 | # store a dummy comment line, to avoid errors with the Makefile 167 | # "include basename.Plo" scheme. 168 | echo "#dummy" > "$depfile" 169 | fi 170 | rm -f "$tmpdepfile" 171 | ;; 172 | 173 | aix) 174 | # The C for AIX Compiler uses -M and outputs the dependencies 175 | # in a .u file. This file always lives in the current directory. 176 | # Also, the AIX compiler puts `$object:' at the start of each line; 177 | # $object doesn't have directory information. 178 | stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` 179 | tmpdepfile="$stripped.u" 180 | outname="$stripped.o" 181 | if test "$libtool" = yes; then 182 | "$@" -Wc,-M 183 | else 184 | "$@" -M 185 | fi 186 | 187 | stat=$? 188 | if test $stat -eq 0; then : 189 | else 190 | rm -f "$tmpdepfile" 191 | exit $stat 192 | fi 193 | 194 | if test -f "$tmpdepfile"; then 195 | # Each line is of the form `foo.o: dependent.h'. 196 | # Do two passes, one to just change these to 197 | # `$object: dependent.h' and one to simply `dependent.h:'. 198 | sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 199 | sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 200 | else 201 | # The sourcefile does not contain any dependencies, so just 202 | # store a dummy comment line, to avoid errors with the Makefile 203 | # "include basename.Plo" scheme. 204 | echo "#dummy" > "$depfile" 205 | fi 206 | rm -f "$tmpdepfile" 207 | ;; 208 | 209 | icc) 210 | # Intel's C compiler understands `-MD -MF file'. However on 211 | # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 212 | # ICC 7.0 will fill foo.d with something like 213 | # foo.o: sub/foo.c 214 | # foo.o: sub/foo.h 215 | # which is wrong. We want: 216 | # sub/foo.o: sub/foo.c 217 | # sub/foo.o: sub/foo.h 218 | # sub/foo.c: 219 | # sub/foo.h: 220 | # ICC 7.1 will output 221 | # foo.o: sub/foo.c sub/foo.h 222 | # and will wrap long lines using \ : 223 | # foo.o: sub/foo.c ... \ 224 | # sub/foo.h ... \ 225 | # ... 226 | 227 | "$@" -MD -MF "$tmpdepfile" 228 | stat=$? 229 | if test $stat -eq 0; then : 230 | else 231 | rm -f "$tmpdepfile" 232 | exit $stat 233 | fi 234 | rm -f "$depfile" 235 | # Each line is of the form `foo.o: dependent.h', 236 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 237 | # Do two passes, one to just change these to 238 | # `$object: dependent.h' and one to simply `dependent.h:'. 239 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 240 | # Some versions of the HPUX 10.20 sed can't process this invocation 241 | # correctly. Breaking it into two sed invocations is a workaround. 242 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 243 | sed -e 's/$/ :/' >> "$depfile" 244 | rm -f "$tmpdepfile" 245 | ;; 246 | 247 | tru64) 248 | # The Tru64 compiler uses -MD to generate dependencies as a side 249 | # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 250 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 251 | # dependencies in `foo.d' instead, so we check for that too. 252 | # Subdirectories are respected. 253 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 254 | test "x$dir" = "x$object" && dir= 255 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 256 | 257 | if test "$libtool" = yes; then 258 | tmpdepfile1="$dir.libs/$base.lo.d" 259 | tmpdepfile2="$dir.libs/$base.d" 260 | "$@" -Wc,-MD 261 | else 262 | tmpdepfile1="$dir$base.o.d" 263 | tmpdepfile2="$dir$base.d" 264 | "$@" -MD 265 | fi 266 | 267 | stat=$? 268 | if test $stat -eq 0; then : 269 | else 270 | rm -f "$tmpdepfile1" "$tmpdepfile2" 271 | exit $stat 272 | fi 273 | 274 | if test -f "$tmpdepfile1"; then 275 | tmpdepfile="$tmpdepfile1" 276 | else 277 | tmpdepfile="$tmpdepfile2" 278 | fi 279 | if test -f "$tmpdepfile"; then 280 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 281 | # That's a space and a tab in the []. 282 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 283 | else 284 | echo "#dummy" > "$depfile" 285 | fi 286 | rm -f "$tmpdepfile" 287 | ;; 288 | 289 | #nosideeffect) 290 | # This comment above is used by automake to tell side-effect 291 | # dependency tracking mechanisms from slower ones. 292 | 293 | dashmstdout) 294 | # Important note: in order to support this mode, a compiler *must* 295 | # always write the proprocessed file to stdout, regardless of -o. 296 | "$@" || exit $? 297 | 298 | # Remove the call to Libtool. 299 | if test "$libtool" = yes; then 300 | while test $1 != '--mode=compile'; do 301 | shift 302 | done 303 | shift 304 | fi 305 | 306 | # Remove `-o $object'. 307 | IFS=" " 308 | for arg 309 | do 310 | case $arg in 311 | -o) 312 | shift 313 | ;; 314 | $object) 315 | shift 316 | ;; 317 | *) 318 | set fnord "$@" "$arg" 319 | shift # fnord 320 | shift # $arg 321 | ;; 322 | esac 323 | done 324 | 325 | test -z "$dashmflag" && dashmflag=-M 326 | # Require at least two characters before searching for `:' 327 | # in the target name. This is to cope with DOS-style filenames: 328 | # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 329 | "$@" $dashmflag | 330 | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 331 | rm -f "$depfile" 332 | cat < "$tmpdepfile" > "$depfile" 333 | tr ' ' ' 334 | ' < "$tmpdepfile" | \ 335 | ## Some versions of the HPUX 10.20 sed can't process this invocation 336 | ## correctly. Breaking it into two sed invocations is a workaround. 337 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 338 | rm -f "$tmpdepfile" 339 | ;; 340 | 341 | dashXmstdout) 342 | # This case only exists to satisfy depend.m4. It is never actually 343 | # run, as this mode is specially recognized in the preamble. 344 | exit 1 345 | ;; 346 | 347 | makedepend) 348 | "$@" || exit $? 349 | # Remove any Libtool call 350 | if test "$libtool" = yes; then 351 | while test $1 != '--mode=compile'; do 352 | shift 353 | done 354 | shift 355 | fi 356 | # X makedepend 357 | shift 358 | cleared=no 359 | for arg in "$@"; do 360 | case $cleared in 361 | no) 362 | set ""; shift 363 | cleared=yes ;; 364 | esac 365 | case "$arg" in 366 | -D*|-I*) 367 | set fnord "$@" "$arg"; shift ;; 368 | # Strip any option that makedepend may not understand. Remove 369 | # the object too, otherwise makedepend will parse it as a source file. 370 | -*|$object) 371 | ;; 372 | *) 373 | set fnord "$@" "$arg"; shift ;; 374 | esac 375 | done 376 | obj_suffix="`echo $object | sed 's/^.*\././'`" 377 | touch "$tmpdepfile" 378 | ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 379 | rm -f "$depfile" 380 | cat < "$tmpdepfile" > "$depfile" 381 | sed '1,2d' "$tmpdepfile" | tr ' ' ' 382 | ' | \ 383 | ## Some versions of the HPUX 10.20 sed can't process this invocation 384 | ## correctly. Breaking it into two sed invocations is a workaround. 385 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 386 | rm -f "$tmpdepfile" "$tmpdepfile".bak 387 | ;; 388 | 389 | cpp) 390 | # Important note: in order to support this mode, a compiler *must* 391 | # always write the proprocessed file to stdout. 392 | "$@" || exit $? 393 | 394 | # Remove the call to Libtool. 395 | if test "$libtool" = yes; then 396 | while test $1 != '--mode=compile'; do 397 | shift 398 | done 399 | shift 400 | fi 401 | 402 | # Remove `-o $object'. 403 | IFS=" " 404 | for arg 405 | do 406 | case $arg in 407 | -o) 408 | shift 409 | ;; 410 | $object) 411 | shift 412 | ;; 413 | *) 414 | set fnord "$@" "$arg" 415 | shift # fnord 416 | shift # $arg 417 | ;; 418 | esac 419 | done 420 | 421 | "$@" -E | 422 | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 423 | sed '$ s: \\$::' > "$tmpdepfile" 424 | rm -f "$depfile" 425 | echo "$object : \\" > "$depfile" 426 | cat < "$tmpdepfile" >> "$depfile" 427 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 428 | rm -f "$tmpdepfile" 429 | ;; 430 | 431 | msvisualcpp) 432 | # Important note: in order to support this mode, a compiler *must* 433 | # always write the proprocessed file to stdout, regardless of -o, 434 | # because we must use -o when running libtool. 435 | "$@" || exit $? 436 | IFS=" " 437 | for arg 438 | do 439 | case "$arg" in 440 | "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 441 | set fnord "$@" 442 | shift 443 | shift 444 | ;; 445 | *) 446 | set fnord "$@" "$arg" 447 | shift 448 | shift 449 | ;; 450 | esac 451 | done 452 | "$@" -E | 453 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 454 | rm -f "$depfile" 455 | echo "$object : \\" > "$depfile" 456 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 457 | echo " " >> "$depfile" 458 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 459 | rm -f "$tmpdepfile" 460 | ;; 461 | 462 | none) 463 | exec "$@" 464 | ;; 465 | 466 | *) 467 | echo "Unknown depmode $depmode" 1>&2 468 | exit 1 469 | ;; 470 | esac 471 | 472 | exit 0 473 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # install - install a program, script, or datafile 4 | # 5 | # This originates from X11R5 (mit/util/scripts/install.sh), which was 6 | # later released in X11R6 (xc/config/util/install.sh) with the 7 | # following copyright and license. 8 | # 9 | # Copyright (C) 1994 X Consortium 10 | # 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy 12 | # of this software and associated documentation files (the "Software"), to 13 | # deal in the Software without restriction, including without limitation the 14 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 15 | # sell copies of the Software, and to permit persons to whom the Software is 16 | # furnished to do so, subject to the following conditions: 17 | # 18 | # The above copyright notice and this permission notice shall be included in 19 | # all copies or substantial portions of the Software. 20 | # 21 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 25 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 26 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | # 28 | # Except as contained in this notice, the name of the X Consortium shall not 29 | # be used in advertising or otherwise to promote the sale, use or other deal- 30 | # ings in this Software without prior written authorization from the X Consor- 31 | # tium. 32 | # 33 | # 34 | # FSF changes to this file are in the public domain. 35 | # 36 | # Calling this script install-sh is preferred over install.sh, to prevent 37 | # `make' implicit rules from creating a file called install from it 38 | # when there is no Makefile. 39 | # 40 | # This script is compatible with the BSD install script, but was written 41 | # from scratch. It can only install one file at a time, a restriction 42 | # shared with many OS's install programs. 43 | 44 | 45 | # set DOITPROG to echo to test this script 46 | 47 | # Don't use :- since 4.3BSD and earlier shells don't like it. 48 | doit="${DOITPROG-}" 49 | 50 | 51 | # put in absolute paths if you don't have them in your path; or use env. vars. 52 | 53 | mvprog="${MVPROG-mv}" 54 | cpprog="${CPPROG-cp}" 55 | chmodprog="${CHMODPROG-chmod}" 56 | chownprog="${CHOWNPROG-chown}" 57 | chgrpprog="${CHGRPPROG-chgrp}" 58 | stripprog="${STRIPPROG-strip}" 59 | rmprog="${RMPROG-rm}" 60 | mkdirprog="${MKDIRPROG-mkdir}" 61 | 62 | transformbasename="" 63 | transform_arg="" 64 | instcmd="$mvprog" 65 | chmodcmd="$chmodprog 0755" 66 | chowncmd="" 67 | chgrpcmd="" 68 | stripcmd="" 69 | rmcmd="$rmprog -f" 70 | mvcmd="$mvprog" 71 | src="" 72 | dst="" 73 | dir_arg="" 74 | 75 | while [ x"$1" != x ]; do 76 | case $1 in 77 | -c) instcmd=$cpprog 78 | shift 79 | continue;; 80 | 81 | -d) dir_arg=true 82 | shift 83 | continue;; 84 | 85 | -m) chmodcmd="$chmodprog $2" 86 | shift 87 | shift 88 | continue;; 89 | 90 | -o) chowncmd="$chownprog $2" 91 | shift 92 | shift 93 | continue;; 94 | 95 | -g) chgrpcmd="$chgrpprog $2" 96 | shift 97 | shift 98 | continue;; 99 | 100 | -s) stripcmd=$stripprog 101 | shift 102 | continue;; 103 | 104 | -t=*) transformarg=`echo $1 | sed 's/-t=//'` 105 | shift 106 | continue;; 107 | 108 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'` 109 | shift 110 | continue;; 111 | 112 | *) if [ x"$src" = x ] 113 | then 114 | src=$1 115 | else 116 | # this colon is to work around a 386BSD /bin/sh bug 117 | : 118 | dst=$1 119 | fi 120 | shift 121 | continue;; 122 | esac 123 | done 124 | 125 | if [ x"$src" = x ] 126 | then 127 | echo "$0: no input file specified" >&2 128 | exit 1 129 | else 130 | : 131 | fi 132 | 133 | if [ x"$dir_arg" != x ]; then 134 | dst=$src 135 | src="" 136 | 137 | if [ -d "$dst" ]; then 138 | instcmd=: 139 | chmodcmd="" 140 | else 141 | instcmd=$mkdirprog 142 | fi 143 | else 144 | 145 | # Waiting for this to be detected by the "$instcmd $src $dsttmp" command 146 | # might cause directories to be created, which would be especially bad 147 | # if $src (and thus $dsttmp) contains '*'. 148 | 149 | if [ -f "$src" ] || [ -d "$src" ] 150 | then 151 | : 152 | else 153 | echo "$0: $src does not exist" >&2 154 | exit 1 155 | fi 156 | 157 | if [ x"$dst" = x ] 158 | then 159 | echo "$0: no destination specified" >&2 160 | exit 1 161 | else 162 | : 163 | fi 164 | 165 | # If destination is a directory, append the input filename; if your system 166 | # does not like double slashes in filenames, you may need to add some logic 167 | 168 | if [ -d "$dst" ] 169 | then 170 | dst=$dst/`basename "$src"` 171 | else 172 | : 173 | fi 174 | fi 175 | 176 | ## this sed command emulates the dirname command 177 | dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` 178 | 179 | # Make sure that the destination directory exists. 180 | # this part is taken from Noah Friedman's mkinstalldirs script 181 | 182 | # Skip lots of stat calls in the usual case. 183 | if [ ! -d "$dstdir" ]; then 184 | defaultIFS=' 185 | ' 186 | IFS="${IFS-$defaultIFS}" 187 | 188 | oIFS=$IFS 189 | # Some sh's can't handle IFS=/ for some reason. 190 | IFS='%' 191 | set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` 192 | IFS=$oIFS 193 | 194 | pathcomp='' 195 | 196 | while [ $# -ne 0 ] ; do 197 | pathcomp=$pathcomp$1 198 | shift 199 | 200 | if [ ! -d "$pathcomp" ] ; 201 | then 202 | $mkdirprog "$pathcomp" 203 | else 204 | : 205 | fi 206 | 207 | pathcomp=$pathcomp/ 208 | done 209 | fi 210 | 211 | if [ x"$dir_arg" != x ] 212 | then 213 | $doit $instcmd "$dst" && 214 | 215 | if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && 216 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && 217 | if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && 218 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi 219 | else 220 | 221 | # If we're going to rename the final executable, determine the name now. 222 | 223 | if [ x"$transformarg" = x ] 224 | then 225 | dstfile=`basename "$dst"` 226 | else 227 | dstfile=`basename "$dst" $transformbasename | 228 | sed $transformarg`$transformbasename 229 | fi 230 | 231 | # don't allow the sed command to completely eliminate the filename 232 | 233 | if [ x"$dstfile" = x ] 234 | then 235 | dstfile=`basename "$dst"` 236 | else 237 | : 238 | fi 239 | 240 | # Make a couple of temp file names in the proper directory. 241 | 242 | dsttmp=$dstdir/_inst.$$_ 243 | rmtmp=$dstdir/_rm.$$_ 244 | 245 | # Trap to clean up temp files at exit. 246 | 247 | trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 248 | trap '(exit $?); exit' 1 2 13 15 249 | 250 | # Move or copy the file name to the temp name 251 | 252 | $doit $instcmd "$src" "$dsttmp" && 253 | 254 | # and set any options; do chmod last to preserve setuid bits 255 | 256 | # If any of these fail, we abort the whole thing. If we want to 257 | # ignore errors from any of these, just make sure not to ignore 258 | # errors from the above "$doit $instcmd $src $dsttmp" command. 259 | 260 | if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && 261 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && 262 | if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && 263 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && 264 | 265 | # Now remove or move aside any old file at destination location. We try this 266 | # two ways since rm can't unlink itself on some systems and the destination 267 | # file might be busy for other reasons. In this case, the final cleanup 268 | # might fail but the new file should still install successfully. 269 | 270 | { 271 | if [ -f "$dstdir/$dstfile" ] 272 | then 273 | $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || 274 | $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || 275 | { 276 | echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 277 | (exit 1); exit 278 | } 279 | else 280 | : 281 | fi 282 | } && 283 | 284 | # Now rename the file to the real destination. 285 | 286 | $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" 287 | 288 | fi && 289 | 290 | # The final little trick to "correctly" pass the exit status to the exit trap. 291 | 292 | { 293 | (exit 0); exit 294 | } 295 | -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | 2 | /* license {{{ */ 3 | /* 4 | 5 | wmctrl 6 | A command line tool to interact with an EWMH/NetWM compatible X Window Manager. 7 | 8 | Author, current maintainer: Tomas Styblo 9 | 10 | Copyright (C) 2003 11 | 12 | This program is free software which I release under the GNU General Public 13 | License. You may redistribute and/or modify this program under the terms 14 | of that license as published by the Free Software Foundation; either 15 | version 2 of the License, or (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | To get a copy of the GNU General Puplic License, write to the 23 | Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | 25 | */ 26 | /* }}} */ 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #define _NET_WM_STATE_REMOVE 0 /* remove/unset property */ 40 | #define _NET_WM_STATE_ADD 1 /* add/set property */ 41 | #define _NET_WM_STATE_TOGGLE 2 /* toggle property */ 42 | 43 | /* help {{{ */ 44 | #define HELP "wmctrl " VERSION "\n" \ 45 | "Usage: wmctrl [OPTION]...\n" \ 46 | "Actions:\n" \ 47 | " -m Show information about the window manager and\n" \ 48 | " about the environment.\n" \ 49 | " -l List windows managed by the window manager.\n" \ 50 | " -d List desktops. The current desktop is marked\n" \ 51 | " with an asterisk.\n" \ 52 | " -s Switch to the specified desktop.\n" \ 53 | " -a Activate the window by switching to its desktop and\n" \ 54 | " raising it.\n" \ 55 | " -c Close the window gracefully.\n" \ 56 | " -R Move the window to the current desktop and\n" \ 57 | " activate it.\n" \ 58 | " -Y Iconify (minimize) the window.\n" \ 59 | " -r -t Move the window to the specified desktop.\n" \ 60 | " -r -e Resize and move the window around the desktop.\n" \ 61 | " The format of the argument is described below.\n" \ 62 | " -r -b Change the state of the window. Using this option it's\n" \ 63 | " possible for example to make the window maximized,\n" \ 64 | " shaded or fullscreen. The format of the \n" \ 65 | " argument and list of possible states is given below.\n" \ 66 | " -r -N Set the name (long title) of the window.\n" \ 67 | " -r -I Set the icon name (short title) of the window.\n" \ 68 | " -r -T Set both the name and the icon name of the window.\n" \ 69 | " -k (on|off) Activate or deactivate window manager's\n" \ 70 | " \"showing the desktop\" mode. Many window managers\n" \ 71 | " do not implement this mode.\n" \ 72 | " -o , Change the viewport for the current desktop.\n" \ 73 | " The X and Y values are separated with a comma.\n" \ 74 | " They define the top left corner of the viewport.\n" \ 75 | " The window manager may ignore the request.\n" \ 76 | " -n Change number of desktops.\n" \ 77 | " The window manager may ignore the request.\n" \ 78 | " -g , Change geometry (common size) of all desktops.\n" \ 79 | " The window manager may ignore the request.\n" \ 80 | " -h Print help.\n" \ 81 | "\n" \ 82 | "Options:\n" \ 83 | " -S List windows in stacking order (bottom to top).\n" \ 84 | " -i Interpret as a numerical window ID.\n" \ 85 | " -p Include PIDs in the window list. Very few\n" \ 86 | " X applications support this feature.\n" \ 87 | " -G Include geometry in the window list.\n" \ 88 | " -x Include WM_CLASS in the window list or\n" \ 89 | " interpret as the WM_CLASS name.\n" \ 90 | " -u Override auto-detection and force UTF-8 mode.\n" \ 91 | " -F Modifies the behavior of the window title matching\n" \ 92 | " algorithm. It will match only the full window title\n" \ 93 | " instead of a substring, when this option is used.\n" \ 94 | " Furthermore it makes the matching case sensitive.\n" \ 95 | " -v Be verbose. Useful for debugging.\n" \ 96 | " -w Use a workaround. The option may appear multiple\n" \ 97 | " times. List of available workarounds is given below.\n" \ 98 | "\n" \ 99 | "Arguments:\n" \ 100 | " This argument specifies the window. By default it's\n" \ 101 | " interpreted as a string. The string is matched\n" \ 102 | " against the window titles and the first matching\n" \ 103 | " window is used. The matching isn't case sensitive\n" \ 104 | " and the string may appear in any position\n" \ 105 | " of the title.\n" \ 106 | "\n" \ 107 | " The -i option may be used to interpret the argument\n" \ 108 | " as a numerical window ID represented as a decimal\n" \ 109 | " number. If it starts with \"0x\", then\n" \ 110 | " it will be interpreted as a hexadecimal number.\n" \ 111 | "\n" \ 112 | " The -x option may be used to interpret the argument\n" \ 113 | " as a string, which is matched against the window's\n" \ 114 | " class name (WM_CLASS property). Th first matching\n" \ 115 | " window is used. The matching isn't case sensitive\n" \ 116 | " and the string may appear in any position\n" \ 117 | " of the class name. So it's recommended to always use\n" \ 118 | " the -F option in conjunction with the -x option.\n" \ 119 | "\n" \ 120 | " The special string \":SELECT:\" (without the quotes)\n" \ 121 | " may be used to instruct wmctrl to let you select the\n" \ 122 | " window by clicking on it.\n" \ 123 | "\n" \ 124 | " The special string \":ACTIVE:\" (without the quotes)\n" \ 125 | " may be used to instruct wmctrl to use the currently\n" \ 126 | " active window for the action.\n" \ 127 | "\n" \ 128 | " A desktop number. Desktops are counted from zero.\n" \ 129 | "\n" \ 130 | " Specifies a change to the position and size\n" \ 131 | " of the window. The format of the argument is:\n" \ 132 | "\n" \ 133 | " ,,,,\n" \ 134 | "\n" \ 135 | " : Gravity specified as a number. The numbers are\n" \ 136 | " defined in the EWMH specification. The value of\n" \ 137 | " zero is particularly useful, it means \"use the\n" \ 138 | " default gravity of the window\".\n" \ 139 | " ,: Coordinates of new position of the window.\n" \ 140 | " ,: New width and height of the window.\n" \ 141 | "\n" \ 142 | " The value of -1 may appear in place of\n" \ 143 | " any of the , , and properties\n" \ 144 | " to left the property unchanged.\n" \ 145 | "\n" \ 146 | " Specifies a change to the state of the window\n" \ 147 | " by the means of _NET_WM_STATE request.\n" \ 148 | " This option allows two properties to be changed\n" \ 149 | " simultaneously, specifically to allow both\n" \ 150 | " horizontal and vertical maximization to be\n" \ 151 | " altered together.\n" \ 152 | "\n" \ 153 | " The format of the argument is:\n" \ 154 | "\n" \ 155 | " (remove|add|toggle),[,]\n" \ 156 | "\n" \ 157 | " The EWMH specification defines the\n" \ 158 | " following properties:\n" \ 159 | "\n" \ 160 | " modal, sticky, maximized_vert, maximized_horz,\n" \ 161 | " shaded, skip_taskbar, skip_pager, hidden,\n" \ 162 | " fullscreen, above, below\n" \ 163 | "\n" \ 164 | "Workarounds:\n" \ 165 | "\n" \ 166 | " DESKTOP_TITLES_INVALID_UTF8 Print non-ASCII desktop titles correctly\n" \ 167 | " when using Window Maker.\n" \ 168 | "\n" \ 169 | "The format of the window list:\n" \ 170 | "\n" \ 171 | " \n" \ 172 | "\n" \ 173 | "The format of the desktop list:\n" \ 174 | "\n" \ 175 | " [-*] \n" \ 176 | "\n" \ 177 | "\n" \ 178 | "Author, current maintainer: Tomas Styblo <tripie@cpan.org>\n" \ 179 | "Released under the GNU General Public License.\n" \ 180 | "Copyright (C) 2003\n" 181 | /* }}} */ 182 | 183 | #define MAX_PROPERTY_VALUE_LEN 4096 184 | #define SELECT_WINDOW_MAGIC ":SELECT:" 185 | #define ACTIVE_WINDOW_MAGIC ":ACTIVE:" 186 | 187 | #define p_verbose(...) if (options.verbose) { \ 188 | fprintf(stderr, __VA_ARGS__); \ 189 | } 190 | 191 | /* declarations of static functions *//*{{{*/ 192 | static gboolean wm_supports (Display *disp, const gchar *prop); 193 | static Window *get_client_list (Display *disp, unsigned long *size); 194 | static int client_msg(Display *disp, Window win, char *msg, 195 | unsigned long data0, unsigned long data1, 196 | unsigned long data2, unsigned long data3, 197 | unsigned long data4); 198 | static int list_windows (Display *disp); 199 | static int list_desktops (Display *disp); 200 | static int showing_desktop (Display *disp); 201 | static int change_viewport (Display *disp); 202 | static int change_geometry (Display *disp); 203 | static int change_number_of_desktops (Display *disp); 204 | static int switch_desktop (Display *disp); 205 | static int wm_info (Display *disp); 206 | static gchar *get_output_str (gchar *str, gboolean is_utf8); 207 | static int action_window (Display *disp, Window win, char mode); 208 | static int action_window_pid (Display *disp, char mode); 209 | static int action_window_str (Display *disp, char mode); 210 | static int activate_window (Display *disp, Window win, 211 | gboolean switch_desktop); 212 | static int close_window (Display *disp, Window win); 213 | static int longest_str (gchar **strv); 214 | static int window_to_desktop (Display *disp, Window win, int desktop); 215 | static void window_set_title (Display *disp, Window win, char *str, char mode); 216 | static gchar *get_window_title (Display *disp, Window win); 217 | static gchar *get_window_class (Display *disp, Window win); 218 | static gchar *get_property (Display *disp, Window win, 219 | Atom xa_prop_type, gchar *prop_name, unsigned long *size); 220 | static void init_charset(void); 221 | static int window_move_resize (Display *disp, Window win, char *arg); 222 | static int window_state (Display *disp, Window win, char *arg); 223 | static Window Select_Window(Display *dpy); 224 | static Window get_active_window(Display *dpy); 225 | 226 | /*}}}*/ 227 | 228 | static struct { 229 | int verbose; 230 | int force_utf8; 231 | int show_class; 232 | int show_pid; 233 | int show_geometry; 234 | int stacking_order; 235 | int match_by_id; 236 | int match_by_cls; 237 | int full_window_title_match; 238 | int wa_desktop_titles_invalid_utf8; 239 | char *param_window; 240 | char *param; 241 | } options; 242 | 243 | static gboolean envir_utf8; 244 | 245 | int main (int argc, char **argv) { /* {{{ */ 246 | int opt; 247 | int action = 0; 248 | int ret = EXIT_SUCCESS; 249 | int missing_option = 1; 250 | Display *disp; 251 | 252 | memset(&options, 0, sizeof(options)); /* just for sure */ 253 | 254 | /* necessary to make g_get_charset() and g_locale_*() work */ 255 | setlocale(LC_ALL, ""); 256 | 257 | /* make "--help" and "--version" work. I don't want to use 258 | * getopt_long for portability reasons */ 259 | if (argc == 2 && argv[1]) { 260 | if (strcmp(argv[1], "--help") == 0) { 261 | fputs(HELP, stdout); 262 | return EXIT_SUCCESS; 263 | } 264 | else if (strcmp(argv[1], "--version") == 0) { 265 | puts(VERSION); 266 | return EXIT_SUCCESS; 267 | } 268 | } 269 | 270 | while ((opt = getopt(argc, argv, "FGVvhSlupidmxa:r:s:c:t:w:k:o:n:g:e:b:N:I:T:R:Y:")) != -1) { 271 | missing_option = 0; 272 | switch (opt) { 273 | case 'F': 274 | options.full_window_title_match = 1; 275 | break; 276 | case 'S': 277 | options.stacking_order = 1; 278 | break; 279 | case 'G': 280 | options.show_geometry = 1; 281 | break; 282 | case 'i': 283 | options.match_by_id = 1; 284 | break; 285 | case 'v': 286 | options.verbose = 1; 287 | break; 288 | case 'u': 289 | options.force_utf8 = 1; 290 | break; 291 | case 'x': 292 | options.match_by_cls = 1; 293 | options.show_class = 1; 294 | break; 295 | case 'p': 296 | options.show_pid = 1; 297 | break; 298 | case 'a': case 'c': case 'R': case 'Y': 299 | options.param_window = optarg; 300 | action = opt; 301 | break; 302 | case 'r': 303 | options.param_window = optarg; 304 | break; 305 | case 't': case 'e': case 'b': case 'N': case 'I': case 'T': 306 | options.param = optarg; 307 | action = opt; 308 | break; 309 | case 's': 310 | options.param = optarg; 311 | action = opt; 312 | break; 313 | case 'w': 314 | if (strcmp(optarg, "DESKTOP_TITLES_INVALID_UTF8") == 0) { 315 | options.wa_desktop_titles_invalid_utf8 = 1; 316 | } 317 | else { 318 | fprintf(stderr, "Unknown workaround: %s\n", optarg); 319 | return EXIT_FAILURE; 320 | } 321 | break; 322 | case 'k': case 'o': case 'n': case 'g': 323 | options.param = optarg; 324 | action = opt; 325 | break; 326 | case '?': 327 | return EXIT_FAILURE; 328 | default: 329 | action = opt; 330 | } 331 | } 332 | 333 | if (missing_option) { 334 | fputs(HELP, stderr); 335 | return EXIT_FAILURE; 336 | } 337 | 338 | init_charset(); 339 | 340 | if (! (disp = XOpenDisplay(NULL))) { 341 | fputs("Cannot open display.\n", stderr); 342 | return EXIT_FAILURE; 343 | } 344 | 345 | switch (action) { 346 | case 'V': 347 | puts(VERSION); 348 | break; 349 | case 'h': 350 | fputs(HELP, stdout); 351 | break; 352 | case 'l': 353 | ret = list_windows(disp); 354 | break; 355 | case 'd': 356 | ret = list_desktops(disp); 357 | break; 358 | case 's': 359 | ret = switch_desktop(disp); 360 | break; 361 | case 'm': 362 | ret = wm_info(disp); 363 | break; 364 | case 'a': case 'c': case 'R': 365 | case 't': case 'e': case 'b': case 'N': case 'I': case 'T': case 'Y': 366 | if (! options.param_window) { 367 | fputs("No window was specified.\n", stderr); 368 | return EXIT_FAILURE; 369 | } 370 | if (options.match_by_id) { 371 | ret = action_window_pid(disp, action); 372 | } 373 | else { 374 | ret = action_window_str(disp, action); 375 | } 376 | break; 377 | case 'k': 378 | ret = showing_desktop(disp); 379 | break; 380 | case 'o': 381 | ret = change_viewport(disp); 382 | break; 383 | case 'n': 384 | ret = change_number_of_desktops(disp); 385 | break; 386 | case 'g': 387 | ret = change_geometry(disp); 388 | break; 389 | } 390 | 391 | XCloseDisplay(disp); 392 | return ret; 393 | } 394 | /* }}} */ 395 | 396 | static void init_charset (void) {/*{{{*/ 397 | const gchar *charset; /* unused */ 398 | gchar *lang = getenv("LANG") ? g_ascii_strup(getenv("LANG"), -1) : NULL; 399 | gchar *lc_ctype = getenv("LC_CTYPE") ? g_ascii_strup(getenv("LC_CTYPE"), -1) : NULL; 400 | 401 | /* this glib function doesn't work on my system ... */ 402 | envir_utf8 = g_get_charset(&charset); 403 | 404 | /* ... therefore we will examine the environment variables */ 405 | if (lc_ctype && (strstr(lc_ctype, "UTF8") || strstr(lc_ctype, "UTF-8"))) { 406 | envir_utf8 = TRUE; 407 | } 408 | else if (lang && (strstr(lang, "UTF8") || strstr(lang, "UTF-8"))) { 409 | envir_utf8 = TRUE; 410 | } 411 | 412 | g_free(lang); 413 | g_free(lc_ctype); 414 | 415 | if (options.force_utf8) { 416 | envir_utf8 = TRUE; 417 | } 418 | p_verbose("envir_utf8: %d\n", envir_utf8); 419 | }/*}}}*/ 420 | 421 | static int client_msg(Display *disp, Window win, char *msg, /* {{{ */ 422 | unsigned long data0, unsigned long data1, 423 | unsigned long data2, unsigned long data3, 424 | unsigned long data4) { 425 | XEvent event; 426 | long mask = SubstructureRedirectMask | SubstructureNotifyMask; 427 | 428 | event.xclient.type = ClientMessage; 429 | event.xclient.serial = 0; 430 | event.xclient.send_event = True; 431 | event.xclient.message_type = XInternAtom(disp, msg, False); 432 | event.xclient.window = win; 433 | event.xclient.format = 32; 434 | event.xclient.data.l[0] = data0; 435 | event.xclient.data.l[1] = data1; 436 | event.xclient.data.l[2] = data2; 437 | event.xclient.data.l[3] = data3; 438 | event.xclient.data.l[4] = data4; 439 | 440 | if (XSendEvent(disp, DefaultRootWindow(disp), False, mask, &event)) { 441 | return EXIT_SUCCESS; 442 | } 443 | else { 444 | fprintf(stderr, "Cannot send %s event.\n", msg); 445 | return EXIT_FAILURE; 446 | } 447 | }/*}}}*/ 448 | 449 | static gchar *get_output_str (gchar *str, gboolean is_utf8) {/*{{{*/ 450 | gchar *out; 451 | 452 | if (str == NULL) { 453 | return NULL; 454 | } 455 | 456 | if (envir_utf8) { 457 | if (is_utf8) { 458 | out = g_strdup(str); 459 | } 460 | else { 461 | if (! (out = g_locale_to_utf8(str, -1, NULL, NULL, NULL))) { 462 | p_verbose("Cannot convert string from locale charset to UTF-8.\n"); 463 | out = g_strdup(str); 464 | } 465 | } 466 | } 467 | else { 468 | if (is_utf8) { 469 | if (! (out = g_locale_from_utf8(str, -1, NULL, NULL, NULL))) { 470 | p_verbose("Cannot convert string from UTF-8 to locale charset.\n"); 471 | out = g_strdup(str); 472 | } 473 | } 474 | else { 475 | out = g_strdup(str); 476 | } 477 | } 478 | 479 | return out; 480 | }/*}}}*/ 481 | 482 | static int wm_info (Display *disp) {/*{{{*/ 483 | Window *sup_window = NULL; 484 | gchar *wm_name = NULL; 485 | gchar *wm_class = NULL; 486 | unsigned long *wm_pid = NULL; 487 | unsigned long *showing_desktop = NULL; 488 | gboolean name_is_utf8 = TRUE; 489 | gchar *name_out; 490 | gchar *class_out; 491 | 492 | if (! (sup_window = (Window *)get_property(disp, DefaultRootWindow(disp), 493 | XA_WINDOW, "_NET_SUPPORTING_WM_CHECK", NULL))) { 494 | if (! (sup_window = (Window *)get_property(disp, DefaultRootWindow(disp), 495 | XA_CARDINAL, "_WIN_SUPPORTING_WM_CHECK", NULL))) { 496 | fputs("Cannot get window manager info properties.\n" 497 | "(_NET_SUPPORTING_WM_CHECK or _WIN_SUPPORTING_WM_CHECK)\n", stderr); 498 | return EXIT_FAILURE; 499 | } 500 | } 501 | 502 | /* WM_NAME */ 503 | if (! (wm_name = get_property(disp, *sup_window, 504 | XInternAtom(disp, "UTF8_STRING", False), "_NET_WM_NAME", NULL))) { 505 | name_is_utf8 = FALSE; 506 | if (! (wm_name = get_property(disp, *sup_window, 507 | XA_STRING, "_NET_WM_NAME", NULL))) { 508 | p_verbose("Cannot get name of the window manager (_NET_WM_NAME).\n"); 509 | } 510 | } 511 | name_out = get_output_str(wm_name, name_is_utf8); 512 | 513 | /* WM_CLASS */ 514 | if (! (wm_class = get_property(disp, *sup_window, 515 | XInternAtom(disp, "UTF8_STRING", False), "WM_CLASS", NULL))) { 516 | name_is_utf8 = FALSE; 517 | if (! (wm_class = get_property(disp, *sup_window, 518 | XA_STRING, "WM_CLASS", NULL))) { 519 | p_verbose("Cannot get class of the window manager (WM_CLASS).\n"); 520 | } 521 | } 522 | class_out = get_output_str(wm_class, name_is_utf8); 523 | 524 | 525 | /* WM_PID */ 526 | if (! (wm_pid = (unsigned long *)get_property(disp, *sup_window, 527 | XA_CARDINAL, "_NET_WM_PID", NULL))) { 528 | p_verbose("Cannot get pid of the window manager (_NET_WM_PID).\n"); 529 | } 530 | 531 | /* _NET_SHOWING_DESKTOP */ 532 | if (! (showing_desktop = (unsigned long *)get_property(disp, DefaultRootWindow(disp), 533 | XA_CARDINAL, "_NET_SHOWING_DESKTOP", NULL))) { 534 | p_verbose("Cannot get the _NET_SHOWING_DESKTOP property.\n"); 535 | } 536 | 537 | /* print out the info */ 538 | printf("Name: %s\n", name_out ? name_out : "N/A"); 539 | printf("Class: %s\n", class_out ? class_out : "N/A"); 540 | 541 | if (wm_pid) { 542 | printf("PID: %lu\n", *wm_pid); 543 | } 544 | else { 545 | printf("PID: N/A\n"); 546 | } 547 | 548 | if (showing_desktop) { 549 | printf("Window manager's \"showing the desktop\" mode: %s\n", 550 | *showing_desktop == 1 ? "ON" : "OFF"); 551 | } 552 | else { 553 | printf("Window manager's \"showing the desktop\" mode: N/A\n"); 554 | } 555 | 556 | g_free(name_out); 557 | g_free(sup_window); 558 | g_free(wm_name); 559 | g_free(wm_class); 560 | g_free(wm_pid); 561 | g_free(showing_desktop); 562 | 563 | return EXIT_SUCCESS; 564 | }/*}}}*/ 565 | 566 | static int showing_desktop (Display *disp) {/*{{{*/ 567 | unsigned long state; 568 | 569 | if (strcmp(options.param, "on") == 0) { 570 | state = 1; 571 | } 572 | else if (strcmp(options.param, "off") == 0) { 573 | state = 0; 574 | } 575 | else { 576 | fputs("The argument to the -k option must be either \"on\" or \"off\"\n", stderr); 577 | return EXIT_FAILURE; 578 | } 579 | 580 | return client_msg(disp, DefaultRootWindow(disp), "_NET_SHOWING_DESKTOP", 581 | state, 0, 0, 0, 0); 582 | }/*}}}*/ 583 | 584 | static int change_viewport (Display *disp) {/*{{{*/ 585 | unsigned long x, y; 586 | const char *argerr = "The -o option expects two integers separated with a comma.\n"; 587 | 588 | if (sscanf(options.param, "%lu,%lu", &x, &y) == 2) { 589 | return client_msg(disp, DefaultRootWindow(disp), "_NET_DESKTOP_VIEWPORT", 590 | x, y, 0, 0, 0); 591 | } 592 | else { 593 | fputs(argerr, stderr); 594 | return EXIT_FAILURE; 595 | } 596 | }/*}}}*/ 597 | 598 | static int change_geometry (Display *disp) {/*{{{*/ 599 | unsigned long x, y; 600 | const char *argerr = "The -g option expects two integers separated with a comma.\n"; 601 | 602 | if (sscanf(options.param, "%lu,%lu", &x, &y) == 2) { 603 | return client_msg(disp, DefaultRootWindow(disp), "_NET_DESKTOP_GEOMETRY", 604 | x, y, 0, 0, 0); 605 | } 606 | else { 607 | fputs(argerr, stderr); 608 | return EXIT_FAILURE; 609 | } 610 | }/*}}}*/ 611 | 612 | static int change_number_of_desktops (Display *disp) {/*{{{*/ 613 | unsigned long n; 614 | 615 | if (sscanf(options.param, "%lu", &n) != 1) { 616 | fputs("The -n option expects an integer.\n", stderr); 617 | return EXIT_FAILURE; 618 | } 619 | 620 | return client_msg(disp, DefaultRootWindow(disp), "_NET_NUMBER_OF_DESKTOPS", 621 | n, 0, 0, 0, 0); 622 | }/*}}}*/ 623 | 624 | static int switch_desktop (Display *disp) {/*{{{*/ 625 | int target = -1; 626 | 627 | target = atoi(options.param); 628 | if (target == -1) { 629 | fputs("Invalid desktop ID.\n", stderr); 630 | return EXIT_FAILURE; 631 | } 632 | 633 | return client_msg(disp, DefaultRootWindow(disp), "_NET_CURRENT_DESKTOP", 634 | (unsigned long)target, 0, 0, 0, 0); 635 | }/*}}}*/ 636 | 637 | static void window_set_title (Display *disp, Window win, /* {{{ */ 638 | char *title, char mode) { 639 | gchar *title_utf8; 640 | gchar *title_local; 641 | 642 | if (envir_utf8) { 643 | title_utf8 = g_strdup(title); 644 | title_local = NULL; 645 | } 646 | else { 647 | if (! (title_utf8 = g_locale_to_utf8(title, -1, NULL, NULL, NULL))) { 648 | title_utf8 = g_strdup(title); 649 | } 650 | title_local = g_strdup(title); 651 | } 652 | 653 | if (mode == 'T' || mode == 'N') { 654 | /* set name */ 655 | if (title_local) { 656 | XChangeProperty(disp, win, XA_WM_NAME, XA_STRING, 8, PropModeReplace, 657 | title_local, strlen(title_local)); 658 | } 659 | else { 660 | XDeleteProperty(disp, win, XA_WM_NAME); 661 | } 662 | XChangeProperty(disp, win, XInternAtom(disp, "_NET_WM_NAME", False), 663 | XInternAtom(disp, "UTF8_STRING", False), 8, PropModeReplace, 664 | title_utf8, strlen(title_utf8)); 665 | } 666 | 667 | if (mode == 'T' || mode == 'I') { 668 | /* set icon name */ 669 | if (title_local) { 670 | XChangeProperty(disp, win, XA_WM_ICON_NAME, XA_STRING, 8, PropModeReplace, 671 | title_local, strlen(title_local)); 672 | } 673 | else { 674 | XDeleteProperty(disp, win, XA_WM_ICON_NAME); 675 | } 676 | XChangeProperty(disp, win, XInternAtom(disp, "_NET_WM_ICON_NAME", False), 677 | XInternAtom(disp, "UTF8_STRING", False), 8, PropModeReplace, 678 | title_utf8, strlen(title_utf8)); 679 | } 680 | 681 | g_free(title_utf8); 682 | g_free(title_local); 683 | 684 | }/*}}}*/ 685 | 686 | static int window_to_desktop (Display *disp, Window win, int desktop) {/*{{{*/ 687 | unsigned long *cur_desktop = NULL; 688 | Window root = DefaultRootWindow(disp); 689 | 690 | if (desktop == -1) { 691 | if (! (cur_desktop = (unsigned long *)get_property(disp, root, 692 | XA_CARDINAL, "_NET_CURRENT_DESKTOP", NULL))) { 693 | if (! (cur_desktop = (unsigned long *)get_property(disp, root, 694 | XA_CARDINAL, "_WIN_WORKSPACE", NULL))) { 695 | fputs("Cannot get current desktop properties. " 696 | "(_NET_CURRENT_DESKTOP or _WIN_WORKSPACE property)" 697 | "\n", stderr); 698 | return EXIT_FAILURE; 699 | } 700 | } 701 | desktop = *cur_desktop; 702 | } 703 | g_free(cur_desktop); 704 | 705 | return client_msg(disp, win, "_NET_WM_DESKTOP", (unsigned long)desktop, 706 | 0, 0, 0, 0); 707 | }/*}}}*/ 708 | 709 | static int activate_window (Display *disp, Window win, /* {{{ */ 710 | gboolean switch_desktop) { 711 | unsigned long *desktop; 712 | 713 | /* desktop ID */ 714 | if ((desktop = (unsigned long *)get_property(disp, win, 715 | XA_CARDINAL, "_NET_WM_DESKTOP", NULL)) == NULL) { 716 | if ((desktop = (unsigned long *)get_property(disp, win, 717 | XA_CARDINAL, "_WIN_WORKSPACE", NULL)) == NULL) { 718 | p_verbose("Cannot find desktop ID of the window.\n"); 719 | } 720 | } 721 | 722 | if (switch_desktop && desktop) { 723 | if (client_msg(disp, DefaultRootWindow(disp), 724 | "_NET_CURRENT_DESKTOP", 725 | *desktop, 0, 0, 0, 0) != EXIT_SUCCESS) { 726 | p_verbose("Cannot switch desktop.\n"); 727 | } 728 | g_free(desktop); 729 | } 730 | 731 | client_msg(disp, win, "_NET_ACTIVE_WINDOW", 732 | 0, 0, 0, 0, 0); 733 | XMapRaised(disp, win); 734 | 735 | return EXIT_SUCCESS; 736 | }/*}}}*/ 737 | 738 | static int iconify_window (Display *disp, Window win) {/* {{{ */ 739 | return !XIconifyWindow(disp, win, DefaultScreen(disp)); 740 | }/*}}}*/ 741 | 742 | static int close_window (Display *disp, Window win) {/*{{{*/ 743 | return client_msg(disp, win, "_NET_CLOSE_WINDOW", 744 | 0, 0, 0, 0, 0); 745 | }/*}}}*/ 746 | 747 | static gchar * normalize_wm_state_name(const char * name) 748 | { 749 | char * short_names[] = { 750 | "modal", "sticky", "maximized_vert", "maximized_horz", 751 | "shaded", "skip_taskbar", "skip_pager", "hidden", 752 | "fullscreen", "above", "below", 0}; 753 | 754 | int i; 755 | for (i = 0; short_names[i]; i++) 756 | { 757 | if (strcmp(short_names[i], name) == 0) 758 | { 759 | gchar * upcase = g_ascii_strup(name, -1); 760 | gchar * result = g_strdup_printf("_NET_WM_STATE_%s", upcase); 761 | g_free(upcase); 762 | return result; 763 | } 764 | } 765 | 766 | if (strcmp("undecorated", name) == 0) 767 | { 768 | return g_strdup("_OB_WM_STATE_UNDECORATED"); 769 | } 770 | 771 | return g_strdup(name); 772 | } 773 | 774 | static int window_state (Display *disp, Window win, char *arg) {/*{{{*/ 775 | unsigned long action; 776 | Atom prop1 = 0; 777 | Atom prop2 = 0; 778 | char *p1, *p2; 779 | const char *argerr = "The -b option expects a list of comma separated parameters: \"(remove|add|toggle),<PROP1>[,<PROP2>]\"\n"; 780 | 781 | if (!arg || strlen(arg) == 0) { 782 | fputs(argerr, stderr); 783 | return EXIT_FAILURE; 784 | } 785 | 786 | if ((p1 = strchr(arg, ','))) { 787 | gchar *tmp_prop1; 788 | 789 | *p1 = '\0'; 790 | 791 | /* action */ 792 | if (strcmp(arg, "remove") == 0) { 793 | action = _NET_WM_STATE_REMOVE; 794 | } 795 | else if (strcmp(arg, "add") == 0) { 796 | action = _NET_WM_STATE_ADD; 797 | } 798 | else if (strcmp(arg, "toggle") == 0) { 799 | action = _NET_WM_STATE_TOGGLE; 800 | } 801 | else { 802 | fputs("Invalid action. Use either remove, add or toggle.\n", stderr); 803 | return EXIT_FAILURE; 804 | } 805 | p1++; 806 | 807 | /* the second property */ 808 | if ((p2 = strchr(p1, ','))) { 809 | gchar *tmp_prop2; 810 | *p2 = '\0'; 811 | p2++; 812 | if (strlen(p2) == 0) { 813 | fputs("Invalid zero length property.\n", stderr); 814 | return EXIT_FAILURE; 815 | } 816 | tmp_prop2 = normalize_wm_state_name(p2); 817 | p_verbose("State 2: %s\n", tmp_prop2); 818 | prop2 = XInternAtom(disp, tmp_prop2, False); 819 | g_free(tmp_prop2); 820 | } 821 | 822 | /* the first property */ 823 | if (strlen(p1) == 0) { 824 | fputs("Invalid zero length property.\n", stderr); 825 | return EXIT_FAILURE; 826 | } 827 | tmp_prop1 = normalize_wm_state_name(p1); 828 | p_verbose("State 1: %s\n", tmp_prop1); 829 | prop1 = XInternAtom(disp, tmp_prop1, False); 830 | g_free(tmp_prop1); 831 | 832 | return client_msg(disp, win, "_NET_WM_STATE", 833 | action, (unsigned long)prop1, (unsigned long)prop2, 0, 0); 834 | } 835 | else { 836 | fputs(argerr, stderr); 837 | return EXIT_FAILURE; 838 | } 839 | }/*}}}*/ 840 | 841 | static gboolean wm_supports (Display *disp, const gchar *prop) {/*{{{*/ 842 | Atom xa_prop = XInternAtom(disp, prop, False); 843 | Atom *list; 844 | unsigned long size; 845 | int i; 846 | 847 | if (! (list = (Atom *)get_property(disp, DefaultRootWindow(disp), 848 | XA_ATOM, "_NET_SUPPORTED", &size))) { 849 | p_verbose("Cannot get _NET_SUPPORTED property.\n"); 850 | return FALSE; 851 | } 852 | 853 | for (i = 0; i < size / sizeof(Atom); i++) { 854 | if (list[i] == xa_prop) { 855 | g_free(list); 856 | return TRUE; 857 | } 858 | } 859 | 860 | g_free(list); 861 | return FALSE; 862 | }/*}}}*/ 863 | 864 | static int window_move_resize (Display *disp, Window win, char *arg) {/*{{{*/ 865 | signed long grav, x, y, w, h; 866 | unsigned long grflags; 867 | const char *argerr = "The -e option expects a list of comma separated integers: \"gravity,X,Y,width,height\"\n"; 868 | 869 | if (!arg || strlen(arg) == 0) { 870 | fputs(argerr, stderr); 871 | return EXIT_FAILURE; 872 | } 873 | 874 | if (sscanf(arg, "%ld,%ld,%ld,%ld,%ld", &grav, &x, &y, &w, &h) != 5) { 875 | fputs(argerr, stderr); 876 | return EXIT_FAILURE; 877 | } 878 | 879 | if (grav < 0) { 880 | fputs("Value of gravity mustn't be negative. Use zero to use the default gravity of the window.\n", stderr); 881 | return EXIT_FAILURE; 882 | } 883 | 884 | grflags = grav; 885 | if (x != -1) grflags |= (1 << 8); 886 | if (y != -1) grflags |= (1 << 9); 887 | if (w != -1) grflags |= (1 << 10); 888 | if (h != -1) grflags |= (1 << 11); 889 | 890 | p_verbose("grflags: %lu\n", grflags); 891 | 892 | if (wm_supports(disp, "_NET_MOVERESIZE_WINDOW")){ 893 | return client_msg(disp, win, "_NET_MOVERESIZE_WINDOW", 894 | grflags, (unsigned long)x, (unsigned long)y, (unsigned long)w, (unsigned long)h); 895 | } 896 | else { 897 | p_verbose("WM doesn't support _NET_MOVERESIZE_WINDOW. Gravity will be ignored.\n"); 898 | if ((w < 1 || h < 1) && (x >= 0 && y >= 0)) { 899 | XMoveWindow(disp, win, x, y); 900 | } 901 | else if ((x < 0 || y < 0) && (w >= 1 && h >= -1)) { 902 | XResizeWindow(disp, win, w, h); 903 | } 904 | else if (x >= 0 && y >= 0 && w >= 1 && h >= 1) { 905 | XMoveResizeWindow(disp, win, x, y, w, h); 906 | } 907 | return EXIT_SUCCESS; 908 | } 909 | }/*}}}*/ 910 | 911 | static int action_window (Display *disp, Window win, char mode) {/*{{{*/ 912 | p_verbose("Using window: 0x%.8lx\n", win); 913 | switch (mode) { 914 | case 'a': 915 | return activate_window(disp, win, TRUE); 916 | 917 | case 'Y': 918 | return iconify_window(disp, win); 919 | 920 | case 'c': 921 | return close_window(disp, win); 922 | 923 | case 'e': 924 | /* resize/move the window around the desktop => -r -e */ 925 | return window_move_resize(disp, win, options.param); 926 | 927 | case 'b': 928 | /* change state of a window => -r -b */ 929 | return window_state(disp, win, options.param); 930 | 931 | case 't': 932 | /* move the window to the specified desktop => -r -t */ 933 | return window_to_desktop(disp, win, atoi(options.param)); 934 | 935 | case 'R': 936 | /* move the window to the current desktop and activate it => -r */ 937 | if (window_to_desktop(disp, win, -1) == EXIT_SUCCESS) { 938 | usleep(100000); /* 100 ms - make sure the WM has enough 939 | time to move the window, before we activate it */ 940 | return activate_window(disp, win, FALSE); 941 | } 942 | else { 943 | return EXIT_FAILURE; 944 | } 945 | 946 | case 'N': case 'I': case 'T': 947 | window_set_title(disp, win, options.param, mode); 948 | return EXIT_SUCCESS; 949 | 950 | default: 951 | fprintf(stderr, "Unknown action: '%c'\n", mode); 952 | return EXIT_FAILURE; 953 | } 954 | }/*}}}*/ 955 | 956 | static int action_window_pid (Display *disp, char mode) {/*{{{*/ 957 | unsigned long wid; 958 | 959 | if (sscanf(options.param_window, "0x%lx", &wid) != 1 && 960 | sscanf(options.param_window, "0X%lx", &wid) != 1 && 961 | sscanf(options.param_window, "%lu", &wid) != 1) { 962 | fputs("Cannot convert argument to number.\n", stderr); 963 | return EXIT_FAILURE; 964 | } 965 | 966 | return action_window(disp, (Window)wid, mode); 967 | }/*}}}*/ 968 | 969 | static int action_window_str (Display *disp, char mode) {/*{{{*/ 970 | Window activate = 0; 971 | Window *client_list; 972 | unsigned long client_list_size; 973 | int i; 974 | 975 | if (strcmp(SELECT_WINDOW_MAGIC, options.param_window) == 0) { 976 | activate = Select_Window(disp); 977 | if (activate) { 978 | return action_window(disp, activate, mode); 979 | } 980 | else { 981 | return EXIT_FAILURE; 982 | } 983 | } 984 | if (strcmp(ACTIVE_WINDOW_MAGIC, options.param_window) == 0) { 985 | activate = get_active_window(disp); 986 | if (activate) 987 | { 988 | return action_window(disp, activate, mode); 989 | } 990 | else 991 | { 992 | return EXIT_FAILURE; 993 | } 994 | } 995 | else { 996 | if ((client_list = get_client_list(disp, &client_list_size)) == NULL) { 997 | return EXIT_FAILURE; 998 | } 999 | 1000 | for (i = 0; i < client_list_size / sizeof(Window); i++) { 1001 | gchar *match_utf8; 1002 | if (options.show_class) { 1003 | match_utf8 = get_window_class(disp, client_list[i]); /* UTF8 */ 1004 | } 1005 | else { 1006 | match_utf8 = get_window_title(disp, client_list[i]); /* UTF8 */ 1007 | } 1008 | if (match_utf8) { 1009 | gchar *match; 1010 | gchar *match_cf; 1011 | gchar *match_utf8_cf = NULL; 1012 | if (envir_utf8) { 1013 | match = g_strdup(options.param_window); 1014 | match_cf = g_utf8_casefold(options.param_window, -1); 1015 | } 1016 | else { 1017 | if (! (match = g_locale_to_utf8(options.param_window, -1, NULL, NULL, NULL))) { 1018 | match = g_strdup(options.param_window); 1019 | } 1020 | match_cf = g_utf8_casefold(match, -1); 1021 | } 1022 | 1023 | if (!match || !match_cf) { 1024 | continue; 1025 | } 1026 | 1027 | match_utf8_cf = g_utf8_casefold(match_utf8, -1); 1028 | 1029 | if ((options.full_window_title_match && strcmp(match_utf8, match) == 0) || 1030 | (!options.full_window_title_match && strstr(match_utf8_cf, match_cf))) { 1031 | activate = client_list[i]; 1032 | g_free(match); 1033 | g_free(match_cf); 1034 | g_free(match_utf8); 1035 | g_free(match_utf8_cf); 1036 | break; 1037 | } 1038 | g_free(match); 1039 | g_free(match_cf); 1040 | g_free(match_utf8); 1041 | g_free(match_utf8_cf); 1042 | } 1043 | } 1044 | g_free(client_list); 1045 | 1046 | if (activate) { 1047 | return action_window(disp, activate, mode); 1048 | } 1049 | else { 1050 | return EXIT_FAILURE; 1051 | } 1052 | } 1053 | }/*}}}*/ 1054 | 1055 | static int list_desktops (Display *disp) {/*{{{*/ 1056 | unsigned long *num_desktops = NULL; 1057 | unsigned long *cur_desktop = NULL; 1058 | unsigned long desktop_list_size = 0; 1059 | unsigned long *desktop_geometry = NULL; 1060 | unsigned long desktop_geometry_size = 0; 1061 | gchar **desktop_geometry_str = NULL; 1062 | unsigned long *desktop_viewport = NULL; 1063 | unsigned long desktop_viewport_size = 0; 1064 | gchar **desktop_viewport_str = NULL; 1065 | unsigned long *desktop_workarea = NULL; 1066 | unsigned long desktop_workarea_size = 0; 1067 | gchar **desktop_workarea_str = NULL; 1068 | gchar *list = NULL; 1069 | int i; 1070 | int id; 1071 | Window root = DefaultRootWindow(disp); 1072 | int ret = EXIT_FAILURE; 1073 | gchar **names = NULL; 1074 | gboolean names_are_utf8 = TRUE; 1075 | 1076 | if (! (num_desktops = (unsigned long *)get_property(disp, root, 1077 | XA_CARDINAL, "_NET_NUMBER_OF_DESKTOPS", NULL))) { 1078 | if (! (num_desktops = (unsigned long *)get_property(disp, root, 1079 | XA_CARDINAL, "_WIN_WORKSPACE_COUNT", NULL))) { 1080 | fputs("Cannot get number of desktops properties. " 1081 | "(_NET_NUMBER_OF_DESKTOPS or _WIN_WORKSPACE_COUNT)" 1082 | "\n", stderr); 1083 | goto cleanup; 1084 | } 1085 | } 1086 | 1087 | if (! (cur_desktop = (unsigned long *)get_property(disp, root, 1088 | XA_CARDINAL, "_NET_CURRENT_DESKTOP", NULL))) { 1089 | if (! (cur_desktop = (unsigned long *)get_property(disp, root, 1090 | XA_CARDINAL, "_WIN_WORKSPACE", NULL))) { 1091 | fputs("Cannot get current desktop properties. " 1092 | "(_NET_CURRENT_DESKTOP or _WIN_WORKSPACE property)" 1093 | "\n", stderr); 1094 | goto cleanup; 1095 | } 1096 | } 1097 | 1098 | if (options.wa_desktop_titles_invalid_utf8 || 1099 | (list = get_property(disp, root, 1100 | XInternAtom(disp, "UTF8_STRING", False), 1101 | "_NET_DESKTOP_NAMES", &desktop_list_size)) == NULL) { 1102 | names_are_utf8 = FALSE; 1103 | if ((list = get_property(disp, root, 1104 | XA_STRING, 1105 | "_WIN_WORKSPACE_NAMES", &desktop_list_size)) == NULL) { 1106 | p_verbose("Cannot get desktop names properties. " 1107 | "(_NET_DESKTOP_NAMES or _WIN_WORKSPACE_NAMES)" 1108 | "\n"); 1109 | /* ignore the error - list the desktops without names */ 1110 | } 1111 | } 1112 | 1113 | /* common size of all desktops */ 1114 | if (! (desktop_geometry = (unsigned long *)get_property(disp, DefaultRootWindow(disp), 1115 | XA_CARDINAL, "_NET_DESKTOP_GEOMETRY", &desktop_geometry_size))) { 1116 | p_verbose("Cannot get common size of all desktops (_NET_DESKTOP_GEOMETRY).\n"); 1117 | } 1118 | 1119 | /* desktop viewport */ 1120 | if (! (desktop_viewport = (unsigned long *)get_property(disp, DefaultRootWindow(disp), 1121 | XA_CARDINAL, "_NET_DESKTOP_VIEWPORT", &desktop_viewport_size))) { 1122 | p_verbose("Cannot get common size of all desktops (_NET_DESKTOP_VIEWPORT).\n"); 1123 | } 1124 | 1125 | /* desktop workarea */ 1126 | if (! (desktop_workarea = (unsigned long *)get_property(disp, DefaultRootWindow(disp), 1127 | XA_CARDINAL, "_NET_WORKAREA", &desktop_workarea_size))) { 1128 | if (! (desktop_workarea = (unsigned long *)get_property(disp, DefaultRootWindow(disp), 1129 | XA_CARDINAL, "_WIN_WORKAREA", &desktop_workarea_size))) { 1130 | p_verbose("Cannot get _NET_WORKAREA property.\n"); 1131 | } 1132 | } 1133 | 1134 | /* prepare the array of desktop names */ 1135 | names = g_malloc0(*num_desktops * sizeof(char *)); 1136 | if (list) { 1137 | id = 0; 1138 | names[id++] = list; 1139 | for (i = 0; i < desktop_list_size; i++) { 1140 | if (list[i] == '\0') { 1141 | if (id >= *num_desktops) { 1142 | break; 1143 | } 1144 | names[id++] = list + i + 1; 1145 | } 1146 | } 1147 | } 1148 | 1149 | /* prepare desktop geometry strings */ 1150 | desktop_geometry_str = g_malloc0((*num_desktops + 1) * sizeof(char *)); 1151 | if (desktop_geometry && desktop_geometry_size > 0) { 1152 | if (desktop_geometry_size == 2 * sizeof(*desktop_geometry)) { 1153 | /* only one value - use it for all desktops */ 1154 | p_verbose("WM provides _NET_DESKTOP_GEOMETRY value common for all desktops.\n"); 1155 | for (i = 0; i < *num_desktops; i++) { 1156 | desktop_geometry_str[i] = g_strdup_printf("%lux%lu", 1157 | desktop_geometry[0], desktop_geometry[1]); 1158 | } 1159 | } 1160 | else { 1161 | /* seperate values for desktops of different size */ 1162 | p_verbose("WM provides separate _NET_DESKTOP_GEOMETRY value for each desktop.\n"); 1163 | for (i = 0; i < *num_desktops; i++) { 1164 | if (i < desktop_geometry_size / sizeof(*desktop_geometry) / 2) { 1165 | desktop_geometry_str[i] = g_strdup_printf("%lux%lu", 1166 | desktop_geometry[i*2], desktop_geometry[i*2+1]); 1167 | } 1168 | else { 1169 | desktop_geometry_str[i] = g_strdup("N/A"); 1170 | } 1171 | } 1172 | } 1173 | } 1174 | else { 1175 | for (i = 0; i < *num_desktops; i++) { 1176 | desktop_geometry_str[i] = g_strdup("N/A"); 1177 | } 1178 | } 1179 | 1180 | /* prepare desktop viewport strings */ 1181 | desktop_viewport_str = g_malloc0((*num_desktops + 1) * sizeof(char *)); 1182 | if (desktop_viewport && desktop_viewport_size > 0) { 1183 | if (desktop_viewport_size == 2 * sizeof(*desktop_viewport)) { 1184 | /* only one value - use it for current desktop */ 1185 | p_verbose("WM provides _NET_DESKTOP_VIEWPORT value only for the current desktop.\n"); 1186 | for (i = 0; i < *num_desktops; i++) { 1187 | if (i == *cur_desktop) { 1188 | desktop_viewport_str[i] = g_strdup_printf("%lu,%lu", 1189 | desktop_viewport[0], desktop_viewport[1]); 1190 | } 1191 | else { 1192 | desktop_viewport_str[i] = g_strdup("N/A"); 1193 | } 1194 | } 1195 | } 1196 | else { 1197 | /* seperate values for each of desktops */ 1198 | for (i = 0; i < *num_desktops; i++) { 1199 | if (i < desktop_viewport_size / sizeof(*desktop_viewport) / 2) { 1200 | desktop_viewport_str[i] = g_strdup_printf("%lu,%lu", 1201 | desktop_viewport[i*2], desktop_viewport[i*2+1]); 1202 | } 1203 | else { 1204 | desktop_viewport_str[i] = g_strdup("N/A"); 1205 | } 1206 | } 1207 | } 1208 | } 1209 | else { 1210 | for (i = 0; i < *num_desktops; i++) { 1211 | desktop_viewport_str[i] = g_strdup("N/A"); 1212 | } 1213 | } 1214 | 1215 | /* prepare desktop workarea strings */ 1216 | desktop_workarea_str = g_malloc0((*num_desktops + 1) * sizeof(char *)); 1217 | if (desktop_workarea && desktop_workarea_size > 0) { 1218 | if (desktop_workarea_size == 4 * sizeof(*desktop_workarea)) { 1219 | /* only one value - use it for current desktop */ 1220 | p_verbose("WM provides _NET_WORKAREA value only for the current desktop.\n"); 1221 | for (i = 0; i < *num_desktops; i++) { 1222 | if (i == *cur_desktop) { 1223 | desktop_workarea_str[i] = g_strdup_printf("%lu,%lu %lux%lu", 1224 | desktop_workarea[0], desktop_workarea[1], 1225 | desktop_workarea[2], desktop_workarea[3]); 1226 | } 1227 | else { 1228 | desktop_workarea_str[i] = g_strdup("N/A"); 1229 | } 1230 | } 1231 | } 1232 | else { 1233 | /* seperate values for each of desktops */ 1234 | for (i = 0; i < *num_desktops; i++) { 1235 | if (i < desktop_workarea_size / sizeof(*desktop_workarea) / 4) { 1236 | desktop_workarea_str[i] = g_strdup_printf("%lu,%lu %lux%lu", 1237 | desktop_workarea[i*4], desktop_workarea[i*4+1], 1238 | desktop_workarea[i*4+2], desktop_workarea[i*4+3]); 1239 | } 1240 | else { 1241 | desktop_workarea_str[i] = g_strdup("N/A"); 1242 | } 1243 | } 1244 | } 1245 | } 1246 | else { 1247 | for (i = 0; i < *num_desktops; i++) { 1248 | desktop_workarea_str[i] = g_strdup("N/A"); 1249 | } 1250 | } 1251 | 1252 | /* print the list */ 1253 | for (i = 0; i < *num_desktops; i++) { 1254 | gchar *out = get_output_str(names[i], names_are_utf8); 1255 | printf("%-2d %c DG: %-*s VP: %-*s WA: %-*s %s\n", i, i == *cur_desktop ? '*' : '-', 1256 | longest_str(desktop_geometry_str), desktop_geometry_str[i], 1257 | longest_str(desktop_viewport_str), desktop_viewport_str[i], 1258 | longest_str(desktop_workarea_str), desktop_workarea_str[i], 1259 | out ? out : "N/A"); 1260 | g_free(out); 1261 | } 1262 | 1263 | p_verbose("Total number of desktops: %lu\n", *num_desktops); 1264 | p_verbose("Current desktop ID (counted from zero): %lu\n", *cur_desktop); 1265 | 1266 | ret = EXIT_SUCCESS; 1267 | goto cleanup; 1268 | 1269 | cleanup: 1270 | g_free(names); 1271 | g_free(num_desktops); 1272 | g_free(cur_desktop); 1273 | g_free(desktop_geometry); 1274 | g_strfreev(desktop_geometry_str); 1275 | g_free(desktop_viewport); 1276 | g_strfreev(desktop_viewport_str); 1277 | g_free(desktop_workarea); 1278 | g_strfreev(desktop_workarea_str); 1279 | g_free(list); 1280 | 1281 | return ret; 1282 | }/*}}}*/ 1283 | 1284 | static int longest_str (gchar **strv) {/*{{{*/ 1285 | int max = 0; 1286 | int i = 0; 1287 | 1288 | while (strv && strv[i]) { 1289 | if (strlen(strv[i]) > max) { 1290 | max = strlen(strv[i]); 1291 | } 1292 | i++; 1293 | } 1294 | 1295 | return max; 1296 | }/*}}}*/ 1297 | 1298 | static Window *get_client_list (Display *disp, unsigned long *size) {/*{{{*/ 1299 | Window *client_list = NULL; 1300 | char * msg = NULL; 1301 | 1302 | if (options.stacking_order) 1303 | { 1304 | msg = "_NET_CLIENT_LIST_STACKING"; 1305 | client_list = (Window *) get_property(disp, DefaultRootWindow(disp), 1306 | XA_WINDOW, "_NET_CLIENT_LIST_STACKING", size); 1307 | } 1308 | else 1309 | { 1310 | msg = "_NET_CLIENT_LIST or _WIN_CLIENT_LIST"; 1311 | client_list = (Window *)get_property(disp, DefaultRootWindow(disp), 1312 | XA_WINDOW, "_NET_CLIENT_LIST", size); 1313 | if (!client_list) 1314 | client_list = (Window *)get_property(disp, DefaultRootWindow(disp), 1315 | XA_CARDINAL, "_WIN_CLIENT_LIST", size); 1316 | } 1317 | 1318 | if (!client_list) 1319 | fprintf(stderr, "Cannot get client list properties.\n(%s)\n", msg); 1320 | 1321 | return client_list; 1322 | }/*}}}*/ 1323 | 1324 | static int list_windows (Display *disp) {/*{{{*/ 1325 | Window *client_list; 1326 | unsigned long client_list_size; 1327 | int i; 1328 | int max_client_machine_len = 0; 1329 | 1330 | if ((client_list = get_client_list(disp, &client_list_size)) == NULL) { 1331 | return EXIT_FAILURE; 1332 | } 1333 | 1334 | /* find the longest client_machine name */ 1335 | for (i = 0; i < client_list_size / sizeof(Window); i++) { 1336 | gchar *client_machine; 1337 | if ((client_machine = get_property(disp, client_list[i], 1338 | XA_STRING, "WM_CLIENT_MACHINE", NULL))) { 1339 | max_client_machine_len = strlen(client_machine); 1340 | } 1341 | g_free(client_machine); 1342 | } 1343 | 1344 | /* print the list */ 1345 | for (i = 0; i < client_list_size / sizeof(Window); i++) { 1346 | gchar *title_utf8 = get_window_title(disp, client_list[i]); /* UTF8 */ 1347 | gchar *title_out = get_output_str(title_utf8, TRUE); 1348 | gchar *client_machine; 1349 | gchar *class_out = get_window_class(disp, client_list[i]); /* UTF8 */ 1350 | unsigned long *pid; 1351 | unsigned long *desktop; 1352 | int x, y, junkx, junky; 1353 | unsigned int wwidth, wheight, bw, depth; 1354 | Window junkroot; 1355 | 1356 | /* desktop ID */ 1357 | if ((desktop = (unsigned long *)get_property(disp, client_list[i], 1358 | XA_CARDINAL, "_NET_WM_DESKTOP", NULL)) == NULL) { 1359 | desktop = (unsigned long *)get_property(disp, client_list[i], 1360 | XA_CARDINAL, "_WIN_WORKSPACE", NULL); 1361 | } 1362 | 1363 | /* client machine */ 1364 | client_machine = get_property(disp, client_list[i], 1365 | XA_STRING, "WM_CLIENT_MACHINE", NULL); 1366 | 1367 | /* pid */ 1368 | pid = (unsigned long *)get_property(disp, client_list[i], 1369 | XA_CARDINAL, "_NET_WM_PID", NULL); 1370 | 1371 | /* geometry */ 1372 | XGetGeometry (disp, client_list[i], &junkroot, &junkx, &junky, 1373 | &wwidth, &wheight, &bw, &depth); 1374 | XTranslateCoordinates (disp, client_list[i], junkroot, junkx, junky, 1375 | &x, &y, &junkroot); 1376 | 1377 | /* special desktop ID -1 means "all desktops", so we 1378 | have to convert the desktop value to signed long */ 1379 | printf("0x%.8lx %2ld", client_list[i], 1380 | desktop ? (signed long)*desktop : 0); 1381 | if (options.show_pid) { 1382 | printf(" %-6lu", pid ? *pid : 0); 1383 | } 1384 | if (options.show_geometry) { 1385 | printf(" %-4d %-4d %-4d %-4d", x, y, wwidth, wheight); 1386 | } 1387 | if (options.show_class) { 1388 | printf(" %-20s ", class_out ? class_out : "N/A"); 1389 | } 1390 | 1391 | printf(" %*s %s\n", 1392 | max_client_machine_len, 1393 | client_machine ? client_machine : "N/A", 1394 | title_out ? title_out : "N/A" 1395 | ); 1396 | g_free(title_utf8); 1397 | g_free(title_out); 1398 | g_free(desktop); 1399 | g_free(client_machine); 1400 | g_free(class_out); 1401 | g_free(pid); 1402 | } 1403 | g_free(client_list); 1404 | 1405 | return EXIT_SUCCESS; 1406 | }/*}}}*/ 1407 | 1408 | static gchar *get_window_class (Display *disp, Window win) {/*{{{*/ 1409 | gchar *class_utf8; 1410 | gchar *wm_class; 1411 | unsigned long size; 1412 | 1413 | wm_class = get_property(disp, win, XA_STRING, "WM_CLASS", &size); 1414 | if (wm_class) { 1415 | gchar *p_0 = strchr(wm_class, '\0'); 1416 | if (wm_class + size - 1 > p_0) { 1417 | *(p_0) = '.'; 1418 | } 1419 | class_utf8 = g_locale_to_utf8(wm_class, -1, NULL, NULL, NULL); 1420 | } 1421 | else { 1422 | class_utf8 = NULL; 1423 | } 1424 | 1425 | g_free(wm_class); 1426 | 1427 | return class_utf8; 1428 | }/*}}}*/ 1429 | 1430 | static gchar *get_window_title (Display *disp, Window win) {/*{{{*/ 1431 | gchar *title_utf8; 1432 | gchar *wm_name; 1433 | gchar *net_wm_name; 1434 | 1435 | wm_name = get_property(disp, win, XA_STRING, "WM_NAME", NULL); 1436 | net_wm_name = get_property(disp, win, 1437 | XInternAtom(disp, "UTF8_STRING", False), "_NET_WM_NAME", NULL); 1438 | 1439 | if (net_wm_name) { 1440 | title_utf8 = g_strdup(net_wm_name); 1441 | } 1442 | else { 1443 | if (wm_name) { 1444 | title_utf8 = g_locale_to_utf8(wm_name, -1, NULL, NULL, NULL); 1445 | } 1446 | else { 1447 | title_utf8 = NULL; 1448 | } 1449 | } 1450 | 1451 | g_free(wm_name); 1452 | g_free(net_wm_name); 1453 | 1454 | return title_utf8; 1455 | }/*}}}*/ 1456 | 1457 | static gchar *get_property (Display *disp, Window win, /*{{{*/ 1458 | Atom xa_prop_type, gchar *prop_name, unsigned long *size) { 1459 | Atom xa_prop_name; 1460 | Atom xa_ret_type; 1461 | int ret_format; 1462 | unsigned long ret_nitems; 1463 | unsigned long ret_bytes_after; 1464 | unsigned long tmp_size; 1465 | unsigned char *ret_prop; 1466 | gchar *ret; 1467 | 1468 | xa_prop_name = XInternAtom(disp, prop_name, False); 1469 | 1470 | /* MAX_PROPERTY_VALUE_LEN / 4 explanation (XGetWindowProperty manpage): 1471 | * 1472 | * long_length = Specifies the length in 32-bit multiples of the 1473 | * data to be retrieved. 1474 | * 1475 | * NOTE: see 1476 | * http://mail.gnome.org/archives/wm-spec-list/2003-March/msg00067.html 1477 | * In particular: 1478 | * 1479 | * When the X window system was ported to 64-bit architectures, a 1480 | * rather peculiar design decision was made. 32-bit quantities such 1481 | * as Window IDs, atoms, etc, were kept as longs in the client side 1482 | * APIs, even when long was changed to 64 bits. 1483 | * 1484 | */ 1485 | if (XGetWindowProperty(disp, win, xa_prop_name, 0, MAX_PROPERTY_VALUE_LEN / 4, False, 1486 | xa_prop_type, &xa_ret_type, &ret_format, 1487 | &ret_nitems, &ret_bytes_after, &ret_prop) != Success) { 1488 | p_verbose("Cannot get %s property.\n", prop_name); 1489 | return NULL; 1490 | } 1491 | 1492 | if (xa_ret_type != xa_prop_type) { 1493 | p_verbose("Invalid type of %s property.\n", prop_name); 1494 | XFree(ret_prop); 1495 | return NULL; 1496 | } 1497 | 1498 | /* null terminate the result to make string handling easier */ 1499 | tmp_size = (ret_format / 8) * ret_nitems; 1500 | /* Correct 64 Architecture implementation of 32 bit data */ 1501 | if(ret_format==32) tmp_size *= sizeof(long)/4; 1502 | ret = g_malloc(tmp_size + 1); 1503 | memcpy(ret, ret_prop, tmp_size); 1504 | ret[tmp_size] = '\0'; 1505 | 1506 | if (size) { 1507 | *size = tmp_size; 1508 | } 1509 | 1510 | XFree(ret_prop); 1511 | return ret; 1512 | }/*}}}*/ 1513 | 1514 | static Window Select_Window(Display *dpy) {/*{{{*/ 1515 | /* 1516 | * Routine to let user select a window using the mouse 1517 | * Taken from xfree86. 1518 | */ 1519 | 1520 | int status; 1521 | Cursor cursor; 1522 | XEvent event; 1523 | Window target_win = None, root = DefaultRootWindow(dpy); 1524 | int buttons = 0; 1525 | int dummyi; 1526 | unsigned int dummy; 1527 | 1528 | /* Make the target cursor */ 1529 | cursor = XCreateFontCursor(dpy, XC_crosshair); 1530 | 1531 | /* Grab the pointer using target cursor, letting it room all over */ 1532 | status = XGrabPointer(dpy, root, False, 1533 | ButtonPressMask|ButtonReleaseMask, GrabModeSync, 1534 | GrabModeAsync, root, cursor, CurrentTime); 1535 | if (status != GrabSuccess) { 1536 | fputs("ERROR: Cannot grab mouse.\n", stderr); 1537 | return 0; 1538 | } 1539 | 1540 | /* Let the user select a window... */ 1541 | while ((target_win == None) || (buttons != 0)) { 1542 | /* allow one more event */ 1543 | XAllowEvents(dpy, SyncPointer, CurrentTime); 1544 | XWindowEvent(dpy, root, ButtonPressMask|ButtonReleaseMask, &event); 1545 | switch (event.type) { 1546 | case ButtonPress: 1547 | if (target_win == None) { 1548 | target_win = event.xbutton.subwindow; /* window selected */ 1549 | if (target_win == None) target_win = root; 1550 | } 1551 | buttons++; 1552 | break; 1553 | case ButtonRelease: 1554 | if (buttons > 0) /* there may have been some down before we started */ 1555 | buttons--; 1556 | break; 1557 | } 1558 | } 1559 | 1560 | XUngrabPointer(dpy, CurrentTime); /* Done with pointer */ 1561 | 1562 | if (XGetGeometry (dpy, target_win, &root, &dummyi, &dummyi, 1563 | &dummy, &dummy, &dummy, &dummy) && target_win != root) { 1564 | target_win = XmuClientWindow (dpy, target_win); 1565 | } 1566 | 1567 | return(target_win); 1568 | }/*}}}*/ 1569 | 1570 | static Window get_active_window(Display *disp) {/*{{{*/ 1571 | char *prop; 1572 | unsigned long size; 1573 | Window ret = (Window)0; 1574 | 1575 | prop = get_property(disp, DefaultRootWindow(disp), XA_WINDOW, 1576 | "_NET_ACTIVE_WINDOW", &size); 1577 | if (prop) { 1578 | ret = *((Window*)prop); 1579 | g_free(prop); 1580 | } 1581 | 1582 | return(ret); 1583 | }/*}}}*/ 1584 | 1585 | 1586 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | # Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. 4 | # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 5 | 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2, or (at your option) 9 | # any later version. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | # 02111-1307, USA. 20 | 21 | # As a special exception to the GNU General Public License, if you 22 | # distribute this file as part of a program that contains a 23 | # configuration script generated by Autoconf, you may include it under 24 | # the same distribution terms that you use for the rest of that program. 25 | 26 | if test $# -eq 0; then 27 | echo 1>&2 "Try \`$0 --help' for more information" 28 | exit 1 29 | fi 30 | 31 | run=: 32 | 33 | # In the cases where this matters, `missing' is being run in the 34 | # srcdir already. 35 | if test -f configure.ac; then 36 | configure_ac=configure.ac 37 | else 38 | configure_ac=configure.in 39 | fi 40 | 41 | case "$1" in 42 | --run) 43 | # Try to run requested program, and just exit if it succeeds. 44 | run= 45 | shift 46 | "$@" && exit 0 47 | ;; 48 | esac 49 | 50 | # If it does not exist, or fails to run (possibly an outdated version), 51 | # try to emulate it. 52 | case "$1" in 53 | 54 | -h|--h|--he|--hel|--help) 55 | echo "\ 56 | $0 [OPTION]... PROGRAM [ARGUMENT]... 57 | 58 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 59 | error status if there is no known handling for PROGRAM. 60 | 61 | Options: 62 | -h, --help display this help and exit 63 | -v, --version output version information and exit 64 | --run try to run the given command, and emulate it if it fails 65 | 66 | Supported PROGRAM values: 67 | aclocal touch file \`aclocal.m4' 68 | autoconf touch file \`configure' 69 | autoheader touch file \`config.h.in' 70 | automake touch all \`Makefile.in' files 71 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 72 | flex create \`lex.yy.c', if possible, from existing .c 73 | help2man touch the output file 74 | lex create \`lex.yy.c', if possible, from existing .c 75 | makeinfo touch the output file 76 | tar try tar, gnutar, gtar, then tar without non-portable flags 77 | yacc create \`y.tab.[ch]', if possible, from existing .[ch]" 78 | ;; 79 | 80 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 81 | echo "missing 0.4 - GNU automake" 82 | ;; 83 | 84 | -*) 85 | echo 1>&2 "$0: Unknown \`$1' option" 86 | echo 1>&2 "Try \`$0 --help' for more information" 87 | exit 1 88 | ;; 89 | 90 | aclocal*) 91 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 92 | # We have it, but it failed. 93 | exit 1 94 | fi 95 | 96 | echo 1>&2 "\ 97 | WARNING: \`$1' is missing on your system. You should only need it if 98 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 99 | to install the \`Automake' and \`Perl' packages. Grab them from 100 | any GNU archive site." 101 | touch aclocal.m4 102 | ;; 103 | 104 | autoconf) 105 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 106 | # We have it, but it failed. 107 | exit 1 108 | fi 109 | 110 | echo 1>&2 "\ 111 | WARNING: \`$1' is missing on your system. You should only need it if 112 | you modified \`${configure_ac}'. You might want to install the 113 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 114 | archive site." 115 | touch configure 116 | ;; 117 | 118 | autoheader) 119 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 120 | # We have it, but it failed. 121 | exit 1 122 | fi 123 | 124 | echo 1>&2 "\ 125 | WARNING: \`$1' is missing on your system. You should only need it if 126 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 127 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 128 | from any GNU archive site." 129 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 130 | test -z "$files" && files="config.h" 131 | touch_files= 132 | for f in $files; do 133 | case "$f" in 134 | *:*) touch_files="$touch_files "`echo "$f" | 135 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 136 | *) touch_files="$touch_files $f.in";; 137 | esac 138 | done 139 | touch $touch_files 140 | ;; 141 | 142 | automake*) 143 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 144 | # We have it, but it failed. 145 | exit 1 146 | fi 147 | 148 | echo 1>&2 "\ 149 | WARNING: \`$1' is missing on your system. You should only need it if 150 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 151 | You might want to install the \`Automake' and \`Perl' packages. 152 | Grab them from any GNU archive site." 153 | find . -type f -name Makefile.am -print | 154 | sed 's/\.am$/.in/' | 155 | while read f; do touch "$f"; done 156 | ;; 157 | 158 | autom4te) 159 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 160 | # We have it, but it failed. 161 | exit 1 162 | fi 163 | 164 | echo 1>&2 "\ 165 | WARNING: \`$1' is needed, and you do not seem to have it handy on your 166 | system. You might have modified some files without having the 167 | proper tools for further handling them. 168 | You can get \`$1Help2man' as part of \`Autoconf' from any GNU 169 | archive site." 170 | 171 | file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 172 | test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 173 | if test -f "$file"; then 174 | touch $file 175 | else 176 | test -z "$file" || exec >$file 177 | echo "#! /bin/sh" 178 | echo "# Created by GNU Automake missing as a replacement of" 179 | echo "# $ $@" 180 | echo "exit 0" 181 | chmod +x $file 182 | exit 1 183 | fi 184 | ;; 185 | 186 | bison|yacc) 187 | echo 1>&2 "\ 188 | WARNING: \`$1' is missing on your system. You should only need it if 189 | you modified a \`.y' file. You may need the \`Bison' package 190 | in order for those modifications to take effect. You can get 191 | \`Bison' from any GNU archive site." 192 | rm -f y.tab.c y.tab.h 193 | if [ $# -ne 1 ]; then 194 | eval LASTARG="\${$#}" 195 | case "$LASTARG" in 196 | *.y) 197 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 198 | if [ -f "$SRCFILE" ]; then 199 | cp "$SRCFILE" y.tab.c 200 | fi 201 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 202 | if [ -f "$SRCFILE" ]; then 203 | cp "$SRCFILE" y.tab.h 204 | fi 205 | ;; 206 | esac 207 | fi 208 | if [ ! -f y.tab.h ]; then 209 | echo >y.tab.h 210 | fi 211 | if [ ! -f y.tab.c ]; then 212 | echo 'main() { return 0; }' >y.tab.c 213 | fi 214 | ;; 215 | 216 | lex|flex) 217 | echo 1>&2 "\ 218 | WARNING: \`$1' is missing on your system. You should only need it if 219 | you modified a \`.l' file. You may need the \`Flex' package 220 | in order for those modifications to take effect. You can get 221 | \`Flex' from any GNU archive site." 222 | rm -f lex.yy.c 223 | if [ $# -ne 1 ]; then 224 | eval LASTARG="\${$#}" 225 | case "$LASTARG" in 226 | *.l) 227 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 228 | if [ -f "$SRCFILE" ]; then 229 | cp "$SRCFILE" lex.yy.c 230 | fi 231 | ;; 232 | esac 233 | fi 234 | if [ ! -f lex.yy.c ]; then 235 | echo 'main() { return 0; }' >lex.yy.c 236 | fi 237 | ;; 238 | 239 | help2man) 240 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 241 | # We have it, but it failed. 242 | exit 1 243 | fi 244 | 245 | echo 1>&2 "\ 246 | WARNING: \`$1' is missing on your system. You should only need it if 247 | you modified a dependency of a manual page. You may need the 248 | \`Help2man' package in order for those modifications to take 249 | effect. You can get \`Help2man' from any GNU archive site." 250 | 251 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 252 | if test -z "$file"; then 253 | file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 254 | fi 255 | if [ -f "$file" ]; then 256 | touch $file 257 | else 258 | test -z "$file" || exec >$file 259 | echo ".ab help2man is required to generate this page" 260 | exit 1 261 | fi 262 | ;; 263 | 264 | makeinfo) 265 | if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then 266 | # We have makeinfo, but it failed. 267 | exit 1 268 | fi 269 | 270 | echo 1>&2 "\ 271 | WARNING: \`$1' is missing on your system. You should only need it if 272 | you modified a \`.texi' or \`.texinfo' file, or any other file 273 | indirectly affecting the aspect of the manual. The spurious 274 | call might also be the consequence of using a buggy \`make' (AIX, 275 | DU, IRIX). You might want to install the \`Texinfo' package or 276 | the \`GNU make' package. Grab either from any GNU archive site." 277 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 278 | if test -z "$file"; then 279 | file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 280 | file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 281 | fi 282 | touch $file 283 | ;; 284 | 285 | tar) 286 | shift 287 | if test -n "$run"; then 288 | echo 1>&2 "ERROR: \`tar' requires --run" 289 | exit 1 290 | fi 291 | 292 | # We have already tried tar in the generic part. 293 | # Look for gnutar/gtar before invocation to avoid ugly error 294 | # messages. 295 | if (gnutar --version > /dev/null 2>&1); then 296 | gnutar "$@" && exit 0 297 | fi 298 | if (gtar --version > /dev/null 2>&1); then 299 | gtar "$@" && exit 0 300 | fi 301 | firstarg="$1" 302 | if shift; then 303 | case "$firstarg" in 304 | *o*) 305 | firstarg=`echo "$firstarg" | sed s/o//` 306 | tar "$firstarg" "$@" && exit 0 307 | ;; 308 | esac 309 | case "$firstarg" in 310 | *h*) 311 | firstarg=`echo "$firstarg" | sed s/h//` 312 | tar "$firstarg" "$@" && exit 0 313 | ;; 314 | esac 315 | fi 316 | 317 | echo 1>&2 "\ 318 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 319 | You may want to install GNU tar or Free paxutils, or check the 320 | command line arguments." 321 | exit 1 322 | ;; 323 | 324 | *) 325 | echo 1>&2 "\ 326 | WARNING: \`$1' is needed, and you do not seem to have it handy on your 327 | system. You might have modified some files without having the 328 | proper tools for further handling them. Check the \`README' file, 329 | it often tells you about the needed prerequirements for installing 330 | this package. You may also peek at any GNU archive site, in case 331 | some other package would contain this missing \`$1' program." 332 | exit 1 333 | ;; 334 | esac 335 | 336 | exit 0 337 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman <friedman@prep.ai.mit.edu> 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | errstatus=0 8 | dirmode="" 9 | 10 | usage="\ 11 | Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." 12 | 13 | # process command line arguments 14 | while test $# -gt 0 ; do 15 | case $1 in 16 | -h | --help | --h*) # -h for help 17 | echo "$usage" 1>&2 18 | exit 0 19 | ;; 20 | -m) # -m PERM arg 21 | shift 22 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 23 | dirmode=$1 24 | shift 25 | ;; 26 | --) # stop option processing 27 | shift 28 | break 29 | ;; 30 | -*) # unknown option 31 | echo "$usage" 1>&2 32 | exit 1 33 | ;; 34 | *) # first non-opt arg 35 | break 36 | ;; 37 | esac 38 | done 39 | 40 | for file 41 | do 42 | if test -d "$file"; then 43 | shift 44 | else 45 | break 46 | fi 47 | done 48 | 49 | case $# in 50 | 0) exit 0 ;; 51 | esac 52 | 53 | case $dirmode in 54 | '') 55 | if mkdir -p -- . 2>/dev/null; then 56 | echo "mkdir -p -- $*" 57 | exec mkdir -p -- "$@" 58 | fi 59 | ;; 60 | *) 61 | if mkdir -m "$dirmode" -p -- . 2>/dev/null; then 62 | echo "mkdir -m $dirmode -p -- $*" 63 | exec mkdir -m "$dirmode" -p -- "$@" 64 | fi 65 | ;; 66 | esac 67 | 68 | for file 69 | do 70 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 71 | shift 72 | 73 | pathcomp= 74 | for d 75 | do 76 | pathcomp="$pathcomp$d" 77 | case $pathcomp in 78 | -*) pathcomp=./$pathcomp ;; 79 | esac 80 | 81 | if test ! -d "$pathcomp"; then 82 | echo "mkdir $pathcomp" 83 | 84 | mkdir "$pathcomp" || lasterr=$? 85 | 86 | if test ! -d "$pathcomp"; then 87 | errstatus=$lasterr 88 | else 89 | if test ! -z "$dirmode"; then 90 | echo "chmod $dirmode $pathcomp" 91 | lasterr="" 92 | chmod "$dirmode" "$pathcomp" || lasterr=$? 93 | 94 | if test ! -z "$lasterr"; then 95 | errstatus=$lasterr 96 | fi 97 | fi 98 | fi 99 | fi 100 | 101 | pathcomp="$pathcomp/" 102 | done 103 | done 104 | 105 | exit $errstatus 106 | 107 | # Local Variables: 108 | # mode: shell-script 109 | # sh-indentation: 2 110 | # End: 111 | # mkinstalldirs ends here 112 | -------------------------------------------------------------------------------- /wmctrl.1: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .TH WMCTRL 1 "December 12, 2004" 3 | 4 | .SH NAME 5 | wmctrl \- interact with a EWMH/NetWM compatible X Window Manager. 6 | .SH SYNOPSIS 7 | .B wmctrl 8 | .RI [ " options " | " actions " ] ... 9 | 10 | 11 | .SH DESCRIPTION 12 | .B wmctrl 13 | is a command that can be used to interact with an X Window manager 14 | that is compatible with the EWMH/NetWM specification. 15 | .B wmctrl 16 | can query the window manager for information, and it can request 17 | that certain window management actions be taken. 18 | 19 | .PP 20 | .B wmctrl 21 | is controlled entirely by its command line arguments. The command line 22 | arguments are used to specify the action to be performed (with options 23 | that modify behavior) and any arguments that might be needed to 24 | perform the actions. 25 | 26 | .PP 27 | The following sections define the supported actions and 28 | options. Arguments to the actions and options are written in the form 29 | .I <ARGNAME> 30 | in the descriptions below. The detailed syntax for writing arguments 31 | are in a single section dedicated to that purpose. 32 | 33 | 34 | 35 | .SH ACTIONS 36 | The following command line arguments can be specified to invoke a 37 | .B wmctrl 38 | action. Only one action can be executed with the invocation of the 39 | .B wmctrl 40 | command. 41 | 42 | .TP 43 | .BI \-a " <WIN>" 44 | Switch to the desktop containing the window 45 | .IR <WIN> , 46 | raise the window, and give it focus. 47 | 48 | .TP 49 | .BI "\-b ( add | remove | toggle)," prop1 " [," prop2 " ]" 50 | Add, remove, or toggle up to two window properties simultaneously. The 51 | window that is being modified must be identified with a 52 | .B \-r 53 | action. The 54 | property change is achived by using the EWMH _NET_WM_STATE 55 | request. The supported property names (for 56 | .IR prop1 " and " prop2 ) 57 | are 58 | .nh 59 | .BR modal ", " sticky ", " maximized_vert ", " maximized_horz , 60 | .BR shaded ", " skip_taskbar ", " skip_pager ", " hidden , 61 | .BR fullscreen ", " above " and " below . 62 | .ny 63 | Two properties are supported to allow operations like maximizing a 64 | window to full screen mode. Note that this action is made up of 65 | exactly two shell command line arguments. 66 | 67 | 68 | .TP 69 | .BI \-c " <WIN>" 70 | Close the window 71 | .I <WIN> 72 | gracefully. 73 | 74 | .TP 75 | .BI \-Y " <WIN>" 76 | Iconify the window 77 | .I <WIN> 78 | \[char46] 79 | 80 | .TP 81 | .B \-d 82 | List all desktops managed by the window manager. One line is output 83 | for each desktop, with the line broken up into space separated 84 | columns. The first column contains an integer desktop number. The 85 | second column contains a '*' character for the current desktop, 86 | otherwise it contains a '\-' character. The next two columns contain the 87 | fixed string 88 | .B "DG:" 89 | and then the desktop geometry as 90 | .RI ' <width> "x" <height> ' 91 | (\fIe.g.\fR '1280x1024'). The following two columns contain the fixed 92 | string 93 | .B "VP:" 94 | and then the viewport position in the format 95 | .RI ' <y> , <y> ' 96 | (\fIe.g.\fR '0,0'). The next three columns after this contains the 97 | fixed string 98 | .B "WA:" 99 | and then two columns with the workarea geometry as 100 | .RI ' X , Y " and " W x H ' 101 | (\fIe.g.\fR '0,0 1280x998'). The rest of the line contains the name of 102 | the desktop (possibly containing multiple spaces). 103 | 104 | .TP 105 | .BI \-e " <MVARG>" 106 | Resize and move a window that has been specified with a 107 | .B \-r 108 | action according to the 109 | .I <MVARG> 110 | argument. 111 | 112 | .TP 113 | .BI \-g " w" , h 114 | Change the geometry (common size) of all desktops so they are 115 | .IR w " pixels wide and " h " pixels high. " w " and " h 116 | must be positive integers. A window manager may ignore this request. 117 | 118 | .TP 119 | .B \-h 120 | Print help text about program usage. 121 | 122 | .TP 123 | .BI \-I " name" 124 | Set the icon name (short title) of the window specified by a 125 | .B \-r 126 | action to 127 | .IR name . 128 | 129 | .TP 130 | .B \-k " (" on " | " off " )" 131 | Turn on or off the window manager's "show the desktop" mode (if the 132 | window manager implements this feature). 133 | 134 | .TP 135 | .B \-l 136 | List the windows being managed by the window manager. One line is 137 | output for each window, with the line broken up into space separated 138 | columns. The first column always contains the window identity as a 139 | hexadecimal integer, and the second column always contains the desktop 140 | number (a \-1 is used to identify a sticky window). If the 141 | .B \-p 142 | option is specified the next column will contain the PID for the 143 | window as a decimal integer. If the 144 | .B \-G 145 | option is specified then four integer columns will follow: x-offset, 146 | y-offset, width and height. The next column always contains the client 147 | machine name. The remainder of the line contains the window title 148 | (possibly with multiple spaces in the title). 149 | 150 | .TP 151 | .B \-m 152 | Display information about the window manager and the environment. 153 | 154 | .TP 155 | .BI \-n " N" 156 | Change the number of desktops to 157 | .IR N 158 | (a non-negative integer). 159 | 160 | .TP 161 | .BI \-N " name" 162 | Set the name (long title) of the window specified by a 163 | .B \-r 164 | action to 165 | .IR name . 166 | 167 | 168 | .TP 169 | .BI \-o " x" , y 170 | Change the viewport for the current desktop. The values 171 | .IR x " and " y 172 | are numeric offsets that specify the position of the top left corner 173 | of the viewport. A window manager may ignore this request. 174 | 175 | .TP 176 | .BI \-r " <WIN>" 177 | Specify a target window for an action. 178 | 179 | .TP 180 | .BI \-R " <WIN>" 181 | Move the window 182 | .I <WIN> 183 | to the current desktop, raise the window, and give it focus. 184 | 185 | .TP 186 | .BI \-s " <DESK>" 187 | Switch to the desktop 188 | .IR <DESK> . 189 | 190 | .TP 191 | .BI \-t " <DESK>" 192 | Move a window that has been specified with the 193 | .B \-r 194 | action to the desktop \fI<DESK>\fR. 195 | 196 | .TP 197 | .BI \-T " name" 198 | Set the both the name (long title) and icon name (short title) of the 199 | window specified by a 200 | .B \-r 201 | action to 202 | .IR name . 203 | This action is like using the 204 | .BR \-N " and " \-I 205 | actions at the same time (which would otherwise be impossible since 206 | .B wmctrl 207 | can execute only one action at a time). 208 | 209 | 210 | .SH OPTIONS 211 | The following options modify the default actions, or they modify the 212 | interpretation of arguments. 213 | 214 | .TP 215 | .B \-F 216 | Window name arguments 217 | .RI ( <WIN> ) 218 | are to be treated as exact window titles that are case 219 | sensitive. Without this options window titles are considered to be 220 | case insensitive substrings of the full window title. 221 | 222 | .TP 223 | .B \-G 224 | Include geometry information in the output of the 225 | .B \-l 226 | action. 227 | 228 | .TP 229 | .B \-S 230 | List windows in stacking order (bottom to top). 231 | 232 | .TP 233 | .B \-i 234 | Interpret window arguments 235 | .RI ( <WIN> ) 236 | as a numeric value rather than a 237 | string name for the window. If the numeric value starts with the 238 | prefix '0x' it is assumed to be a hexadecimal number. 239 | 240 | .TP 241 | .B \-p 242 | Include PIDs in the window list printed by the 243 | .B \-l 244 | action. Prints a PID of '0' if the application owning the window does 245 | not support it. 246 | 247 | .TP 248 | .B \-u 249 | Override auto-detection and force UTF-8 mode. 250 | 251 | .TP 252 | .B \-v 253 | Provide verbose output. This is really useful when debugging 254 | .B wmctrl 255 | itself. 256 | 257 | .TP 258 | .BI \-w " [ <WORKAROUND>[,<WORKAROUND>]... ]" 259 | Use workarounds specified in the argument. 260 | 261 | .TP 262 | .B \-x 263 | Include WM_CLASS in the window list or interpret <WIN> as the WM_CLASS name. 264 | 265 | 266 | .SH ARGUMENTS 267 | 268 | .TP 269 | .I <DESK> 270 | A Desktop is always specified by an integer which represents the 271 | desktop numbers. Desktop numbers start at 0. 272 | 273 | .TP 274 | .I <MVARG> 275 | A move and resize argument has the format 276 | .BI ' g , x , y, w , h '. 277 | All five components are integers. The first value, 278 | .IR g , 279 | is the gravity of the window, with 0 being the most common value (the 280 | default value for the window). Please see the EWMH specification for 281 | other values. 282 | .IP 283 | The four remaining values are a standard geometry specification: 284 | .IB x , y 285 | is the position of the top left corner of the window, and 286 | .IB w , h 287 | is the width and height of the window, with the exception that the 288 | value of \-1 in any position is interpreted to mean that the current 289 | geometry value should not be modified. 290 | 291 | 292 | .TP 293 | .I <WIN> 294 | This argument specifies a window that is the target of an action. By 295 | default the argument is treated as if were a string, and windows are 296 | examined until one is found with a title the contains the specified 297 | string as a substring. The substring matching is done in a case 298 | insensitive manner. The 299 | .B \-F 300 | option may be used to force exact, case sensitive title matching. The 301 | option 302 | .B \-i 303 | may be used to interpret the window target as a numeric window 304 | identity instead of a string. 305 | .IP 306 | The window name string 307 | .B :SELECT: 308 | is treated specially. If this window name is used then 309 | .B wmctrl 310 | waits for the user to select the target window by clicking on it. 311 | .IP 312 | The window name string 313 | .B :ACTIVE: 314 | may be used to instruct 315 | .B wmctrl 316 | to use the currently active window for the action. 317 | 318 | 319 | .TP 320 | .I <WORKAROUND> 321 | There is only one work around currently implemeted. It is specified by 322 | using the string 323 | .B DESKTOP_TITLES_INVALID_UTF8 324 | and it causes the printing of non-ASCII desktop tiles correctly when 325 | using Window Maker. 326 | 327 | 328 | 329 | .SH EXAMPLES 330 | .PP 331 | Getting a list of windows managed by the window manager 332 | .IP 333 | wmctrl -l 334 | .PP 335 | Getting a list of windows with PID and geometry information. 336 | .IP 337 | wmctrl -p -G -l 338 | .PP 339 | Going to the window with a name containing 'emacs' in it 340 | .IP 341 | wmctrl -a emacs 342 | .PP 343 | Shade a window with a title that contains the word 'mozilla' 344 | .IP 345 | wmctrl -r mozilla -b add,shaded 346 | .PP 347 | Close a very specifically titled window sticky 348 | .IP 349 | wmctrl -F -c 'Debian bug tracking system - Mozilla' 350 | .PP 351 | Toggle the 'stickiness' of a window with a specific window identity 352 | .IP 353 | wmctrl -i -r 0x0120002 -b add,sticky 354 | .PP 355 | Change the title of window to a specified string but choose the window 356 | by clicking on it 357 | .IP 358 | wmctrl -r :SELECT: -T "Selected Window" 359 | .SH SEE ALSO 360 | .BR zenity (1) 361 | is a useful dialog program for building scripts with 362 | .BR wmctrl . 363 | .PP 364 | Some examples of EWMH/NetWM compatible window managers include recent 365 | versions of Enlightenment, Icewm, Kwin, Sawfish and Xfce. 366 | .SH AUTHOR 367 | wmctrl was written by Tomas Styblo <tripie@cpan.org>. 368 | .PP 369 | This manual page was written by Shyamal Prasad <shyamal@member.fsf.org> 370 | for the Debian project (but may be used by others). 371 | --------------------------------------------------------------------------------