/winmess

WinGrid-antiX like shell scripts for smart placing and resizing the active window under X11.

Primary LanguageShellThe UnlicenseUnlicense

About The WinMess

WinGrid-antiX like shell scripts for smart placing and resizing the active window under X11.

I usually place app windows in the same positions. Text editors, terminal emulators, the browser (when is not full screen)---they all take up different but repetitive positions and sizes. I use keyboard to launch them from Fluxbox main menu and don't want touch the mouse.

WinGrid-antiX is a good but not ideal solution for me. I want to see Rox icons and Conky on my wide 1920x1080 monitor. I want place the browser some what centered and wider than terminal emulator also centered somehow.

So WinMess here for this. It place active window exactly where it instructed by config script (winmess.conf file).

But why not use...

Why not use the window manager commands, right? In that case it's hard to experiment: you must reconfigure Fluxbox any time you change the keys file. Keys file does not allow you to define a variable or function for reuse in multiple keybindings. Keybinding definitions differs from one window manager to another. If you have found some interesting placement scheme, you cannot just send it to a friend by email: it may need to be adopted to his WM. And last but not least, placement hints can be automatically generated by some other utilities (wich I or others could write in the future).

Prerequisites

x11-utils package for

  • xdpyinfo
  • xwininfo

wmcrtl package for

  • wmctrl

yad package for

  • yad

Some Unix classics must be available...

  • awk (from gawk or mawk package)
  • fmt
  • sed
  • tr

Installation

  1. Clone the repo.
    git clone https://github.com/zblsv/winmess.git
  2. Read all the code for security holes, fatal errors, performance glitches.
  3. Install into the Home (recomended).
    . install.sh
    Or into the Dark Home (preferred).
    . install.sh ~/.local
    Or into the system (not recomended).
    sudo . install.sh /usr/local
    ME=$(whoami)
    sudo chown $ME:$ME $HOME/.config/winmess.conf

How to update to latest version

Use git to fetch from the origin. See details here: Getting changes from a remote repository

Update to current HEAD.

git pull

Then switch to specific release if needed.

git tag -l
git checkout tags/0.1.0

How to uninstall

Remember where you have installed WinMess (The Home, The Dark Home, The System...).

. uninstall.sh

Or

. uninstall.sh ~/.local

Or

sudo . uninstall.sh /usr/local

Usage

In ~/.config/winmess.conf define your placement hints. Some examples given.

winmess.conf is a bash script. So all the bash syntax is valid.

The hint is a string value in the HINT map of the form
"x:$X y:$Y w:$W h:$H"
where $X and $Y are the left and top edges of the window in pixels. $W and $H are its windth and height.

You assign an arbitrary name to this string. Let's say, the "T" hint for narrow center area of my 1920x1080 monitor, for instance. Then

HINT[T]="x:350 y:0 w:1100 h:1010"

defines this placement.

Now you can run

~/bin/winmess-place T

in a terminal emulator and its window will be adjusted accordingly.

To guess this values, place a window in desired position with the mouse then run ~/bin/winmess-dim utility in terminal. Click the window. winmess-dim will show the hint string and screen dimentions.

Define hotkeys that winmess-place will run with your window manager. I use Fluxbox on antiX Linux. In my ~/.fluxbox/keys is:

!winmess
Mod5 0 :ExecCommand $HOME/bin/winmess-place T
Mod5 1 :ExecCommand $HOME/bin/winmess-place L0
Mod5 2 :ExecCommand $HOME/bin/winmess-place R0
Mod5 9 :ExecCommand $HOME/bin/winmess-place W

Don't forget to add $HOME/bin or ~/bin if you install to the Home (or ~/.local/bin if you install there).

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Any contributions you make are greatly appreciated.

  1. Fork the Project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your Changes (git commit -m 'Add some AmazingFeature').
  4. Push to the Branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

License

Distributed under The Unlicense. See LICENSE file.

Contact

Sergei Zyablov, zblsv.

Project Home: https://github.com/zblsv/winmess

Acknowledgements

WinMess is inspired by awesome WinGrid-antiX scripts from antiX Linux.