summaryrefslogtreecommitdiff
path: root/community/gambas3/fix-xfce4-terminal.patch
blob: c8fcc8f4f0030a77e4f72f59ea309d39e16d40d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
--- gb.desktop/src/gb.desktop/.src/Desktop.class	(révision 5536)
+++ gb.desktop/src/gb.desktop/.src/Desktop.class	(révision 5537)
@@ -1,6 +1,6 @@
 ' Gambas class file
 
-Export 
+Export
 
 Class _Desktop
 
@@ -27,64 +27,64 @@
 Static Private $aImgExt As String[]
 
 Static Public Sub SendMail({To} As String[], Optional Cc As String[], Optional Bcc As String[], Optional Subject As String, Optional Body As String, Optional Attachment As String)
-  
+
   Dim aArg As String[]
   'xdg-email [--utf8] [--cc address] [--bcc address] [--subject text] [--body text
   ' ] [--attach file] { mailto-uri | address(es) }
-  
+
   aArg = ["--utf8"]
-  If CC And If CC.Count Then 
+  If CC And If CC.Count Then
     aArg.Add("--cc")
     aArg.Insert(CC)
   Endif
-  If BCC And If BCC.Count Then 
+  If BCC And If BCC.Count Then
     aArg.Add("--bcc")
     aArg.Insert(BCC)
   Endif
-  If Subject Then 
+  If Subject Then
     aArg.Add("--subject")
     aArg.Add(Subject)
-  Endif 
-  If Body Then 
+  Endif
+  If Body Then
     aArg.Add("--body")
     aArg.Add(Body)
   Endif
-  If Attachment Then 
+  If Attachment Then
     aArg.Add("--attach")
     aArg.Add(Attachment)
-  Endif 
-  
-  If {To} And If To.Count Then 
+  Endif
+
+  If {To} And If To.Count Then
     aArg.Insert({To})
   Endif
-  
+
   Main.RunXdgUtil("xdg-email", aArg)
-  
+
 End
 
 Static Public Sub {Open}(URL As String, Optional {Wait} As Boolean)
-  
+
   If URL = "~" Then
     URL = User.Home
   Else If URL Begins "~/" Then
     URL = User.Home & Mid$(URL, 2)
   Endif
-  
+
   Main.RunXdgUtil("xdg-open", [URL], {Wait})
-  
+
 End
 
 ' Static Private Function Menus_Read() As _DesktopMenus
-' 
-'   Return _DesktopMenus  
-' 
+'
+'   Return _DesktopMenus
+'
 ' End
-' 
-' 
+'
+'
 ' Static Private Function Icons_Read() As _DesktopIcons
-' 
+'
 '   Return _DesktopIcons
-' 
+'
 ' End
 
 Static Private Function ScreenSaver_Read() As _Desktop_ScreenSaver
@@ -96,20 +96,20 @@
 '  GB_STATIC_METHOD("Find", "Integer[]", CDESKTOP_find, "[(Title)s(Application)s(Role)s]"),
 
 Static Public Sub FindWindow(Optional Title As String, Application As String, Role As String) As Integer[]
-  
+
   Return _Desktop.FindWindow(Title, Application, Role)
-  
+
 End
 
 ' STATIC PRIVATE SUB InitKeys()
-'   
+'
 '   $cKeys = NEW Collection
 '   $cKeys["é"] = "eacute"
-'   
+'
 ' END
 
 Static Public Sub SendKeys(Keys As String)
-  
+
   Dim iInd As Integer
   Dim sCar As String
   Dim iPos As Integer
@@ -117,15 +117,15 @@
   Dim bHold As Boolean
   Dim sErr As String
   Dim iLen As Integer = String.Len(Keys)
-  
+
   Do
-  
+
     Inc iInd
     If iInd > iLen Then Break
-    
+
     sCar = String.Mid$(Keys, iInd, 1)
-    
-    If sCar = "[" Then 
+
+    If sCar = "[" Then
       iPos = String.InStr(Keys, "]", iInd)
       If iPos = 0 Then Break
       sCar = String.Mid$(Keys, iInd + 1, iPos - iInd - 1)
@@ -134,7 +134,7 @@
     Else If sCar = "{" And If Not bHold Then
       bHold = True
       Continue
-    Else If sCar = "}" And If bHold Then 
+    Else If sCar = "}" And If bHold Then
       bHold = False
       aRelease.Reverse
       For Each sCar In aRelease
@@ -144,11 +144,11 @@
       aRelease.Clear
       Continue
     Endif
-    
-    If Len(sCar) >= 2 Then 
+
+    If Len(sCar) >= 2 Then
       Try sCar = Conv(sCar, "UTF-8", "LATIN1")
     Endif
-    
+
     If bHold Then
       'DEBUG sCar;; TRUE
       _Desktop.SendKey(sCar, True)
@@ -159,25 +159,25 @@
       'DEBUG sCar;; FALSE
       _Desktop.SendKey(sCar, False)
     Endif
-    
-  Loop 
-  
-Catch 
 
+  Loop
+
+Catch
+
   sErr = Error.Text & ": '" & sCar & "'"
-  
+
   For Each sCar In aRelease
     _Desktop.SendKey(sCar, False)
   Next
 
   Error.Raise(sErr)
-  
+
 End
 
 Static Private Sub GetDesktop() As String
-  
+
   If Not $sDesktop Then
-    
+
     If Application.Env["KDE_FULL_SESSION"] Then
       If Application.Env["KDE_SESSION_VERSION"] = "4" Then
         $sDesktop = "KDE4"
@@ -204,24 +204,23 @@
           $sDesktop = "?"
       End Select
     Endif
-    
+
   Endif
-  
+
   '$sDesktop = "GNOME"
   Return $sDesktop
-  
+
 End
 
+Static Public Sub OpenTerminal(Optional {Dir} As String) ', Optional Command As String)
 
-Static Public Sub OpenTerminal(Optional {Dir} As String) ', Optional Command As String)
-  
   Dim sExec As String
   Dim sCmd As String
   Dim bNoDir As Boolean
   Dim Command As String
-  
+
   Select Case GetDesktop()
-  
+
     Case "KDE"
       sExec = "konsole"
     Case "KDE4"
@@ -247,7 +246,7 @@
       Endif
       If Command Then sExec &= " -x " & Shell$(Command)
     Case "XFCE"
-      sExec = "Terminal"
+      sExec = "xfce4-terminal"
       If Command Then sExec &= " -x " & Shell$(Command)
     Case "LXDE"
       sExec = "lxterminal"
@@ -255,46 +254,43 @@
     Case Else
       sExec = "xterm"
       If Command Then sExec &= " -e " & Shell$(Command)
-  
+
   End Select
-  
+
   If {Dir} And If Not bNoDir Then
     sCmd = "(cd " & Shell$({Dir}) & "; " & sExec & ")"
   Else
     sCmd = sExec
   Endif
-  
+
   Shell sCmd
-  
+
 End
 
-
 Static Private Function Type_Read() As String
 
-  Return GetDesktop()  
+  Return GetDesktop()
 
 End
 
-
 Static Public Sub _get(Index As Integer) As _DesktopVirtual
 
   Dim hVirtual As _DesktopVirtual
-  
+
   If Not $cDesktop Then $cDesktop = New Collection
-  
+
   hVirtual = $cDesktop[Index]
   If Not hVirtual Then
     hVirtual = New _DesktopVirtual(Index)
     $cDesktop[Index] = hVirtual
   Endif
   Return hVirtual
-  
+
 End
 
-
 Static Private Function Current_Read() As Integer
 
-  Try Return _Desktop.GetWindowProperty(Atom["_NET_CURRENT_DESKTOP"])[0]  
+  Try Return _Desktop.GetWindowProperty(Atom["_NET_CURRENT_DESKTOP"])[0]
 
 End
 
@@ -313,7 +309,7 @@
 
 Static Private Sub Count_Write(Value As Integer)
 
-  _Desktop.SendClientMessageToRootWindow(Atom["_NET_NUMBER_OF_DESKTOPS"], [Value])  
+  _Desktop.SendClientMessageToRootWindow(Atom["_NET_NUMBER_OF_DESKTOPS"], [Value])
 
 End
 
@@ -343,40 +339,40 @@
 
 Static Private Sub Showing_Write(Value As Boolean)
 
-  _Desktop.SendClientMessageToRootWindow(Atom["_NET_SHOWING_DESKTOP"], [If(Value, 1, 0)])  
+  _Desktop.SendClientMessageToRootWindow(Atom["_NET_SHOWING_DESKTOP"], [If(Value, 1, 0)])
 
 End
 
 ' Static Private Function Width_Read() As Integer
-' 
+'
 '   Dim iWidth As Integer
-'   
+'
 '   Try iWidth = _Desktop.GetWindowProperty(Atom["_NET_DESKTOP_GEOMETRY"])[0]
 '   If iWidth = 0 Then iWidth = Super.Width
 '   Return iWidth
-' 
+'
 ' End
-' 
+'
 ' Static Private Function Height_Read() As Integer
-' 
+'
 '   Dim iHeight As Integer
-' 
+'
 '   Try iHeight = _Desktop.GetWindowProperty(Atom["_NET_DESKTOP_GEOMETRY"])[1]
 '   If iHeight = 0 Then iHeight = Super.Height
 '   Return iHeight
-' 
+'
 ' End
 
 ' Static Private Function W_Read() As Integer
-' 
+'
 '   Return Width_Read()
-' 
+'
 ' End
-' 
+'
 ' Static Private Function H_Read() As Integer
-' 
+'
 '   Return Height_Read()
-' 
+'
 ' End
 
 Static Private Function Passwords_Read() As _Desktop_Passwords
@@ -385,7 +381,6 @@
 
 End
 
-
 Static Private Function Path_Read() As String
 
   Return Main.GetDesktopPath()
@@ -399,34 +394,33 @@
 End
 
 Static Public Sub RunAsRoot(Command As String)
-  
+
   Main.RunXdgUtil("xdg-su", ["-c", Command])
-  
 
 End
 
 Static Public Sub GetFileIcon(Path As String, Size As Integer, Optional Preview As Boolean) As Picture
-  
+
   Dim hImage As Image
   Dim hIcon As Image
   Dim sIcon As String
   Dim hPict As Picture
-  
+
   If IsDir(Path) Then Return Picture["icon:/" & CStr(Size) & "/directory"]
-  
+
   If Preview And If $aImgExt.Exist(File.Ext(Path)) < 0 Then
-    If Stat(Path).Size <= 65536 Then 
-    
+    If Stat(Path).Size <= 65536 Then
+
       Try hImage = Image.Load(Path)
       If Not Error Then
-        If Not (hImage.Width = Size And hImage.Height = Size) Then 
-          If hImage.Width > hImage.Height Then 
+        If Not (hImage.Width = Size And hImage.Height = Size) Then
+          If hImage.Width > hImage.Height Then
             hImage = hImage.Stretch(Size, (Size * hImage.Height) \ hImage.Width)
           Else
             hImage = hImage.Stretch((Size * hImage.Width) \ hImage.Height, Size)
           Endif
         Endif
-        
+
         hIcon = New Image(hImage.W + 4, hImage.H + 4, Color.Transparent)
         Paint.Begin(hIcon)
         Paint.AntiAlias = False
@@ -435,38 +429,38 @@
         Paint.Stroke
         Paint.End
         hIcon.DrawImage(hImage, 2, 2)
-        
+
         Return hIcon.Picture
       Else
-        Return Picture["icon:/" & Size & "/image"]  
+        Return Picture["icon:/" & Size & "/image"]
       Endif
-    
+
     Endif
-    
+
   Endif
 
   Try hPict = DesktopMime.FromFile(Path).GetIcon(Size).Picture
   If hPict Then Return hPict
-    
+
   If Not $cExt Then InitFileExt
-  
+
   Try sIcon = $cExt[File.Ext(Path)]
   If sIcon Then Return Picture["icon:/" & CStr(Size) &/ sIcon]
-    
+
   With Stat(Path)
-    
+
     If InStr(.Perm[System.User.Name], "x") Then Return Picture["icon:/" & CStr(Size) &/ "exec"]
-    
+
   End With
-  
+
 Catch
-  
+
   Error "gb.desktop: unable to get icon for file: "; File.Name(Path)
-  
+
 End
 
 Static Private Sub InitFileExt()
-  
+
   $cExt = New Collection
   $cExt["html"] = "html"
   $cExt["htm"] = "html"
@@ -502,7 +496,7 @@
   $cExt["ico"] = "image"
   $cExt["xcf"] = "image"
   $cExt["svg"] = "image"
-  
+
   $aImgExt = ["png", "jpeg", "jpg", "gif", "xpm", "bmp", "ico"]
-  
+
 End