Hi folks,

the attached patch allows lxpanelctl to toggle panel visibility; this is
useful for folks like me who want to give the maximum screen estate to their
running applications, but want to have the panel only a hotkey away.

I am open to debate about the name of the command "togglehide" seems a bit
long.

Re
diff --git a/src/lxpanelctl.c b/src/lxpanelctl.c
index 293c673..c3fcc63 100644
--- a/src/lxpanelctl.c
+++ b/src/lxpanelctl.c
@@ -36,6 +36,7 @@ static const char usage[] =
         "run\tshow run dialog\n"
         "config\tshow configuration dialog\n"
         "restart\trestart lxpanel\n"
+        "togglehide\ttoggle autohide\n"
         "exit\texit lxpanel\n\n";
 
 static int get_cmd( const char* cmd )
@@ -48,6 +49,8 @@ static int get_cmd( const char* cmd )
         return LXPANEL_CMD_CONFIG;
     else if( ! strcmp( cmd, "restart") )
         return LXPANEL_CMD_RESTART;
+    else if( ! strcmp( cmd, "togglehide") )
+        return LXPANEL_TOGGLE_AUTOHIDE;
     else if( ! strcmp( cmd, "exit") )
         return LXPANEL_CMD_EXIT;
     return -1;
diff --git a/src/lxpanelctl.h b/src/lxpanelctl.h
index a9181d1..3040b74 100644
--- a/src/lxpanelctl.h
+++ b/src/lxpanelctl.h
@@ -28,7 +28,8 @@ typedef enum {
     LXPANEL_CMD_RUN,
     LXPANEL_CMD_CONFIG,
     LXPANEL_CMD_RESTART,
-    LXPANEL_CMD_EXIT
+    LXPANEL_TOGGLE_AUTOHIDE,
+    LXPANEL_CMD_EXIT,
 } PanelControlCommand;
 
 #endif
diff --git a/src/panel.c b/src/panel.c
index 163f835..2d8f4c9 100644
--- a/src/panel.c
+++ b/src/panel.c
@@ -230,6 +230,7 @@ gboolean panel_edge_available(Panel* p, int edge);
 void restart(void);
 void gtk_run(void);
 void panel_destroy(Panel *p);
+static void panel_set_visibility(Panel *p, gboolean visible);
 
 static void process_client_msg ( XClientMessageEvent* ev )
 {
@@ -270,6 +271,13 @@ static void process_client_msg ( XClientMessageEvent* ev )
         case LXPANEL_CMD_RESTART:
             restart();
             break;
+        case LXPANEL_TOGGLE_AUTOHIDE:
+            {
+            Panel * p = ((all_panels != NULL) ? all_panels->data : NULL);
+            if (p != NULL)
+                panel_set_visibility(p, !p->visible);
+            }
+            break;
         case LXPANEL_CMD_EXIT:
             gtk_main_quit();
             break;
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Lxde-list mailing list
Lxde-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxde-list

Reply via email to