Linuxデスクトップ環境でウィンドウをタイリングする
概要
GNOMEはウィンドウを右端に持って行くと、ウィンドウが画面全体の右半分にタイリングされるようになっているが、このようなウィンドウのタイリングを他のデスクトップ環境でも使いたいときがある。その方法を紹介する。
方法
quicktileをダウンロードし、 次のように必要なパッケージを揃える:
sudo apt-get install python python-gtk2 python-xlib python-dbus python-wnck
quicktile.pyを実行すれば、Ctrl+Altを押しながらテンキーの6を押すと、アクティブなウィンドウが画面全体の右半分へタイリングされる。
quicktile.pyの初回起動時にデフォルトの設定ファイル~/.config/quicktile.cfgが作成されている:
[general] cfg_schema = 1 UseWorkarea = True ModMask = <Ctrl><Alt> [keys] C = move-to-center H = horizontal-maximize V = vertical-maximize KP_0 = maximize KP_1 = bottom-left KP_2 = bottom KP_3 = bottom-right KP_4 = left KP_5 = middle KP_6 = right KP_7 = top-left KP_8 = top KP_9 = top-right KP_Enter = monitor-switch
[general]のModMaskが先ほどのCtrl+Altに相当するキー設定で、[keys]にModMaskを押しながら各キーを押した時の動作が設定されている。
quicktile.pyをデーモン化して実行するには、--deamonizeオプションをつける:
quicktile.py --daemonize
ウィンドウマネージャ起動時に、デーモン化したquicktile.pyを実行するように設定して、次回ログイン時から自動的にタイリング機能を有効にするようにすると良いだろう。
Openboxの場合
ウィンドウマネージャにOpenboxを使っている場合、
~/.config/openbox/rc.xml
を設定することでウィンドウのタイリングおよびそのキーバインディングを設定できる[2]。
デスクトップ環境LXDEを使っている場合は標準ではウィンドウマネージャはOpenboxであり、同じく~/.config/openbox/で設定ができる。 特にlubuntuを使っている場合には~/.config/openbox/lubuntu-rc.xmlが設定ファイルとなっていて、以下の箇所でウィンドウのタイリングにWindowsキー+カーソルキーを割り当てている:
<?xml version="1.0" encoding="UTF-8"?> <!-- Do not edit this file, it will be overwritten on install. Copy the file to $HOME/.config/openbox/ instead. --> <openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude"> ... <keyboard> ... <!-- Keybindings for window tiling --> <keybind key="W-Left"> # HalfLeftScreen <action name="UnmaximizeFull"/> <action name="MoveResizeTo"> <x>0</x> <y>0</y> <height>100%</height> <width>50%</width> </action> </keybind> <keybind key="W-Right"> # HalfRightScreen <action name="UnmaximizeFull"/> <action name="MoveResizeTo"> <x>-0</x> <y>0</y> <height>100%</height> <width>50%</width> </action> </keybind> <keybind key="W-Up"> # HalfUpperScreen <action name="UnmaximizeFull"/> <action name="MoveResizeTo"> <x>0</x> <y>0</y> <width>100%</width> <height>50%</height> </action> </keybind> <keybind key="W-Down"> # HalfLowerScreen <action name="UnmaximizeFull"/> <action name="MoveResizeTo"> <x>0</x> <y>-0</y> <width>100%</width> <height>50%</height> </action> </keybind> ...
なお、デフォルトでは右・左半分にした時の高さが97%になっていたのが気に入らなかったので100%にした。
xfce4
xfconf-query -c xfwm4 -p /general/wrap_windows -s false
References
- ↑ Tiling window manager functionality for normal Linux desktop environments - Software Recommendations Stack Exchange
- ↑ Aero Snap in Openbox (Page 1) / CrunchBang Talk / CrunchBang Linux Forums http://crunchbang.org/forums/viewtopic.php?id=13968
- ↑ Automatically size windows using Xfce like in gnome - Ask Ubuntu http://askubuntu.com/questions/103456/automatically-size-windows-using-xfce-like-in-gnome