Radoslav
Radoslav

Reputation: 11

GUI over bash using glade

I want to make a remote control for my PC. Basically all I need is to run a command on a button click. Following this guide I managed to build the layout and it's everything i've ever dreamed of. But when I try to run it using

gtkdialog -g test.glade -p MainWindow

this happens

(gtkdialog:18284): libglade-WARNING **: Expected <glade-interface>.  Got <interface>.
(gtkdialog:18284): libglade-WARNING **: did not finish in PARSER_FINISH state
(gtkdialog:18284): libglade-CRITICAL **: glade_xml_get_widget: assertion 'self != NULL' failed
(gtkdialog:18284): ERROR **: Can not load 'MainWindow' from file 'test.glade' 

And after that nothing really happens.. Is there a easier way to do this?

My idea is to put that program on a separate virtual screen and access it using my cellphone.

That's the glade file

 <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<interface>
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkWindow" id="MainWindow">
    <property name="can_focus">False</property>
    <child>
      <object class="GtkGrid">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <child>
          <object class="GtkButton" id="LvUP">
            <property name="label" translatable="yes">Left Channel UP</property>
            <property name="width_request">217</property>
            <property name="height_request">154</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <signal name="clicked" handler="amixer -c 1 set &quot;PCM Front&quot; 5%+,0%-" swapped="no"/>
          </object>
          <packing>
            <property name="left_attach">0</property>
            <property name="top_attach">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="VolUp">
            <property name="label" translatable="yes">Vol UP</property>
            <property name="width_request">217</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <signal name="clicked" handler="pactl set-sink-volume 0 +5%" swapped="no"/>
          </object>
          <packing>
            <property name="left_attach">1</property>
            <property name="top_attach">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="RvUP">
            <property name="label" translatable="yes">Right Channel UP</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <signal name="clicked" handler="amixer -c 1 set &quot;PCM Front&quot; 0%-,5%+" swapped="no"/>
          </object>
          <packing>
            <property name="left_attach">2</property>
            <property name="top_attach">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="prev">
            <property name="label">gtk-media-previous</property>
            <property name="height_request">154</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="use_stock">True</property>
          </object>
          <packing>
            <property name="left_attach">0</property>
            <property name="top_attach">1</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="play">
            <property name="label" translatable="yes">Play / Pause</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <signal name="clicked" handler="clementine -t" swapped="no"/>
          </object>
          <packing>
            <property name="left_attach">1</property>
            <property name="top_attach">1</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="next">
            <property name="label">gtk-media-next</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="use_stock">True</property>
            <signal name="clicked" handler="clementine -f" swapped="no"/>
          </object>
          <packing>
            <property name="left_attach">2</property>
            <property name="top_attach">1</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="LvDown">
            <property name="label" translatable="yes">Left Channel Down</property>
            <property name="height_request">154</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <signal name="clicked" handler="amixer -c 1 set &quot;PCM Front&quot; 5%-,0%-" swapped="no"/>
          </object>
          <packing>
            <property name="left_attach">0</property>
            <property name="top_attach">2</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="VolDown">
            <property name="label" translatable="yes">Vol Down</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <signal name="clicked" handler="pactl set-sink-volume 0 -5%" swapped="no"/>
          </object>
          <packing>
            <property name="left_attach">1</property>
            <property name="top_attach">2</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="RvDown">
            <property name="label" translatable="yes">Right Channel Down</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <signal name="clicked" handler="amixer -c 1 set &quot;PCM Front&quot; 0%-,5%-" swapped="no"/>
          </object>
          <packing>
            <property name="left_attach">2</property>
            <property name="top_attach">2</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="mute">
            <property name="label" translatable="yes">Mute</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
          </object>
          <packing>
            <property name="left_attach">0</property>
            <property name="top_attach">3</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="foff">
            <property name="label" translatable="yes">Hello Darkness, My Old Friend | foff</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
          </object>
          <packing>
            <property name="left_attach">1</property>
            <property name="top_attach">3</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="hib">
            <property name="label" translatable="yes">Hib3rnate</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
          </object>
          <packing>
            <property name="left_attach">2</property>
            <property name="top_attach">3</property>
          </packing>
        </child>
      </object>
    </child>
    <child type="titlebar">
      <placeholder/>
    </child>
  </object>
</interface>

Upvotes: 0

Views: 2008

Answers (1)

TingPing
TingPing

Reputation: 2292

gtkdialog is an old dead project that does not support the modern gtkbuilder syntax that glade uses. It should be avoided and you should make the application in a language such as python or gjs which has official bindings.

Upvotes: 1

Related Questions