How-To :: Super OpenBox no Slackware (1ª parte)


Conforme o prometido (e com anos de atraso!), finalmente confeccionei o How-to de instalação de um Super OpenBox no Slackware.

A premissa aqui é a de que você já está com o Slackware instalado, seja com o XFCE (que é o que recomendo), ou mesmo com o KDE.

Aqui mesmo no blog, tem um tutorial de instalação do Slackware utilizando o SLINT: HOW-TO :: SLINT, INSTALAÇÃO DO SLACKWARE EM PT_BR, basta apenas escolher a versão 14.2 ao acessar um dos links citados no artigo.

Outro meio necessário é a instalação do eficiente Sbopkg, que pode ser visto em: DICA :: ATUALIZAÇÃO DO SBOPKG (atentem para a observação ao fim da dica!).

E no começo tudo era um vazio…

De imediato o que precisamos é de um sistema atualizado, logo:

# slackpkg update
# slackpkg upgrade-all
atualização dos pacotes do sistema…

Em seguida, passemos para a atualização dos pacotes instalados via Sbopkg:

# sbopkg -r
# sbopkg -c

Estando com todos os pacotes atualizados, podemos começar.

Display Manager

Mas antes vem a explicação: sabemos que o XDM é bem horroroso e que a seleção do ambiente a ser iniciado se dá pela configuração via xwmconfig, então porque substituí-lo? oras… primeiro porque com outros Login Managers como o LXDM ou SLIM podemos selecionar outros ambientes e iniciá-los, e em segundo lugar pela estética, vejam como é feio o XDM:

Tela de login do XDM

Então, veremos a instalação do LXDM (que é o meu preferido), mas se quiser, pode-se instalar o SLIM.

Mas antes seguem algumas observações. A instalação de pacotes (seja individuais ou em série) sempre se dará em dois passos, o primeiro usando o sqg (parte do pacote sbopkg), seguido pelo próprio sbopkg acrescido da opção -k (para que você não precise recompilar um pacote já instalado, estamos entendidos? vamos lá!

# sqg -p lxdm
# sbopkg -k -i lxdm

* no início deste tutorial não utilizei a opção -k, porque o sistema estava limpo, mas à medida que os pacotes foram sendo instalados, isto passou a ser necessário para não recompilar pacotes.

Este slideshow necessita de JavaScript.

** caso queiram compilar o LXDM com suporte ao GTK3, façam isto:

# cp -av /var/lib/sbopkg/SBo/14.2/system/lxdm .
# cd lxdm
# GTK3=yes ./lxdm.SlackBuild
# upgradepkg --install-new --reinstall /tmp/lxdm-0.5.3-x86_64-3_SBo.tgz

Em seguida temos que adicionar o LXDM ou o SLIM no script /etc/rc.d/rc.4, abaixo segue uma cópia exata do meu, bem como um link para baixá-lo (em caso de problemas):

#! /bin/sh
#
# rc.4		This file is executed by init(8) when the system is being
#		initialized for run level 4 (XDM)
#
# Version:	@(#)/etc/rc.d/rc.4	2.00	02/17/93
#
# Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
# At least 47% rewritten by:  Patrick J. Volkerding <volkerdi@slackware.com>
#

# Tell the viewers what's going to happen...
echo "Starting up X11 session manager..."

# LXDE Login Manager (LXDM).
if [ -x /usr/sbin/lxdm ]; then
  exec /usr/sbin/lxdm
fi

# SLIM.
if [ -x /usr/bin/slim ]; then
  exec /usr/bin/slim
fi

# Try to use GNOME's gdm session manager.  This comes first because if
# gdm is on the machine then the user probably installed it and wants
# to use it by default:
if [ -x /usr/bin/gdm ]; then
  exec /usr/bin/gdm -nodaemon
fi

# Someone thought that gdm looked prettier in /usr/sbin,
# so look there, too:
if [ -x /usr/sbin/gdm ]; then
  exec /usr/sbin/gdm -nodaemon
fi

# Not there?  OK, try to use KDE's kdm session manager:
if [ -x /opt/kde/bin/kdm ]; then
  exec /opt/kde/bin/kdm -nodaemon
elif [ -x /usr/bin/kdm ]; then
  exec /usr/bin/kdm -nodaemon
fi

# Look for SDDM as well:
if [ -x /usr/bin/sddm ]; then
  exec /usr/bin/sddm
fi

# If all you have is XDM, I guess it will have to do:
if [ -x /usr/bin/xdm ]; then
  exec /usr/bin/xdm -nodaemon
elif [ -x /usr/X11R6/bin/xdm ]; then
  exec /usr/X11R6/bin/xdm -nodaemon
fi

# error
echo
echo "Hey, you don't have KDM, GDM, or XDM.  Can't use runlevel 4 without"
echo "one of those installed."
sleep 30

# All done.

/etc/rc.d/rc.4:

# wget -nv https://gist.githubusercontent.com/anonymous/b2715a8537b105a88c4b3d81a180547e/raw/b9938249389ff015dc77c2198bf9120283c0b74e/rc.4
# mv -v rc.4 /etc/rc.d/
# chmod +x /etc/rc.d/rc.4
adição do LXDM e do SLIM no script /etc/rc.d/rc.4

Se tiverem interesse existe no Blog um post sobre a Instalação do SLIM no Slackware.

Feito isto, ao reiniciar o seu sistema você já cairá na tela de login do LXDM:

Tela de login do LXDM

Você poderá configurar sua tela de login (avatar, autenticação automática, entre outros), executando:

# lxdm-config
configuração do LXDM

Window Manager

Veremos agora a instalação básica do OpenBox:

# sqg -p "openbox obconf obmenu lxappearance-obconf"
# sbopkg -k -i "openbox obconf obmenu lxappearance-obconf"

* sempre quando perguntado, tecle Q (para processar a fila de dependências) antes de iniciar o empacotamento do programa desejado.

Este slideshow necessita de JavaScript.

Em seguida copiaremos as configurações do OpenBox:

$ mkdir -p ~/.config/openbox
$ cp -av /etc/xdg/openbox/* ~/.config/openbox/
$ echo "exec ck-launch-session dbus-launch --exit-with-session openbox-session" > ~/.xinitrc ### OPCIONAL!
ou
$ xwmconfig  ### RECOMENDADO!
cópia dos arquivos de configuração do OpenBox
seleção do WM padrão com o xwmconfig

A partir deste momento você já poderia reiniciar e logar-se no OpenBox, mas teria uma experiência frustrante, pois o mesmo vem pelado!

Menu

E agora chegou a hora de substituirmos o espartano menu do OpenBox por algo mais chique como o obmenu-generator, logo:

# sqg -p obmenu-generator
# sbopkg -k -i obmenu-generator
$ obmenu-generator -i -p  ### EXECUTE ISTO COMO USUARIO NORMAL!!!
$ wget -nv https://gist.githubusercontent.com/anonymous/80b0808256407032c96d4ebcf063aaac/raw/c9de9b3cc0ea37cc577cdf0e9635810b38b2cb31/menu.xml
$ mv -v menu.xml ~/.config/openbox/
$ openbox --reconfigure

Este slideshow necessita de JavaScript.

Abaixo segue o conteúdo do arquivo schema.pl (editado e traduzido), bem como um link para baixá-lo (basta substituir o constante em ~/.config/obmenu-generator/schema.pl:

#!/usr/bin/perl

# obmenu-generator - schema file

=for comment

    item:      add an item inside the menu               {item => ["command", "label", "icon"]},
    cat:       add a category inside the menu             {cat => ["name", "label", "icon"]},
    sep:       horizontal line separator                  {sep => undef}, {sep => "label"},
    pipe:      a pipe menu entry                         {pipe => ["command", "label", "icon"]},
    raw:       any valid Openbox XML string               {raw => q(xml string)},
    begin_cat: begin of a category                  {begin_cat => ["name", "icon"]},
    end_cat:   end of a category                      {end_cat => undef},
    obgenmenu: generic menu settings                {obgenmenu => ["label", "icon"]},
    exit:      default "Exit" action                     {exit => ["label", "icon"]},

=cut

# NOTE:
#    * Keys and values are case sensitive. Keep all keys lowercase.
#    * ICON can be a either a direct path to an icon or a valid icon name
#    * Category names are case insensitive. (X-XFCE and x_xfce are equivalent)

require "$ENV{HOME}/.config/obmenu-generator/config.pl";

## Text editor
    my $editor = $CONFIG->{editor};

our $SCHEMA = [
    #          COMMAND                 LABEL                ICON
    {sep => 'SlackBox Desktop'},
    {sep => undef},
    {item => ['xfce4-screenshooter', 'Captura de tela',              'applets-screenshooter']},
    {item => ['leafpad',             'Editor de Texto',              'text-editor']},
    {item => ['sakura',              'Emulador de Terminal',                     'terminal']},
    {item => ['caja',              'Gerenciador de Arquivos',      'file-manager']},
    {item => ['opera-legacy',               'Navegador Web',                'web-browser']},
    {sep => undef},    
    #          NAME            LABEL                ICON
    {cat => ['utility',     'Acessórios',      'applications-utilities']},
    {cat => ['settings',    'Configurações',   'applications-accessories']},
    {cat => ['development', 'Desenvolvimento', 'applications-development']},
    {cat => ['education',   'Educativos',      'applications-science']},
    {cat => ['office',      'Escritório',      'applications-office']},
    {cat => ['graphics',    'Gráficos',        'applications-graphics']},
    {cat => ['network',     'Internet',        'applications-internet']},
    {cat => ['game',        'Jogos',           'applications-games']},
    {cat => ['audiovideo',  'Multimídia',      'applications-multimedia']},
    {cat => ['other',       'Outros',          'applications-other']},
    {cat => ['system',      'Sistema',         'applications-system']},

    #{cat => ['qt',          'QT Applications',    'qt4logo']},
    #{cat => ['gtk',         'GTK Applications',   'gnome-applications']},
    #{cat => ['x_xfce',      'XFCE Applications',  'applications-other']},
    #{cat => ['gnome',       'GNOME Applications', 'gnome-applications']},
    #{cat => ['consoleonly', 'CLI Applications',   'applications-utilities']},

    #                  LABEL          ICON
    #{begin_cat => ['My category',  'cat-icon']},
    #             ... some items ...
    #{end_cat   => undef},

    #            COMMAND     LABEL        ICON
    #{sep => undef},
    #{wine_apps => ['Wine apps', 'applications-other']},
    #{sep => undef},
    #{pipe => ['obbrowser', 'Pasta Pessoal', 'drive-harddisk']},

    ## Generic advanced settings
    #{sep       => undef},
    #{obgenmenu => ['Openbox Settings', 'openbox']},
    #{sep       => undef},

    # Wine category.
    {begin_cat => ['Wine', 'wine']},
    {item      => ['wine ~/.wine/drive_c/Program\ Files/1by1/1by1.exe',               '1by1',     'wine']},
    {item      => ['wine ~/.wine/drive_c/Program\ Files/Mp3tag/Mp3tag.exe',           'Mp3tag',   'wine']},
    {end_cat => undef},

    ## Custom advanced settings.
    {sep => undef},
    {begin_cat => ['Configurações do WM', 'preferences-desktop-theme']},

    # obmenu-generator category.
    {begin_cat => ['Obmenu-Generator', 'menu-editor']},
    {item      => ["$editor ~/.config/obmenu-generator/schema.pl", 'Menu Schema', $editor]},
    {item      => ["$editor ~/.config/obmenu-generator/config.pl", 'Menu Config', $editor]},
    {sep  => undef},
    {item => ['obmenu-generator -p',    'Generate a dinamic menu',              'menu-editor']},
    {item => ['obmenu-generator -p -i', 'Generate a dinamic menu with icons',   'menu-editor']},
    {item => ['obmenu-generator -s -c',    'Generate a static menu',            'menu-editor']},
    {item => ['obmenu-generator -s -i -c', 'Generate a static menu with icons', 'menu-editor']},
    {sep  => undef},
    {item    => ['obmenu-generator -d', 'Refresh Icon Set', 'gtk-refresh']},
    {end_cat => undef},

    # Openbox category.
    {begin_cat => ['Openbox', 'openbox']},
    {item      => ["$editor ~/.config/openbox/autostart", 'Editar autostart',    $editor]},
    {item      => ["$editor ~/.config/openbox/menu.xml",  'Editar menu.xml',     $editor]},
    {item      => ["$editor ~/.config/openbox/rc.xml",    'Editar rc.xml',       $editor]},
    {sep  => undef},
    {item      => ['obconf',                 'OpenBox Configuration Manager', 'obconf']},
    {item      => ['obmenu',                 'OpenBox Menu Configurator',     '/usr/share/obmenu/mnu48.png']},
    {item      => ['openbox --reconfigure',  'Reconfigurar Openbox',          'openbox']},
    {end_cat => undef},

    # Programs category.
    {begin_cat => ['Programas', 'gnome-settings']},
    {item      => ["$editor ~/.conkyrc",              'Editar conkyrc',    $editor]},
    {item      => ["$editor ~/.config/tint2/tint2rc", 'Editar tint2rc',    $editor]},
    {item      => ["$editor ~/.zshrc",                'Editar zshrc',      $editor]},
    {end_cat => undef},

    # Themes category.
    {begin_cat => ['Themes', 'preferences-desktop-theme']},
    {item      => ["lxappearance",              'Alterar Aparência',    'preferences-desktop-theme']},
    {item      => ['nitrogen ~/Imagens',        'Trocar Wallpaper',     'nitrogen']},
    {end_cat => undef},

    {end_cat => undef},
    {sep => undef},
    {item => ['gmrun',                      'Executar comando...',       'gtk-execute']},
    {sep => undef},
    {item => ['xscreensaver-command -lock', 'Bloquear tela',             'locked']},
    {sep => undef},
    {item => ['obsession-logout',           'Sair',                      'system-log-out']},
]

~/.config/obmenu-generator/schema.pl:

$ wget -nv https://gist.githubusercontent.com/anonymous/482bac6aef3628464751653208681efa/raw/9746942a2748ca13f769dd27f7dad41e57a56009/schema.pl
$ mv -v schema.pl ~/config/obmenu-generator/
$ obmenu-generator -i -p

* e caso queiram modificar o Editor de Textos e o Terminal, o façam no arquivo ~/.config/obmenu-generator/config.pl.

Alternativa ao obmenu-generator.

Caso queiram, existe uma alternativa ao obmenu-generator e chama-se openbox-menu, para instalá-lo, basta seguir os passos abaixo:

# sqg -p "gnome-menus openbox-menu"
# sbopkg -k -i "gnome-menus openbox-menu"
$ cp -av ~/.config/openbox/menu.xml ~/.config/openbox/menu.xml-BACKUP
$ cp -a /usr/doc/openbox-menu-0.8.0/menu.xml-sample ~/.config/openbox/menu.xml
$ openbox --reconfigure

Painel

Aqui porei 3 opções para painel, o LXPanel, o Tint2 e o Plank, mas demonstrarei apenas os 2 últimos:

# sqg -p "lxpanel tint2 plank"
# sbopkg -i tint2
$ echo "tint2 &" >> ~/.config/openbox/autostart  # Adiciona e habilita o início do Tint2
# sbopkg -i plank
$ echo "#plank &" >> ~/.config/openbox/autostart # Adiciona, mas deixa desabilitado o Plank

Este slideshow necessita de JavaScript.

Caso prefiram o LxPanel, abaixo segue o link para download da config que utilizo, na qual o Gestor de Saída Obsession, visto logo abaixo, já encontra-se configurado:

# sbopkg -k -i lxpanel
$ wget -nv https://gist.githubusercontent.com/anonymous/75c562ad673e3f09747b2fea25dad613/raw/ee97b4f5b1ecc7f378cd1842d3c7c847ff02c301/config
$ wget -nv https://gist.githubusercontent.com/anonymous/ce79111cb8f30212fbae0c2c1ca256e6/raw/b9f26d10b04d6c0ad80ffa6f059b9140cabeb177/panel
$ mkdir -p ~/config/lxpanel/default/panels
$ mv -v config ~/config/lxpanel/default/
$ mv -v panel ~/config/lxpanel/default/panels/

Gestor de Saída

E já que disponibilizei o esquema do obmenu-generator, como gestor de saída utilizaremos o Obsession, cuja única dependência é o vala, que fora instalada no passo do Plank:

# sqg -p obsession
# sbopkg -i obsession

Este slideshow necessita de JavaScript.

Gestor de Sessão Obsession

Compositor

E para adicionar efeitos no ambiente, instalaremos o Compton:

# sqg -p compton
# sbopkg -i compton
$ echo "compton -cCfF &" >> ~/.config/openbox/autostart   # Adiciona e habilita o início do Compton

Este slideshow necessita de JavaScript.

Wallpaper

Para gerenciar o Wallpaper, instalaremos o Nitrogen:

# sqg -p nitrogen
# sbopkg -i nitrogen
$ echo "(nitrogen --restore) &" >> ~/.config/openbox/autostart   # Adiciona e habilita o início do Nitrogen

Este slideshow necessita de JavaScript.

Lançador de Aplicativos

Para lançar aplicativos com a tradicional combinação Alt+F2, instalaremos o GMRun:

# sqg -p gmrun
# sbopkg -i gmrun

Este slideshow necessita de JavaScript.

Numlockx

Iniciar o OpenBox com a tecla NumLock ligada:

# sqg -p numlockx
# sbopkg -k -i numlockx
$ echo "numlockx on &" >> ~/.config/openbox/autostart

OpenBox II

E para finalizar esta primeira parte, disponibilizarei a minha configuração do arquivo ~/.config/openbox/rc.xml, arquivo onde estão configuradas opções como o Alt+F2, controle de volume, etc, ao final também constarão links para baixá-lo e um contendo um modelo com inúmeras opções para o arquivo ~/.config/openbox/autostart.

<?xml version="1.0" encoding="UTF-8"?>
<openbox_config xmlns="http://openbox.org/3.4/rc">
  <resistance>
    <strength>10</strength>
    <screen_edge_strength>20</screen_edge_strength>
  </resistance>
  <focus>
    <focusNew>yes</focusNew>
    <!-- always try to focus new windows when they appear. other rules do
       apply -->
    <followMouse>no</followMouse>
    <!-- move focus to a window when you move the mouse into it -->
    <focusLast>yes</focusLast>
    <!-- focus the last used window when changing desktops, instead of the one
       under the mouse pointer. when followMouse is enabled -->
    <underMouse>no</underMouse>
    <!-- move focus under the mouse, even when the mouse is not moving -->
    <focusDelay>200</focusDelay>
    <!-- when followMouse is enabled, the mouse must be inside the window for
       this many milliseconds (1000 = 1 sec) before moving focus to it -->
    <raiseOnFocus>no</raiseOnFocus>
    <!-- when followMouse is enabled, and a window is given focus by moving the
       mouse into it, also raise the window -->
  </focus>
  <placement>
    <policy>UnderMouse</policy>
    <!-- 'Smart' or 'UnderMouse' -->
    <center>yes</center>
    <!-- whether to place windows in the center of the free area found or
       the top left corner -->
    <monitor>Any</monitor>
    <primaryMonitor/>
  </placement>
  <theme>
    <name>NumixBLUE</name>
    <titleLayout>DSLIMC</titleLayout>
    <!--
      avaible characters are NDSLIMC, each can occur at most once.
      N: window icon
      L: window label (AKA title).
      I: iconify
      M: maximize
      C: close
      S: shade (roll up/down)
      D: omnipresent (on all desktops).
  -->
    <keepBorder>yes</keepBorder>
    <animateIconify>yes</animateIconify>
    <font place="ActiveWindow">
      <name>Coda Ultra-Bold</name>
      <size>13</size>
      <!-- font size in points -->
      <weight>Normal</weight>
      <!-- 'bold' or 'normal' -->
      <slant>Normal</slant>
      <!-- 'italic' or 'normal' -->
    </font>
    <font place="InactiveWindow">
      <name>Coda</name>
      <size>13</size>
      <!-- font size in points -->
      <weight>Normal</weight>
      <!-- 'bold' or 'normal' -->
      <slant>Normal</slant>
      <!-- 'italic' or 'normal' -->
    </font>
    <font place="MenuHeader">
      <name>Coda</name>
      <size>13</size>
      <!-- font size in points -->
      <weight>Normal</weight>
      <!-- 'bold' or 'normal' -->
      <slant>Normal</slant>
      <!-- 'italic' or 'normal' -->
    </font>
    <font place="MenuItem">
      <name>Coda</name>
      <size>13</size>
      <!-- font size in points -->
      <weight>Normal</weight>
      <!-- 'bold' or 'normal' -->
      <slant>Normal</slant>
      <!-- 'italic' or 'normal' -->
    </font>
    <font place="ActiveOnScreenDisplay">
      <name>Coda</name>
      <size>12</size>
      <weight>Normal</weight>
      <slant>Normal</slant>
    </font>
    <font place="InactiveOnScreenDisplay">
      <name>Coda</name>
      <size>12</size>
      <weight>Normal</weight>
      <slant>Normal</slant>
    </font>
  </theme>
  <desktops>
    <!-- this stuff is only used at startup, pagers allow you to change them
       during a session

       these are default values to use when other ones are not already set
       by other applications, or saved in your session

       use obconf if you want to change these without having to log out
       and back in -->
    <number>2</number>
    <firstdesk>1</firstdesk>
    <names>
      <name>1</name>
      <name>2</name>
      <name>3</name>
      <name>4</name>
    </names>
    <popupTime>875</popupTime>
    <!-- The number of milliseconds to show the popup for when switching
       desktops.  Set this to 0 to disable the popup. -->
  </desktops>
  <resize>
    <drawContents>yes</drawContents>
    <popupShow>Nonpixel</popupShow>
    <!-- 'Always', 'Never', or 'Nonpixel' (xterms and such) -->
    <popupPosition>Center</popupPosition>
    <!-- 'Center' or 'Top' -->
    <popupFixedPosition>
      <x>0</x>
      <y>0</y>
    </popupFixedPosition>
  </resize>
  <!-- You can reserve a portion of your screen where windows will not cover when
     they are maximized, or when they are initially placed.
     Many programs reserve space automatically, but you can use this in other
     cases. -->
  <margins>
    <top>0</top>
    <bottom>0</bottom>
    <left>0</left>
    <right>0</right>
  </margins>
  <dock>
    <position>TopLeft</position>
    <!-- (Top|Bottom)(Left|Right|)|Top|Bottom|Left|Right|Floating -->
    <floatingX>0</floatingX>
    <floatingY>0</floatingY>
    <noStrut>no</noStrut>
    <stacking>Above</stacking>
    <!-- 'Above', 'Normal', or 'Below' -->
    <direction>Vertical</direction>
    <!-- 'Vertical' or 'Horizontal' -->
    <autoHide>no</autoHide>
    <hideDelay>300</hideDelay>
    <!-- in milliseconds (1000 = 1 second) -->
    <showDelay>300</showDelay>
    <!-- in milliseconds (1000 = 1 second) -->
    <moveButton>Middle</moveButton>
    <!-- 'Left', 'Middle', 'Right' -->
  </dock>
  <keyboard>
    <chainQuitKey>C-g</chainQuitKey>
    <!-- Keybindings for desktop switching -->
    <keybind key="C-A-Left">
      <action name="DesktopLeft">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="C-A-Right">
      <action name="DesktopRight">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="C-A-Up">
      <action name="DesktopUp">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="C-A-Down">
      <action name="DesktopDown">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-A-Left">
      <action name="SendToDesktopLeft">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-A-Right">
      <action name="SendToDesktopRight">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-A-Up">
      <action name="SendToDesktopUp">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-A-Down">
      <action name="SendToDesktopDown">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="W-F1">
      <action name="Desktop">
        <desktop>1</desktop>
      </action>
    </keybind>
    <keybind key="W-F2">
      <action name="Desktop">
        <desktop>2</desktop>
      </action>
    </keybind>
    <keybind key="W-F3">
      <action name="Desktop">
        <desktop>3</desktop>
      </action>
    </keybind>
    <keybind key="W-F4">
      <action name="Desktop">
        <desktop>4</desktop>
      </action>
    </keybind>
    <keybind key="W-F11">
      <action name="Execute">
        <command>openbox --reconfigure</command>
      </action>
    </keybind>
    <keybind key="W-d">
      <action name="ToggleShowDesktop"/>
    </keybind>
    <!-- Keybindings for windows -->
    <keybind key="A-F4">
      <action name="Close"/>
    </keybind>
    <keybind key="A-Escape">
      <action name="Lower"/>
      <action name="FocusToBottom"/>
      <action name="Unfocus"/>
    </keybind>
    <keybind key="A-space">
      <action name="ShowMenu">
        <menu>client-menu</menu>
      </action>
    </keybind>
    <keybind key="Print">
      <action name="Execute">
        <execute>scrot</execute>
      </action>
    </keybind>
    <keybind key="A-Print">
      <action name="Execute">
        <execute>scrot '%Y-%m-%d--%s_$wx$h_scrot.png' -e 'mv $f ~/Screenshots/ &amp; gpicview ~/Screenshots/$f'</execute>
      </action>
    </keybind>
    <!-- Keybindings for window switching -->
    <keybind key="A-Tab">
      <action name="NextWindow">
        <finalactions>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Unshade"/>
        </finalactions>
      </action>
    </keybind>
    <keybind key="A-S-Tab">
      <action name="PreviousWindow"/>
    </keybind>
    <keybind key="C-A-Tab">
      <action name="NextWindow">
        <panels>yes</panels>
        <desktop>yes</desktop>
      </action>
    </keybind>
    <!-- Keybindings for PULSEAUDIO and POGO Audio Player! -->
    <keybind key="XF86AudioRaiseVolume">
      <action name="Execute">
        <command>/usr/bin/pulseaudio-ctl up</command>
      </action>
    </keybind>
    <keybind key="XF86AudioLowerVolume">
      <action name="Execute">
        <command>/usr/bin/pulseaudio-ctl down</command>
      </action>
    </keybind>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <command>/usr/bin/pulseaudio-ctl mute</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPlay">
      <action name="Execute">
        <command>pogo play</command>
      </action>
    </keybind>
    <keybind key="XF86AudioNext">
      <action name="Execute">
        <command>pogo next</command>
      </action>
    </keybind>
    <keybind key="XF86AudioPrev">
      <action name="Execute">
        <command>pogo prev</command>
      </action>
    </keybind>
    <!-- Keybindings for PULSEAUDIO and POGO Audio Player! -->
    <!-- Keybindings for running applications -->
    <keybind key="A-F2">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Run Program</name>
        </startupnotify>
        <command>gmrun</command>
      </action>
    </keybind>
    <keybind key="A-F3">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>dmenu-bind</name>
        </startupnotify>
        <command>~/.config/dmenu/dmenu-bind.sh</command>
      </action>
    </keybind>
    <keybind key="W-f">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>thunar</name>
        </startupnotify>
        <command>thunar</command>
      </action>
    </keybind>
    <keybind key="W-t">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Terminal</name>
        </startupnotify>
        <command>sakura</command>
      </action>
    </keybind>
    <keybind key="W-w">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Web Browser</name>
        </startupnotify>
        <command>opera</command>
      </action>
    </keybind>
    <keybind key="W-l">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Lock screen</name>
        </startupnotify>
        <command>xscreensaver-command -lock</command>
      </action>
    </keybind>
    <keybind key="W-e">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Editor</name>
        </startupnotify>
        <command>leafpad</command>
      </action>
    </keybind>
    <keybind key="W-h">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Task Manager</name>
        </startupnotify>
        <command>sakura -x htop</command>
      </action>
    </keybind>
    <keybind key="W-m">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Mediaplayer</name>
        </startupnotify>
        <command>pogo</command>
      </action>
    </keybind>
    <keybind key="W-v">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Volume</name>
        </startupnotify>
        <command>xfce4-mixer</command>
      </action>
    </keybind>
    <keybind key="W-x">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Logout</name>
        </startupnotify>
        <command>obsession-logout</command>
      </action>
    </keybind>
    <keybind key="W-Tab">
      <action name="ShowMenu">
        <menu>client-list-combined-menu</menu>
      </action>
    </keybind>
    <keybind key="W-space">
      <action name="ShowMenu">
        <menu>root-menu</menu>
      </action>
    </keybind>
    <keybind key="A-C-q">
      <action name="ShowMenu">
        <menu>root-menu</menu>
      </action>
    </keybind>
    <!-- A bit of tiling -->
    <keybind key="W-Right">
      <action name="GrowToEdgeEast"/>
    </keybind>
    <keybind key="W-Left">
      <action name="GrowToEdgeWest"/>
    </keybind>
    <keybind key="W-Down">
      <action name="GrowToEdgeSouth"/>
    </keybind>
    <keybind key="W-Up">
      <action name="GrowToEdgeNorth"/>
    </keybind>
  </keyboard>
  <mouse>
    <dragThreshold>8</dragThreshold>
    <!-- number of pixels the mouse must move before a drag begins -->
    <doubleClickTime>200</doubleClickTime>
    <!-- in milliseconds (1000 = 1 second) -->
    <screenEdgeWarpTime>400</screenEdgeWarpTime>
    <!-- Time before changing desktops when the pointer touches the edge of the
       screen while moving a window, in milliseconds (1000 = 1 second).
       Set this to 0 to disable warping -->
    <context name="Frame">
      <mousebind button="A-Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="A-Left" action="Click">
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="A-Left" action="Drag">
        <action name="Move"/>
      </mousebind>
      <mousebind button="A-Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="A-Right" action="Drag">
        <action name="Resize"/>
      </mousebind>
      <mousebind button="A-Middle" action="Press">
        <action name="Lower"/>
        <action name="FocusToBottom"/>
        <action name="Unfocus"/>
      </mousebind>
      <mousebind button="A-Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="A-Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="C-A-Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="C-A-Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="A-S-Up" action="Click">
        <action name="SendToDesktopPrevious"/>
      </mousebind>
      <mousebind button="A-S-Down" action="Click">
        <action name="SendToDesktopNext"/>
      </mousebind>
    </context>
    <context name="Titlebar">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Move"/>
      </mousebind>
      <mousebind button="Left" action="DoubleClick">
        <action name="ToggleMaximizeFull"/>
      </mousebind>
      <mousebind button="Middle" action="Press">
        <action name="Lower"/>
        <action name="FocusToBottom"/>
        <action name="Unfocus"/>
      </mousebind>
      <mousebind button="Up" action="Click">
        <action name="Shade"/>
        <action name="FocusToBottom"/>
        <action name="Unfocus"/>
        <action name="Lower"/>
      </mousebind>
      <mousebind button="Down" action="Click">
        <action name="Unshade"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="ShowMenu">
          <menu>client-menu</menu>
        </action>
      </mousebind>
    </context>
    <context name="Top">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize">
          <edge>top</edge>
        </action>
      </mousebind>
    </context>
    <context name="Left">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize">
          <edge>left</edge>
        </action>
      </mousebind>
    </context>
    <context name="Right">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize">
          <edge>right</edge>
        </action>
      </mousebind>
    </context>
    <context name="Bottom">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize">
          <edge>bottom</edge>
        </action>
      </mousebind>
      <mousebind button="Middle" action="Press">
        <action name="Lower"/>
        <action name="FocusToBottom"/>
        <action name="Unfocus"/>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="ShowMenu">
          <menu>client-menu</menu>
        </action>
      </mousebind>
    </context>
    <context name="BLCorner">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize"/>
      </mousebind>
    </context>
    <context name="BRCorner">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize"/>
      </mousebind>
    </context>
    <context name="TLCorner">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize"/>
      </mousebind>
    </context>
    <context name="TRCorner">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize"/>
      </mousebind>
    </context>
    <context name="Client">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Middle" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
    </context>
    <context name="Icon">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
        <action name="ShowMenu">
          <menu>client-menu</menu>
        </action>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="ShowMenu">
          <menu>client-menu</menu>
        </action>
      </mousebind>
    </context>
    <context name="AllDesktops">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Click">
        <action name="ToggleOmnipresent"/>
      </mousebind>
    </context>
    <context name="Shade">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Click">
        <action name="ToggleShade"/>
      </mousebind>
    </context>
    <context name="Iconify">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Click">
        <action name="Iconify"/>
      </mousebind>
    </context>
    <context name="Maximize">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Middle" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Click">
        <action name="ToggleMaximizeFull"/>
      </mousebind>
      <mousebind button="Middle" action="Click">
        <action name="ToggleMaximizeVert"/>
      </mousebind>
      <mousebind button="Right" action="Click">
        <action name="ToggleMaximizeHorz"/>
      </mousebind>
    </context>
    <context name="Close">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Click">
        <action name="Close"/>
      </mousebind>
    </context>
    <context name="Desktop">
      <mousebind button="Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="A-Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="A-Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="C-A-Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="C-A-Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
    </context>
    <context name="Root">
      <!-- Menus -->
      <mousebind button="Middle" action="Press">
        <action name="ShowMenu">
          <menu>client-list-combined-menu</menu>
        </action>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="ShowMenu">
          <menu>root-menu</menu>
        </action>
      </mousebind>
    </context>
    <context name="MoveResize">
      <mousebind button="Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="A-Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="A-Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
    </context>
  </mouse>
  <menu>
    <!-- You can specify more than one menu file in here and they are all loaded,
       just don't make menu ids clash or, well, it'll be kind of pointless -->
    <!-- default menu file (or custom one in $HOME/.config/openbox/) -->
    <!-- system menu files on Debian systems 
    <file>/var/lib/openbox/debian-menu.xml</file>
    <file>debian-menu.xml</file> -->
    <file>menu.xml</file>
    <hideDelay>200</hideDelay>
    <middle>no</middle>
    <submenuShowDelay>100</submenuShowDelay>
    <applicationIcons>yes</applicationIcons>
  </menu>
  <applications>
    <!--
  # this is an example with comments through out. use these to make your
  # own rules, but without the comments of course.

  <application name="first element of window's WM_CLASS property (see xprop)"
              class="second element of window's WM_CLASS property (see xprop)"
               role="the window's WM_WINDOW_ROLE property (see xprop)">
  # the name or the class can be set, or both. this is used to match
  # windows when they appear. role can optionally be set as well, to
  # further restrict your matches.

  # the name, class, and role use simple wildcard matching such as those
  # used by a shell. you can use * to match any characters and ? to match
  # any single character.

  # when multiple rules match a window, they will all be applied, in the
  # order that they appear in this list


    # each element can be left out or set to 'default' to specify to not 
    # change that attribute of the window

    <decor>yes</decor>
    # enable or disable window decorations

    <shade>no</shade>
    # make the window shaded when it appears, or not

    <position>
      # the position is only used if both an x and y coordinate are provided
      # (and not set to 'default')
      <x>center</x>
      # a number like 50, or 'center' to center on screen. use a negative number
      # to start from the right (or bottom for <y>), ie -50 is 50 pixels from the
      # right edge (or bottom).
      <y>200</y>
      <monitor>1</monitor>
      # specifies the monitor in a xinerama setup.
      # 1 is the first head, or 'mouse' for wherever the mouse is
    </position>

    <focus>yes</focus>
    # if the window should try be given focus when it appears. if this is set
    # to yes it doesn't guarantee the window will be given focus. some
    # restrictions may apply, but Openbox will try to

    <desktop>1</desktop>
    # 1 is the first desktop, 'all' for all desktops

    <layer>normal</layer>
    # 'above', 'normal', or 'below'

    <iconic>no</iconic>
    # make the window iconified when it appears, or not

    <skip_pager>no</skip_pager>
    # asks to not be shown in pagers

    <skip_taskbar>no</skip_taskbar>
    # asks to not be shown in taskbars. window cycling actions will also
    # skip past such windows

    <fullscreen>yes</fullscreen>
    # make the window in fullscreen mode when it appears

    <maximized>true</maximized>
    # 'Horizontal', 'Vertical' or boolean (yes/no)
  </application>

  # end of the example
-->
    <application name="terminator">
      <position>
        <x>center</x>
        <y>center</y>
      </position>
      <layer>below</layer>
      <decor>no</decor>
      <shade>yes</shade>
      <desktop>all</desktop>
      <skip_taskbar>yes</skip_taskbar>
    </application>
  </applications>
</openbox_config>

~/.config/openbox/rc.xml:

$ wget -nv https://gist.githubusercontent.com/anonymous/4f94c4a856be8a8c327827ef87580bbf/raw/9d9b3d2be9786b52124cf32e7d078ba9d4ff6276/rc.xml
$ mv -v rc.xml ~/.config/openbox/

~/.config/openbox/autostart:

$ wget -nv https://gist.githubusercontent.com/anonymous/8f9ef4c7d04ad9562bfc318e4c487c41/raw/7e1c17f718fd06b41e954db70db81719d8379035/autostart
$ mv -v autostart ~/.config/openbox/

Na segunda parte, veremos a instalação de uma série de programas, como gerenciadores de arquivos, players de música, aplicativos de escritório e internet, de sistema, fontes, temas, etc.

IntÈ!

How-To :: Super OpenBox no Slackware (1ª parte)

8 comentários sobre “How-To :: Super OpenBox no Slackware (1ª parte)

  1. Guilherme Xavier disse:

    Excelente dica. fiquei apenas com uma duvida, na parte de instalação do Lxdm não faltou configurar o ~/.xinitrc ? Para quando usar o startx subir o lxdm?

    Curtir

    1. Sim (e não) rsrs na primeira versão deste artigo eu até coloquei o comando antes do xwmconfig, mas como demonstrei como configurar o OpenBox para acesso via LXDM (ou até como login automático se configurado via lxdm-config acabei retirando-o.

      Ainda mais porque o .xinitrc acaba sendo sobrescrito ao rodar o xwmconfig.

      Mas se quiser tê-lo sempre à mão:

      $ echo "exec ck-launch-session dbus-launch --exit-with-session openbox-session" > ~/.xinitrc

      Curtir

      1. Guilherme Xavier disse:

        Obrigado por esclarecer, mas ainda tenho uma dúvida rs. De acordo com o modelo de configuração proposto eu necessito alterar o init para 4 ao invés de 3 como padrão?

        Curtir

      2. Sim. Assim você ja iniciará o Slack no modo gráfico, com gerenciador de login, seja o padrão XDM ou o que aqui propus, o LXDM.

        Mas se não quiser mudar o init de 3 para 4, vc loga na telinha preta e tasca:

        $ startx

        Curtir

Deixe um comentário