Pular para o conteúdo principal

Creating an extra custom menu in openbox WM

    Hi, folks. It's been a while, isn't it?

    Well, I know nowadays people are telling X11 will be dead soon and the future is Wayland, but for the ones like me, dinosaurs that can't live without things like fluxbox or openbox, how the future will be? 

    Openbox is a very mature WM, offering some tricks we don't see much around here.

    Here's one much helpful: Making custom menus. 

    I've already shown the path to do the same in fluxbox in the past. 

    Now I show you all to do that in openbox.

    First, locate in rc.xml the block of code that refers the menu. It's something like this:

<menu>
    <hideDelay>250</hideDelay>
    <middle>no</middle>
    <submenuShowDelay>100</submenuShowDelay>
    <submenuHideDelay>400</submenuHideDelay>
    <applicationIcons>yes</applicationIcons>
    <manageDesktops>yes</manageDesktops>
    <file>menu.xml</file>

  </menu>

    My suggestion is to duplicate the code but creating a new menu in the tag <file>. Something like this:

<menu>
    <hideDelay>250</hideDelay>
    <middle>no</middle>
    <submenuShowDelay>100</submenuShowDelay>
    <submenuHideDelay>400</submenuHideDelay>
    <applicationIcons>no</applicationIcons>
    <manageDesktops>yes</manageDesktops>
    <file>/home/pibarnas/.config/openbox/custom.xml</file>

  </menu>

    Don't forget to associate a keybind key to call your future menu, into the rc.xml too:

<keybind key="W-c">
      <action name="ShowMenu">
        <menu>custom</menu>
      </action>

    </keybind> 

    Now, in $HOME/.config/openbox, create the file custom.xml, following the rules to make openbox menus (openbox menus):

    Always starting with 

<?xml version="1.0" encoding="utf-8"?>

<openbox_menu xmlns="http://openbox.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openbox.org/ file:///usr/share/openbox/menu.xsd">

    And finish with:

          </openbox_menu>


    In mine, the contents are like this:
<?xml version="1.0" encoding="utf-8"?>
<openbox_menu xmlns="http://openbox.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openbox.org/ file:///usr/share/openbox/menu.xsd">
<menu
  id="custom"
  label="custom"
>
<item
  label="Music"
>
  <action
    name="Execute"
  >
  <execute>sakura -x /home/pibarnas/bin/music.sh -h</execute>
  </action>
</item>
<item
  label="Vim"
>
  <action
    name="Execute"
  >
  <execute>/opt/appimages/vi</execute>
  </action>
</item>
<item label="_backup OB files">
                <action name="Execute">
                    <prompt>
                        Fazer backup das configs?
                    </prompt>
                    <execute>
                        /home/pibarnas/bin/bkp_openbox2.sh
                    </execute>
                </action>
            </item>
            <item label="Edit Backup">
                <action name="Execute">
                    <execute>
    /opt/appimages/vi /home/pibarnas/bin/bkp_openbox2.sh
                    </execute>
                </action>
            </item>


<menu
  id="Sair"
  label="Sair"
>
<item
  label="Reiniciar"
>
        <action name="Execute">
          <command>/usr/bin/systemctl reboot</command>
        </action>
      </item>
<item
  label="Desligar"
>
        <action name="Execute">
          <command>/usr/bin/systemctl poweroff</command>
        </action>
      </item>

</menu>
</menu>

</openbox_menu>

    That's it! Apart from the root menu, now I have a custom menu that's shown when I press Windows key+"c". You can make several openbox menus, each one with some functionality (a menu to close the session, for instance). Mine's like this:


    

    Only to show you the difference, my root menu is like this:



         That's all folks! Hope you enjoy this tip!




Comentários

Postagens mais visitadas deste blog

Window list in Fluxbox

One of the best features on openbox comes "hidden" in Fluxbox. To use it, put a line in your "keys" (/home/"user"/.fluxbox/keys) file like that: Mod4 Escape    :ClientMenu In my case, when I click windows button+escape I get: That's it!

Openbox: trays e bmpanel

Todos sabem que sou amante dos gerentes de janelas minimalistas, que ocupam pouco espaço na memória e que uso muito o openbox. Na verdade, existe uma funcionalidade que o openbox não provê nativamente e em virtude dessa deficiência, é necessário usar um programa externo. Tal funcionalidade é o que se chama de systray, que é geralmente uma pequena barra onde ficam alocados os ícones de certas aplicações, como o parcellite, o beep-media-player-x, o quodlibet (geralmente players têm essa característica). Então, você pode interagir com o programa mesmo ali de seu ícone na systray, no caso de players, com comandos como "play", "pause", stop, etc. Contudo, como disse anteriormente, o fato é que no openbox, essa funcionalidade não é provida, de modo que eu tive problemas com aplicações como o player beep-media-player-x (minha aplicação favorita para ouvir rádio na web), porque em sua configuração padrão, quando você clica no "x" da janela, a aplicação não é morta...