Openbox - Arch Linux 中文维基

跳至內容

# Openbox

出自 Arch Linux 中文维基
翻譯狀態：

- 本文（或部分內容）譯自 Openbox，最近一次同步於 2021-07-24，若英文版本有所更改，則您可以幫助同步與翻譯更改的內容。
- 您可以在 ArchWiki 的對應頁面找到本文翻譯的原始修訂歷史。
- 本文可能與英文原文存在出入。

本文或本節需要翻譯。要貢獻翻譯，請訪問簡體中文翻譯團隊。

附註： 原文已同步更新翻譯未完成. Unfinished translation started 2021-07-23.（在 Talk:Openbox# 中討論）

相關文章

- 桌面環境
- 顯示管理器
- 窗口管理器
- File manager functionality
- Xdg-menu
- Oblogout

Openbox 是一個輕量、強大且高度可定製的堆疊式窗口管理器，它支持大量擴展標準。它可以單獨作為某個桌面環境的一個基礎組件獨立構建和運行，也可以集成於其它桌面環境如KDE或Xfce中，作為備選窗口管理器。LXDE和LXQt桌面環境則是基於Openbox構建而成。

## 安裝

只需安裝openbox包軟體包。也可以安裝TTF字體，如ttf-dejavu包和ttf-liberation包。

## 啟動

### 單獨運行

通過 xinit 運行 `openbox` 或者 `openbox-session` 。 注意只有 `openbox-session` 支持 #自動啟動.

注意：執行openbox-session後,屏幕上只會出現灰色的空白界面。 嘗試移動你的滑鼠並右鍵單擊 ，如果顯示一個Openbox菜單，說明它真的在工作了。

### 其它桌面環境

注意：

- 如果你把一個 桌面環境 的原有窗口管理器替換為 Openbox，請記住 Openbox 不會提供任何的混成特效 (比如透明度)。 請參閱 #混成特效.
- Openbox可以與GNOME應用程式一起工作(見GTK#Client-side decorations). [1]

請參閱桌面環境#使用其它窗口管理器。

## 配置

注意：本地配置文件總是會覆蓋全局配置。

四個關鍵文件構成了 openbox配置的基礎，每個文件都有其獨特的作用。它們分別是： `rc.xml`, `menu.xml`, `autostart`, 和 `environment`。 儘管這些文件將在下面進行更詳細的討論，但要開始配置Openbox，首先需要基於它們創建一個本地 Openbox 配置文件 (即針對您特定的用戶帳戶) 。 這可以通過從全局的 `/etc/xdg/openbox` 配置文件中複製它們作為模板來完成 (適用於任何和所有用戶):

    $ mkdir -p ~/.config/openbox
    $ cp -a /etc/xdg/openbox/ ~/.config/

### rc.xml

提示：自定義鍵盤快捷鍵 (鍵綁定) 必須添加到此文件的 `<keyboard>` 部分， 並在 `<!-- Keybindings for running aplications -->` 標題下方添加。

`~/.config/openbox/rc.xml` 是主要的配置文件，負責確定整個會話的行為和設置，其中包括：

- 鍵盤快捷鍵 (e.g. starting applications; controlling the volume)
- 主題
- 桌面和虛擬桌面設置
- 應用程式窗口設置

該文件也是預配置的，這意味著只需要修改現有內容就可以根據個人喜好自定義行為。

注意：僅當定義了 x 和 y 位置時，與每個監視器上的應用程式固定放置相關的每個應用程式的特定設置才能生效。

### menu.xml

`~/.config/openbox/menu.xml` 定義了桌面菜單的類型和行為，可以通過右鍵單擊背景訪問。 儘管提供的默認菜單是一個靜態菜單 (即在安裝新應用程式時不會自動更新), 但也有可能使用動態菜單，它們將自動更新。

在 #菜單部分下面詳細討論了可用的選項。

### 自動啟動

`openbox-session` 提供了兩種自動啟動機制： XDG Autostart (僅在安裝了 python-pyxdg包 時可用) 和 Openbox's own autostart mechanism.

Openbox 自己的自動啟動機制：

- 來源 `/etc/xdg/openbox/environment`
- 來源 `~/.config/openbox/environment`
- 運行 `/etc/xdg/openbox/autostart`
- 運行 `~/.config/openbox/autostart`

解決`~/.config/openbox/autostart` 中命令順序執行錯誤（或者被跳過）的問題通常可以通過增加小的延遲來解決。例如：

    xset -b
    (sleep 3s && nm-applet) &
    (sleep 3s && conky) &

### 環境

`~/.config/openbox/environment` 可以用於導出和設置相關的環境變量，例如：

- 定義新的路徑（例如執行需要將整個路徑列出的命令）
- 更改語言設置
- 定義其他要使用的變量（例如，可以在此處列出對於GTK主題的修復）

### 主題

安裝 obconf包 和/或 lxappearance-obconf包 ，用於配置視覺設置和主題的圖形界面。

可以在 openbox-themesAUR 軟體包或 AUR 中找到大量精選的主題。一些 GTK#Themes 也附帶了Openbox主題。 安裝時，Openbox特定和兼容的主題將被安裝到 `/usr/share/themes` 目錄，並且可以立即選擇使用。

box-look.org 是一個優秀且歷史悠久的主題資源網站。

deviantART.com 是另一個優秀的資源網站。在網上還可以找到更多的資源。

#### 編輯或創建

提示：對於主題，最好將其複製到您的主目錄而不是編輯在 `/usr/share/themes/`中找到的主題。這樣做可以在出現任何問題時保留原始文件，並確保在更新時不會被覆蓋您所做的更改。

在官方的 openbox.org 網站上有詳細介紹創建新主題或修改現有主題的過程。obthemeAUR 是一個用戶友好的圖形界面工具，用於進行這些操作。

### 圖形界面配置

有幾個圖形界面應用程式可供選擇，可以快速簡便地配置您的Openbox桌面環境。

- ObConf — 一個基於GTK3的配置工具，用於Openbox窗口管理器。

  http://openbox.org/wiki/ObConf:About || obconf包

- LXAppearance ObConf — 這是一個用於配置Openbox的LXAppearance插件。請注意，該插件並不提供所有用於配置Openbox的選項，因此您可能仍然需要安裝obconf來完成配置。

  https://lxde.org || lxappearance-obconf包

- LXInput — LXDE鍵盤和滑鼠配置。

  https://lxde.org || lxinput包

- LXRandR — LXDE顯示器配置。

  https://wiki.lxde.org/en/LXRandR[失效連結 2022-09-22 ⓘ] || lxrandr包

- obkey — 配置Openbox的鍵盤快捷鍵。

  https://code.google.com/p/obkey/ || obkeyAUR

- obapps — Openbox中用於配置應用程式設置的圖形化工具。

  https://sourceforge.net/projects/obapps/ || obappsAUR

在 #菜單部分討論與配置Openbox桌面菜單相關的程序和應用程式。

## 重新配置Openbox

提示：如果還沒有，為了方便起見，值得將此命令添加到菜單和/或鍵綁定中。

Openbox並不總是會在會話中自動反映對其配置文件所做的更改。因此，在編輯完配置文件之後，需要手動重新加載這些文件。要執行此操作，請輸入以下命令：

    $ openbox --reconfigure

打算將此命令作為鍵綁定添加到 `~/.config/openbox/rc.xml` ， 將命令列為 `reconfigure` 即可。 以下是一個示例，使用 `Super`+`F11` 鍵綁定：

    <keybind key="W-F11">
      <action name="Reconfigure"/>
    </keybind>

## 鍵綁定

所有鍵綁定都必須添加到 `~/.config/openbox/rc.xml` 文件中，並放置在 `<!-- Keybindings for running aplications -->` 標題下方。然在這裡提供了簡要概述，但更詳細的鍵綁定說明可以在openbox.org 網站上找到。

鍵綁定可以使用以下語法添加到配置文件中：

    <keybind key="my-key-combination">
      <action name="my-action">
        ...
      </action>
    </keybind>

執行外部命令的操作名稱是Execute。使用以下語法來定義要執行的外部命令：

    <action name="Execute">
      <command>my-command</command>
    </action>

請參閱 the Openbox wiki 以獲取所有可用操作的列表。

提示：obkeyAUR 實用程序提供了一個圖形界面來配置按鍵綁定。在使用 obkey 之前，您應該使用 obconf 來創建 `~/.config/openbox/rc.xml` 文件。

對於鍵位綁定，使用標準的字母數字鍵是很直觀的，但其他類型的鍵，如 `modifiers`， `multimedia` 和 `navigation`，會分配特殊的名稱。

### 組合鍵

`Modifier` 鍵在鍵綁定中起著重要作用（例如，按住。`shift` 鍵 或 `CTRL / control` 與其他鍵組合以執行某項操作）。使用修飾鍵有助於防止衝突的鍵綁定，即將兩個或多個操作連結到同一個鍵或鍵組合。使用修飾鍵與其他鍵結合的語法是：

    "<modifier>-<key>"

修飾符代碼如下：

- `S`: Shift
- `C`: Control / CTRL
- `A`: Alt
- `W`: Super / Windows
- `M`: Meta
- `H`: Hyper (如果它綁定到某個東西上)

### 多媒體鍵

在可用的情況下，可以設置適當的 `multimedia` 鍵來執行其預期的功能，例如控制音量和/或屏幕亮度。 這些通常會集成到 `function` 中，並通過相應的符號進行標識。請參見 Extra keyboard keys 獲取更多信息。

音量和亮度的多媒體代碼如下（請注意，命令仍然需要分配給它們才能實際發揮作用）:

- `XF86AudioRaiseVolume`: 增加音量
- `XF86AudioLowerVolume`: 減小音量
- `XF86AudioMute`: 靜音/取消靜音
- `XF86MonBrightnessUp`: 增加屏幕亮度
- `XF86MonBrightnessDown`: 降低屏幕亮度

要查看完整的XF86多媒體鍵列表，請參閱 LQWiki:XF86 keyboard symbols。

#### 音量控制

控制音量所使用的命令取決於音頻播放系統是使用 ALSA，PulseAudio，還是 OSS。

- ALSA: 請參閱 Advanced Linux Sound Architecture#Keyboard volume control.
- PulseAudio: 請參閱 PulseAudio#Keyboard volume control
- OSS: 請參閱 Open Sound System#Keyboard volume control.

### 導航鍵

這些是方向/箭頭鍵，通常用於將光標向上、向下、向左或向右移動。以下是（自說明的）導航代碼：

- `Up`: 上
- `Down`: 下
- `Left`: 左
- `Right`: 右

## 菜單

在Openbox中，有三種類型的菜單可供選擇使用： `static`，`pipes` (動態) 和 `generators` (靜態或動態). 這些菜單可以單獨使用，也可以組合使用。

### 靜態菜單

As the name would suggest, this default type of menu does not change in any way, and may be manually edited and/or (re)generated automatically through the use on an appropriate software package.

Fast and efficient, while this type of menu can be used to select applications, it can also be useful to access specific functions and/or perform specific tasks (e.g. desktop configuration), leaving the access of applications to another process (e.g. the synapse包 or xfce4-appfinder包 applications).

The `~/.config/openbox/menu.xml` file will be the sole source of static desktop menu content.

#### 菜單生成器

menumaker包 automatically generates `xml` menus for several window managers, including Openbox, Fluxbox, IceWM and Xfce. It will search for all installed executable programs and consequently create a menu file for them. It is also possible to configure MenuMaker to exclude certain application types (e.g. relating to GNOME or KDE), if desired.

Once installed and executed, it will automatically generate a new `~/.config/openbox/menu.xml` file. To avoid overwriting an existing file, enter:

    $ mmaker -v OpenBox3

Otherwise, to overwrite an existing file, add the `force` argument (`f`):

    $ mmaker -vf OpenBox3

Once a new `~/.config/openbox/menu.xml` file has been generated it may then be manually edited, or configured using a GUI menu editor, such as obmenuAUR.

#### obmenu

警告：`obm-xdg` - a pipe menu to generate a list of GTK and GNOME applications - is also provided with obmenu. However, it has long-running bugs whereby it may produce an invalid output, or even not function at all. Consequently it has been omitted from discussion.

obmenuAUR is a "user-friendly" GUI application to edit `~/.config/openbox/menu.xml`, without the need to code in `xml`.

#### xdg-menu

archlinux-xdg-menu包 will automatically generate a menu based on `xdg` files contained within the `/etc/xdg/` directory for numerous Window Managers, including Openbox. Review the Xdg-menu#OpenBox article for further information.

#### 登出菜單選項

提示：The commands provided can also be attached to #鍵綁定

The `~/.config/openbox/menu.xml` file can be edited in order to provide a sub-menu with the same options as provided by oblogout. The sample script below will provide all of these options, with the exception of the ability to lock the screen:

    <menu id="exit-menu" label="Exit">
    	<item label="Log Out">
    		<action name="Execute">
    			<command>openbox --exit</command>
    		</action>
    	</item>
    	<item label="Shutdown">
    		<action name="Execute">
    			<command>systemctl poweroff</command>
    		</action>
    	</item>
    	<item label="Restart">
    		<action name="Execute">
    		        <command>systemctl reboot</command>
    		</action>
    	</item>
    	<item label="Suspend">
    		<action name="Execute">
    		        <command>systemctl suspend</command>
    		</action>
    	</item>
    	<item label="Hibernate">
    		<action name="Execute">
    		        <command>systemctl hibernate</command>
    		</action>
    	</item>
    </menu>

Once the entries have been composed, add the following line to present the sub-menu where desired within the main desktop menu (usually as the last entry):

    <menu id="exit-menu"/>

### 管道菜單

提示：It is entirely feasible for a static menu to contain one or more pipe sub-menus. The functionality of some pipe menus may also rely on the installation of relevant software packages.

This type of menu is in essence a script that provides dynamic, refreshed lists on-the-fly as and when run. These lists may be used for multiple purposes, including to list applications, to provide information, and to provide control functions. Pre-configured pipe menus can be installed, although not from the official repositories. More experienced users can also modify and/or create their own custom scripts. Again, `~/.config/openbox/menu.xml` may and commonly will contain several pipe menus.

#### 範例

- openbox-xdgmenuAUR: 快速將xdg菜單轉換為xml管道菜單的轉換器。
- obfilebrowserAUR: 應用程式和文件瀏覽器
- obdevicemenuAUR: 使用 Udisks 管理可移動介質
- wifi pipe menu: 使用 Netctl 進行無線網絡連接

Openbox.org 還提供了更多的管道菜單列表。

### 生成器

This type of menu is akin to those provided by the taskbars of desktop environments such as Xfce or LXDE. Automatically updating on-the-fly, this type of menu can be powerful and very convenient. It may also be possible to add custom categories and menu entries; read the documentation for your intended dynamic menu to determine if and how this can be done.

A menu generator will have to be executed from the `~/.config/openbox/menu.xml` file.

#### obmenu-generator

提示：icons can still be disabled in obmenu-generatorAUR, even where enabled in `~/.config/openbox/rc.xml`.

obmenu-generatorAUR is highly recommended despite being an unofficial package. With the ability to be used as a static or dynamic menu, it is highly configurable, powerful, and versatile. Menu categories and individual entries may also be easily hidden, customised, and/or added with ease. The official homepage provides further information and screenshots.

Below is an example of how obmenu-generator would be dynamically executed without icons in `~/.config/openbox/menu.xml`:

    <?xml version="1.0" encoding="utf-8"?>
    <openbox_menu>
        <menu id="root-menu" label="OpenBox 3" execute="/usr/bin/obmenu-generator">
        </menu>
    </openbox_menu>

To automatically iconify entries, the `-i` option would be added:

    <menu id="root-menu" label="OpenBox 3" execute="/usr/bin/obmenu-generator -i">

#### openbox-menu

提示：If this menu produces an error, it may be solved by enabling icons in `~/.config/openbox/rc.xml`.

openbox-menuAUR uses the LXDE menu-cache to create dynamic menus. The official homepage provides further information and screenshots.

### 菜單圖標

To show icons next to menu entries, it will be necessary to ensure they are enabled in the `<menu>` section of the `~/.config/openbox/rc.xml` file:

    <showIcons>yes</showIcons>

Where using a static menu, it will then be necessary to edit the `~/.config/openbox/menu.xml` file to provide both the `icon =` command, along with the full path and icon name for each entry. An example of the syntax used to provide an icon for a category is:

    <menu id="apps-menu" label="[label name]" icon="[pathway to icon]/[icon name]">

### 將桌面菜單作為面板菜單

提示：XDoTool can simulate any keybind for any action, and as such, it may therefore be used for many other purposes...

xdotool is a package that can issue commands to simulate key presses / keybinds, meaning that it is possible to use it to invoke keybind-related actions without having to actually press their assigned keys. As this includes the ability to invoke an assigned keybind for the Openbox desktop menu, it is therefore possible to use XDoTool to turn the Openbox desktop menu into a panel menu. Especially where the desktop menu is heavily customised and feature-rich, this may prove very useful to:

- Replace an existing panel menu
- Implement a panel menu where otherwise not provided or possible (e.g. for Tint2)
- Compensate where losing access to the desktop menu due to the use of an application like xfdesktop包 to manage the desktop.

Once XDoTool has been installed - if not already present - it will be necessary to create a keybind to access the root menu in `~/.config/openbox/rc.xml`, and again below the `<!-- Keybindings for running aplications -->` heading. For example, the following code will bring up the menu by pressing `CTRL` + `m`:

    <keybind key="C-m">
        <action name="ShowMenu">
           <menu>root-menu</menu>
        </action>
    </keybind>

Openbox must then be reconfigured. In this instance, XDoTool will be used to simulate the `CTRL` + `m` keypress to access the desktop menu with the following command (note the use of `+` in place of `-`):

    xdotool key control+m

How this command may be used as a panel launcher / icon is largely dependent on the features of panel used. While some panels will allow the above command to be executed directly in the process of creating a new launcher, others may require the use of an executable script. As an example, a custom executable script called `obpanelmenu.sh` will be created in the `~/.config` folder:

    $ text editor ~/.config/obpanelmenu.sh

Once the empty file has been opened, the appropriate XDoTool command must be added to the empty file (i.e. to simulate the `CTRL` + `m` keypress for this example):

    xdotool key control+m

After the file has been saved and closed, it may then be made into an executable script with the following command:

    $ chmod +x ~/.config/obpanelmenu.sh

Executing it will bring up the Openbox desktop menu. Consequently, where using a panel that supports drag-and-drop functionality to add new launchers, simply drag the executable script onto it before changing the icon to suit personal taste.

### XDG 兼容菜單

一個符合xdg標準的菜單是基於freedesktop.org標準的。菜單的定義位於/etc/xdg/menus目錄中的菜單文件中。新的應用程式將自動出現在菜單中。

#### 範例

- californium[失效連結 2021-11-15 ⓘ]: 基於LXQt主菜單的xdg菜單，易於主題化。

## 提示與技巧

### 光標與圖標主題

詳情參閱光標主題和圖標。

### 桌面圖標與壁紙

Openbox本身不支持使用桌面圖標或壁紙。

請參閱 PCManFM, SpaceFM 和 Idesk.

注意：您可能需要編輯 `~/.conkyrc` 並將 `own_window_type` 設置成 `normal`.

請參閱 List of applications#Wallpaper setters.

### 混成特效

Openbox對混成不提供原生支持，因此需要外部混成器。

雖然合成不是必需的組件， 但它可以特別避免 oblogout 導致的屏幕失真問題，以及終端窗口透明度引起的視覺故障等問題。請參見 Xorg#Composite 獲取常見的選擇。

### oblogout

請參閱 Oblogout 文章，了解如何使用這個實用的圖形化註銷腳本的概述。

### Openbox多顯示器用戶

While Openbox provides better than average multihead support on its own, openbox-multihead-gitAUR[損壞的連結：package not found] provides a development branch called Openbox Multihead that gives multihead users per-monitor desktops. This model is not commonly found in floating window managers, but exists mainly in tiling window managers. It is explained well on the Xmonad web site. Also, please see README.MULTIHEAD for a more comprehensive description of the new features and configuration options found in Openbox Multihead.

Openbox Multihead會在只有一個屏幕時像普通的Openbox一樣工作。

### 熱鍵執行複合命令

如果您需要執行複雜的命令，請使用Shell功能。

特殊字符的替換如下：

- `&`: &amp;
- `<`: &lt;
- `>`: &gt;

這個示例將立即關閉顯示器並使用slock包 鎖定屏幕。它是從這個帖子中獲取的.

     <keybind key="W-l">
       <action name="Execute">
         <command>sh -c 'slock &amp; (sleep .5 &amp;&amp; xset dpms force off)'</command>
       </action>
     </keybind>

有時候需要為應用程式指定環境變量：

     <keybind key="A-F7">
       <action name="Execute">
         <command>sh -c "LC_ALL=C obconf"</command>
       </action>
     </keybind>

另一個示例將啟動應用程式，並將所有stdout和stderr輸出保存到文件中：

     <keybind key="A-f">
       <action name="Execute">
         <command>sh -c sh -c "exec gimp &gt;/tmp/gimp.out 2&gt;&amp;1"</command>
       </action>
     </keybind>

啟用屏幕截圖功能：

     <keybind key="Print">
       <action name="Execute">
         <command>gnome-screenshot -c</command>
       </action>
     </keybind>
     <keybind key="A-Print">
       <action name="Execute">
         <command>gnome-screenshot -c -w</command>
       </action>
     </keybind>
     <keybind key="W-Print">
       <action name="Execute">
         <command>gnome-screenshot -i</command>
       </action>
     </keybind>

### 應用程式啟動器

Given the lack of a desktop environment with a plain Openbox install, it can be useful to install one or more application launchers as supplements to the Openbox menu system and the hotkeys. Lists of such launchers can be found at Category:Application launchers and List of applications/Other#Application launchers; popular examples are Gmrun and dmenu.

### 滑鼠切換桌面

It is possible to switch desktop by moving the mouse cursor to the edges of the screen. First install xdotool包 and add the following two lines to your `~/.xinitrc`:

    xdotool behave_screen_edge --delay 500 left set_desktop --relative -- -1 &
    xdotool behave_screen_edge --delay 500 right set_desktop --relative -- +1 &

### 設置默認應用及文件關聯

請參見默認應用程式文章.

### Ad-hoc窗口透明

警告：這可能在行動組中定義了其他動作時無法工作。

The program transset-dfAUR can enable window transparency on-the-fly.

For example, using the following code in the `<mouse>` section of the `~/.config/openbox/rc.xml` file will enable control of application window transparency by hovering the mouse-pointer over the title bar and scrolling with the middle button:

    <context name="Titlebar">
        ...
        <mousebind button="Up" action="Click">
            <action name= "Execute" >
            <execute>transset-df -p .2 --inc  </execute>
            </action>
        </mousebind>
        <mousebind button="Down" action="Click">
            <action name= "Execute" >
            <execute>transset-df -p .2 --dec </execute>
            </action>
        </mousebind>
        ...
    </context>

### 使用 obxprop 進行更快的配置

The openbox包 package provides a `obxprop` binary that can parse relevant values for applications settings in `rc.xml`. Officially `obxprop | grep "^_OB_APP"` is recommended for this task. Start the process by running the command shown, then click a window to see its properties in the terminal.

### 應用程式的 Xprop 值

xorg-xprop包 can be used to relay property values for selected applications. Where frequently using per-application settings, the following Bash Alias may be useful:

    alias xp='xprop | grep "WM_WINDOW_ROLE\|WM_CLASS" && echo "WM_CLASS(STRING) = \"NAME\", \"CLASS\""'

To use Xorg-XProp, run using the alias given `xp`, and click on the active program desired to define with per-application settings. The results displayed will only be the information that Openbox itself requires, namely the `WM_WINDOW_ROLE` and `WM_CLASS` (name and class) values:

    WM_WINDOW_ROLE(STRING) = "roster"
    WM_CLASS(STRING) = "gajim.py", "Gajim.py"
    WM_CLASS(STRING) = "NAME", "CLASS"

### 切換鍵盤布局

請參考文章在鍵盤布局之間切換的方法中的說明。

### 設置虛擬桌面網格

安裝 obsetlayoutAUR。例如，要設置一個 2x2 的網格：

    obsetlayout 0 2 2 0

在不帶參數的情況下運行它，以了解參數的含義。

### 啟用敏感邊角

lead-gitAUR 為openbox和其他輕量級窗口管理器提供了熱角功能。在自動啟動文件中添加一個條目以啟動該應用程式：

    lead &

命令可以在配置文件中進行編輯`~/.config/mlde/lead.conf`:

    [eDP1]
    bottom=
    bottomLeft=chromium
    bottomRight=thunar
    left=
    right=
    top=
    topLeft=mlde.californium toggle
    topRight=skippy-xd

### 窗口吸附

Many desktop environments and window managers support window snapping (e.g. Windows 7 Aero snap), whereby they will automatically snap into place when moved to the edge of the screen. This effect can also be simulated in Openbox through the use of keybinds on focused windows.

As illustrated in the example below, percentages must be used to determine window sizes (see openbox.org for further information). In this instance, The `super` key is used in conjunction with the `navigation` keys:

    <keybind key="W-Left">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
            <width>50%</width>
        </action>
        <action name="MoveToEdge"><direction>west</direction></action>
    </keybind>
    <keybind key="W-Right">
        <action name="UnmaximizeFull"/>
        <action name="MaximizeVert"/>
        <action name="MoveResizeTo">
            <width>50%</width>
        </action>
        <action name="MoveToEdge"><direction>east</direction></action>
    </keybind>

However, it should be noted that once a window has been 'snapped' to an edge, it will remain vertically maximised unless subsequently maximised and then restored. The solution is to implement additional keybinds - in this instance using the `down` and `up` keys - to do so. This will also make pulling 'snapped' windows from screen edges faster as well:

    <keybind key="W-Down">
       <action name="Unmaximize"/>
    </keybind>
    <keybind key="W-Up">
       <action name="Maximize"/>
    </keybind>

This Ubuntu forum thread provides more information. Applications such as opensnapAUR are also available to automatically simulate window snapping behaviour without the use of keybinds. Another option is to use bunsen-utilities-gitAUR which provides `bl-aerosnap --left` and `bl-aerosnap --right` commands which will snap active window on left or right edge respectively if it's not snapped and restore it to original size and position otherwise. Just bind these commands to the key combination of your choosing.

### 平滑的顯示管理器過渡

注意：這已經確定可以在 LightDM 上工作。

Users of display managers might experience a flickering during the transition between the display manager and the Openbox desktop. The flickering comes from Openbox setting the root window's color during startup. Therefore there is a brief moment when the display flashes in a grey color, between the display manager's background and the desktop's wallpaper.

Setting the root window's background color can be disabled by editing the Openbox startup script found in `/usr/lib/openbox/openbox-autostart`. Simply comment out (or delete) the block starting with `# Set a background color`.

注意：Users who do not specifically set their wallpaper will "inherit" the display manager's background automatically if they disable the root window color adjustment.

### 窗口渲染

To remove window decorations for all or particular applications, use the <decor> option in the <applications> section of rc.xml (user: ~/.config/openbox/ or system: /etc/xdg/openbox/).
Example for Firefox, including variants like Firefox-Beta and Firefox-Nightly:

     <application class="Firefox*">
       <decor>no</decor>
     </application>

One could also disable decorations for all applications (using class "*"), then enable them (using yes) for individual ones. To apply the changes, restart your desktop session, and thus Openbox. Reference: Openbox FAQ

## 排錯

### Firefox

基於Mozilla的瀏覽器可能會忽略應用程式規則 (例如 `<desktop>`) 除非使用 `class="Firefox"` 。請參閱 #應用程式的 Xprop 值.

### 主題丟失

If for any reason the newly extracted theme cannot be selected, open the theme directory to first ensure that it is compatible with Openbox - there should be an `openbox-3` directory and a `themerc` file within it. An `.obt` (OpenBox Theme) file may also be present in some instances, which can then be manually loaded in obconf包.

A theme may also be not accessible due to wrong permissions. See File permissions and attributes for more.

### 連續切換桌面時停頓

By default Openbox switches from the last desktop back to the first desktop on mouse wheel scroll. Use `<wrap>no</wrap>` in the `mousebind` section to disable this behaviour.

       <context name="Desktop">
         <mousebind button="Up" action="Click">
           <action name="GoToDesktop">
             <to>previous</to>
             <wrap>no</wrap>
           </action>
         </mousebind>
         <mousebind button="Down" action="Click">
           <action name="GoToDesktop">
             <to>next</to>
             <wrap>no</wrap>
           </action>
         </mousebind>
       </context>

### 新窗口隱藏在活動窗口後面

Some application windows (such as Firefox windows) may load behind the currently active window, causing you to need to switch to the window you just created to focus it. To fix this behavior add this to your `~/.config/openbox/rc.xml` file, inbetween the `<openbox_config>` and `</openbox_config>` tags:

    <applications>
      <application class="*">
        <focus>yes</focus>
      </application>
    </applications>

## 參閱

- Openbox Website - 官方網站
- Box-Look.org - 一個關於主題和相關藝術作品的資源網站
- Openbox Hacks and Configs Thread @ Arch Linux 論壇
- Openbox Screenshots Thread @ Arch Linux 論壇
- An Openbox guide

分類：​

- 堆疊式窗口管理器
- 包含失效連結的頁面
- 包含損壞的軟體包連結的頁面

隱藏分類：​

- 使用「模板:Translateme」標記的頁面或章節

Openbox
新增話題