[Gambas-user] gb.desktop.x11 (taskbar)

herberth guzman herberthguzman at ...626...
Fri May 16 18:15:48 CEST 2014


Hi Beno?t

Send part of my code from my taskbar
I have read a little about freedesktop and have seen some codes (they are
all different)
Really do not want to use one existing, I want one made ​​in Gambas3, is
that why I need it.

I would like that my whole project is developed in Gambas3.

And thanks for your help and support.

Regards.


//////////////////////////////////////////////

Public id_win_active As Integer
Public HPanel_app As Panel
Public hToggle As ToggleButton

Public Sub _new()

X11.SetWindowProperty(Atom["_NET_WM_WINDOW_TYPE"], Atom["ATOM"],
Atom["_NET_WM_WINDOW_TYPE_DOCK"], f_taskbar.Id)
X11.SetWindowProperty(Atom["_NET_WM_STRUT"], Atom["ATOM"], [0, 0, 0, 32],
f_taskbar.Id)
X11.SetWindowProperty(Atom["_NET_WM_STRUT_PARTIAL"], Atom["ATOM"], [0, 0,
0, 32, 0, 0, 0, 0, 0, 0, Desktop.H], f_taskbar.Id)

'_NET_WM_USER_TIME (I have no idea)

Desktop_Windows

End

Public Sub Form_Open()

Me.TopOnly = True
M_Global.Add(Me)

Me.Top = Desktop.Height - 32
Me.Width = Desktop.Width
Me.x = 0
m_kernel.Show_Appearance_Taskbar
Wait 0.5

M_Embed.EMBED_SYSTEMTRAY

End

Public Sub MK_Panel()

      HPanel_app = New Panel(Me.Panel1) As "PanelApp"
      With HPanel_app
     .AutoResize = True
      .Expand = True
      .Arrangement = Arrange.Horizontal
      .Padding = 0
      .Spacing = True
      .H = 18

  End With

End


Public Sub Desktop_Windows()

  Dim i As Integer

  MK_Panel
  Desktop.Windows.Refresh
  For I = 0 To Desktop.Windows.Count - 1
    If Desktop.Windows[i].Name Then

      hToggle = New ToggleButton(Me.HPanel_app) As "toggle"
      hToggle.Text = Desktop.Windows[i].Name
  Try hToggle.Picture = Desktop.Windows[i].GetIcon(16,
16).Picture.Image.Stretch(32, 32).Picture
      hToggle.Border = True
      hToggle.AutoResize = True
      hToggle.Height = 16
      hToggle.Font.Size = 8
      hToggle.Width = 150
      hToggle.Mouse = 13
      hToggle.Value = Desktop.Windows[i].id = Desktop.ActiveWindow
      hToggle.Tag = Desktop.Windows[i].Id
      hToggle.Tooltip = Desktop.Windows[i].Name
      hToggle.Refresh

    If (hToggle.Picture = Picture[Null]) Then
      hToggle.Picture = Picture["icon:/16/apps/application-default-icon"]
    Endif

  Endif

Next

End

Public Sub Toggle_Click()

Dim Value As Integer =1

  Try id_win_active = Last.Tag
  Try Desktop.ActiveWindow = id_win_active


  _X11.MinimizeWindow(id_win_active, 1)

 If Value = 1 Then

   _X11.MinimizeWindow(id_win_active, 0)

 Else

   _X11.MinimizeWindow(id_win_active, 1)

 Endif

End

Public Sub Form_Close()

  Shell " killall nm-applet"
  Shell " killall stalonetray"

End

Public Sub mnuClose_Click()

  _X11.SendClientMessageToRootWindow("_NET_CLOSE_WINDOW", [1, 0,
id_win_active, 0, 0], id_win_active)
  Desktop.Windows.Refresh()
  f_taskbar.Refresh
  Wait

End

Public Sub mnuMaximized_Click()

_X11.MinimizeWindow(id_win_active, 0)

End

Public Sub mnuMinimizar_Click()

_X11.MinimizeWindow(id_win_active, 1)

End



Herberth Guzman



More information about the User mailing list