Add blackbox to switchdesk

From blag.wiki.aktivix.org

Jump to: navigation, search

[This article was written in reference to Blag 30k, it might also work with later versions, but I (ewl) haven't tested it] Blackbox is included in the Blag installation cd and yet switchdesk, both the command line and gui versions are not set up to handle it. Ordinarily to change your preferred desktop to blackbox so that when you log in with gdm or at the command line if you are running at run level 3, you would run the "desktop switching tool" and choose the Blackbox entry or type "switchdesk blackbox" at the command line. But "desktop switching tool" does not have an entry for Blackbox and "switchdesk" will give you the error message "Unknown desktop requested: blackbox". The quick fix would be to edit the .Xclients-default file which is created the first time you use switchdesk.

To do that, open your favorite text editor to edit ~/.Xclients-default. If your system is set up with to run gnome as the default desktop then it should look something like this:

  #!/bin/bash
  # (c) 2001 Red Hat, Inc.
                    
  WM="gnome-session"
  WMPATH="/usr/bin /usr/X11R6/bin /usr/local/bin"
                          
  for p in $WMPATH ; do
     [ -x $p/$WM ] && exec $p/$WM
  done
                      
  exit 1

To change the default desktop to blackbox, change WM="gnome-session" to WM="blackbox". The next time you login in at gdm, it will run blackbox.

But if you switch back and forth among the desktops you might like to have it accessible through switchdesk.

The command line switchdesk is easy to fix. It simply involves editing the script /usr/bin/switchdesk-helper and creating a file /usr/share/switchdesk/Xclients.blackbox. Switch to superuser (su) and call up your favorite editor to edit /usr/bin/switchdesk-helper (first save a copy of the original as "switchdesk-helper.bak" or whatever). Halfway down the script you will find a "case" statement: "case $DESKTOP in" followed by several entries. Each of these paragraphs is associated with a different desktop. Add the following paragraph in there without breaking up any of the other paragraphs:

   BLACKBOX)
       [ ! -x /usr/bin/blackbox ] && NotFound BLACKBOX
       DNAME="blackbox"
       NEW_XCLIENTS="$DATADIR/Xclients.blackbox"
       ;;

Save the file. Next you have to create a file Xclients.blackbox in the /usr/share/switchdesk directory. Open your favorite editor as root and enter the following:

   #! /bin/bash
   # (c) 2000-2004 Red Hat, Inc.
                  
   WM="blackbox"
   WMPATH="/usr/bin /usr/X11R6/bin /usr/local/bin"
                     
   for p in $WMPATH ; do
       [ -x $p/$WM ] && exec $p/$WM
   done
                   
   exit 1   

Save it as /usr/share/switchdesk/Xclients.blackbox That will fix the command line "switchdesk". Now when you type "switchdesk blackbox" at the command line it will respond: "Desktop now set up to run blackbox." and when you log in at the gdm prompt or type startx at the command line, blackbox will come up.

Fixing the GUI in order to get an entry for Blackbox involves changing 3 other files in /usr/share/switchdesk/.

Open /usr/share/switchdesk/switchdesk.glade in your favorite text editor. Save the current file as "switchdesk.glade.bak". You will find a number of paragraphs in the middle of the script beginning with the tag <child> and ending with </child>

The paragraph associated with Xfce will have the following line after the openning tag:

    <widget class="GtkRadioButton" id="xfceRB">

Find the end tag (</child>) for that paragraph and paste in the following paragraph after </child> and before <child> of the next paragraph:

   <child>
               <widget class="GtkRadioButton" id="blackboxRB">
               <property name="can_focus">True</property>
               <property name="label"   translatable="yes">_Blackbox</property>
               <property name="use_underline">True</property>
               <property name="relief">GTK_RELIEF_NORMAL</property>
               <property name="focus_on_click">True</property>
               <property name="active">False</property>
               <property name="inconsistent">False</property>
               <property name="draw_indicator">True</property>
               <property name="group">gnomeRB</property>
               <signal name="clicked" handler="on_blackboxRB_clicked" last_modification_time=""/>
               </widget>
               <packing>
                  <property name="padding">0</property>
                  <property name="expand">False</property>
                  <property name="fill">False</property>
               </packing>
   </child>


Save the file.

Next open /usr/share/switchdesk/backend.py with you text editor. Part way down is a section defining desktops.

  GNOME = 'GNOME'
  KDE = 'KDE'
  XFCE = 'XFce'

etc. Somewhere in there add the following entry:

  BLACKBOX='BlackBox'

Right under that is a section starting:

  WINDOWMANAGERS={ KDE           : [ 'startkde', 'kdeRB', 'kde', 'kde.png' ],
                   GNOME         : [ 'gnome-session', 'gnomeRB', 'gnome', 'gnome.png' ],
                   XFCE          : [ 'startxfce4', 'xfceRB' , 'xfce', 'xfce.png' ],


Add the following entry to the list:

  BLACKBOX       : [ 'blackbox', 'blackboxRB', 'blackbox', 'blackbox.png' ],

Save the file.

Open /usr/share/switchdesk/switchdesk-gui.py. Part way down you will see the following:

       self.xml.signal_autoconnect(
           {
           'on_cancelB_clicked' : self.on_cancelB_clicked,
           'on_okB_clicked' : self.on_okB_clicked,
           'on_gnomeRB_clicked' : (self.on_RB_clicked, GNOME),
           'on_kdeRB_clicked' : (self.on_RB_clicked, KDE),
           'on_xfceRB_clicked' : (self.on_RB_clicked, XFCE),

etc. Add the following to that list:

          'on_blackboxRB_clicked' : (self.on_RB_clicked, BLACKBOX),
 

Save the file.

You should have already created a Xclients.blackbox file. If not see above for instructions. Now, when you click on "Desktop Switching Tool" or type "switchdesk" in a terminal with X-windows running you should see a dialog box and Blackbox should be included among the selections. The only thing wrong is that there is no graphical icon associated with it. That is fixed by downloading the following: [/http://ed.labonte.com/blackbox.png] and placing the file in /usr/share/switchdesk/pixmaps.

Personal tools