├── .version
├── .directory
├── .app.png
├── .icon.png
├── .lang
├── it.mo
├── nl_NL.mo
├── it.po
└── nl_NL.po
├── appicon.png
├── backgrounds
├── 00.png
├── 01.png
├── 02.png
├── 03.png
├── 04.png
├── 05.png
├── 06.png
├── 07.png
├── 08.png
├── 09.png
├── 10.png
├── 11.png
├── 12.png
├── 13.png
├── 14.png
├── 15.png
├── 17.png
├── 18.png
├── 20.png
├── 21.png
├── 22.png
├── 25.png
├── 26.png
├── 27.png
├── 29.png
├── 30.png
├── 32.png
├── 34.png
├── 35.png
├── 38.png
├── 39.png
├── 41.png
├── 42.png
└── 44.png
├── .src
├── StartClass.class
├── plugins
│ ├── plugin_apps_gui.form
│ ├── plugin_apps_gui.class
│ ├── plugin_009_history.class
│ ├── plugin_030_executable.class
│ ├── plugin_050_ls.class
│ ├── plugin_indexer_gui.form
│ ├── plugin_040_fbookmarks.class
│ ├── plugin_indexer_gui.class
│ ├── plugin_999_template.class
│ ├── bridge.class
│ ├── plugin_100_windows.class
│ ├── plugin_010_calculator.class
│ ├── plugin_015_recent.class
│ ├── plugin_020_apps.class
│ └── plugin_090_indexer.class
├── FMain.form
├── Global.module
├── XbindKeys.class
├── MySettings.module
├── old_Plugins.class
├── gstyle.module
├── hSettings.class
├── hSettings.form
├── MyDesktop.class
└── DesktopApps.class
├── .startup
├── higgins.desktop
├── .project
├── higgins.appdata.xml
├── extbin
├── External_plugin_windowcontrol.sh
├── External_plugin_locate.sh
├── External_plugin_kill.sh
└── External_plugin_grep.sh
├── README.md
└── .settings
/.version:
--------------------------------------------------------------------------------
1 | 0.9.3109
--------------------------------------------------------------------------------
/.directory:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Icon=./.icon.png
3 |
--------------------------------------------------------------------------------
/.app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/.app.png
--------------------------------------------------------------------------------
/.icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/.icon.png
--------------------------------------------------------------------------------
/.lang/it.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/.lang/it.mo
--------------------------------------------------------------------------------
/appicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/appicon.png
--------------------------------------------------------------------------------
/.lang/nl_NL.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/.lang/nl_NL.mo
--------------------------------------------------------------------------------
/backgrounds/00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/00.png
--------------------------------------------------------------------------------
/backgrounds/01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/01.png
--------------------------------------------------------------------------------
/backgrounds/02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/02.png
--------------------------------------------------------------------------------
/backgrounds/03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/03.png
--------------------------------------------------------------------------------
/backgrounds/04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/04.png
--------------------------------------------------------------------------------
/backgrounds/05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/05.png
--------------------------------------------------------------------------------
/backgrounds/06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/06.png
--------------------------------------------------------------------------------
/backgrounds/07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/07.png
--------------------------------------------------------------------------------
/backgrounds/08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/08.png
--------------------------------------------------------------------------------
/backgrounds/09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/09.png
--------------------------------------------------------------------------------
/backgrounds/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/10.png
--------------------------------------------------------------------------------
/backgrounds/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/11.png
--------------------------------------------------------------------------------
/backgrounds/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/12.png
--------------------------------------------------------------------------------
/backgrounds/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/13.png
--------------------------------------------------------------------------------
/backgrounds/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/14.png
--------------------------------------------------------------------------------
/backgrounds/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/15.png
--------------------------------------------------------------------------------
/backgrounds/17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/17.png
--------------------------------------------------------------------------------
/backgrounds/18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/18.png
--------------------------------------------------------------------------------
/backgrounds/20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/20.png
--------------------------------------------------------------------------------
/backgrounds/21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/21.png
--------------------------------------------------------------------------------
/backgrounds/22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/22.png
--------------------------------------------------------------------------------
/backgrounds/25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/25.png
--------------------------------------------------------------------------------
/backgrounds/26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/26.png
--------------------------------------------------------------------------------
/backgrounds/27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/27.png
--------------------------------------------------------------------------------
/backgrounds/29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/29.png
--------------------------------------------------------------------------------
/backgrounds/30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/30.png
--------------------------------------------------------------------------------
/backgrounds/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/32.png
--------------------------------------------------------------------------------
/backgrounds/34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/34.png
--------------------------------------------------------------------------------
/backgrounds/35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/35.png
--------------------------------------------------------------------------------
/backgrounds/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/38.png
--------------------------------------------------------------------------------
/backgrounds/39.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/39.png
--------------------------------------------------------------------------------
/backgrounds/41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/41.png
--------------------------------------------------------------------------------
/backgrounds/42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/42.png
--------------------------------------------------------------------------------
/backgrounds/44.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokoko3k/higgins/HEAD/backgrounds/44.png
--------------------------------------------------------------------------------
/.src/StartClass.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Static Public Sub Main()
4 | FMain.first_init()
5 | ' While 1 = 1
6 | ' fmain.Show()
7 | ' Wait
8 | ' fmain.hide()
9 | ' Wait
10 | ' Wend
11 | End
12 |
--------------------------------------------------------------------------------
/.startup:
--------------------------------------------------------------------------------
1 | StartClass
2 | Higgins
3 | #higgins
4 | 0
5 | 0.9.3109
6 |
7 | gb.args
8 | gb.image
9 | gb.qt5
10 | gb.form
11 | gb.dbus
12 | gb.desktop
13 | gb.desktop.x11
14 | gb.eval
15 | gb.util
16 | gb.settings
17 | gb.gui.trayicon
18 | gb.net
19 | gb.web
20 |
21 |
--------------------------------------------------------------------------------
/higgins.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=higgins
3 | GenericName=Versatile application launcher
4 | Comment=Launches application and do things through plugins
5 | Exec=higgins
6 | Icon=higgins
7 | Categories=FileManager;Utility;FileTools;
8 | Type=Application
9 | StartupNotify=true
10 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 | # Gambas Project File 3.0
2 | Title=Higgins
3 | Startup=StartClass
4 | Icon=appicon.png
5 | Version=0.9.3109
6 | Component=gb.args
7 | Component=gb.image
8 | Component=gb.qt5
9 | Component=gb.form
10 | Component=gb.dbus
11 | Component=gb.desktop
12 | Component=gb.desktop.x11
13 | Component=gb.eval
14 | Component=gb.util
15 | Component=gb.settings
16 | Component=gb.gui.trayicon
17 | Component=gb.net
18 | Component=gb.web
19 | Description="Higgins:\nApplication launcher,\nstarts applications and search for things.\n\nCurrently it:\nEvaluate expressions (calculator)\nFind recently opened documents\nFind desktop applications\nFind executables\nFind local bookmarks\nLists the content of folders\nFind files by indexing user-specified folders\n\nSupport external plugins; take a look to External_plugin_locate.sh for an example"
20 | Authors="Antonio Orefice"
21 | TabSize=2
22 | Translate=1
23 | Language=it
24 | ControlPublic=1
25 | ModulePublic=1
26 | Vendor=kokoko3k
27 | Packager=1
28 | Tags=Calculator,System,TrayIcon,Utility,TerminalEmulator
29 | Dependencies=xbindkeys
30 | GambasVersion=3.8
31 | WebSite=https://github.com/kokoko3k/higgins
32 |
--------------------------------------------------------------------------------
/higgins.appdata.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | higgins.desktop
5 | CC0-1.0
6 | GPL-2.0+ and GFDL-1.3
7 | higgins
8 | Application launcher
9 |
10 | Yet another application launcher: start applications, search for things,
11 | do calculations or whatever you want through external plugins.
12 | Lanciatore di applicazioni: avvia applicazioni, ricerca oggetti
13 | fa calcoli o qualsiasi cosa tu voglia, grazie ai plugin esterni
14 |
15 |
16 | https://github.com/kokoko3k/higgins/
17 |
18 |
19 | http://wpage.unina.it/aorefice/sharevari/higgins/shots/BlackFrame.png
20 |
21 |
22 | https://github.com/kokoko3k/higgins/
23 | Utilities
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/extbin/External_plugin_windowcontrol.sh:
--------------------------------------------------------------------------------
1 |
2 | #!/bin/bash
3 | #Grep plugin
4 | #Put me in ~/.config/gambas3/higgins/extbin to use me
5 |
6 | #This plugin will list every line in $srcfile matching the query
7 |
8 | export IFS=$'\n'
9 | trigger="" #No trigger
10 | minchar=4 #Don't search on queries smaller than that, trigger does not count.
11 |
12 | query="$@"
13 |
14 | #Do we use a trigger?
15 | if [ -n "$trigger" ] ; then
16 | #...Yes, we do, so exit if not triggered
17 | if [[ $query != $trigger* ]] ; then
18 | exit
19 | fi
20 | #Strip the trigger prefix from the query
21 | query=$(echo $query| sed "s/^$trigger//")
22 | fi
23 |
24 |
25 | #Exit if the query is too small
26 | if [ ${#query} -lt $minchar ] ; then
27 | exit ;
28 | fi
29 |
30 | SCRIPTDIR="${0%/*}"
31 |
32 | matches=$(wmctrl -l | grep -vi " -1 " | grep -i "$query" | awk '{$2="";print}')
33 | for window in $matches ; do
34 |
35 | echo BEGIN
36 | wid=$(echo $window | cut -d " " -f 1)
37 | title=$(echo $window | cut -d " " -f 2-)
38 | # For fields description and possible values, please refer to plugins/plugin_999_template
39 | echo Text=$title
40 | echo SubText="Raise and focus this window"
41 | echo Image_file="resize://$SCRIPTDIR/support/windowcontrol.png"
42 | echo Clipboard_data=$title
43 | echo Action="EXEC"
44 | echo Action_p=wmctrl -i -R $wid
45 | echo END
46 | done
47 |
--------------------------------------------------------------------------------
/extbin/External_plugin_locate.sh:
--------------------------------------------------------------------------------
1 |
2 | #!/bin/bash
3 | #Simple locate plugin example.
4 | #Put me in ~/.config/gambas3/higgins/extbin to use me
5 |
6 | #This plugin will search for files using locate command, which has to be installed.
7 | #This plugin will run only when the trigger is used, so:
8 | # to search for "myfile.txt"
9 | # write: l:myfile.txt
10 | # (trigger is "l:")
11 |
12 | #This plugin will not search anything lower than 3 characters (minchar=3)
13 |
14 |
15 | export IFS=$'\n'
16 | trigger="l:" #Search using the trigger? es: l:myfile
17 | minchar=3 #Don't search on queries smaller than that, trigger does not count.
18 |
19 | query="$@"
20 |
21 | #Do we use a trigger?
22 | if [ -n "$trigger" ] ; then
23 | #...Yes, we do, so exit if not triggered
24 | if [[ $query != $trigger* ]] ; then
25 | exit
26 | fi
27 | #Strip the trigger prefix from the query
28 | query=$(echo $query| sed "s/^$trigger//")
29 | fi
30 |
31 | len=${#query}
32 |
33 | #Exit if the query is too small
34 | if [ $len -lt $minchar ] ; then
35 | exit ;
36 | fi
37 |
38 |
39 | #Finally, start the search:
40 | locate --limit 100 -i "$query" | while read file ; do
41 | echo BEGIN
42 | # For fields description and possible values, please refer to plugins/plugin_999_template
43 | echo Text="[Locate:] $(basename $file)"
44 | echo SubText="in " $(dirname $file)"/"
45 | echo Image_file="mimetype://$file"
46 | echo Clipboard_data="$file"
47 | echo Action="GUESS"
48 | echo Action_p="$file"
49 | echo END
50 | done
51 |
--------------------------------------------------------------------------------
/extbin/External_plugin_kill.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #Simple locate plugin example.
3 | #Put me in ~/.config/gambas3/higgins/extbin to use me
4 |
5 | #This plugin will list active processes and kill them on selection
6 |
7 | # !WITHOUT ASKING FOR CONFIRMATION!
8 |
9 |
10 | #This plugin will run only when the trigger is used, so:
11 | # to search for "firefox"
12 | # write: k:firef
13 | # (trigger is "k:")
14 |
15 | #This plugin will list every process with "k:"
16 |
17 |
18 | export IFS=$'\n'
19 | trigger="k:" #Search using the trigger? es: l:myfile
20 | minchar=0 #Don't search on queries smaller than that, trigger does not count.
21 |
22 | query="$@"
23 |
24 | #Do we use a trigger?
25 | if [ -n "$trigger" ] ; then
26 | #...Yes, we do, so exit if not triggered
27 | if [[ $query != $trigger* ]] ; then
28 | exit
29 | fi
30 | #Strip the trigger prefix from the query
31 | query=$(echo $query| sed "s/^$trigger//")
32 | fi
33 |
34 | len=${#query}
35 |
36 | #Exit if the query is too small
37 | if [ $len -lt $minchar ] ; then
38 | exit ;
39 | fi
40 |
41 | SCRIPTDIR=${0%/*}
42 | #Finally, start the search:
43 | for proc in $( ps -e --sort=cmd | grep -e '[0-9]' |grep "$query") ; do
44 | name=$(echo $proc | awk '{ print $4 }')
45 | pid=$(echo $proc | awk '{ print $1 }')
46 | ttime=$(echo $proc | awk '{ print $3 }')
47 | echo BEGIN
48 | # For fields description and possible values, please refer to plugins/plugin_999_template
49 | echo Text=Process name: $name '(' $pid ')'
50 | echo SubText="Time: $ttime"
51 | echo Image_file="resize://$SCRIPTDIR/support/kill.png"
52 | echo Clipboard_data=$name
53 | echo Action="EXEC"
54 | echo Action_p="kill $pid"
55 | echo END
56 | done
57 |
58 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Higgins
2 | ========
3 | Yet another application launcher: start applications, search for things, do calculations or whatever you want through external plugins.
4 |
5 |
6 |
7 |
8 |
9 |
10 | Internal plugins:
11 | ========
12 | * Evaluate expressions (calculator)
13 | * Find recently opened documents
14 | * Find desktop applications
15 | * Find executables
16 | * Find local bookmarks
17 | * Lists the content of folders
18 | * Find files by indexing user-specified folders
19 |
20 | External plugins:
21 | ========
22 | higgins also supports plugins located in ~/.config/gambas3/higgins/extbin/
23 | and since it parses the external plugin output,
24 | the plugins can be written in any language, from bash to c++
25 | Take a look to External_plugin_locate.sh or External_plugin_kill.sh
26 |
27 | Fully themable:
28 | ========
29 | You can define corner radius, background color, image, shadows and more:
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | Mandatory requirements:
41 | ========
42 | * Gambas 3 (usually the very latest version)
43 |
44 | Recommended tools:
45 | ========
46 | * xbindkeys (higgins use it to register a global X11 shortcut)
47 |
48 |
49 | Compiling it:
50 | ========
51 | After you installed gambas 3, just checkout and compile higgins that way:
52 | ```
53 | # git clone https://github.com/kokoko3k/higgins.git
54 | # cd higgins/
55 | # /path/to/gambas/binaries/gbc3 -e -a -g -t -p -m
56 | # /path/to/gambas/binaries/gba3
57 | # ./higgins.gambas
58 | ```
59 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_apps_gui.form:
--------------------------------------------------------------------------------
1 | # Gambas Form File 3.0
2 |
3 | { Form Form
4 | MoveScaled(0,0,78,63)
5 | Persistent = True
6 | Arrangement = Arrange.Vertical
7 | Margin = True
8 | { Frame1 Panel
9 | MoveScaled(-1,0,77,61)
10 | Expand = True
11 | Arrangement = Arrange.Vertical
12 | Margin = True
13 | Border = Border.Raised
14 | { Label3 Label
15 | MoveScaled(0,0,52,5)
16 | Text = ("Also search for apps in the following folders (Not recursive)")
17 | Alignment = Align.Center
18 | }
19 | { HBox1 HBox
20 | MoveScaled(2,5,72,49)
21 | Expand = True
22 | Spacing = True
23 | { VBox3 VBox
24 | MoveScaled(3,1,40,45)
25 | Expand = True
26 | Spacing = True
27 | { GridPaths TableView
28 | MoveScaled(4,7,23,27)
29 | Expand = True
30 | Mode = Select.Single
31 | Grid = False
32 | ShowCursor = True
33 | Header = GridView.Horizontal
34 | }
35 | }
36 | { HBox3 VBox
37 | MoveScaled(49,2,20,46)
38 | AutoResize = True
39 | Spacing = True
40 | { Panel1 Panel
41 | MoveScaled(2,1,14,5)
42 | Arrangement = Arrange.Horizontal
43 | { ButtonAdd Button
44 | MoveScaled(0,0,4,4)
45 | Expand = True
46 | Picture = Picture["icon:/small/add"]
47 | }
48 | { ButtonDel Button
49 | MoveScaled(5,0,4,4)
50 | Expand = True
51 | Picture = Picture["icon:/small/delete"]
52 | }
53 | }
54 | { Separator1 Separator
55 | MoveScaled(1,6,16,1)
56 | }
57 | { Panel2 Panel
58 | MoveScaled(2,7,14,5)
59 | Arrangement = Arrange.Horizontal
60 | { ButtonUp Button
61 | MoveScaled(0,0,4,4)
62 | Expand = True
63 | Picture = Picture["icon:/small/up"]
64 | }
65 | { ButtonDown Button
66 | MoveScaled(5,0,4,4)
67 | Expand = True
68 | Picture = Picture["icon:/small/down"]
69 | }
70 | }
71 | { Separator4 Separator
72 | MoveScaled(1,13,16,1)
73 | }
74 | { HBox2 HBox
75 | MoveScaled(2,15,11,3)
76 | Expand = True
77 | }
78 | }
79 | }
80 | { CheckboxNoDesktop CheckBox
81 | MoveScaled(2,55,70,4)
82 | AutoResize = True
83 | Text = ("Identify desktop files by extension only (faster)")
84 | Value = CheckBox.True
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/.src/FMain.form:
--------------------------------------------------------------------------------
1 | # Gambas Form File 3.0
2 |
3 | { Form Form
4 | MoveScaled(0,0,83,50)
5 | Visible = False
6 | Icon = Picture["appicon.png"]
7 | Persistent = True
8 | Stacking = Window.Above
9 | Sticky = True
10 | SkipTaskbar = True
11 | Arrangement = Arrange.Fill
12 | { TrayMenu Menu
13 | Text = ("TrayMenu")
14 | Visible = False
15 | { MenuTrayOptions Menu
16 | Text = ("Options")
17 | Picture = Picture["icon:/small/options"]
18 | }
19 | { MenuTrayShow Menu
20 | Text = ("Show")
21 | Picture = Picture["icon:/small/new-window"]
22 | }
23 | { QuitMenuTray Menu
24 | Text = ("Quit")
25 | Picture = Picture["icon:/medium/quit"]
26 | }
27 | }
28 | { MenuPopup Menu
29 | Text = ("Menu1")
30 | Visible = False
31 | { MenuOpenFolder Menu
32 | Text = ("Open containing folder")
33 | Picture = Picture["icon:/small/directory"]
34 | }
35 | { MenuOpenFile Menu
36 | Text = ("Open File")
37 | Picture = Picture["icon:/small/file"]
38 | }
39 | { MenuCopy Menu
40 | Text = ("Copy to Clipboard")
41 | Picture = Picture["icon:/small/copy"]
42 | }
43 | { QuitMenu Menu
44 | Text = ("Quit")
45 | Picture = Picture["icon:/huge/quit"]
46 | }
47 | }
48 | { Panel2 Panel
49 | MoveScaled(3,2,73,38)
50 | Tracking = True
51 | Arrangement = Arrange.Vertical
52 | Spacing = True
53 | Margin = True
54 | Padding = 20
55 | { Panel1 Panel
56 | MoveScaled(1,0,79,4.5714)
57 | Tracking = True
58 | Arrangement = Arrange.Horizontal
59 | { TextBox1 TextBox
60 | MoveScaled(22,0,24,4.5714)
61 | Background = &HFF000000
62 | Foreground = Color.TextForeground
63 | Expand = True
64 | Border = False
65 | }
66 | { ButtonConfigure Button
67 | MoveScaled(69,0,4.5714,4)
68 | Picture = Picture["icon:/medium/options"]
69 | Border = False
70 | }
71 | { TextBox2 TextBox
72 | MoveScaled(1,0,20,4.5714)
73 | Background = Color.TextBackground
74 | Foreground = Color.LightForeground
75 | NoTabFocus = True
76 | Ignore = True
77 | ReadOnly = True
78 | Border = False
79 | }
80 | }
81 | { ResultGrid GridView
82 | MoveScaled(8,8,58,25)
83 | Visible = False
84 | Font = Font["+1"]
85 | Background = &HFFFFFF
86 | Tracking = True
87 | Expand = True
88 | Border = False
89 | Mode = Select.Single
90 | Grid = False
91 | ScrollBar = Scroll.None
92 | }
93 | { TimerClose #Timer
94 | #MoveScaled(72,7)
95 | }
96 | }
97 | { PictureBoxBackground PictureBox
98 | MoveScaled(57,31,16,16)
99 | Ignore = True
100 | Stretch = True
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_apps_gui.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Private caller As Object
4 |
5 | Public Sub GridPaths_Activate()
6 | GridPaths.Edit
7 | End
8 |
9 |
10 | Public Sub Form_Show()
11 | LoadSettings()
12 | End
13 |
14 | Public Sub init(caller_p As Object)
15 | caller = caller_p
16 | GridPaths.Columns.count = 1
17 | GridPaths.Columns[0].Title = ("Directory")
18 | GridPaths.Columns.w = -1
19 | LoadSettings()
20 | Update_apps_List()
21 | End
22 |
23 | Public Sub SaveSettings()
24 | Dim i As Integer
25 | Dim filedata As String
26 | For i = 0 To GridPaths.Rows.Max
27 | filedata &= GridPaths[i, 0].text & "\n"
28 | Next
29 | Settings["plugin_apps/grid"] = Left(filedata, -1)
30 | Settings.Save()
31 | End
32 |
33 | Public Sub LoadSettings()
34 | Dim i As Integer
35 | Dim filedata, item, WhatToDo As String
36 | GridPaths.Rows.count = 0
37 | Try filedata = Settings["plugin_apps/grid"]
38 | If Error Then Return
39 | For Each item In Split(filedata, "\n", "", False)
40 | GridPaths.Rows.count += 1
41 | GridPaths[GridPaths.Rows.max, 0].text = item
42 | Next
43 | End
44 |
45 | Public Sub ButtonAdd_Click()
46 | If Dialog.path = "" Then Dialog.path = User.home
47 | If Dialog.SelectDirectory() Then Return
48 | GridPaths.Rows.count += 1
49 | GridPaths[GridPaths.Rows.max, 0].text = Dialog.Path
50 | GridPaths.Columns.w = -1
51 | SaveSettings()
52 | Update_apps_List()
53 | End
54 |
55 | Public Sub ButtonDel_Click()
56 | Try GridPaths.Rows.Remove(GridPaths.row)
57 | SaveSettings()
58 | Update_apps_List()
59 | End
60 |
61 | Public Sub ButtonUp_Click()
62 | Dim t As String
63 | Dim c As Integer
64 | If GridPaths.row <= 0 Then Return
65 |
66 | For c = 0 To GridPaths.Columns.Max
67 | t = GridPaths[GridPaths.row - 1, c].text
68 | GridPaths[GridPaths.row - 1, c].text = GridPaths[GridPaths.row, c].text
69 | GridPaths[GridPaths.row, c].text = t
70 | Next
71 | Try GridPaths.row -= 1
72 | SaveSettings()
73 | Update_apps_List()
74 | End
75 |
76 | Public Sub ButtonDown_Click()
77 | Dim t As String
78 | Dim c As Integer
79 | If GridPaths.row < 0 Then Return
80 | If GridPaths.row = GridPaths.Rows.max Then Return
81 |
82 | For c = 0 To GridPaths.Columns.Max
83 | t = GridPaths[GridPaths.row + 1, c].text
84 | GridPaths[GridPaths.row + 1, c].text = GridPaths[GridPaths.row, c].text
85 | GridPaths[GridPaths.row, c].text = t
86 | Next
87 | Try GridPaths.row += 1
88 | SaveSettings()
89 | Update_apps_List()
90 | End
91 |
92 | Public Sub Update_apps_List()
93 | Dim newdirs As New String[]
94 | Dim i As Integer
95 | For i = 0 To GridPaths.Rows.max
96 | newdirs.Add(GridPaths[i, 0].text)
97 | Next
98 | DesktopApps.Reset(newdirs)
99 | End
100 |
101 |
102 | Public Sub CheckboxNoDesktop_Click()
103 | Settings["plugin_apps/desktop_from_extension"] = CheckboxNoDesktop.value
104 | MySettings.save()
105 | caller.update_apps_timer()
106 | End
107 |
108 | Public Sub Frame1_Arrange()
109 | CheckboxNoDesktop.value = Settings["plugin_apps/desktop_from_extension", CheckBox.true]
110 | End
111 |
--------------------------------------------------------------------------------
/extbin/External_plugin_grep.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #Grep plugin, useful for contacts file (one contact per line)
3 | #Put me in ~/.config/gambas3/higgins/extbin to use me
4 |
5 | #This plugin will list every line in $srcfile matching the query
6 |
7 | export IFS=$'\n'
8 | trigger="" #No trigger
9 | minchar=4 #Don't search on queries smaller than that, trigger does not count.
10 |
11 | query="$@"
12 |
13 | len=${#query}
14 |
15 | #Exit if the query is too small
16 | if [ $len -lt $minchar ] ; then
17 | exit ;
18 | fi
19 |
20 | SCRIPTDIR=${0%/*}
21 |
22 | srcfile=/home/koko/documenti/mycontacts.txt
23 | results=$(grep -i "$query" $srcfile) || exit
24 |
25 | #Finally, start the search:
26 |
27 | for result in $results ; do
28 | echo BEGIN
29 | # For fields description and possible values, please refer to plugins/plugin_999_template
30 | echo Text=$result
31 | echo SubText=In $(basename $srcfile)
32 | echo Image_file="resize://$SCRIPTDIR/support/grep.png"
33 | echo Clipboard_data=$result
34 | echo Action="CLIPBOARD"
35 | echo Action_p=$result
36 | echo END
37 | done
38 |
--------------------------------------------------------------------------------
/.src/Global.module:
--------------------------------------------------------------------------------
1 | ' Gambas module file
2 |
3 | Public unfocused_hide As Boolean = True
4 | Public UseTray As Boolean = True
5 | Public cleartext As Boolean = True
6 | Public backimage As Image
7 | Public text_foreground As Integer = Color.textforeground
8 | Public textgrid_foreground As Integer = Color.textforeground
9 | Public fullyloaded As Boolean = False
10 | Public already_shown As Boolean = False
11 | Public form_open_h As Integer = 0
12 |
13 |
14 | Public Function Change_transparency(f As Form, transparent As Boolean) As Boolean
15 | 'change the f transparent property and returns if there is an error
16 | Dim err As Boolean
17 | Try f.transparent = transparent
18 | If Error Then
19 | err = True
20 | hSettings.MessageView1.animated = True
21 | hSettings.MessageView1.Open("You may need to restart higgins for changes to take effect")
22 | Else
23 | f.background = -1
24 | Endif
25 | Return err
26 | End
27 |
28 |
29 | Public Function image_from_svg(svg_file As String, rSize As String) As Image
30 | Dim hSvg As SvgImage
31 | Dim hImage As Image
32 | If Not Exist(svg_file, True) Then Return Null
33 | hSvg = SvgImage.Load(svg_file)
34 | hImage = New Image(rSize, rSize, Color.Transparent)
35 | Paint.Begin(hImage)
36 | hSvg.Resize(rSize, rSize)
37 | hSvg.Paint
38 | Paint.End
39 | Return hImage
40 | End
41 |
42 | Public Function Load_image(img_file As String, Optional rSize As Integer = -1) As Image
43 | Dim i As New Image
44 |
45 | If Not Exist(img_file, True) Then Return Null
46 |
47 | If Lower(img_file) Ends ".svg" Then Return image_from_svg(img_file, rSize)
48 |
49 | If rSize <> -1 Then
50 | i = Image.Load(img_file)
51 | If i.w <> rSize Then i = i.Stretch(rSize, rSize)
52 | Return i
53 | Endif
54 |
55 | Return Image.Load(img_file)
56 | End
57 |
58 | Public Function find_term() As String
59 | Dim terms As String[] = ["konsole", "gnome-terminal", "xfce4-terminal", "lxterminal", "xterm"]
60 | Dim term As String
61 | For Each term In terms
62 | Debug "checking for " & term & "..."
63 | If System.Exist(term) Then
64 | Debug "found."
65 | Return System.Find(term)
66 | Endif
67 | Next
68 | Return ""
69 | End
70 |
71 | Public Function terminal_cmdline(terminal_emulator As String, cmdline As String) As String
72 | Return terminal_emulator & " -e " & "\"" & "sh -c ' " & cmdline & "; echo; echo Press enter to exit ; read ' \""
73 | End
74 |
75 | Public Function object_lock(o As Object)
76 | While Not (Object.IsLocked(o))
77 | Object.lock(o)
78 | Wend
79 | End
80 |
81 | Public Function object_unlock(o As Object)
82 | While Object.IsLocked(o)
83 | Object.unlock(o)
84 | Wend
85 | End
86 |
87 | Public Function IsDesktopFile(sFile As String) As Boolean
88 | Dim hFile As Stream
89 | Dim sOneLine As String
90 | Dim FoundTag As Boolean = False
91 | Dim maxLines As Integer = 10
92 | Dim i As Integer = 1
93 | If Lower(sFile) Ends ".desktop" Then Return True
94 | Try hFile = Open sFile For Input
95 | If Error Then Return
96 | While Not Eof(hFile)
97 | Line Input #hFile, sOneLine
98 | sOneLine = Trim(sOneLine)
99 | If sOneLine = "[Desktop Entry]" Then Return True
100 | If Not ((sOneLine Begins "#") Or (sOneLine = "")) Then Return False
101 | i += 1
102 | If i > maxLines Then Return False
103 | Wend
104 | Close #hFile
105 | Return False
106 | End
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/.src/XbindKeys.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Private xbindkeysp As Process
4 | Private conf_file As String
5 | Private hotkeys As Collection
6 | Private xbindkeys_alias As String
7 | Public init_error As Boolean = False
8 | Public CallerForm As Form
9 |
10 | Public Sub _new(conf As String, Optional alias As String = "", fForm As Form)
11 | If Not System.Exist("xbindkeys") Then
12 | Debug "ERROR: xbindkeys not found in system path"
13 | init_error = True
14 | Return
15 | Endif
16 |
17 | If alias <> "" Then
18 | Shell.MkDir(File.Dir(alias))
19 | Try Link System.Find("xbindkeys") To alias
20 | xbindkeys_alias = alias
21 | Else
22 | xbindkeys_alias = "xbindkeys"
23 | Endif
24 |
25 | conf_file = conf
26 | hotkeys = parse_conf()
27 | If hotkeys = Null Then hotkeys = New Collection
28 | CallerForm = fForm
29 | Reload_xbindkeys()
30 | End
31 |
32 | Private Function parse_conf() As Collection
33 | Dim pHotKeys As New Collection
34 | Dim aLine As String
35 | Dim WhatToDo As String 'find_new,find_action,find_hotkey
36 | Dim action, hotkey As String
37 | 'Syntax:
38 | '#new
39 | 'Action
40 | 'hotkey
41 | If Not Exist(conf_file, True) Then Return Null
42 | WhatToDo = "find_new"
43 | For Each aLine In Split(File.Load(conf_file), "\n", "", True)
44 | Select WhatToDo
45 | Case "find_new"
46 | If aLine = "#new" Then WhatToDo = "find_action"
47 | Case "find_action"
48 | action = aLine
49 | WhatToDo = "find_hotkey"
50 | Case "find_hotkey"
51 | hotkey = aLine
52 | pHotkeys[hotkey] = action
53 | WhatToDo = "find_new"
54 | End Select
55 | Next
56 | Return pHotKeys
57 | End
58 |
59 | Private Sub write_conf()
60 | Dim outfile As String
61 | Dim action As String
62 | Dim HotKey As String
63 | For Each Action In hotkeys
64 | hotkey = hotkeys.key
65 | outfile &= "#new" & "\n"
66 | outfile &= Action & "\n"
67 | outfile &= Hotkey & "\n"
68 | Next
69 | File.Save(conf_file, outfile)
70 | End
71 | '
72 | Public Sub register(action As String) As String
73 | Dim tmp As String = Temp()
74 | Dim out As String
75 | Dim splitted As String[]
76 | Dim hotkey As String
77 | Dim x, y, w, h As Integer
78 | Dim g As String
79 |
80 | Shell "touch " & tmp Wait
81 | xbindkeysp.kill
82 |
83 | w = CallerForm.Font.TextWidth("_") * 50
84 | h = CallerForm.Font.textheight("|") * 10
85 | x = CallerForm.screenx + (CallerForm.w Div 2) - (w Div 2)
86 | y = CallerForm.screeny + (CallerForm.h Div 2) - (h Div 2)
87 | g = " -g " & w & "x" & h & "+" & x & "+" & y & " "
88 |
89 | Shell xbindkeys_alias & g & " -k -f " & tmp To out
90 | splitted = Split(out, "\n", "", True)
91 | hotkey = Trim(splitted[splitted.count - 1])
92 | hotkeys[hotkey] = "\"" & "echo " & action & "\""
93 | write_conf()
94 | Reload_xbindkeys()
95 | Return hotkey
96 | End
97 |
98 | Public Sub close()
99 | Try xbindkeysp.kill
100 | clear_hotkeys()
101 | End
102 |
103 | Public Sub clear_hotkeys()
104 | hotkeys.Clear()
105 | End
106 |
107 |
108 | Public Sub Reload_xbindkeys()
109 | Try xbindkeysp.kill
110 | xbindkeysp = Shell xbindkeys_alias & " -n -f " & conf_file For Read As "xbindkeysp"
111 | End
112 |
113 | Event HotkeyPressed(action As String)
114 |
115 | Public Sub xbindkeysp_read()
116 | Dim out As String
117 |
118 | Line Input #xbindkeysp, out
119 | Raise Hotkeypressed(out)
120 | End
121 |
122 |
123 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_009_history.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = ("Finds previously selected documents")
5 | Static Public Friendly_name As String = ("History plugin")
6 | Static Public configurable As Boolean = False
7 | Static Public Default_enabled As Boolean = True
8 | Static Public default_blocking As Boolean = False 'Should the subsequent plugins be blocked when
9 | 'this plugin finds some results?
10 |
11 | Public Struct rItemT
12 | plugin As String 'the plugin name
13 | Text As String 'text displayed in the clipboard
14 | SubText As String 'text displayed under the main text
15 | Image_file As String 'optional image displayed (fullpath or "DefferredMimeIcon")
16 | Clipboard_data As String 'the data copied to the clipboard
17 | Action As String 'string that indicates an action
18 | Action_p As Variant 'the parameter for Action
19 | End Struct
20 |
21 | Private plugin As String
22 | Private iconsize As Integer
23 | Private minchar As Integer = 1 'exit if the search term is lower than that
24 | Private History_size As Integer = 10
25 | Private fconf As String = FMain.confpath & "/" "history.txt"
26 | Private history As New String[]
27 |
28 |
29 | Public Sub _new(p_plugin As String, p_iconsize As Integer)
30 | plugin = p_plugin
31 | iconsize = p_iconsize
32 | Try history = Split(File.Load(fconf), "\n", "", True)
33 | End
34 |
35 | Private Sub trigged(query As String) As Boolean
36 | Return True
37 | End
38 |
39 | Event new_results(rResults As RItemT[])
40 | Public Sub find(textcontrol As Object) As RItemT[]
41 | 'evualuate expressions
42 | Dim rResults As New RItemT[]
43 | Dim rResult As RItemT
44 | Dim current_search As String = textcontrol.text
45 | Dim item As String
46 |
47 | If Not trigged(textcontrol.text) Then Return
48 |
49 | If history.count = 0 Then Return
50 |
51 | For Each item In history
52 | If InStr(Lower(item), Lower(textcontrol.text)) Then
53 | rResult = create_item(item)
54 | If rResult <> Null Then
55 | rResults.Add(rResult)
56 | Raise new_results(rResults)
57 | Endif
58 | If textcontrol.text <> current_search Then Return
59 | Wait
60 | Endif
61 | Next
62 |
63 | Return rResults
64 |
65 | End
66 |
67 |
68 | Public Sub store(filename As String)
69 | Dim pos As Integer
70 |
71 | If Lower(filename) Like "*://*" Then Return
72 | If Not Exist(filename, True) Then Return
73 | If IsDir(filename) Then Return
74 |
75 | If history.count > 0 Then
76 | pos = history.Find(filename)
77 | If pos > -1 Then
78 | history.Remove(pos)
79 | Endif
80 | Endif
81 | history.Add(filename, 0)
82 | If history.count > history_size Then history.Resize(history_size)
83 | File.Save(fconf, history.Join("\n"))
84 | End
85 |
86 |
87 | Private Function create_item(path As String) As RItemT
88 | Dim return_item As RItemT
89 |
90 | If Not (Exist(path, True)) Then Return Null
91 | return_item = New RItemT
92 |
93 | return_item.image_file = "mimetype://" & path
94 |
95 | return_item.plugin = plugin
96 | return_item.Action = "GUESS"
97 | return_item.Action_p = path
98 | return_item.Clipboard_data = path
99 |
100 | return_item.Text = File.Name(path)
101 | return_item.SubText = "Recent item, In: " & File.Dir(path)
102 |
103 | Return return_item
104 |
105 | End
106 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_030_executable.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = ("Executables launcher")
5 | Static Public Friendly_name As String = ("Executables")
6 | Static Public configurable As Boolean = False
7 | Static Public Default_enabled As Boolean = True
8 | Static Public default_blocking As Boolean = False 'Should the subsequent plugins be blocked when
9 | 'this plugin finds some results?
10 |
11 | Public Struct rItemT
12 | plugin As String 'the plugin name
13 | Text As String 'text displayed in the clipboard
14 | SubText As String 'text displayed under the main text
15 | Image_file As String 'optional image displayed (fullpath or "DefferredMimeIcon")
16 | Clipboard_data As String 'the data copied to the clipboard
17 | Action As String 'string that indicates an action
18 | Action_p As Variant 'the parameter for Action
19 | End Struct
20 |
21 |
22 | Private plugin As String
23 | Private iconsize As Integer
24 | Private minchar As Integer = 3 'exit if the search term is lower than that
25 |
26 | Private terminal_emulator As String = ""
27 |
28 |
29 | Public Sub _new(p_plugin As String, p_iconsize As Integer)
30 |
31 | plugin = p_plugin
32 | iconsize = p_iconsize
33 |
34 | End
35 |
36 | Private Sub trigged(query As String) As Boolean
37 | If Len(query) < minchar Then Return False
38 | 'some more controls here (?)
39 | Return True
40 | End
41 |
42 | ' Editable part of the template follows:
43 |
44 | Public Sub find(textcontrol As Object) As RItemT[]
45 | 'search for filedialogs bookmarks
46 | Dim rResults As New RItemT[]
47 | Dim rResult As RItemT
48 | Dim current_search As String = textcontrol.text
49 | Dim exe_found, cmd As String
50 |
51 | If Not trigged(textcontrol.text) Then Return
52 |
53 | If Exist(current_search, True) Then
54 | If Stat(current_search, True).type = gb.Directory Then Return
55 | Endif
56 |
57 | cmd = Split(current_search, " ", "", True)[0]
58 |
59 | Try exe_found = System.Find(cmd)
60 | If exe_found = "" Then Return
61 |
62 | terminal_emulator = Settings["terminal_emulator"]
63 |
64 | rResult = create_item(current_search, False)
65 | If rResult <> Null Then rResults.Add(rResult)
66 |
67 | rResult = create_item(current_search, True)
68 | If rResult <> Null Then rResults.Add(rResult)
69 |
70 | Raise new_results(rResults)
71 | Return rResults
72 | End
73 |
74 | Event new_results(rResults As RItemT[])
75 |
76 |
77 | Private Function create_item(result As String, Optional terminal As Boolean = False) As RItemT
78 | Dim return_item As RItemT
79 | Dim cmdterm As String
80 | Dim cmd, params As String
81 |
82 | cmd = Split(result, " ")[0]
83 | params = Right(result, -Len(cmd))
84 |
85 | return_item = New RItemT
86 | return_item.plugin = plugin
87 | return_item.Clipboard_data = System.Find(cmd) & " " & params
88 | return_item.action = "EXEC"
89 |
90 | If terminal Then
91 | If terminal_emulator <> "" Then terminal_emulator = System.Find(terminal_emulator)
92 | If terminal_emulator = "" Then
93 | Debug "No terminal emulator configured, guessing..."
94 | terminal_emulator = Global.find_term()
95 | If terminal_emulator = "" Then
96 | Debug "Sorry, could not find any terminal emulator"
97 | Return
98 | Endif
99 | Endif
100 | cmdterm = Global.terminal_cmdline(terminal_emulator, result)
101 | return_item.Action_p = cmdterm
102 | return_item.image_file = "icon:/" & iconsize & "/terminal"
103 | return_item.Text = "Run " & result
104 | return_item.SubText = "Run " & result & " in the terminal emulator"
105 |
106 | Else ' no terminal
107 |
108 | return_item.Action_p = result
109 | return_item.image_file = "icon:/" & iconsize & "/exec"
110 | return_item.Text = result
111 | Endif
112 | Return return_item
113 | End
114 |
115 |
116 |
117 | ' Public Function configure()
118 | '
119 | ' '
120 | '
121 | ' End
122 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_050_ls.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = ("List files from a folder")
5 | Static Public Friendly_name As String = ("list plugin")
6 | Static Public configurable As Boolean = False
7 | Static Public Default_enabled As Boolean = True
8 | Static Public default_blocking As Boolean = False 'Should the subsequent plugins be blocked when
9 | 'this plugin finds some results?
10 |
11 | Public Struct rItemT
12 | plugin As String 'the plugin name
13 | Text As String 'text displayed in the clipboard
14 | SubText As String 'text displayed under the main text
15 | Image_file As String 'optional image displayed (fullpath or "DefferredMimeIcon")
16 | Clipboard_data As String 'the data copied to the clipboard
17 | Action As String 'string that indicates an action
18 | Action_p As Variant 'the parameter for Action
19 | End Struct
20 |
21 |
22 | Private plugin As String
23 | Private iconsize As Integer
24 | Private minchar As Integer = 4 'exit if the search term is lower than that
25 |
26 |
27 |
28 | Public Sub _new(p_plugin As String, p_iconsize As Integer)
29 |
30 | plugin = p_plugin
31 | iconsize = p_iconsize
32 |
33 | End
34 |
35 |
36 | Private Sub trigged(query As String) As Boolean
37 | If Len(query) < minchar Then Return False
38 | 'some more controls here (?)
39 | Return True
40 | End
41 |
42 | ' Editable part of the template follows:
43 |
44 | Public Sub find(textcontrol As Object) As RItemT[]
45 | 'search for files under the current directory
46 | Dim rResults As New RItemT[]
47 | Dim rResult As RItemT
48 | Dim current_search As String = textcontrol.text
49 | Dim s_path, path As String
50 | Dim aDir As New String[]
51 | If Not trigged(textcontrol.text) Then Return
52 |
53 | s_path = current_search
54 |
55 | If Exist(s_path, True) Then
56 | If Stat(s_path, True).type = gb.file Then
57 | Return [create_item(s_path)]
58 | Endif
59 | Endif
60 |
61 | If Not (s_path Begins "/") Then s_path = User.home & "/" & s_path
62 | If Not Exist(s_path, True) Then Return
63 | 'If Not (Stat(s_path, True).type = gb.Directory) Then Return
64 |
65 | rResults.Add(create_item(s_path))
66 | Raise new_results(rResults)
67 | Try aDir = Dir(s_path).Sort(gb.Natural + gb.IgnoreCase)
68 | If Not Error Then
69 | For Each path In aDir
70 | Debug aDir
71 | Wait 0.0005
72 | If s_path Ends "/" Then
73 | path = s_path & path
74 | Else
75 | path = s_path & "/" & path
76 | Endif
77 | rResult = create_item(path)
78 |
79 | If rResult <> Null Then
80 | rResults.Add(rResult)
81 | Raise new_results(rResults)
82 |
83 | Endif
84 |
85 | If textcontrol.text <> current_search Then Return
86 | Next
87 | Endif
88 | Return rResults
89 | End
90 |
91 | Event new_results(rResults As RItemT[])
92 |
93 | Private Function create_item(path As String) As RItemT
94 | Dim return_item As RItemT
95 | Dim isdir As Boolean
96 | If Exist(path, True) Then
97 | If Not (path Ends "/") Then
98 | isdir = (Stat(path, True).type = gb.Directory)
99 | Else
100 | isdir = True
101 | Endif
102 | Wait
103 | Endif
104 |
105 | If path Ends "/" Then path = Left(path, -1)
106 | return_item = New RItemT
107 | return_item.plugin = plugin
108 | return_item.Action = "GUESS" ' DESKTOPOPEN,EXEC,TERMINALEXEC,GUESS,NULL... MORE?
109 | return_item.Action_p = path
110 | return_item.Clipboard_data = path
111 | 'Stop
112 | If isdir Then
113 | return_item.image_file = "icon:/" & iconsize & "/directory"
114 | return_item.Text = File.Name(path) & "/"
115 | Else If path Ends ".desktop" Then
116 | return_item.image_file = "desktopfile://" & path
117 | return_item.Text = File.Name(path)
118 | Else
119 | return_item.image_file = "mimetype://" & path
120 | return_item.Text = File.Name(path)
121 | Endif
122 |
123 | return_item.SubText = "In " & File.dir(path) '& "/"
124 |
125 | Return return_item
126 | End
127 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_indexer_gui.form:
--------------------------------------------------------------------------------
1 | # Gambas Form File 3.0
2 |
3 | { Form Form
4 | MoveScaled(0,0,79,73)
5 | Text = ("indexer plugin config")
6 | Icon = Picture["icon:/48/options"]
7 | Persistent = True
8 | Arrangement = Arrange.Vertical
9 | Spacing = True
10 | Margin = True
11 | { Frame1 Panel
12 | MoveScaled(1,0,77,67)
13 | Expand = True
14 | Arrangement = Arrange.Vertical
15 | Margin = True
16 | Border = Border.Raised
17 | { Label3 Label
18 | MoveScaled(0,0,35,5)
19 | Text = ("Directories to index")
20 | Alignment = Align.Center
21 | }
22 | { HBox1 HBox
23 | MoveScaled(2,5,72,60)
24 | Expand = True
25 | Spacing = True
26 | { VBox3 VBox
27 | MoveScaled(1,2,40,45)
28 | Expand = True
29 | Spacing = True
30 | { GridIndex TableView
31 | MoveScaled(2,1,36,36)
32 | Expand = True
33 | Mode = Select.Single
34 | Grid = False
35 | ShowCursor = True
36 | Header = GridView.Horizontal
37 | }
38 | { LabelIndexSize Label
39 | MoveScaled(3,40,17,4)
40 | AutoResize = True
41 | Alignment = Align.Left
42 | }
43 | }
44 | { HBox3 VBox
45 | MoveScaled(50,2,20,57)
46 | AutoResize = True
47 | Spacing = True
48 | { Panel1 Panel
49 | MoveScaled(2,1,14,5)
50 | Arrangement = Arrange.Horizontal
51 | { ButtonAdd Button
52 | MoveScaled(0,0,4,4)
53 | Expand = True
54 | Picture = Picture["icon:/small/add"]
55 | }
56 | { ButtonDel Button
57 | MoveScaled(5,0,4,4)
58 | Expand = True
59 | Picture = Picture["icon:/small/delete"]
60 | }
61 | }
62 | { Separator1 Separator
63 | MoveScaled(1,6,16,1)
64 | }
65 | { Panel2 Panel
66 | MoveScaled(2,7,14,5)
67 | Arrangement = Arrange.Horizontal
68 | { ButtonUp Button
69 | MoveScaled(0,0,4,4)
70 | Expand = True
71 | Picture = Picture["icon:/small/up"]
72 | }
73 | { ButtonDown Button
74 | MoveScaled(5,0,4,4)
75 | Expand = True
76 | Picture = Picture["icon:/small/down"]
77 | }
78 | }
79 | { Separator4 Separator
80 | MoveScaled(1,13,16,1)
81 | }
82 | { VBox1 VBox
83 | MoveScaled(1,15,16,1)
84 | Expand = True
85 | }
86 | { LabelLimit Label
87 | MoveScaled(3,17,14,3)
88 | AutoResize = True
89 | Text = ("Limit results to:")
90 | }
91 | { SpinMaxResults SpinBox
92 | MoveScaled(1,21,16,4.5714)
93 | MaxValue = 10000
94 | Value = 50
95 | }
96 | { CheckboxMatchFullPath CheckBox
97 | MoveScaled(1,27,15,4)
98 | ToolTip = ("Example:\nPath /aa/bb/cc exists. and you search for \"aa\" or \"bb\"\nOption checked -> You get \"/aa/bb/cc\"\nOption unchecked -> You DONT get \"/aa/bb/cc\"")
99 | AutoResize = True
100 | Text = ("Match Full Pathname")
101 | }
102 | { CheckBoxMatchHidden CheckBox
103 | MoveScaled(1,32,15,4)
104 | ToolTip = ("Show hidden files or not in search list.\nHidden files are still shown if search begins with \".\"")
105 | AutoResize = True
106 | Text = ("Match hidden files")
107 | }
108 | { Separator2 Separator
109 | MoveScaled(1,38,16,1)
110 | }
111 | { VBox2 VBox
112 | MoveScaled(1,40,16,1)
113 | Expand = True
114 | }
115 | { Label2 Label
116 | MoveScaled(1,41,17,4)
117 | AutoResize = True
118 | Text = ("Update index every:")
119 | Alignment = Align.Left
120 | }
121 | { ValueBoxReindex ValueBox
122 | MoveScaled(1,46,17,4.5714)
123 | Text = ("00:30")
124 | Type = ValueBox.Time
125 | }
126 | { Separator3 Separator
127 | MoveScaled(2,51,16,1)
128 | }
129 | { ButtonReindex Button
130 | MoveScaled(1,52,16,4)
131 | Text = ("Index Now")
132 | Picture = Picture["icon:/small/find"]
133 | }
134 | }
135 | }
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/.src/MySettings.module:
--------------------------------------------------------------------------------
1 | ' Gambas module file
2 |
3 | Public Sub save()
4 | Settings.Save()
5 | End
6 |
7 |
8 | Public plugin_indexer_last_index_time As Date
9 |
10 | Public Sub load()
11 | hSettings.ComboboxTerminalEmulator.text = Settings["terminal_emulator", Global.find_term()]
12 | hSettings.ComboboxIconThemes.text = Settings["icon_theme", ""]
13 | hSettings.ComboboxLag.text = Settings["input_lag", "0.1"]
14 | load_geometry()
15 | hSettings.ColorButton1.value = Settings["style/background", Color.background]
16 | hSettings.checkbox1.value = Settings["style/undecorated", CheckBox.false]
17 | hSettings.SpinBoxExtraPad.value = Settings["style/extrapad", 0]
18 | hSettings.ComboPicture.text = Settings["style/backpicture", ""]
19 | If hSettings.ComboPicture.text <> "" Then
20 | Try Global.backimage = loadBackimage(hSettings.ComboPicture.text)
21 | If Error Then Debug "Could not load background image"
22 | Endif
23 | hSettings.SpinBoxwopacity.value = Settings["style/inneropacity", 100]
24 | hSettings.SpinBoxwopacitygrid.value = Settings["style/inneropacitygrid", 100]
25 | Global.text_foreground = Settings["style/textfg", Color.TextForeground]
26 | Global.textgrid_foreground = Settings["style/textgridfg", Color.TextForeground]
27 | hSettings.colorbuttontextfg.value = Global.text_foreground
28 | hSettings.colorbuttontextgridfg.value = Global.textgrid_foreground
29 | hSettings.colorbuttontextbg.value = Settings["style/textbg", Color.TextBackground]
30 | hSettings.colorbuttongridbg.value = Settings["style/gridbg", Color.TextBackground]
31 | hSettings.CheckBoxborder.value = Settings["style/border", CheckBox.false]
32 |
33 | hSettings.CheckboxShadow.value = Settings["style/shadows", CheckBox.false]
34 | hSettings.SpinBoxshadowsize.value = Settings["style/shadowsize", 9]
35 | hSettings.SpinBoxshadowgamma.value = Settings["style/shadowgamma", -7]
36 | hSettings.SpinBoxshadowalpha.value = Settings["style/shadowalpha", 200]
37 | hSettings.SpinBoxcornerradius.value = Settings["style/cornerradius", 0]
38 | hSettings.checkBoxbordertextbox.value = Settings["style/inputboxborder", CheckBox.true]
39 | hSettings.ScrollbarCheckbox.value = Settings["style/scrollbar", CheckBox.false]
40 |
41 | Global.form_open_h = Settings["General/form_open_h", (Screen.h Div 4)]
42 |
43 | End
44 |
45 | Public Sub loadBackimage(ifile As String) As Image
46 | Dim i As Image
47 | Try i = Image.Load(ifile)
48 | If i.w > Screen.AvailableWidth Then i = i.Stretch(Screen.AvailableWidth, i.h)
49 | If i.h > Screen.AvailableHeight Then i = i.Stretch(i.w, Screen.AvailableHeight)
50 | Return i
51 | End
52 |
53 |
54 |
55 | Public Sub save_geometry()
56 | Dim xy_r As Integer[]
57 | xy_r = Relative_window_geom(fmain)
58 |
59 | Settings["win_rx"] = xy_r[0]
60 | Settings["win_ry"] = xy_r[1]
61 | If xy_r[1] = 28 Then Stop
62 | Settings["win_w"] = xy_r[2]
63 | End
64 |
65 | Public Sub load_geometry(Optional pretend As Boolean = False) As Collection
66 | Dim s As Screen
67 | Dim rx, ry, w As Integer
68 | Dim geom As New Collection
69 | s = Screenbypos(Mouse.ScreenX, Mouse.ScreenY)
70 | rx = Settings["win_rx", 0]
71 | ry = Settings["win_ry", 0]
72 | w = Settings["win_w", (s.w Div 2)]
73 | ' h = Settings["win_h", 64]
74 | If Not pretend Then fmain.Move(rx + s.x, ry + s.y, w)
75 | geom["x"] = rx + s.x
76 | geom["y"] = ry + s.y
77 | geom["w"] = w
78 | Return geom
79 | End
80 |
81 |
82 | Private Function Screenbypos(x As Integer, y As Integer) As Screen
83 | Dim s As Screen
84 | For Each s In Screens
85 | If (x >= s.x) And x <= (s.x + s.W) Then
86 | If (y >= s.y) And y <= (s.y + s.h) Then
87 | Return s
88 | Endif
89 | Endif
90 | Next
91 | 'no screen found !? repeat with more tolerance:
92 | For Each s In Screens
93 | If (x + 50 >= s.x) And x <= (s.x + s.W + 50) Then
94 | If (y + 50 >= s.y) And y <= (s.y + s.h + 50) Then
95 | Return s
96 | Endif
97 | Endif
98 | Next
99 | 'still no screen found? return the first.
100 | Debug "Couldn 't get the matching screen (!)"
101 | Return Screens[0]
102 | End
103 |
104 | Public Function Relative_window_geom(o As Window) As Integer[]
105 | 'get the object position relative to the screen is on
106 | Dim rx, ry, ox, oy As Integer
107 | Dim cs As Screen
108 | Dim out As New Integer[]
109 | cs = Screenbypos(o.x, o.y)
110 | ox = cs.X 'offset
111 | oy = cs.Y 'offset
112 | rx = o.x - ox
113 | ry = o.y - oy
114 | out.Add(rx)
115 | out.Add(ry)
116 | out.Add(o.w)
117 | out.Add(o.h)
118 | Return out
119 | End
120 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_040_fbookmarks.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = ("Search through desktop bookmarks")
5 | Static Public Friendly_name As String = ("Folder bookmarks")
6 | Static Public configurable As Boolean = False
7 | Static Public Default_enabled As Boolean = True
8 | Static Public default_blocking As Boolean = False 'Should the subsequent plugins be blocked when
9 | 'this plugin finds some results?
10 |
11 | Public Struct rItemT
12 | plugin As String 'the plugin name
13 | Text As String 'text displayed in the clipboard
14 | SubText As String 'text displayed under the main text
15 | Image_file As String 'optional image displayed (fullpath or "DefferredMimeIcon")
16 | Clipboard_data As String 'the data copied to the clipboard
17 | Action As String 'string that indicates an action
18 | Action_p As Variant 'the parameter for Action
19 | End Struct
20 |
21 |
22 | Private plugin As String
23 | Private iconsize As Integer
24 | Private minchar As Integer = 4 'exit if the search term is lower than that
25 |
26 |
27 |
28 | Public Sub _new(p_plugin As String, p_iconsize As Integer)
29 |
30 | plugin = p_plugin
31 | iconsize = p_iconsize
32 |
33 | End
34 |
35 |
36 | Private Sub trigged(query As String) As Boolean
37 | If Len(query) < minchar Then Return False
38 | 'some more controls here (?)
39 | Return True
40 | End
41 |
42 |
43 | Public Sub find(textcontrol As Object) As RItemT[]
44 | 'search for filedialogs bookmarks
45 | Dim rResults As New RItemT[]
46 | Dim rResult As RItemT
47 | Dim current_search As String = textcontrol.text
48 |
49 | Dim b_file_split As New String[]
50 | Dim b_files As New String[]
51 | Dim my_bookmarks As New String[]
52 | Dim b_file, aLine, path, file_path As String
53 | Dim ok_to_create As Boolean = False
54 | Dim match_str As String
55 | Dim term As String
56 |
57 | If Not trigged(textcontrol.text) Then Return
58 |
59 | term = current_search
60 | 'gtk2,3,qt(kde?)
61 | b_files.Add(User.home & "/" & ".gtk-bookmarks")
62 | b_files.Add(User.home & "/" & ".config/gtk-3.0/bookmarks")
63 | b_files.Add(User.home & "/" & ".local/share/user-places.xbel")
64 |
65 | For Each b_file In b_files
66 |
67 | Try b_file_split = Split(File.load(b_file), "\n")
68 | If Not Error Then 'parseit
69 | For Each aline In b_file_split
70 |
71 | If b_file Ends ".xbel" Then
72 | match_str = "* href=*//*" & term & "*" 'qt/kde
73 | Else
74 | match_str = "*://*" & term & "*" 'gtk2,3
75 | Endif
76 |
77 | If aline Like match_str Then
78 | If b_file Ends ".xbel" Then
79 | Try path = Split(aline, "\"")[1]
80 | Else
81 | Try path = Split(aline, " ")[0]
82 | Endif
83 |
84 | If Lower(path) Begins "file:" Then
85 | If Lower(path) Begins "file://" Then
86 | file_path = Right(path, -7)
87 | Else
88 | file_path = Right(path, -5)
89 | Endif
90 | Endif
91 |
92 | If file_path = "" Then
93 | ok_to_create = True
94 | Else
95 | ok_to_create = False
96 | Try ok_to_create = Exist(file_path, True)
97 | Endif
98 |
99 | If Not Error And ok_to_create Then
100 | If Not (b_file Ends ".xbel") Then path = Replace(path, " ", "%20")
101 | If path Ends "/" Then path = Left(path, -1) 'this is necessary to eliminate dupes
102 | If my_bookmarks.find(path) < 0 Then
103 | my_bookmarks.Add(path)
104 | rResult = create_item(path)
105 | Raise new_results(rResults)
106 | If rResult <> Null Then rResults.Add(rResult)
107 | Endif
108 | Endif 'not error
109 | Endif
110 | Next 'aline
111 | Endif
112 | Next 'b_file
113 | Return rResults
114 | End
115 |
116 | Event new_results(rResults As RItemT[])
117 |
118 | ' Editable part of the template follows:
119 |
120 | Private Function create_item(path As String) As RItemT
121 | Dim return_item As RItemT
122 | return_item = New RItemT
123 | return_item.plugin = plugin
124 | return_item.Action = "DESKTOPOPEN"
125 | return_item.Action_p = path
126 | return_item.Clipboard_data = path
127 | return_item.image_file = "icon:/" & iconsize & "/bookmark"
128 | return_item.Text = path
129 | return_item.SubText = "Local bookmark: " & path
130 | Return return_item
131 | End
132 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_indexer_gui.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Public confdir As String
4 | Public last_index_time As Date
5 | Public caller As Object
6 | Public index_size As Integer = 0
7 |
8 | Public Sub Form_Show()
9 | init(caller)
10 | LoadSettings()
11 | UpdateLabelIndexSize()
12 | End
13 |
14 | Public Sub Form_Hide()
15 | If Me.closed Then Return
16 | SaveSettings()
17 |
18 | End
19 |
20 | Public Sub Form_Close()
21 |
22 | SaveSettings()
23 |
24 | End
25 |
26 | Public Sub SaveSettings()
27 | Settings["plugin_indexer/interval"] = ValueBoxReindex.value
28 | Settings["plugin_indexer/last_index_time"] = last_index_time
29 | Settings["plugin_indexer/maxresults"] = SpinMaxResults.value
30 | Settings["plugin_indexer/matchfullpath"] = CheckBoxmatchfullpath.value
31 | Settings["plugin_indexer/matchhidden"] = CheckBoxmatchhidden.value
32 | SaveGrid()
33 | Settings.Save()
34 | End
35 |
36 | Public Sub LoadSettings()
37 | last_index_time = Settings["plugin_indexer/last_index_time", Date(1900, 1, 1)]
38 | ValueBoxReindex.value = Settings["plugin_indexer/interval", "00:31"]
39 | SpinMaxResults.value = Settings["plugin_indexer/maxresults", 50]
40 | CheckBoxmatchfullpath.value = Settings["plugin_indexer/matchfullpath", CheckBox.false]
41 | CheckBoxmatchhidden.value = Settings["plugin_indexer/matchhidden", CheckBox.false]
42 | LoadGrid()
43 | 'fixme altro da fare?
44 | End
45 |
46 |
47 | Public Sub init(caller_p As Object)
48 | caller = caller_p
49 | GridIndex.Columns.count = 2
50 | GridIndex.Columns[0].Title = ("Depth")
51 | GridIndex.Columns[1].Title = ("Directory")
52 | GridIndex.Columns.w = -1
53 | End
54 |
55 |
56 | Public Sub ButtonAdd_Click()
57 | If Dialog.path = "" Then Dialog.path = User.home
58 | If Dialog.SelectDirectory() Then Return
59 | GridIndex.Rows.count += 1
60 | GridIndex[GridIndex.Rows.max, 1].text = Dialog.Path
61 | GridIndex[GridIndex.Rows.max, 0].text = 5
62 | GridIndex.Columns.w = -1
63 | SaveSettings()
64 | End
65 |
66 | Public Sub GridIndex_Activate()
67 | GridIndex.Edit
68 | End
69 |
70 | Public Sub GridIndex_Save(Row As Integer, Column As Integer, Value As String)
71 | If column = 0 Then
72 | Try GridIndex[row, column].text = CInt(value)
73 | Else
74 | GridIndex[row, column].text = value
75 | Endif
76 | SaveSettings()
77 | End
78 |
79 | Public Sub ButtonDel_Click()
80 | Try GridIndex.Rows.Remove(GridIndex.row)
81 | SaveSettings()
82 | End
83 |
84 | Public Sub SaveGrid()
85 | Dim i As Integer
86 | Dim filedata As String
87 | For i = 0 To GridIndex.Rows.Max
88 | filedata &= GridIndex[i, 0].text & "\n"
89 | filedata &= GridIndex[i, 1].text & "\n"
90 | Next
91 | Settings["plugin_indexer/grid"] = Left(filedata, -1)
92 | End
93 |
94 | Public Sub LoadGrid()
95 | Dim i As Integer
96 | Dim filedata, item, WhatToDo As String
97 |
98 | GridIndex.Rows.count = 0
99 | Try filedata = Settings["plugin_indexer/grid"]
100 | If Error Then Return
101 | WhatToDo = "getDepth"
102 | For Each item In Split(filedata, "\n", "", False)
103 | Select WhatToDo
104 | Case "getDepth"
105 | GridIndex.Rows.count += 1
106 | GridIndex[GridIndex.Rows.max, 0].text = item
107 | WhatToDo = "getDir"
108 | Case "getDir"
109 | GridIndex[GridIndex.Rows.max, 1].text = item
110 | WhatToDo = "getDepth"
111 | End Select
112 | Next
113 |
114 | ' For i = 0 To GridIndex.Rows.Max
115 | ' filedata &= GridIndex[i, 0].text & "\n"
116 | ' filedata &= GridIndex[i, 1].text & "\n"
117 | ' Next
118 | End
119 |
120 | Public Sub ButtonReindex_Click()
121 | caller.reindex()
122 | ButtonReindex.enabled = False
123 | Repeat
124 | Wait 0.1
125 | Until caller.indexing = False
126 | ButtonReindex.enabled = True
127 |
128 | End
129 |
130 |
131 |
132 |
133 | Public Sub ValueBoxReindex_Change()
134 |
135 | Try caller.restart_timer()
136 |
137 | End
138 |
139 | Public Sub UpdateLabelIndexSize()
140 |
141 | LabelIndexSize.text = caller.index_db.count & " " & ("items indexed.")
142 |
143 | End
144 |
145 |
146 |
147 | Public Sub ButtonUp_Click()
148 | Dim t As String
149 | Dim c As Integer
150 | If GridIndex.row <= 0 Then Return
151 |
152 | For c = 0 To GridIndex.Columns.Max
153 | t = GridIndex[GridIndex.row - 1, c].text
154 | GridIndex[GridIndex.row - 1, c].text = GridIndex[GridIndex.row, c].text
155 | GridIndex[GridIndex.row, c].text = t
156 | Next
157 | Try GridIndex.row -= 1
158 | SaveGrid()
159 | End
160 |
161 | Public Sub ButtonDown_Click()
162 | Dim t As String
163 | Dim c As Integer
164 | If GridIndex.row < 0 Then Return
165 | If GridIndex.row = GridIndex.Rows.max Then Return
166 |
167 | For c = 0 To GridIndex.Columns.Max
168 | t = GridIndex[GridIndex.row + 1, c].text
169 | GridIndex[GridIndex.row + 1, c].text = GridIndex[GridIndex.row, c].text
170 | GridIndex[GridIndex.row, c].text = t
171 | Next
172 | Try GridIndex.row += 1
173 | SaveGrid()
174 | End
175 |
176 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_999_template.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = ("Example plugin description") 'A description for this plugin
5 | Static Public Friendly_name As String = ("Example plugin") 'A friendly name for this plugin
6 | Static Public configurable As Boolean = False 'Does this plugin provides a configure() method?
7 | Static Public Default_enabled As Boolean = False 'Does this plugin have to be enabled by default?
8 | Static Public default_blocking As Boolean = False 'Should the subsequent plugins be blocked when
9 | 'this plugin finds some results?
10 |
11 | Public Sub _free()
12 |
13 | End
14 |
15 |
16 | Public Struct rItemT
17 | plugin As String 'The plugin name
18 | Text As String 'Text displayed (main text)
19 | SubText As String 'Text displayed under the main text
20 | Image_file As String 'Optional image displayed: possible values:
21 | ' "mimetype://fullpath/to/filename/to/identify"
22 | ' get picture from mime icon
23 | ' "desktopfile://fullpath/to/.desktop/file"
24 | ' Get the picture from .desktop file
25 | ' "resize://fullpath/to/image/file"
26 | ' Load the image from disk and resize it automatically
27 | ' "/fullpath/to/image/file"
28 | ' Load the image from disk
29 |
30 | Clipboard_data As String 'The data copied to the clipboard
31 | Action As String 'String that indicates what to do when activating a result:
32 | '"DESKTOPOPEN"
33 | ' Open folders and starts .desktop files from "exec" field
34 | '"XDGOPEN"
35 | ' Open files using xdg desktop routines
36 | '"EXEC"
37 | ' Executes executables files
38 | '"EXEC_TERMINAL"
39 | ' Executes executables files in terminal emulator
40 | '"CLIPBOARD"
41 | ' Copy result into clipboard
42 | '"GUESS"
43 | ' Choose an action based on filetype
44 | '"NULL"
45 | ' Does nothing
46 |
47 | Action_p As Variant 'the parameter for Action
48 |
49 | End Struct
50 |
51 |
52 | Private plugin As String
53 | Private iconsize As Integer
54 | Private minchar As Integer = 3 'The plugin will not operate on query text smaller than that
55 |
56 |
57 | Public Sub _new(p_plugin As String, p_iconsize As Integer)
58 |
59 | plugin = p_plugin
60 | iconsize = p_iconsize
61 |
62 | End
63 |
64 |
65 | Public Sub Stop()
66 |
67 | 'not sure if this is the right way, but this should be called when the plugin has to be unloaded
68 |
69 | End
70 |
71 |
72 | Private Sub trigged(query As String) As Boolean
73 | 'this function will decide if the plugin will be search for "query" or not.
74 | If Len(query) < minchar Then Return False
75 | 'some more controls here (?)
76 | Return True
77 | End
78 |
79 |
80 | Public Sub find(textcontrol As Object) As RItemT[]
81 | 'this is the main function, textcontrol is an object that exposes a "text" property.
82 | 'We need to pass an entire object reference instead of a simple string so that
83 | 'we can stop a (slow) plugin as soon as textcontrol.text changes (ie: the user is still typing...)
84 |
85 | Dim anItem As String
86 | Dim rResults As New RItemT[]
87 | Dim rResult As RItemT
88 | Dim current_search As String = textcontrol.text
89 |
90 | If Not trigged(textcontrol.text) Then Return
91 |
92 | For Each anItem In Dir(User.home).sort()
93 |
94 | rResult = create_item(anItem)
95 | If rResult <> Null Then rResults.Add(rResult)
96 | 'Wait 'if calculations are heavy a wait may be handy.
97 | If textcontrol.text <> current_search Then Return
98 |
99 |
100 | Next 'anItem
101 | Raise new_results(rResults)
102 | End
103 |
104 | Event new_results(rResults As RItemT[])
105 |
106 |
107 | Private Function create_item(result As String) As RItemT
108 | 'this function creates an item that will be pushed into the result list.
109 | Dim return_item As RItemT
110 | return_item = New RItemT
111 | return_item.plugin = plugin
112 | return_item.Action = "EXEC" ' DESKTOPOPEN,EXEC,GUESS,NULL... MORE?
113 | return_item.Action_p = "/usr/bin/gambas3"
114 | return_item.Clipboard_data = "Some data copied to the clipboard"
115 | return_item.image_file = "icon:/" & iconsize & "/bookmark"
116 | return_item.Text = "EXAMPLE PLUGIN " & result
117 | return_item.SubText = "EXAMPLE PLUGIN " & "In: " & User.home
118 | Return return_item
119 | End
120 |
121 | Public Sub configure()
122 |
123 | 'this starts the configuration window.
124 |
125 | End
126 |
--------------------------------------------------------------------------------
/.src/old_Plugins.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | ' ' Gambas class file
4 | '
5 | ' Create Static
6 | '
7 | ' 'how many characters needs to be entered to start the following searches
8 | ' Public Const min_char_calculate As Integer = 1
9 | ' Public Const min_char_app As Integer = 2
10 | ' Public Const min_char_execute As Integer = 2
11 | ' Public Const min_char_app_by_desc As Integer = 3
12 | ' Public Const min_char_locate As Integer = 3
13 | ' Public Const min_char_path As Integer = 1
14 | ' Public Const min_char_fBookmarks As Integer = 1
15 | '
16 | '
17 | ' Public Struct rItem
18 | ' Priority As Integer
19 | ' Category As String 'app,locate,calculate,desktopexec,execute,fbookmark
20 | ' Text As String
21 | ' SubText As String
22 | ' Mexec As String
23 | ' 'pic As Picture
24 | ' happ As DesktopApps
25 | ' uri As String
26 | ' clipboard As String
27 | ' End Struct
28 | '
29 | '
30 | '
31 | ' Public Sub find_apps_by_desc(term As String)
32 | ' Dim happ As New DesktopApps
33 | ' Dim app As String
34 | ' Dim ismatched As Boolean = False
35 | ' Dim result As RItem
36 | '
37 | ' If String.Len(term) < min_char_app_by_desc Then Return
38 | ' For Each app In DesktopApps
39 | ' happ = DesktopApps[app]
40 | ' If happ = Null Then Return
41 | ' ismatched = InStr(Lower(happ._$Comment), Lower(term)) > 0
42 | ' ismatched = ismatched Or InStr(Lower(happ._$Category), Lower(term)) > 0
43 | ' ismatched = ismatched Or InStr(Lower(happ._$Keywords), Lower(term)) > 0
44 | ' If ismatched Then
45 | ' result = New RItem
46 | ' result.category = "app"
47 | ' result.Text = happ.name
48 | ' result.subtext = happ.comment
49 | ' result.mExec = happ.Exec_R_noargs
50 | ' result.uri = happ.file_path
51 | ' result.happ = happ
52 | ' result.clipboard = result.uri
53 | '
54 | ' FMain.results_list.Add(result)
55 | ' FMain.ResultGrid.Rows.count += 1
56 | ' Endif
57 | ' Next
58 | ' End
59 | '
60 | ' Public locatep As Process
61 | '
62 | ' Public Sub locate(term As String)
63 | '
64 | ' If String.Len(term) < min_char_locate Then Return
65 | ' 'locatep = Shell "nice -n -19 locate -l 1000 -i " & "'" & term & "'" For Input As "locatep"
66 | ' locatep = Shell "nice -n -19 locate -l 100 -i " & "'*" & term & "*'" For Input As "locatep"
67 | ' locatep.Blocking = True
68 | ' locatep.tag = term
69 | ' FMain.mouse_busy()
70 | ' Debug "locate " & "'" & term & "'"
71 | ' End
72 | '
73 | ' Public Sub find_executables(term As String)
74 | ' Dim exe, exe_found As String
75 | ' Dim result As RItem
76 | ' Try exe = Split(term, " ", "", True)[0]
77 | ' If exe = "" Then Return
78 | '
79 | ' exe_found = System.Find(term)
80 | ' If exe_found = "" Then Return
81 | ' result = New RItem
82 | ' result.Category = "execute"
83 | ' result.Mexec = term
84 | ' result.Text = "Run " & term
85 | ' result.SubText = "From " & File.Dir(exe_found)
86 | ' result.uri = exe_found
87 | ' FMain.results_list.Add(result)
88 | ' FMain.ResultGrid.Rows.count += 1
89 | '
90 | ' result = New RItem
91 | ' result.Category = "execute_terminal"
92 | ' result.Mexec = term
93 | ' result.Text = "Run " & term & " in the terminal emulator"
94 | ' result.SubText = "From " & File.Dir(exe_found)
95 | ' result.uri = exe_found
96 | ' result.clipboard = result.uri
97 | '
98 | ' FMain.results_list.Add(result)
99 | ' FMain.ResultGrid.Rows.count += 1
100 | ' End
101 | '
102 | ' Public Sub locatep_read()
103 | ' Dim result As String
104 | ' Dim rResult As RItem
105 | ' Dim is_desktop_exec As Boolean = False
106 | ' Dim stream_ok As Boolean
107 | ' FMain.mouse_busy()
108 | ' stream_ok = False
109 | ' Try stream_ok = Not Eof(locatep)
110 | ' If Not stream_ok Then Return
111 | '
112 | ' Try Line Input #locatep, result
113 | ' If Error Then Return
114 | ' If (result = "") Or (locatep.tag <> FMain.TextBox1.text) Then
115 | ' Wait
116 | ' Return
117 | ' Endif
118 | ' If Not Exist(result, True) Then Return
119 | ' rResult = New RItem
120 | '
121 | ' If result Ends ".desktop" Then
122 | ' MyDesktop.init()
123 | ' MyDesktop.parse(result)
124 | ' If MyDesktop.dExec <> "" Then is_desktop_exec = True
125 | ' Endif
126 | '
127 | ' If is_desktop_exec Then
128 | ' rResult.Category = "desktopexec"
129 | ' Else
130 | ' rResult.Category = "locate"
131 | ' Endif
132 | '
133 | ' rResult.mExec = result
134 | ' rResult.uri = result
135 | '
136 | ' If Stat(result, True).type = gb.directory Then
137 | ' rResult.Text = File.Name(result) & "/"
138 | ' Else
139 | ' rResult.Text = File.Name(result)
140 | ' Endif
141 | '
142 | ' rResult.SubText = File.Dir(result)
143 | ' rResult.clipboard = result
144 | '
145 | '
146 | ' FMain.results_list.Add(rResult)
147 | ' FMain.ResultGrid.Rows.count += 1
148 | '
149 | ' End
150 | '
151 | ' Public Sub kill_locate()
152 | ' If locatep <> Null Then
153 | ' While Exist("/proc/" & locatep.handle)
154 | ' Try locatep.drop
155 | ' Try locatep.close
156 | ' Try locatep.kill
157 | ' Wait
158 | ' Wend
159 | ' Endif
160 | ' End
161 | '
162 | ' Public Sub locatep_kill()
163 | ' FMain.mouse_normal()
164 | ' End
165 |
--------------------------------------------------------------------------------
/.src/plugins/bridge.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = "Bridge to external plugin" 'A description for this plugin
5 | Static Public Friendly_name As String = "Bridge Plugin" 'A friendly name for this plugin
6 | Static Public configurable As Boolean = False 'Does this plugin provides a configure() method?
7 | Static Public Default_enabled As Boolean = False 'Does this plugin have to be enabled by default?
8 |
9 | Private wait_time As Float = 0.0005
10 |
11 | Public Sub _free()
12 | Stop()
13 | End
14 |
15 |
16 | Public Struct rItemT
17 | plugin As String 'the plugin name
18 | Text As String 'text displayed in the clipboard
19 | SubText As String 'text displayed under the main text
20 | Image_file As String 'optional image displayed (fullpath or "DefferredMimeIcon")
21 | Clipboard_data As String 'the data copied to the clipboard
22 | Action As String 'string that indicates an action
23 | Action_p As Variant 'the parameter for Action
24 | End Struct
25 |
26 |
27 | Private plugin As String
28 | Private iconsize As Integer
29 | Private minchar As Integer = 0 'The plugin will not operate on query text smaller than that
30 |
31 |
32 | Private ext As Process
33 | Private ext_plugin As String '= "/root/tmp/locate.sh"
34 |
35 | Public Sub _new(p_plugin As String, p_iconsize As Integer, p_plugin_execuatble_filename As String)
36 | plugin = p_plugin
37 | iconsize = p_iconsize
38 | ext_plugin = p_plugin_execuatble_filename
39 | End
40 |
41 |
42 |
43 | Public Sub Stop()
44 | If ext <> Null Then
45 | Try Flush #ext
46 | Try ext.Close
47 | Try ext.kill
48 | Endif
49 | items.clear
50 | End
51 |
52 |
53 | Private Sub trigged(query As String) As Boolean
54 | 'this function will decide if the plugin will be search for "query" or not.
55 | If Len(query) < minchar Then Return False
56 | 'some more controls here (?)
57 | Return True
58 | End
59 |
60 |
61 | Private textcontrol_copy As Object
62 |
63 | Public Sub find(textcontrol As Object) As RItemT[]
64 | 'this is the main function, textcontrol is an object that exposes a "text" property.
65 | 'We need to pass an entire object reference instead of a simple string so that
66 | 'we can stop a (slow) plugin as soon as textcontrol.text changes (ie: the user is still typing...)
67 |
68 | Dim current_search As String = textcontrol.text
69 | textcontrol_copy = textcontrol
70 |
71 |
72 | Stop()
73 |
74 | If Not trigged(textcontrol.text) Then Return
75 |
76 | ext = Shell ext_plugin & " " & current_search For Input As "ext"
77 | ext.tag = current_search
78 | While ext.state = Process.running 'async wait for process to end.
79 | Wait 0.01
80 | Wend
81 |
82 | If current_search <> textcontrol.text Then Return
83 |
84 | Return items
85 |
86 |
87 | End
88 |
89 |
90 | Private current_item As RItemT
91 | Private items As New RItemT[]
92 |
93 |
94 | Public Sub ext_read()
95 | Dim iLine As String
96 | Line Input #ext, iLine
97 |
98 | If ext.tag <> textcontrol_copy.text Then
99 | Debug "Cancelled previous search " & ext.tag
100 | Return
101 | Endif
102 |
103 | iLine = Trim(iLine)
104 |
105 | Select iLine
106 | Case "BEGIN"
107 | current_item = New RItemT
108 | current_item.plugin = "external"
109 |
110 | Case Like "Text=*"
111 | If current_item = Null Then
112 | Debug "Error: Item not yet initialized, missing \"BEGIN\"?"
113 | Return
114 | Endif
115 | current_item.Text = Right(iLine, -InStr(iLine, "="))
116 |
117 | Case Like "SubText=*"
118 | If current_item = Null Then
119 | Debug "Error: Item not yet initialized, missing \"BEGIN\"?"
120 | Return
121 | Endif
122 | current_item.SubText = Right(iLine, -InStr(iLine, "="))
123 |
124 | Case Like "Image_file=*"
125 | If current_item = Null Then
126 | Debug "Error: Item not yet initialized, missing \"BEGIN\"?"
127 | Return
128 | Endif
129 | current_item.Image_file = Right(iLine, -InStr(iLine, "="))
130 |
131 | Case Like "Clipboard_data=*"
132 | If current_item = Null Then
133 | Debug "Error: Item not yet initialized, missing \"BEGIN\"?"
134 | Return
135 | Endif
136 | current_item.Clipboard_data = Right(iLine, -InStr(iLine, "="))
137 |
138 | Case Like "Action=*"
139 | If current_item = Null Then
140 | Debug "Error: Item not yet initialized, missing \"BEGIN\"?"
141 | Return
142 | Endif
143 | current_item.Action = Right(iLine, -InStr(iLine, "="))
144 |
145 | Case Like "Action_p=*"
146 | If current_item = Null Then
147 | Debug "Error: Item not yet initialized, missing \"BEGIN\"?"
148 | Return
149 | Endif
150 | current_item.Action_p = Right(iLine, -InStr(iLine, "="))
151 |
152 | Case "END"
153 | If current_item = Null Then
154 | Debug "Error: Item not yet initialized, missing \"BEGIN\"?"
155 | Return
156 | Endif
157 | items.Add(current_item)
158 | Raise new_results(items)
159 | End Select
160 |
161 | End
162 |
163 |
164 |
165 |
166 |
167 | Public Sub configure()
168 |
169 | 'this starts the configuration window.
170 |
171 | End
172 |
173 | Event new_results(rResults As RItemT[])
174 |
175 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_100_windows.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = ("[BROKEN, hangs with windows with long titles] Search and activate windows") 'A description for this plugin
5 | Static Public Friendly_name As String = ("Search and activate windows") 'A friendly name for this plugin
6 | Static Public configurable As Boolean = False 'Does this plugin provides a configure() method?
7 | Static Public Default_enabled As Boolean = False 'Does this plugin have to be enabled by default?
8 | Static Public default_blocking As Boolean = False 'Should the subsequent plugins be blocked when
9 | 'this plugin finds some results?
10 |
11 | Public Sub _free()
12 |
13 | End
14 |
15 |
16 | Public Struct rItemT
17 | plugin As String 'The plugin name
18 | Text As String 'Text displayed (main text)
19 | SubText As String 'Text displayed under the main text
20 | Image_file As String 'Optional image displayed: possible values:
21 | ' "mimetype://fullpath/to/filename/to/identify"
22 | ' get picture from mime icon
23 | ' "desktopfile://fullpath/to/.desktop/file"
24 | ' Get the picture from .desktop file
25 | ' "resize://fullpath/to/image/file"
26 | ' Load the image from disk and resize it automatically
27 | ' "/fullpath/to/image/file"
28 | ' Load the image from disk
29 |
30 | Clipboard_data As String 'The data copied to the clipboard
31 | Action As String 'String that indicates what to do when activating a result:
32 | '"DESKTOPOPEN"
33 | ' Open folders and starts .desktop files from "exec" field
34 | '"XDGOPEN"
35 | ' Open files using xdg desktop routines
36 | '"EXEC"
37 | ' Executes executables files
38 | '"EXEC_TERMINAL"
39 | ' Executes executables files in terminal emulator
40 | '"CLIPBOARD"
41 | ' Copy result into clipboard
42 | '"GUESS"
43 | ' Choose an action based on filetype
44 | '"NULL"
45 | ' Does nothing
46 |
47 | Action_p As Variant 'the parameter for Action
48 |
49 | End Struct
50 |
51 |
52 | Private plugin As String
53 | Private iconsize As Integer
54 | Private minchar As Integer = 3 'The plugin will not operate on query text smaller than that
55 |
56 |
57 | Public Sub _new(p_plugin As String, p_iconsize As Integer)
58 |
59 | plugin = p_plugin
60 | iconsize = p_iconsize
61 |
62 | End
63 |
64 |
65 | Public Sub Stop()
66 |
67 | 'not sure if this is the right way, but this should be called when the plugin has to be unloaded
68 |
69 | End
70 |
71 |
72 | Private Sub trigged(query As String) As Boolean
73 | 'this function will decide if the plugin will be search for "query" or not.
74 | If Len(query) < minchar Then Return False
75 | 'some more controls here (?)
76 | Return True
77 | End
78 |
79 |
80 | Public Sub find(textcontrol As Object) As RItemT[]
81 | 'this is the main function, textcontrol is an object that exposes a "text" property.
82 | 'We need to pass an entire object reference instead of a simple string so that
83 | 'we can stop a (slow) plugin as soon as textcontrol.text changes (ie: the user is still typing...)
84 |
85 | Dim w As DesktopWindow
86 | Dim rResults As New RItemT[]
87 | Dim rResult As RItemT
88 | Dim current_search As String = Lower(textcontrol.text)
89 | Desktop.Windows.Refresh
90 | Stop
91 | If Not trigged(textcontrol.text) Then Return
92 | Stop
93 | For Each w In Desktop.Windows
94 | Debug "prima1"
95 | Debug w
96 | Debug w.name
97 | Debug "dopo"
98 | If w.name Like "Telegram*" Then Stop
99 | If w.SkipTaskbar = False Then
100 | If InStr(Lower(w.name), current_search) Then
101 | Stop
102 | rResult = create_item(w)
103 | If rResult <> Null Then
104 | rResults.Add(rResult)
105 | Raise new_results(rResults)
106 | Endif
107 | If Lower(textcontrol.text) <> Lower(current_search) Then Return
108 | Endif
109 | Endif
110 | Debug "next"
111 | Stop
112 | Next 'anItem
113 |
114 | Return rResults
115 | End
116 |
117 | Event new_results(rResults As RItemT[])
118 |
119 |
120 | Private Function create_item(w As DesktopWindow) As RItemT
121 | 'this function creates an item that will be pushed into the result list.
122 | Dim return_item As RItemT
123 | return_item = New RItemT
124 | return_item.plugin = plugin
125 | return_item.Action = "WINDOWS" ' DESKTOPOPEN,EXEC,GUESS,NULL... MORE?
126 | return_item.Action_p = w.id
127 | return_item.Clipboard_data = ""
128 | return_item.image_file = "icon:/" & iconsize & "/new-window"
129 | return_item.Text = "Window: " & w.name
130 | return_item.SubText = "Activate the window"
131 | Return return_item
132 | End
133 |
134 | Public Sub configure()
135 |
136 | 'this starts the configuration window.
137 |
138 | End
139 |
140 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_010_calculator.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = ("Expression evaluator")
5 | Static Public Friendly_name As String = ("Calculator")
6 | Static Public configurable As Boolean = False
7 | Static Public Default_enabled As Boolean = True
8 | Static Public default_blocking As Boolean = True 'Should the subsequent plugins be blocked when
9 | 'this plugin finds some results?
10 |
11 | Public Struct rItemT
12 | plugin As String 'the plugin name
13 | Text As String 'text displayed in the clipboard
14 | SubText As String 'text displayed under the main text
15 | Image_file As String 'optional image displayed (fullpath or "DefferredMimeIcon")
16 | Clipboard_data As String 'the data copied to the clipboard
17 | Action As String 'string that indicates an action
18 | Action_p As Variant 'the parameter for Action
19 | End Struct
20 |
21 | Private plugin As String
22 | Private iconsize As Integer
23 | Private minchar As Integer = 3 'exit if the search term is lower than that
24 |
25 |
26 |
27 |
28 | Public Sub _new(p_plugin As String, p_iconsize As Integer)
29 |
30 | plugin = p_plugin
31 | iconsize = p_iconsize
32 |
33 | End
34 |
35 | Private Sub trigged(query As String) As Boolean
36 | Dim lquery As String = Lower(query)
37 | If Left(lquery) = "=" Then Return True
38 | If Right(lquery) = "=" Then Return True
39 |
40 | If Len(lquery) < minchar Then Return False
41 |
42 | If InStr(lquery, "(") Then Return True
43 | If InStr(lquery, ")") Then Return True
44 |
45 | If InStr(lquery, "+") Then Return True
46 | If InStr(lquery, "-") Then Return True
47 | If InStr(lquery, "*") Then Return True
48 | If InStr(lquery, "/") Then Return True
49 |
50 | If InStr(lquery, "^") Then Return True
51 | If InStr(lquery, "div") Then Return True
52 | If InStr(lquery, "%") Then Return True
53 | If InStr(lquery, "mod") Then Return True
54 | If InStr(lquery, "/") Then Return True
55 |
56 | If InStr(lquery, ">") Then Return True
57 | If InStr(lquery, "<") Then Return True
58 |
59 | If InStr(lquery, "and") Then Return True
60 | If InStr(lquery, "not") Then Return True
61 | If InStr(lquery, "or") Then Return True
62 | If InStr(lquery, "xor") Then Return True
63 |
64 | If InStr(lquery, "abs") Then Return True
65 | If InStr(lquery, "ceil") Then Return True
66 | If InStr(lquery, "dec") Then Return True
67 | If InStr(lquery, "fix") Then Return True
68 | If InStr(lquery, "floor") Then Return True
69 | If InStr(lquery, "frac") Then Return True
70 | If InStr(lquery, "inc") Then Return True
71 | If InStr(lquery, "int") Then Return True
72 | If InStr(lquery, "max") Then Return True
73 | If InStr(lquery, "min") Then Return True
74 | If InStr(lquery, "round") Then Return True
75 | If InStr(lquery, "sgn") Then Return True
76 |
77 | If InStr(lquery, "acos") Then Return True
78 | If InStr(lquery, "acosh") Then Return True
79 | If InStr(lquery, "and") Then Return True
80 | If InStr(lquery, "asin") Then Return True
81 | If InStr(lquery, "asinh") Then Return True
82 | If InStr(lquery, "atan") Then Return True
83 | If InStr(lquery, "atan2") Then Return True
84 | If InStr(lquery, "atanh") Then Return True
85 | If InStr(lquery, "cos") Then Return True
86 | If InStr(lquery, "cosh") Then Return True
87 | If InStr(lquery, "deg") Then Return True
88 | If InStr(lquery, "hyp") Then Return True
89 | If InStr(lquery, "mag") Then Return True
90 | If InStr(lquery, "pi") Then Return True
91 | If InStr(lquery, "sin") Then Return True
92 | If InStr(lquery, "sinh") Then Return True
93 | If InStr(lquery, "tan") Then Return True
94 | If InStr(lquery, "tanh") Then Return True
95 | If InStr(lquery, "rad") Then Return True
96 |
97 | If InStr(lquery, "cbr") Then Return True
98 | If InStr(lquery, "exp") Then Return True
99 | If InStr(lquery, "exp2") Then Return True
100 | If InStr(lquery, "exp10") Then Return True
101 | If InStr(lquery, "expm") Then Return True
102 | If InStr(lquery, "log") Then Return True
103 | If InStr(lquery, "log2") Then Return True
104 | If InStr(lquery, "log10") Then Return True
105 | If InStr(lquery, "logp") Then Return True
106 | If InStr(lquery, "sqr") Then Return True
107 |
108 | 'some more controls here (?)
109 | Return False
110 | End
111 |
112 | Event new_results(rResults As RItemT[])
113 |
114 | Public Sub find(textcontrol As Object) As RItemT[]
115 | 'evualuate expressions
116 | Dim rResults As New RItemT[]
117 | Dim rResult As RItemT
118 | Dim current_search As String = textcontrol.text
119 |
120 | If Not trigged(textcontrol.text) Then Return
121 |
122 | rResult = create_item(current_search)
123 | If rResult <> Null Then rResults.Add(rResult)
124 |
125 | If textcontrol.text <> current_search Then Return
126 | Wait
127 | Raise new_results(rResults)
128 | Return rResults
129 |
130 | End
131 |
132 | ' Editable part of the template follows:
133 |
134 | Private Function create_item(expr As String) As RItemT
135 | Dim return_item As RItemT
136 | Dim evalued As Variant
137 |
138 | If expr Begins "=" Then expr = Right(expr, -1)
139 | If expr Ends "=" Then expr = Left(expr, -1)
140 | Try evalued = Eval(expr)
141 | If Error Then Return
142 |
143 | return_item = New RItemT
144 | return_item.plugin = plugin
145 | return_item.Action = "NULL"
146 | return_item.Action_p = ""
147 | return_item.Clipboard_data = evalued
148 |
149 | return_item.image_file = "icon:/" & iconsize & "/calculator"
150 |
151 | If evalued = True Then evalued = ("-1 (boolean TRUE)")
152 | If evalued = False Then evalued = ("0 (boolean FALSE)")
153 |
154 | return_item.Text = evalued
155 | return_item.SubText = "= " & expr
156 |
157 | Return return_item
158 | End
159 |
160 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_015_recent.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = ("Search for Recent Documents")
5 | Static Public Friendly_name As String = ("Recent Documents")
6 | Static Public configurable As Boolean = False
7 | Static Public Default_enabled As Boolean = True
8 | Static Public default_blocking As Boolean = False 'Should the subsequent plugins be blocked when
9 | 'this plugin finds some results?
10 |
11 | Public Struct rItemT
12 | plugin As String 'the plugin name
13 | Text As String 'text displayed in the clipboard
14 | SubText As String 'text displayed under the main text
15 | Image_file As String 'optional image displayed (fullpath or "DefferredMimeIcon")
16 | Clipboard_data As String 'the data copied to the clipboard
17 | Action As String 'string that indicates an action
18 | Action_p As Variant 'the parameter for Action
19 | End Struct
20 |
21 |
22 | Private plugin As String
23 | Private iconsize As Integer
24 | Private minchar As Integer = 3 'exit if the search term is lower than that
25 |
26 |
27 |
28 | Public Sub _new(p_plugin As String, p_iconsize As Integer)
29 |
30 | plugin = p_plugin
31 | iconsize = p_iconsize
32 |
33 | End
34 |
35 |
36 | Private Sub trigged(query As String) As Boolean
37 | If Len(query) < minchar Then Return False
38 | 'some more controls here (?)
39 | Return True
40 | End
41 |
42 |
43 | Public Sub find(textcontrol As Object) As RItemT[]
44 | 'search for filedialogs bookmarks
45 | Dim rResults As New RItemT[]
46 | Dim rResult As RItemT
47 | Dim current_search As String = textcontrol.text
48 |
49 | Dim b_file_split As New String[]
50 | Dim aLine, path As String
51 | Dim match_str As String
52 | Dim term As String
53 |
54 | Dim KDE4HOME As String = ""
55 | Dim kde_paths As New String[]
56 | Dim kde_path As String
57 | Dim k_recent As String
58 | Dim gtk_path As String
59 |
60 | Dim i As Integer
61 |
62 | If Not trigged(textcontrol.text) Then Return
63 |
64 | term = current_search
65 |
66 | 'kde5
67 | kde_paths.Add(User.home & "/.local/share/RecentDocuments")
68 |
69 | 'kde4
70 | Try KDE4HOME = Application.Env("KDEHOME")
71 | If KDE4HOME = "" Then
72 | kde_paths.Add(User.home & "/.kde4/share/apps/RecentDocuments/")
73 | kde_paths.Add(User.home & "/.kde/share/apps/RecentDocuments/")
74 | Else
75 | kde_paths.Add(KDE4HOME)
76 | Endif
77 |
78 | For Each kde_path In kde_paths
79 | If Exist(kde_path, True) Then
80 | For Each k_recent In Dir(kde_path, "*.desktop")
81 | If InStr(Lower(k_recent), Lower(term)) > 0 Then
82 | rResult = create_item_k(kde_path & "/" & k_recent)
83 | If rResult <> Null Then add_no_dupe(rResult, rResults)
84 | Endif
85 | Next
86 | Endif
87 | Next
88 |
89 |
90 | 'gtk
91 | gtk_path = user.home & "/.local/share/recently-used.xbel"
92 |
93 | Try b_file_split = Split(File.load(gtk_path), "\n")
94 | match_str = "*://*" & term & "*" 'gtk2,3
95 |
96 | If Not Error Then 'parseit
97 | For Each aline In b_file_split
98 | If aline Like match_str Then
99 | Try path = Split(aline, "\"")[1]
100 | If Not Error Then
101 | path = URL.Decode(path)
102 | rResult = create_item_g(path)
103 | If rResult <> Null Then add_no_dupe(rResult, rResults)
104 | Endif
105 | Endif
106 | Next 'aline
107 | Endif
108 | Return rResults
109 | End
110 |
111 |
112 | Private Function add_no_dupe(a As RItemT, ritems As RItemT[])
113 | If (find_similar(a, ritems) = -1) Then
114 | ritems.Add(a)
115 | Raise new_results(ritems)
116 | Endif
117 | End
118 |
119 |
120 | Event new_results(rResults As RItemT[])
121 |
122 | Private Function find_similar(a As RItemT, ritems As RItemT[]) As Integer
123 | Dim i As Integer
124 | For i = 0 To ritems.Max
125 | If ritems[i].Action_p = a.Action_p Then Return i
126 | Next
127 | Return -1
128 |
129 | End
130 |
131 |
132 | ' Editable part of the template follows:
133 |
134 | Private Function create_item_g(path As String) As RItemT 'a lot of code duplication here
135 | Dim return_item As RItemT
136 | Dim url As String
137 | Debug path
138 | return_item = New RItemT
139 |
140 | url = Right(path, -InStr(path, "://") - 2) 'strip protocol
141 | url = Replace(url, "$HOME", User.home)
142 |
143 | If Lower(path) Begins "file://" Then
144 | If Not Exist(url, True) Then Return Null
145 | Endif
146 |
147 | return_item.plugin = plugin
148 | return_item.Action = "XDGOPEN"
149 | return_item.Action_p = url
150 | return_item.Clipboard_data = url
151 | If url Ends ".desktop" Then
152 | return_item.image_file = "desktopfile://" & url
153 | Else
154 | return_item.image_file = "mimetype://" & url
155 | Endif
156 | return_item.Text = File.Name(url)
157 | return_item.SubText = "Recent Document (GTK)"
158 | Return return_item
159 | End
160 |
161 |
162 |
163 | Private Function create_item_k(path As String) As RItemT 'a lot of code duplication here
164 | Dim return_item As RItemT
165 | Dim url As String
166 | return_item = New RItemT
167 | return_item.plugin = plugin
168 | return_item.Action = "XDGOPEN"
169 |
170 | MyDesktop.init()
171 | MyDesktop.parse(path)
172 | If InStr(mydesktop.durl, "://") > 0 Then
173 | 'new kde version uses file:filename, old uses file:// (??)
174 | url = Right(mydesktop.durl, -InStr(mydesktop.durl, "://") - 2) 'strip protocol
175 | Else
176 | url = Right(mydesktop.durl, -InStr(mydesktop.durl, ":")) 'strip protocol
177 | Endif
178 | url = Replace(url, "$HOME", User.home)
179 |
180 | If mydesktop.dURL Begins "file://" Then
181 | If Not Exist(url, True) Then Return Null
182 | Endif
183 |
184 | return_item.Action_p = url
185 | return_item.Clipboard_data = url
186 |
187 | If url Ends ".desktop" Then
188 | return_item.image_file = "desktopfile://" & url
189 | Else
190 | return_item.image_file = "mimetype://" & url
191 | Endif
192 | return_item.Text = MyDesktop.dName
193 | return_item.SubText = "Recent Document (KDE)"
194 | Return return_item
195 | End
196 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_020_apps.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = ("Find desktop applications")
5 | Static Public Friendly_name As String = ("Desktop apps")
6 | Static Public configurable As Boolean = True
7 | Static Public Default_enabled As Boolean = True
8 | Static Public default_blocking As Boolean = False 'Should the subsequent plugins be blocked when
9 | 'this plugin finds some results?
10 |
11 | Public Struct rItemT
12 | plugin As String 'the plugin name
13 | Text As String 'text displayed in the clipboard
14 | SubText As String 'text displayed under the main text
15 | Image_file As String 'optional image displayed (fullpath or "DefferredMimeIcon")
16 | Clipboard_data As String 'the data copied to the clipboard
17 | Action As String 'string that indicates an action
18 | Action_p As Variant 'the parameter for Action
19 | End Struct
20 |
21 | Private plugin As String
22 | Private iconsize As Integer
23 | Private minchar As Integer = 3 'exit if the search term is lower than that
24 |
25 | Private update_apps As Timer
26 |
27 |
28 | Public Sub _new(p_plugin As String, p_iconsize As Integer)
29 |
30 | plugin = p_plugin
31 | iconsize = p_iconsize
32 | update_apps = New Timer As "update_apps"
33 | update_apps.delay = 3000
34 | update_apps.enabled = False
35 |
36 | plugin_apps_gui.init(Me)
37 | DesktopApps.WarmCache()
38 |
39 | End
40 |
41 | Private Sub trigged(query As String) As Boolean
42 | If Len(query) < minchar Then Return False
43 | 'some more controls here (?)
44 | Return True
45 | End
46 |
47 |
48 | ' Editable part of the template follows:
49 |
50 | Public Sub find(textcontrol As Object) As RItemT[]
51 | 'search for filedialogs bookmarks
52 | Dim rResults As New RItemT[]
53 | Dim rResult As RItemT
54 | Dim current_search As String = textcontrol.text
55 | Dim happ As DesktopApps
56 | Dim app As String
57 | Dim ismatched As Boolean = False
58 | Dim happs As New DesktopApps[]
59 |
60 | If Not trigged(textcontrol.text) Then Return
61 |
62 | For Each app In DesktopApps
63 |
64 | Try happ = DesktopApps[app]
65 | If Error Then Continue
66 | If (Not (happ.NoDisplay)) Or (happ.exec_R Like "systemsettings *") Then
67 |
68 | ' Dim foundebug As Boolean = False
69 | ' 'if (Lower(happ.XKDEServiceTypes) = "kcmodule") Then Stop
70 | ' If happ.file_path Like "*kcm_mouse.desktop*" Then
71 | ' foundebug = "true"
72 | ' Stop
73 | ' Endif
74 | ' Debug happ.file_path
75 |
76 |
77 | If (happ.Exec_R <> "") Or (Lower(happ.XKDEServiceTypes) = "kcmodule") Then
78 | ismatched = InStr(Lower(happ.Get("Name")), Lower(current_search)) > 0
79 | If Not ismatched Then
80 | If Not ismatched Then ismatched = InStr(Lower(happ.Get("Comment")), Lower(current_search)) > 0
81 | If Not ismatched Then ismatched = ismatched Or InStr(Lower(happ.Get("Category")), Lower(current_search)) > 0
82 | If Not ismatched Then ismatched = ismatched Or InStr(Lower(happ.Get("Keywords")), Lower(current_search)) > 0
83 | If Not ismatched Then ismatched = ismatched Or InStr(Lower(happ.Get("GenericName")), Lower(current_search)) > 0
84 | If Not ismatched Then ismatched = ismatched Or InStr(Lower(File.BaseName(happ.file_path)), Lower(current_search)) > 0
85 | Endif
86 |
87 | If ismatched Then
88 | add_no_dupe(happs, happ)
89 | Wait 'if calculations are heavy a wait may be handy.
90 |
91 | Endif
92 | Endif
93 | If textcontrol.text <> current_search Then Return
94 | Endif
95 | Next 'happ
96 |
97 | For Each happ In happs
98 | rResult = create_item(happ)
99 |
100 | If rResult <> Null Then
101 | rResults.Add(rResult)
102 | Raise new_results(rResults)
103 | Endif
104 | Wait 'if calculations are heavy a wait may be handy.
105 | If textcontrol.text <> current_search Then Return
106 | Next 'happ
107 |
108 | update_apps.start()
109 | Return rResults
110 | End
111 |
112 | Event new_results(rResults As RItemT[])
113 |
114 | Public Sub update_apps_timer()
115 | update_apps.stop
116 | DesktopApps.MakeAppList()
117 | End
118 |
119 |
120 | Private Sub add_no_dupe(happs As DesktopApps[], new_happ As DesktopApps)
121 | Dim existing_happ As DesktopApps
122 |
123 | For Each existing_happ In happs
124 | If existing_happ.Get("Exec") = new_happ.Get("Exec") Then 'dupe found
125 | 'prefer the one with the comment
126 | If existing_happ.Get("Comment") <> "" Then
127 | Return
128 | Else
129 | If new_happ.Get("Comment") <> "" Then
130 | happs.Find(existing_happ)
131 | existing_happ = new_happ
132 | Endif
133 | Endif
134 | Return
135 | Endif
136 | Next
137 | 'no dupe found
138 | happs.Add(new_happ)
139 | End
140 |
141 |
142 |
143 |
144 |
145 | Private Function create_item(happ As DesktopApps) As RItemT
146 | Dim return_item As RItemT
147 | Dim subtext As String
148 | return_item = New RItemT
149 | return_item.plugin = plugin
150 | return_item.Action = "DESKTOPOPEN"
151 | return_item.Action_p = happ.file_path
152 | return_item.Clipboard_data = happ.file_path
153 | return_item.image_file = "desktopfile://" & happ.file_path
154 |
155 | return_item.Text = happ.Get("Name")
156 | If return_item.Text = "" Then
157 | return_item.Text = File.BaseName(happ.file_path)
158 | Endif
159 |
160 | subtext = happ.Get("GenericName") & ", " & happ.Get("Comment")
161 | If subtext Begins ", " Then subtext = Right(subtext, -2)
162 | If subtext Ends ", " Then subtext = Left(subtext, -2)
163 | If subtext = "" Then subtext = ("In: ") & File.Dir(happ.file_path)
164 |
165 | return_item.SubText = subtext
166 | Return return_item
167 | End
168 |
169 | Public Sub configure()
170 | plugin_apps_gui.Show()
171 | End
172 |
--------------------------------------------------------------------------------
/.src/gstyle.module:
--------------------------------------------------------------------------------
1 | ' Gambas module file
2 |
3 | Public Sub applystyle()
4 | Dim wopacity As Integer
5 | Dim wopacitygrid As Integer
6 |
7 | If Not Global.fullyloaded Then Return
8 |
9 | 'window background
10 | If fmain.PictureBoxBackground.picture <> Null Then
11 | fmain.PictureBoxBackground.Background = Color.Default
12 | Else
13 | fmain.PictureBoxBackground.Background = hSettings.ColorButton1.value
14 | Endif
15 |
16 | 'padding
17 | FMain.panel2.padding = Desktop.scale + hSettings.SpinBoxExtraPad.value
18 |
19 | 'background
20 | gstyle.make_background()
21 |
22 | 'textboxes border
23 | fmain.textbox1.border = hSettings.CheckBoxbordertextbox.value = CheckBox.true
24 | fmain.textbox2.border = fmain.textbox1.border
25 |
26 | 'text fg/bg
27 | Global.text_foreground = hSettings.colorbuttontextfg.value
28 | Global.textgrid_foreground = hSettings.colorbuttontextgridfg.value
29 | FMain.ResultGrid.background = hSettings.colorbuttongridbg.value
30 | FMain.ResultGrid.Foreground = Global.textgrid_foreground
31 | FMain.textbox2.Background = hSettings.colorbuttontextbg.value
32 | FMain.TextBox2.Foreground = Color.Merge(Global.text_foreground, hSettings.colorbuttontextbg.value, 0.5)
33 | FMain.TextBox1.Foreground = hSettings.colorbuttontextfg.value
34 |
35 | 'scrollbar
36 | If hSettings.ScrollbarCheckbox.value = CheckBox.true Then
37 | fmain.ResultGrid.scrollbar = Scroll.Vertical
38 | fmain.ResultGrid.Tracking = False
39 | Else
40 | fmain.ResultGrid.scrollbar = Scroll.none
41 | fmain.ResultGrid.Tracking = True
42 | Endif
43 |
44 |
45 | 'inner widgets opacity
46 | FMain.ResultGrid.border = (hSettings.SpinBoxwopacitygrid.value = 100)
47 |
48 | wopacity = CInt(hSettings.SpinBoxwopacity.value * (255 / 100))
49 | 'wopacitygrid = CInt(hSettings.SpinBoxwopacitygrid.value * (hSettings.SpinBoxwopacitygrid.value / 255)) 'hack for gambas bug (?)
50 | wopacitygrid = CInt(hSettings.SpinBoxwopacitygrid.value * (255 / 100)) 'hack for gambas bug (?)
51 | If wopacity = 0 Then wopacity = 1
52 | If wopacitygrid = 0 Then wopacitygrid = 1
53 |
54 | FMain.ResultGrid.background = Color.SetAlpha(FMain.ResultGrid.background, 255 - wopacitygrid)
55 | FMain.buttonconfigure.background = Color.SetAlpha(FMain.buttonconfigure.background, 255 - wopacity)
56 | FMain.textbox2.background = Color.SetAlpha(FMain.textbox2.background, 255 - wopacity)
57 |
58 |
59 | 'window border drawing
60 | If hSettings.CheckBoxborder.value = CheckBox.true Then
61 | FMain.Panel2.border = Border.plain
62 | Else
63 | FMain.Panel2.border = Border.none
64 | Endif
65 |
66 | 'FMain.resize_form()
67 | End
68 |
69 | Public Sub make_background(Optional bFast As Boolean = False)
70 | Dim flat_img As Image
71 | Dim need_compositing As Boolean = False
72 |
73 | 'Se c'è ombra, fai l'ombra con l'eventuale immagine
74 | If hSettings.CheckboxShadow.value = CheckBox.true Then
75 | global.Change_transparency(fmain, True)
76 | fmain.PictureBoxBackground.Show
77 | fmain.PictureBoxBackground.background = Color.Transparent
78 | fmain.margin = True
79 | fmain.padding = hSettings.SpinBoxshadowsize.value
80 | fmain.PictureBoxBackground.border = False
81 | FMain.PictureBoxBackground.picture = gstyle.shadow(fmain, FMain.padding, hSettings.SpinBoxshadowalpha.value, hSettings.spinboxshadowgamma.value / 10, Global.backimage, hSettings.ColorButton1.value, hSettings.SpinBoxcornerradius.value, bfast)
82 | Return
83 | Endif
84 | fmain.margin = False
85 | fmain.padding = 0
86 |
87 | 'se c'è solo immagine, fai solo l'immagine
88 | If Global.backimage <> Null Then
89 | global.Change_transparency(fmain, True)
90 | fmain.PictureBoxBackground.Show
91 | fmain.PictureBoxBackground.background = -1
92 | FMain.PictureBoxBackground.picture = round_img(Global.backimage.Stretch(FMain.w, FMain.h), hSettings.SpinBoxcornerradius.value).picture
93 | Return
94 | Endif
95 |
96 | 'plain backgound with rounded corners
97 | If hSettings.SpinBoxcornerradius.value <> 0 Then
98 | global.Change_transparency(fmain, True)
99 | fmain.PictureBoxBackground.Show
100 |
101 | FMain.PictureBoxBackground.background = Color.Transparent
102 | flat_img = New Image
103 | flat_img.Resize(fmain.PictureBoxBackground.w, fmain.PictureBoxBackground.h)
104 | flat_img = flat_img.Resize(fmain.PictureBoxBackground.w, fmain.PictureBoxBackground.h).Fill(fmain.pictureboxbackground.background)
105 | fmain.PictureBoxBackground.picture = round_img(flat_img, hSettings.SpinBoxcornerradius.value).picture
106 | Return
107 | Endif
108 |
109 |
110 | 'altrimenti, resetta:
111 | global.Change_transparency(fmain, False)
112 |
113 | FMain.PictureBoxBackground.border = False
114 | If hSettings.ColorButton1.value = Color.background Then
115 | fmain.Background = -1
116 | Else
117 | fmain.Background = hSettings.ColorButton1.value
118 | Endif
119 | fmain.PictureBoxBackground.hide
120 | FMain.PictureBoxBackground.picture = Null
121 |
122 | End
123 |
124 |
125 | Public Sub round_img(i As Image, r As Integer) As Image
126 | 'returns i with rounded corners
127 |
128 | Dim out_img As New Image
129 | If r = 0 Then Return i
130 | out_img.Resize(i.w, i.h)
131 |
132 | Paint.Begin(out_img)
133 |
134 | 'clear the image
135 | Paint.Brush = Paint.Color(Color.Transparent)
136 | Paint.operator = Paint.OperatorClear
137 | Paint.Rectangle(0, 0, i.W, i.H, 0)
138 | Paint.Fill()
139 |
140 | 'draw shaped image
141 | Paint.operator = Paint.Operatorover
142 | Paint.brush = Paint.Image(i)
143 | Paint.Rectangle(0, 0, i.w, i.h, r)
144 | Paint.Fill()
145 |
146 | Paint.end
147 |
148 | Return out_img
149 | End
150 |
151 | Public Function shadow(f As Object, radius As Integer, alpha As Integer, fgamma As Float, Optional i As Image = Null, Optional window_color As Integer = Color.Background, Optional round_corner As Integer = 0, Optional bfast As Boolean = False) As Picture
152 | Dim topimage As Image
153 | Dim shadowimage As Image
154 | Dim shadowcolor As Integer = Color.SetAlpha(Color.black, alpha)
155 | Dim ff As Integer = 1
156 | Dim fw, fh As Integer
157 | Dim sRadius As Integer
158 | Dim cRadius As Integer
159 |
160 | 'Reduce rendering quality?
161 | If bfast Then ff = 2
162 | fw = f.w Div ff
163 | fh = f.h Div ff
164 | Sradius = radius Div ff
165 | cRadius = round_corner Div ff
166 |
167 | 'create the top image
168 | If i <> Null Then
169 | topimage = i.Copy()
170 | topimage = topimage.stretch(fw - (Sradius * 2), fh - (Sradius * 2))
171 | Else
172 | topimage = New Image(fw - (Sradius * 2), fh - (Sradius * 2))
173 | topimage = topimage.Fill(Window_color)
174 | Endif
175 |
176 | If cRadius <> 0 Then Try topimage = round_img(topimage, cRadius)
177 |
178 | 'create the shadow (a little bigger than topimage)
179 | shadowimage = New Image(fw, fh)
180 | shadowimage = shadowimage.Fill(Color.white)
181 | Paint.Begin(shadowimage)
182 | Paint.Brush = Paint.Color(shadowcolor)
183 | Paint.Rectangle(Sradius, Sradius, shadowimage.w - (Sradius * 2), shadowimage.h - (Sradius * 2), cRadius)
184 | Paint.Fill()
185 | Paint.end
186 |
187 | 'shadowimage.PaintRect(Sradius, Sradius, shadowimage.w - (Sradius * 2), shadowimage.h - (Sradius * 2), shadowcolor)
188 | shadowimage = shadowimage.fuzzy(Sradius).gamma(fgamma)
189 | shadowimage.Erase(Color.white)
190 |
191 | 'Clear the topimage shape from the shadowimage
192 | Paint.Begin(shadowimage)
193 | Paint.Brush = Paint.Color(Color.transparent)
194 | Paint.operator = Paint.OperatorClear
195 | Paint.Rectangle(Sradius + 1, Sradius + 1, shadowimage.w - (Sradius * 2) - 2, shadowimage.h - (Sradius * 2) - 2, cRadius)
196 | Paint.Fill()
197 | paint.end
198 |
199 | 'blend the topimage over the shadow
200 | shadowimage.paintimage(topimage, Sradius, Sradius)
201 |
202 | Return shadowimage.picture
203 |
204 | End
205 |
206 |
--------------------------------------------------------------------------------
/.src/hSettings.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Public Sub Button1_Click()
4 | Try FMain.xb.close()
5 | FMain.setup_xbindkeys()
6 | If FMain.xb.init_error Then
7 | Try FMain.setup_xbindkeys()
8 | If FMain.xb.init_error Then
9 | FMain.xb_show_init_error(True)
10 | Return
11 | Endif
12 | Endif
13 | Me.mouse = Mouse.wait
14 | Wait 0.1
15 | Me.enabled = False
16 | Wait
17 | Message.Info("A blank window will open shortly,\nPlease press the desidered shortcut there.")
18 | FMain.xb.clear_hotkeys()
19 | FMain.xb.register("show")
20 | Me.enabled = True
21 | Me.mouse = Mouse.normal
22 | ShowShortcut()
23 | End
24 |
25 | Public Sub Form_Hide()
26 | If Me.closed Then Return
27 | MySettings.save()
28 | FMain.Show()
29 | End
30 |
31 | Public Sub ComboboxTerminalEmulator_Change()
32 | Settings["terminal_emulator"] = ComboboxTerminalEmulator.text
33 | Settings.Save()
34 | End
35 |
36 | Public Sub Panel1_BeforeArrange()
37 | ShowShortcut()
38 | End
39 |
40 | Private Sub ShowShortcut()
41 |
42 | Dim s As String[]
43 |
44 | hSettings.button1.text = ("Change")
45 | Try s = Split(File.Load(FMain.xb_rcpath), "\n", "", True)
46 |
47 | If Error Then Return
48 |
49 | hSettings.button1.text = s[s.max]
50 |
51 | End
52 |
53 | Public Sub ButtonOpenExtPlugin_Click()
54 |
55 | Desktop.Open(FMain.extbinpath)
56 |
57 | End
58 |
59 | Public Sub UpdateIconThemes()
60 | Dim theme As String
61 | Dim extext As String = ComboboxIconThemes.text
62 | Object.Lock(ComboboxIconThemes)
63 | ComboboxIconThemes.Clear()
64 | Object.unLock(ComboboxIconThemes)
65 | For Each theme In Stock.Themes
66 | If ComboboxIconThemes.Find(theme) < 0 Then
67 | ComboboxIconThemes.Add(theme)
68 | Endif
69 | Next
70 | ComboboxIconThemes.text = extext
71 | End
72 |
73 |
74 | Public Sub Panel2_Arrange()
75 |
76 | UpdateIconThemes()
77 |
78 | End
79 |
80 | Public Sub ComboboxIconThemes_Change()
81 | Settings["icon_theme"] = ComboboxIconThemes.text
82 | Debug Settings["icon_theme"]
83 | Settings.Save()
84 | End
85 |
86 |
87 |
88 |
89 | Public Sub ColorButton1_Change()
90 | gstyle.applystyle()
91 | Settings["style/background"] = ColorButton1.value
92 | Settings.Save
93 | End
94 |
95 | Public Sub Button2_Click()
96 | ColorButton1.value = Color.Background
97 | Settings["style/background"] = ColorButton1.value
98 | Settings.Save
99 | gstyle.applystyle()
100 | End
101 |
102 |
103 |
104 | Public Sub CheckBox1_Click()
105 | If Not Global.fullyloaded Then Return
106 | Settings["style/undecorated"] = CheckBox1.value
107 | FMain.Hide
108 | Wait 0.1
109 | FMain.show
110 | End
111 |
112 | Public Sub SpinBoxExtraPad_Change()
113 | Settings["style/extrapad"] = SpinBoxExtraPad.value
114 | fmain.check_min_size(True)
115 | gstyle.applystyle()
116 | End
117 |
118 | Public Sub set_bg_picture()
119 | If ComboPicture.Current.text <> "" Then
120 | Try Global.backimage = MySettings.loadBackimage(hSettings.ComboPicture.text)
121 | If Error Then Debug "Could not load background image"
122 | Else
123 | Global.backimage = Null
124 | Endif
125 | gstyle.applystyle()
126 | gstyle.make_background()
127 | Settings["style/backpicture"] = ComboPicture.text
128 | Settings.save()
129 | End
130 |
131 |
132 | Public Sub ComboPicture_Click()
133 | Dim prevtext As String
134 | If ComboPicture.Current.text = ComboPicture[0].text Then
135 | If Dialog.path = "" Then Dialog.path = User.home
136 | Dialog.title = ("Choose a picture")
137 | If Not Dialog.OpenFile() Then
138 | ComboPicture.text = Dialog.path
139 | Wait
140 | Settings["style/backpicture"] = ComboPicture.text
141 | Else
142 | ComboPicture.text = ""
143 | Endif
144 | Endif
145 | set_bg_picture()
146 | End
147 |
148 | Public Sub ComboPicture_Clear()
149 | Settings["style/backpicture"] = ""
150 | Global.backimage = Null
151 | gstyle.applystyle()
152 | End
153 |
154 | Public Sub SpinBoxwopacity_Change()
155 | Settings["style/inneropacity"] = SpinBoxwopacity.value
156 | gstyle.applystyle()
157 | End
158 |
159 | Public Sub SpinBoxwopacityGrid_Change()
160 | Settings["style/inneropacitygrid"] = SpinBoxwopacitygrid.value
161 | gstyle.applystyle()
162 | End
163 |
164 |
165 | Public Sub colorbuttontextfg_Change()
166 | gstyle.applystyle()
167 | Settings["style/textfg"] = colorbuttontextfg.value
168 | Settings.Save
169 | End
170 |
171 |
172 | Public Sub colorbuttontextgridfg_Change()
173 | gstyle.applystyle()
174 | Settings["style/textgridfg"] = colorbuttontextgridfg.value
175 | Settings.Save
176 | End
177 |
178 |
179 |
180 |
181 |
182 | Public Sub ColorButtontextbg_Change()
183 | gstyle.applystyle()
184 | Settings["style/textbg"] = colorbuttontextbg.value
185 | Settings.Save
186 | End
187 |
188 | Public Sub ColorButtongridbg_Change()
189 | gstyle.applystyle()
190 | Settings["style/gridbg"] = colorbuttongridbg.value
191 | Settings.Save
192 | End
193 |
194 | Public Sub CheckBoxborder_Click()
195 | Settings["style/border"] = CheckBoxborder.value
196 | Settings.save
197 | gstyle.applystyle()
198 | End
199 |
200 | Public Sub ScrollbarCheckbox_Click()
201 | Settings["style/scrollbar"] = ScrollbarCheckbox.value
202 | Settings.save
203 | gstyle.applystyle()
204 | End
205 |
206 |
207 | Public Sub CheckboxShadow_Click()
208 | If Not Global.FULLYLOADED Then Return
209 | fmain.hide
210 | Wait
211 | Settings["style/shadows"] = CheckboxShadow.value
212 | Settings.save()
213 | panelshadow.enabled = (CheckboxShadow.value = CheckBox.true)
214 | gstyle.make_background()
215 | fmain.check_min_size(True)
216 | Wait
217 | fmain.show
218 | End
219 |
220 | Public Sub SpinBoxcornerradius_Change()
221 | Dim need_workaround As Boolean = False
222 | If Not Global.FULLYLOADED Then Return
223 |
224 | If SpinBoxcornerradius.value > 0 Then CheckBoxborder.value = CheckBox.false
225 |
226 | Settings["style/cornerradius"] = Last.value
227 | Settings.save()
228 |
229 | need_workaround = ((fmain.transparent = False) And (SpinBoxcornerradius.value > 0))
230 | need_workaround = need_workaround Or (SpinBoxcornerradius.value = 0)
231 |
232 | If need_workaround Then
233 | fmain.Hide
234 | Wait
235 | Endif
236 |
237 | gstyle.make_background()
238 |
239 | If need_workaround Then
240 | Wait
241 | fmain.show
242 | Endif
243 | End
244 |
245 |
246 | Public Sub PanelShadow_Arrange()
247 | panelshadow.enabled = (CheckboxShadow.value = CheckBox.true)
248 | End
249 |
250 |
251 | Public Sub SpinBoxshadowsize_Change()
252 | If Not Global.fullyloaded Then Return
253 | If Last.value Mod 2 <> 0 Then
254 | Inc Last.value
255 | Return
256 | Endif
257 | Settings["style/shadowsize"] = Last.value
258 | Settings.save
259 | gstyle.make_background()
260 | fmain.check_min_size()
261 | End
262 |
263 | Public Sub SpinBoxshadowgamma_Change()
264 | If Not Global.fullyloaded Then Return
265 | Settings["style/shadowgamma"] = Last.value
266 | Settings.save
267 | gstyle.make_background()
268 | End
269 |
270 | Public Sub SpinBoxshadowalpha_Change()
271 | If Not Global.fullyloaded Then Return
272 | Settings["style/shadowalpha"] = Last.value
273 | Settings.save
274 | gstyle.make_background()
275 | End
276 |
277 |
278 |
279 |
280 |
281 | Public Sub ComboPicture_Enter()
282 | Dim f As String
283 | Dim ptext As String = ComboPicture.text
284 | Object.Lock(ComboPicture)
285 | ComboPicture.clear
286 | ComboPicture.add(("Load an image"))
287 | ComboPicture.Add("")
288 | For Each f In Dir("backgrounds").Sort()
289 | ComboPicture.Add("backgrounds/" & f)
290 | Next
291 | ComboPicture.text = ptext
292 | Object.unLock(ComboPicture)
293 | End
294 |
295 | Public Sub CheckBoxbordertextbox_Click()
296 | Settings["style/inputboxborder"] = checkBoxbordertextbox.value
297 | Settings.Save()
298 | gstyle.applystyle()
299 | End
300 |
301 |
302 | Public Sub Button4_Click()
303 | SpinBoxwopacity.value = 100
304 | colorbuttontextbg.value = Color.TextBackground
305 | Settings["style/textbg"] = colorbuttontextbg.value
306 | colorbuttontextfg.value = Color.TextForeground
307 | Settings["style/textfg"] = colorbuttontextfg.value
308 | gstyle.applystyle()
309 | Settings.save
310 | End
311 |
312 | Public Sub Button5_Click()
313 | SpinBoxwopacitygrid.value = 100
314 | colorbuttongridbg.value = Color.TextBackground
315 | Settings["style/gridbg"] = colorbuttongridbg.value
316 | colorbuttontextgridfg.value = Color.TextForeground
317 | Settings["style/textgridfg"] = colorbuttontextgridfg.value
318 | gstyle.applystyle()
319 | Settings.save
320 | End
321 |
322 | Public Sub Button3_Click()
323 |
324 | fmain.init_hsettings()
325 |
326 | End
327 |
328 |
329 | Public Sub ComboboxLag_Change()
330 | If InStr(ComboboxLag.text, " ") > 0 Then
331 | Settings["input_lag"] = Trim(Left(ComboboxLag.text, InStr(ComboboxLag.text, " ")))
332 | Else
333 | Settings["input_lag"] = ComboboxLag.text
334 | Endif
335 | Debug Settings["input_lag"]
336 | Settings.Save()
337 | End
338 |
339 |
--------------------------------------------------------------------------------
/.src/hSettings.form:
--------------------------------------------------------------------------------
1 | # Gambas Form File 3.0
2 |
3 | { Form Form
4 | MoveScaled(0,0,81,79)
5 | Text = ("Higgins settings")
6 | Icon = Picture["icon:/medium/options"]
7 | Persistent = True
8 | Arrangement = Arrange.Vertical
9 | Spacing = True
10 | Margin = True
11 | { TabStrip1 TabStrip
12 | MoveScaled(1,1,79,73)
13 | Expand = True
14 | Arrangement = Arrange.Vertical
15 | Spacing = True
16 | Margin = True
17 | Count = 3
18 | Index = 0
19 | Text = ("General")
20 | Picture = Picture["icon:/small/options"]
21 | { Panel3 ScrollView
22 | MoveScaled(1,2,76,53)
23 | Expand = True
24 | Arrangement = Arrange.Vertical
25 | Spacing = True
26 | Margin = True
27 | { Panel1 HBox
28 | MoveScaled(1,3,73,5)
29 | Spacing = True
30 | { LabelHotkey Label
31 | MoveScaled(1,1,17,4)
32 | Expand = True
33 | AutoResize = True
34 | Text = ("Hide/show shortcut:")
35 | Alignment = Align.Left
36 | }
37 | { Button1 Button
38 | MoveScaled(46,1,25.7143,4)
39 | Text = ("Change")
40 | Picture = Picture["icon:/small/shortcut"]
41 | }
42 | }
43 | { Panel4 HBox
44 | MoveScaled(1,11,73,5)
45 | Spacing = True
46 | { LabelHotkey2 Label
47 | MoveScaled(2,1,12,4)
48 | Expand = True
49 | AutoResize = True
50 | Text = ("Terminal")
51 | Alignment = Align.Left
52 | }
53 | { ComboboxTerminalEmulator ComboBox
54 | MoveScaled(45,0,25.7143,4)
55 | List = [("xterm"), ("lxterminal"), ("xfce4-terminal"), ("gnome-terminal"), ("konsole")]
56 | }
57 | }
58 | { Panel2 HBox
59 | MoveScaled(1,19,73,5)
60 | Spacing = True
61 | { LabelHotkey4 Label
62 | MoveScaled(1,0,40,4)
63 | Expand = True
64 | AutoResize = True
65 | Text = ("Fallback icons (or current desktop icon theme)")
66 | Alignment = Align.Left
67 | }
68 | { ComboboxIconThemes ComboBox
69 | MoveScaled(45,0,25.7143,4)
70 | List = [("xterm"), ("lxterminal"), ("xfce4-terminal"), ("gnome-terminal"), ("konsole")]
71 | }
72 | }
73 | { Separator1 Separator
74 | MoveScaled(11,25,48,1)
75 | }
76 | { Panel14 HBox
77 | MoveScaled(0,27,73,5)
78 | Spacing = True
79 | { LabelHotkey5 Label
80 | MoveScaled(1,0,40,4)
81 | Expand = True
82 | AutoResize = True
83 | Text = ("Input lag in seconds (responsivity vs cpu use)")
84 | Alignment = Align.Left
85 | }
86 | { ComboboxLag ComboBox
87 | MoveScaled(45,0,25.7143,4)
88 | List = [("Adaptive "), ("0.00 - immediate"), ("0.05 - Very fast cpu"), ("0.10 - Fast cpu"), ("0.20 - Slow cpu"), ("0.30 - Very slow cpu"), ("0.40 "), ("0.50 ")]
89 | Text = ("0.10")
90 | }
91 | }
92 | }
93 | Index = 1
94 | Text = ("Plugins")
95 | Picture = Picture["icon:/small/connect"]
96 | { Frame1 ScrollView
97 | MoveScaled(1,2,74,22)
98 | Background = Color.TextBackground
99 | Expand = True
100 | Arrangement = Arrange.Vertical
101 | Spacing = True
102 | Margin = True
103 | }
104 | { Panel10 Panel
105 | MoveScaled(0,27,74,5)
106 | Arrangement = Arrange.Horizontal
107 | { ButtonOpenExtPlugin Button
108 | MoveScaled(1,0,33,5)
109 | Expand = True
110 | Text = ("Open External plugins directory")
111 | Picture = Picture["icon:/small/shortcut"]
112 | }
113 | { Button3 Button
114 | MoveScaled(43,0,31,5)
115 | Expand = True
116 | Text = ("Refresh External plugins list")
117 | Picture = Picture["icon:/16/refresh"]
118 | }
119 | }
120 | Index = 2
121 | Text = ("Style")
122 | Picture = Picture["icon:/small/color-picker"]
123 | { Panel9 ScrollView
124 | MoveScaled(1,1,76,67)
125 | Expand = True
126 | Arrangement = Arrange.Vertical
127 | Spacing = True
128 | Margin = True
129 | { Panel6 HBox
130 | MoveScaled(2,1,71,5)
131 | Padding = 1
132 | { CheckBox1 CheckBox
133 | MoveScaled(0,0,24,4)
134 | Expand = True
135 | AutoResize = True
136 | Text = ("Undecorated Window")
137 | }
138 | { CheckBoxborder CheckBox
139 | MoveScaled(40,0,26,4)
140 | Expand = True
141 | AutoResize = True
142 | Text = ("Window border")
143 | Value = CheckBox.True
144 | }
145 | }
146 | { Panel13 HBox
147 | MoveScaled(2,6,71,5)
148 | Padding = 1
149 | { CheckBoxbordertextbox CheckBox
150 | MoveScaled(0,0,19,4)
151 | Expand = True
152 | AutoResize = True
153 | Text = ("Input field border")
154 | Value = CheckBox.True
155 | }
156 | { ScrollbarCheckbox CheckBox
157 | MoveScaled(40,1,19,4)
158 | Expand = True
159 | AutoResize = True
160 | Text = ("Show scrollbar")
161 | }
162 | }
163 | { Separator3 Separator
164 | MoveScaled(5,11,58,1)
165 | }
166 | { Panel5 HBox
167 | MoveScaled(2,12,72,5)
168 | { LabelFormColor Label
169 | MoveScaled(1,1,24,4)
170 | Expand = True
171 | AutoResize = True
172 | Text = ("Window color")
173 | Alignment = Align.Left
174 | }
175 | { Button2 Button
176 | MoveScaled(57,0,4,4)
177 | AutoResize = True
178 | Picture = Picture["icon:/small/clear"]
179 | Border = False
180 | }
181 | { ColorButton1 ColorButton
182 | MoveScaled(63,0,6.4286,4)
183 | Value = Color.Background
184 | }
185 | }
186 | { Panel11 HBox
187 | MoveScaled(2,18,72,5)
188 | { LabelFormColor2 Label
189 | MoveScaled(1,1,29,4)
190 | Expand = True
191 | AutoResize = True
192 | Text = ("Search (background, text, opacity)")
193 | Alignment = Align.Left
194 | }
195 | { Button4 Button
196 | MoveScaled(43,0,4,4)
197 | AutoResize = True
198 | Picture = Picture["icon:/small/clear"]
199 | Border = False
200 | }
201 | { ColorButtontextbg ColorButton
202 | MoveScaled(49,0,6.4286,4)
203 | Value = Color.TextBackground
204 | }
205 | { ColorButtontextfg ColorButton
206 | MoveScaled(56,0,6.4286,4)
207 | Value = Color.TextForeground
208 | }
209 | { SpinBoxwopacity SpinBox
210 | MoveScaled(63,0,8,4)
211 | Step = 5
212 | Value = 100
213 | }
214 | }
215 | { Panel12 HBox
216 | MoveScaled(1,23,73,5)
217 | { LabelFormColor3 Label
218 | MoveScaled(1,1,28,4)
219 | Expand = True
220 | AutoResize = True
221 | Text = ("Results (background, text, opacity)")
222 | Alignment = Align.Left
223 | }
224 | { Button5 Button
225 | MoveScaled(44,1,4,4)
226 | AutoResize = True
227 | Picture = Picture["icon:/small/clear"]
228 | Border = False
229 | }
230 | { ColorButtongridbg ColorButton
231 | MoveScaled(50,1,6.4286,4)
232 | Value = Color.TextBackground
233 | }
234 | { ColorButtontextgridFG ColorButton
235 | MoveScaled(57,1,6.4286,4)
236 | Value = Color.TextForeground
237 | }
238 | { SpinBoxwopacitygrid SpinBox
239 | MoveScaled(64,0,8,4)
240 | Step = 5
241 | Value = 100
242 | }
243 | }
244 | { Panel7 HBox
245 | MoveScaled(1,29,73,5)
246 | Spacing = True
247 | { LabelPadding Label
248 | MoveScaled(2,0,40,4)
249 | Expand = True
250 | AutoResize = True
251 | Text = ("Extra window padding")
252 | Alignment = Align.Left
253 | }
254 | { SpinBoxExtraPad SpinBox
255 | MoveScaled(46,1,25.7143,4)
256 | }
257 | }
258 | { Panel8 HBox
259 | MoveScaled(1,35,73,5)
260 | Spacing = True
261 | { LabelHotkey3 Label
262 | MoveScaled(1,1,40,4)
263 | Expand = True
264 | AutoResize = True
265 | Text = ("Background picture")
266 | Alignment = Align.Left
267 | }
268 | { ComboPicture ComboBox
269 | MoveScaled(47,1,25.7143,4)
270 | }
271 | }
272 | { Separator2 Separator
273 | MoveScaled(14,44,47,1)
274 | }
275 | { Label4 Label
276 | MoveScaled(2,46,37,3)
277 | Text = ("The followings need a compositor")
278 | }
279 | { HPanel1 Panel
280 | MoveScaled(2,50,72,5)
281 | Arrangement = Arrange.Vertical
282 | { CheckboxShadow CheckBox
283 | MoveScaled(1,1,24,4)
284 | AutoResize = True
285 | Text = ("Shadow")
286 | }
287 | }
288 | { PanelShadow HBox
289 | MoveScaled(2,55,72,5)
290 | Spacing = True
291 | Indent = True
292 | { Label1 Label
293 | MoveScaled(1,0,4,4)
294 | AutoResize = True
295 | Text = ("S:")
296 | }
297 | { SpinBoxshadowsize SpinBox
298 | MoveScaled(6,1,9,4)
299 | Expand = True
300 | MinValue = 2
301 | Step = 2
302 | Value = 2
303 | }
304 | { Label2 Label
305 | MoveScaled(17,1,4,4)
306 | AutoResize = True
307 | Text = ("G:")
308 | }
309 | { SpinBoxshadowgamma SpinBox
310 | MoveScaled(21,1,16,4)
311 | Expand = True
312 | MinValue = -10
313 | MaxValue = 10
314 | }
315 | { Label3 Label
316 | MoveScaled(42,1,4,4)
317 | AutoResize = True
318 | Text = ("A:")
319 | }
320 | { SpinBoxshadowalpha SpinBox
321 | MoveScaled(52,1,16,4)
322 | Expand = True
323 | MaxValue = 255
324 | Step = 10
325 | }
326 | }
327 | { PanelShadow2 HBox
328 | MoveScaled(2,60,72,5)
329 | Spacing = True
330 | Indent = True
331 | { Label5 Label
332 | MoveScaled(1,0,40,4)
333 | Expand = True
334 | AutoResize = True
335 | Text = ("Window corner round radius")
336 | }
337 | { SpinBoxcornerradius SpinBox
338 | MoveScaled(46,0,25.7143,4)
339 | }
340 | }
341 | }
342 | Index = 0
343 | }
344 | { MessageView1 MessageView
345 | MoveScaled(0,74,62,5)
346 | }
347 | }
348 |
--------------------------------------------------------------------------------
/.src/MyDesktop.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 |
5 | Public dname As String
6 | Public dExec As String
7 | Public dPath As String
8 | Public dTerminal As Boolean
9 | Public dType As String
10 | Public dIconName As String
11 | Public dCategory As String
12 | Public dGenericName As String
13 | Public dComment As String
14 | Public dNoDisplay As Boolean
15 | Public dDisplayOnlyIn As String
16 | Public dNotShowIn As String
17 | Public dURL As String
18 | 'Public dXKDELibrary As String
19 | Public dXKDEServiceTypes As String
20 |
21 | Public Sub init()
22 | dname = ""
23 | dExec = ""
24 | dTerminal = False
25 | dType = ""
26 | dIconName = ""
27 | dCategory = ""
28 | dGenericName = ""
29 | dComment = ""
30 | dNoDisplay = ""
31 | dDisplayOnlyIn = ""
32 | dNotShowIn = ""
33 | dURL = ""
34 | ' dXKDELibrary = ""
35 | dXKDEServiceTypes = ""
36 | End
37 |
38 |
39 | Public Function parse(desktopfile As String)
40 | Dim sLine As String
41 | Dim sSection As String
42 | init()
43 | If Not Exist(desktopfile, True) Then Return
44 | For Each sLine In Split(File.Load(desktopfile), "\n")
45 | sLine = Trim(sLine)
46 | If sLine Begins "[" Then
47 | sSection = Mid(sLine, 2, Len(sLine) - 2)
48 | If LCase(sSection) <> "desktop entry" Then Break
49 | Endif
50 | If sLine Begins "Name=" Then dName = Right(sLine, -InStr(sLine, "="))
51 | If sLine Begins "Path=" Then dPath = Right(sLine, -InStr(sLine, "="))
52 | If sLine Begins "Exec=" Then dExec = Right(sLine, -InStr(sLine, "="))
53 | If sLine Begins "Terminal=" Then
54 | dTerminal = (Lower((Right(sLine, -InStr(sLine, "=")))) = "true")
55 | Endif
56 | If sLine Begins "Type" Then dType = Right(sLine, -InStr(sLine, "="))
57 | If sLine Begins "Icon" Then dIconName = Right(sLine, -InStr(sLine, "="))
58 | If sLine Begins "URL" Then dURL = Right(sLine, -InStr(sLine, "="))
59 | If sLine Begins "Categories" Then dCategory = Right(sLine, -InStr(sLine, "="))
60 | If sLine Begins "GenericName=" Then dGenericName = Right(sLine, -InStr(sLine, "="))
61 | If sLine Begins "Comment=" Then dComment = Right(sLine, -InStr(sLine, "="))
62 | If sLine Begins "NoDisplay" Then dNoDisplay = CBool(Right(sLine, -InStr(sLine, "=")))
63 | If sLine Begins "DisplayOnlyIn" Then dDisplayOnlyIn = Right(sLine, -InStr(sLine, "="))
64 | If sLine Begins "NotShowIn" Then dNotShowIn = Right(sLine, -InStr(sLine, "="))
65 | If sLine Begins "X-KDE-ServiceTypes" Then dXKDEServiceTypes = Right(sLine, -InStr(sLine, "="))
66 | 'If sLine Begins "X-KDE-Library" Then dXKDELibrary = Right(sLine, -InStr(sLine, "="))
67 | Next
68 | End
69 |
70 | Static Private image_cache As New Collection
71 |
72 |
73 | Static Public Sub Get_mime_Icon(path As String, Optional rSize As Integer = 16) As Picture
74 | Dim mimetype As String
75 | Dim aKey As String
76 | Try mimetype = DesktopMime.FromFile(path).type
77 | If Error Then Return Null
78 | aKey = mimetype & Chr(8) & rsize
79 | If Not image_cache.Exist(aKey) Then
80 | If mimetype = "application/x-executable" Then
81 | image_cache[aKey] = Picture["icon:/" & rSize & "/exec"]
82 | Else
83 | image_cache[aKey] = DesktopMime.FromFile(path).GetIcon(rSize).Picture
84 | Endif
85 | Else
86 | Endif
87 | Return image_cache[aKey]
88 | End
89 |
90 |
91 | Static Public Sub Mime_exe(path As String) As String
92 | Dim mimetype As String
93 | If path = "" Then Return False
94 | 'Shell "file -biL '" & path & "' |cut -d ';' -f 1" To mimetype
95 | Shell "file -biL '" & path & "'" To mimetype
96 | path = Trim(path)
97 | mimetype = Trim(mimetype)
98 | If mimetype Like "*executable*" Then Return True
99 | If mimetype Like "*shellscript*" Then Return True
100 | If mimetype = "application/octet-stream; charset=binary" Then Return True
101 | Return False
102 | End
103 |
104 | Static Private Function svg2image(svg_file As String, w As Integer, h As Integer) As Image
105 | Dim hsvg As SvgImage
106 | Dim himage As Image
107 | hSvg = SvgImage.Load(svg_file)
108 | hImage = New Image(w, h, Color.transparent)
109 | Paint.Begin(hImage)
110 | hSvg.Resize(w, h)
111 | hSvg.Paint
112 | Paint.End
113 | Return hImage
114 | End
115 |
116 |
117 |
118 | Static Public Sub GetIcon(dIconName As String, Optional Size As Integer = 16) As Image
119 |
120 | Dim sPath As String
121 | Dim hImage As Image
122 | Dim sDir As String
123 | Dim sSize As String
124 | Dim s As String
125 | If Exist(dIconName, True) Then
126 | If dIconName Ends ".svg" Then
127 | hImage = svg2image(dIconName, Size, Size)
128 | Else
129 | Try hImage = Image.Load(dIconName)
130 | Endif
131 |
132 | Else
133 | If ((dIconName Ends ".png") Or (dIconName Ends ".xpm") Or (dIconName Ends ".svg")) Then dIconName = File.BaseName(dIconName)
134 |
135 |
136 | For Each sDir In [Desktop.DataDir &/ "icons", "/usr/share/icons", "/usr/local/share/icons"]
137 |
138 | sPath = sDir & "/" & dIconName & ".png"
139 | If Exist(sPath) Then
140 | Try hImage = Image.Load(sPath)
141 | If hImage Then Break
142 | Endif
143 |
144 | sPath = sDir & "/" & dIconName & ".xpm"
145 | If Exist(sPath) Then
146 | Try hImage = Image.Load(sPath)
147 | If hImage Then Break
148 | Endif
149 |
150 | sPath = sDir & "/" & dIconName & ".svg"
151 | If Exist(sPath) Then
152 | Try hImage = svg2image(sPath, size, size)
153 | If hImage Then Break
154 | Endif
155 |
156 | For Each sSize In [CStr(Size), "256", "128", "64", "48", "32" "22", "16", "8"]
157 | sPath = Subst(sDir &/ "hicolor/&1x&1/apps/&2.png", sSize, dIconName)
158 | If Exist(sPath, True) Then
159 | Try hImage = Image.Load(sPath)
160 | If hImage Then Break
161 | Endif
162 | sPath = Subst(sDir &/ "hicolor/&1x&1/apps/&2.xpm", sSize, dIconName)
163 | If Exist(sPath, True) Then
164 | Try hImage = Image.Load(sPath)
165 | If hImage Then Break
166 | Endif
167 | Next
168 | If hImage Then Break
169 | Next
170 |
171 | If Not hImage Then
172 | sPath = Subst("/usr/share/pixmaps/&1.png", dIconName)
173 | If Exist(sPath, True) Then Try hImage = Image.Load(sPath)
174 | Endif
175 |
176 | If Not hImage Then
177 | sPath = Subst("/usr/share/pixmaps/&1.xpm", dIconName)
178 | If Exist(sPath, True) Then Try hImage = Image.Load(sPath)
179 | Endif
180 |
181 | Endif
182 | If Not hImage Then
183 | 'For Each s In ["apps", "actions", "places", "devices"]
184 | For Each s In ["apps", "actions", "places", "devices", "categories", "emblems", "mime", "misc", "status", "mimetypes"]
185 | Try hImage = Stock[CStr(Size) &/ s &/ dIconName].Image
186 | If hImage Then Break
187 | Next
188 | Endif
189 | 'If dIconName = "preferences-desktop-theme-windowdecorations" Then Stop
190 | If Not hImage Then hImage = fallback_icon(dIconName, size)
191 | If hImage.W <> Size Or If hImage.H <> Size Then hImage = hImage.Stretch(Size, Size)
192 | Return hImage
193 | Catch
194 |
195 | End
196 |
197 |
198 | Static Private Sub fallback_icon(iconname As String, size As Integer) As Image
199 | Dim tPath, theme As String
200 | Dim icon_theme As String
201 | Dim iconfiles As String[]
202 | Dim iconfiles_name As String
203 | Dim scores As New Integer[]
204 | Dim maxscore As Integer = 0
205 | Dim best_item_index As Integer = 0
206 | Dim best_item As String
207 | Dim good_matches As New String[]
208 | Dim i, s As Integer
209 | Dim himage As Image
210 | Dim t0 As Float
211 | Dim try_icon_theme As String
212 | Debug "getting fallback icon"
213 |
214 | icon_theme = Settings["icon_theme", ""]
215 | If icon_theme = "" Then Stop
216 | t0 = Timer()
217 |
218 | If icon_theme <> "" Then
219 | For Each try_icon_theme In [icon_theme, Lower(icon_theme)]
220 | tpath = User.home & "/.local/share/icons/" & try_icon_theme
221 | If Exist(tpath, True) Then Goto found
222 | tpath = User.home & "/.icons/" & try_icon_theme
223 | If Exist(tpath, True) Then Goto found
224 | tpath = "/usr/share/icons/" & try_icon_theme
225 | If Exist(tpath, True) Then Goto found
226 | Next
227 | found:
228 |
229 |
230 |
231 | iconfiles = RDir(tPath, "*/*")
232 | For i = 0 To iconfiles.Max
233 | iconfiles_name = File.BaseName(iconfiles[i])
234 | For s = 0 To Len(iconfiles_name) - 1
235 | If Not (iconname Begins Left(iconfiles_name, s + 1)) Then Break
236 | Next
237 | If (s > maxscore) Then
238 | maxscore = s
239 | best_item_index = i
240 | Endif
241 | Next
242 | Endif
243 |
244 | If maxscore > (Len(File.BaseName(iconname)) Div 2) Then
245 | best_item = tpath & "/" & iconfiles[best_item_index]
246 | If best_item Ends "*.svg" Then Try Return Global.image_from_svg(best_item, size)
247 | Try Return Image.Load(best_item)
248 | Endif
249 |
250 |
251 | Return Null 'Stock[CStr(Size) &/ "program"].Image
252 |
253 | End
254 |
255 |
256 | Static Public Sub Get_file_Icon(dIconName As String, Optional Size As Integer = 16) As String
257 |
258 | Dim sPath As String
259 | Dim hImage As Image
260 | Dim sDir As String
261 | Dim sSize As String
262 | Dim s As String
263 | Dim out As String
264 |
265 | If Exist(dIconName, True) Then Return dIconName
266 |
267 | If ((dIconName Ends ".png") Or (dIconName Ends ".xpm")) Then dIconName = File.BaseName(dIconName)
268 |
269 | For Each sDir In [Desktop.DataDir &/ "icons", "/usr/share/icons"]
270 |
271 | For Each sSize In [CStr(Size), "256", "128", "64", "48", "32" "22", "16", "8"]
272 |
273 | sPath = Subst(sDir &/ "hicolor/&1x&1/apps/&2.png", sSize, dIconName)
274 | If Exist(sPath, True) Then
275 | Try hImage = Image.Load(sPath)
276 | If hImage Then
277 | out = sPath
278 | Goto returnLabel
279 | Endif
280 | Endif
281 |
282 | sPath = Subst(sDir &/ "hicolor/&1x&1/apps/&2.xpm", sSize, dIconName)
283 | If Exist(sPath, True) Then
284 | Try hImage = Image.Load(sPath)
285 | If hImage Then
286 | out = sPath
287 | Goto returnLabel
288 | Endif
289 | Endif
290 |
291 | Next 'sSize
292 |
293 | If hImage Then Goto returnlabel
294 | Next 'sDir
295 |
296 | For Each sPath In [Subst("/usr/share/pixmaps/&1.png", dIconName), Subst("/usr/share/pixmaps/&1.xpm", dIconName)]
297 | If Exist(sPath, True) Then
298 | Try hImage = Image.Load(sPath)
299 | If hImage Then
300 | out = sPath
301 | Goto returnLabel
302 | Endif
303 | Endif
304 | Next
305 |
306 |
307 |
308 | For Each s In ["apps", "actions", "places", "devices", "categories", "emblems", "mime", "misc", "status", "mimetypes"]
309 | Try hImage = Stock[CStr(Size) &/ s &/ dIconName].Image
310 | If hImage Then
311 | out = sPath
312 | Goto returnLabel
313 | Endif
314 | Next
315 |
316 |
317 | returnLabel:
318 | Return out
319 |
320 | End
321 |
--------------------------------------------------------------------------------
/.lang/it.po:
--------------------------------------------------------------------------------
1 | #, fuzzy
2 | msgid ""
3 | msgstr ""
4 | "Project-Id-Version: higgins 3.10.0\n"
5 | "POT-Creation-Date: 2024-03-06 11:57 UTC\n"
6 | "PO-Revision-Date: 2018-06-11 10:06 UTC\n"
7 | "Last-Translator: kokoko3k \n"
8 | "Language: it\n"
9 | "MIME-Version: 1.0\n"
10 | "Content-Type: text/plain; charset=UTF-8\n"
11 | "Content-Transfer-Encoding: 8bit\n"
12 |
13 | #: .project:1
14 | msgid "Higgins"
15 | msgstr "-"
16 |
17 | #: .project:2
18 | msgid ""
19 | "Higgins:\n"
20 | "Application launcher,\n"
21 | "starts applications and search for things.\n"
22 | "\n"
23 | "Currently it:\n"
24 | "Evaluate expressions (calculator)\n"
25 | "Find recently opened documents\n"
26 | "Find desktop applications\n"
27 | "Find executables\n"
28 | "Find local bookmarks\n"
29 | "Lists the content of folders\n"
30 | "Find files by indexing user-specified folders\n"
31 | "\n"
32 | "Support external plugins; take a look to External_plugin_locate.sh for an example"
33 | msgstr ""
34 | "Higgins: Lanciatore di applicazioni,\n"
35 | "avvia applicazioni e cerca cose.\n"
36 | "\n"
37 | "Attualmente è in grado, tra l'altro di:\n"
38 | "Valutare espressioni (calcolatrice)\n"
39 | "Trovare documenti recenti\n"
40 | "Trovare applicazioni\n"
41 | "Trovare eseguibili\n"
42 | "Trovare segnalibri locali\n"
43 | "Mostrare il contenuto delle cartelle\n"
44 | "Trovare file indicizzando cartelle selezionate\n"
45 | "Supporta plugin esterni; (dai uno sguardo a External_plugin_locate.sh per un esempio)"
46 |
47 | #: FMain.class:507
48 | msgid "Execute file?"
49 | msgstr "Eseguire il file?"
50 |
51 | #: FMain.class:1006
52 | msgid "Bridge to external plugin"
53 | msgstr "Ponte per plugin esterni"
54 |
55 | #: FMain.class:1218
56 | msgid "Do not auto-hide main window"
57 | msgstr "Non nascondere higgins automaticamente"
58 |
59 | #: FMain.class:1219
60 | msgid "Do not use a tray icon"
61 | msgstr "Non usare l'icona nel vassoio"
62 |
63 | #: FMain.class:1220
64 | msgid "Clear the previous search on hide"
65 | msgstr "Cancella l'ultima ricerca alla scomparsa"
66 |
67 | #: FMain.class:1245
68 | msgid "Higgins is not configured"
69 | msgstr "Higgins non è configurato"
70 |
71 | #: FMain.class:1246
72 | msgid "Please configure at least the hotkey"
73 | msgstr "Prego, configura almeno la scorciatoia"
74 |
75 | #: FMain.class:1247
76 | msgid "to show the higgins window."
77 | msgstr "Per mostrare la finestra di higgins."
78 |
79 | #: FMain.form:33
80 | msgid "TrayMenu"
81 | msgstr "-"
82 |
83 | #: FMain.form:37
84 | msgid "Options"
85 | msgstr "Opzioni"
86 |
87 | #: FMain.form:42
88 | msgid "Show"
89 | msgstr "Mostra"
90 |
91 | #: FMain.form:47
92 | msgid "Quit"
93 | msgstr "Esci"
94 |
95 | #: FMain.form:53
96 | msgid "Menu1"
97 | msgstr "-"
98 |
99 | #: FMain.form:57
100 | msgid "Open containing folder"
101 | msgstr "Apri la cartella contenente"
102 |
103 | #: FMain.form:62
104 | msgid "Open File"
105 | msgstr "Apri il file"
106 |
107 | #: FMain.form:67
108 | msgid "Copy to Clipboard"
109 | msgstr "Copia nella clipboard"
110 |
111 | #: hSettings.class:136
112 | msgid "Choose a picture"
113 | msgstr "Scegli un'immagine"
114 |
115 | #: hSettings.class:286
116 | msgid "Load an image"
117 | msgstr "Carica un'immagine"
118 |
119 | #: hSettings.form:71
120 | msgid "Higgins settings"
121 | msgstr "Impostazioni di Higgins"
122 |
123 | #: hSettings.form:86
124 | msgid "General"
125 | msgstr "Generale"
126 |
127 | #: hSettings.form:104
128 | msgid "Hide/show shortcut:"
129 | msgstr "Scorciatoia per Nascondi/Mostra:"
130 |
131 | #: hSettings.form:110
132 | msgid "Change"
133 | msgstr "Cambia"
134 |
135 | #: hSettings.form:123
136 | msgid "Terminal"
137 | msgstr "Terminale"
138 |
139 | #: hSettings.form:129
140 | msgid "gnome-terminal"
141 | msgstr "-"
142 |
143 | #: hSettings.form:129
144 | msgid "konsole"
145 | msgstr "-"
146 |
147 | #: hSettings.form:129
148 | msgid "lxterminal"
149 | msgstr "-"
150 |
151 | #: hSettings.form:129
152 | msgid "xfce4-terminal"
153 | msgstr "-"
154 |
155 | #: hSettings.form:129
156 | msgid "xterm"
157 | msgstr "-"
158 |
159 | #: hSettings.form:141
160 | msgid "Fallback icons (or current desktop icon theme)"
161 | msgstr "Tema di icone di ripiego (o tema corrente)"
162 |
163 | #: hSettings.form:163
164 | msgid "Input lag in seconds (responsivity vs cpu use)"
165 | msgstr "Ritardo in secondi (responsività vs uso cpu)"
166 |
167 | #: hSettings.form:169
168 | msgid "0.00 - immediate"
169 | msgstr "0.00 - istantaneo"
170 |
171 | #: hSettings.form:169
172 | msgid "0.05 - Very fast cpu"
173 | msgstr "0.05 - cpu molto veloce"
174 |
175 | #: hSettings.form:169
176 | msgid "0.10 - Fast cpu"
177 | msgstr "0.10 - cpu veloce"
178 |
179 | #: hSettings.form:169
180 | msgid "0.20 - Slow cpu"
181 | msgstr "0.20 - cpu lenta"
182 |
183 | #: hSettings.form:169
184 | msgid "0.30 - Very slow cpu"
185 | msgstr "0.30 - cpu molto lenta"
186 |
187 | #: hSettings.form:169
188 | msgid "0.40 "
189 | msgstr "-"
190 |
191 | #: hSettings.form:169
192 | msgid "0.50 "
193 | msgstr "-"
194 |
195 | #: hSettings.form:169
196 | msgid "Adaptive "
197 | msgstr "Adattivo"
198 |
199 | #: hSettings.form:170
200 | msgid "0.10"
201 | msgstr "0.10"
202 |
203 | #: hSettings.form:175
204 | msgid "Plugins"
205 | msgstr "Plugin"
206 |
207 | #: hSettings.form:194
208 | msgid "Open External plugins directory"
209 | msgstr "Apri la cartella dei plugin esterni"
210 |
211 | #: hSettings.form:201
212 | msgid "Refresh External plugins list"
213 | msgstr "Aggiorna la lista di plugin esterni"
214 |
215 | #: hSettings.form:206
216 | msgid "Style"
217 | msgstr "Stile"
218 |
219 | #: hSettings.form:224
220 | msgid "Undecorated Window"
221 | msgstr "Finestra non decorata"
222 |
223 | #: hSettings.form:231
224 | msgid "Window border"
225 | msgstr "Bordo della finestra"
226 |
227 | #: hSettings.form:244
228 | msgid "Input field border"
229 | msgstr "Bordo del campo di immissione"
230 |
231 | #: hSettings.form:252
232 | msgid "Show scrollbar"
233 | msgstr "Mostra le barre di scorrimento"
234 |
235 | #: hSettings.form:267
236 | msgid "Window color"
237 | msgstr "Colore della finestra"
238 |
239 | #: hSettings.form:291
240 | msgid "Search (background, text, opacity)"
241 | msgstr "Ricerca (sfondo,testo,opacità)"
242 |
243 | #: hSettings.form:326
244 | msgid "Results (background, text, opacity)"
245 | msgstr "Risultati (sfondo,testo,opacità)"
246 |
247 | #: hSettings.form:362
248 | msgid "Extra window padding"
249 | msgstr "Contorno aggiuntivo"
250 |
251 | #: hSettings.form:379
252 | msgid "Background picture"
253 | msgstr "Immagine di sfondo"
254 |
255 | #: hSettings.form:394
256 | msgid "The followings need a compositor"
257 | msgstr "I seguenti necessitano di un compositore"
258 |
259 | #: hSettings.form:404
260 | msgid "Shadow"
261 | msgstr "Ombra"
262 |
263 | #: hSettings.form:416
264 | msgid "S:"
265 | msgstr "-"
266 |
267 | #: hSettings.form:430
268 | msgid "G:"
269 | msgstr "-"
270 |
271 | #: hSettings.form:443
272 | msgid "A:"
273 | msgstr "A:"
274 |
275 | #: hSettings.form:463
276 | msgid "Window corner round radius"
277 | msgstr "Raggio degli angoli arrotondati"
278 |
279 | #: plugin_009_history.class:4
280 | #, fuzzy
281 | msgid "Finds previously selected documents"
282 | msgstr "Trova oggetti usati in precedenza"
283 |
284 | #: plugin_009_history.class:5
285 | msgid "History plugin"
286 | msgstr "Cronologia"
287 |
288 | #: plugin_010_calculator.class:4
289 | msgid "Expression evaluator"
290 | msgstr "Valuta le espressioni"
291 |
292 | #: plugin_010_calculator.class:5
293 | msgid "Calculator"
294 | msgstr "Calcolatrice"
295 |
296 | #: plugin_010_calculator.class:151
297 | msgid "-1 (boolean TRUE)"
298 | msgstr "-1 (logico vero)"
299 |
300 | #: plugin_010_calculator.class:152
301 | msgid "0 (boolean FALSE)"
302 | msgstr "0 (logico falso)"
303 |
304 | #: plugin_015_recent.class:4
305 | msgid "Search for Recent Documents"
306 | msgstr "Trova i documenti aperti di recente"
307 |
308 | #: plugin_015_recent.class:5
309 | msgid "Recent Documents"
310 | msgstr "Documenti recenti"
311 |
312 | #: plugin_020_apps.class:4
313 | msgid "Find desktop applications"
314 | msgstr "Trova le applicazioni installate"
315 |
316 | #: plugin_020_apps.class:5
317 | msgid "Desktop apps"
318 | msgstr "Applicazioni del desktop"
319 |
320 | #: plugin_020_apps.class:160
321 | msgid "In: "
322 | msgstr "In:"
323 |
324 | #: plugin_030_executable.class:4
325 | msgid "Executables launcher"
326 | msgstr "Avviatore di eseguibili"
327 |
328 | #: plugin_030_executable.class:5
329 | msgid "Executables"
330 | msgstr "Eseguibili"
331 |
332 | #: plugin_040_fbookmarks.class:4
333 | msgid "Search through desktop bookmarks"
334 | msgstr "Trova i segnalibri del sistema"
335 |
336 | #: plugin_040_fbookmarks.class:5
337 | msgid "Folder bookmarks"
338 | msgstr "Segnalibri delle cartelle"
339 |
340 | #: plugin_050_ls.class:4
341 | msgid "List files from a folder"
342 | msgstr "Mostra i file da una cartella"
343 |
344 | #: plugin_050_ls.class:5
345 | msgid "list plugin"
346 | msgstr "Lista"
347 |
348 | #: plugin_090_indexer.class:4
349 | msgid "Index filenames from user-defined folders."
350 | msgstr "Indicizza i nomi dei file da cartelle selezionate"
351 |
352 | #: plugin_090_indexer.class:5
353 | msgid "Indexer"
354 | msgstr "Indicizzatore"
355 |
356 | #: plugin_100_windows.class:4
357 | msgid "[BROKEN, hangs with windows with long titles] Search and activate windows"
358 | msgstr ""
359 |
360 | #: plugin_100_windows.class:5
361 | msgid "Search and activate windows"
362 | msgstr "Cerca e attiva le finestre"
363 |
364 | #: plugin_999_template.class:4
365 | msgid "Example plugin description"
366 | msgstr "descrizione del plugin di esempio"
367 |
368 | #: plugin_999_template.class:5
369 | msgid "Example plugin"
370 | msgstr "Plugin di esempio"
371 |
372 | #: plugin_apps_gui.class:17 plugin_indexer_gui.class:51
373 | msgid "Directory"
374 | msgstr "Cartella"
375 |
376 | #: plugin_apps_gui.form:36
377 | msgid "Also search for apps in the following folders (Not recursive)"
378 | msgstr "Cerca le applicazioni anche nelle seguenti cartelle (non ricorsivo)"
379 |
380 | #: plugin_apps_gui.form:117
381 | msgid "Identify desktop files by extension only (faster)"
382 | msgstr "Identifica i file del desktop dall'estensione (più veloce)"
383 |
384 | #: plugin_indexer_gui.class:50
385 | msgid "Depth"
386 | msgstr "Profondità"
387 |
388 | #: plugin_indexer_gui.class:141
389 | msgid "items indexed."
390 | msgstr "oggetti indicizzati."
391 |
392 | #: plugin_indexer_gui.form:33
393 | msgid "indexer plugin config"
394 | msgstr "Configurazione del plugin indicizzatore"
395 |
396 | #: plugin_indexer_gui.form:49
397 | msgid "Directories to index"
398 | msgstr "Cartelle da indicizzare"
399 |
400 | #: plugin_indexer_gui.form:134
401 | msgid "Limit results to:"
402 | msgstr "Limita i risultati a:"
403 |
404 | #: plugin_indexer_gui.form:145
405 | msgid ""
406 | "Example:\n"
407 | "Path /aa/bb/cc exists. and you search for \"aa\" or \"bb\"\n"
408 | "Option checked -> You get \"/aa/bb/cc\"\n"
409 | "Option unchecked -> You DONT get \"/aa/bb/cc\""
410 | msgstr ""
411 | "Esempio:\n"
412 | "Il percorso /aa/bb/cc esiste. e tu cerchi \"aa\" oppure \"bb\"\n"
413 | "Opzione abilitata -> Avrai il risultato \"/aa/bb/cc\"\n"
414 | "Opzione disabilitata -> NON Avrai il risultato \"/aa/bb/cc\""
415 |
416 | #: plugin_indexer_gui.form:147
417 | msgid "Match Full Pathname"
418 | msgstr "Corrispondenza in percorsi completi"
419 |
420 | #: plugin_indexer_gui.form:152
421 | msgid ""
422 | "Show hidden files or not in search list.\n"
423 | "Hidden files are still shown if search begins with \".\""
424 | msgstr ""
425 | "Mostra i file nascosti o meno nella lista.\n"
426 | " I file nascosti sono comunque mostrati se la ricerca comincia con \".\""
427 |
428 | #: plugin_indexer_gui.form:154
429 | msgid "Match hidden files"
430 | msgstr "Trova anche file nascosti"
431 |
432 | #: plugin_indexer_gui.form:169
433 | msgid "Update index every:"
434 | msgstr "Aggiorna l'indice ogni:"
435 |
436 | #: plugin_indexer_gui.form:175
437 | msgid "00:30"
438 | msgstr "-"
439 |
440 | #: plugin_indexer_gui.form:185
441 | msgid "Index Now"
442 | msgstr "Indicizza ora"
443 |
--------------------------------------------------------------------------------
/.lang/nl_NL.po:
--------------------------------------------------------------------------------
1 | msgid ""
2 | msgstr ""
3 | "Project-Id-Version: higgins 3.9.2\n"
4 | "PO-Revision-Date: 2017-09-29 21:51+0200\n"
5 | "MIME-Version: 1.0\n"
6 | "Content-Type: text/plain; charset=UTF-8\n"
7 | "Content-Transfer-Encoding: 8bit\n"
8 | "POT-Creation-Date: \n"
9 | "Language-Team: \n"
10 | "X-Generator: Poedit 2.0.2\n"
11 | "Last-Translator: Heimen Stoffels \n"
12 | "Plural-Forms: nplurals=2; plural=(n != 1);\n"
13 | "Language: nl_NL\n"
14 |
15 | #: .project:1
16 | msgid "Higgins"
17 | msgstr "Higgins"
18 |
19 | #: .project:2
20 | msgid ""
21 | "Higgins:\n"
22 | "Application launcher,\n"
23 | "starts applications and search for things.\n"
24 | "\n"
25 | "Currently it:\n"
26 | "Evaluate expressions (calculator)\n"
27 | "Find recently opened documents\n"
28 | "Find desktop applications\n"
29 | "Find executables\n"
30 | "Find local bookmarks\n"
31 | "Lists the content of folders\n"
32 | "Find files by indexing user-specified folders\n"
33 | "\n"
34 | "Support external plugins; take a look to External_plugin_locate.sh for an "
35 | "example"
36 | msgstr ""
37 | "Higgins:\n"
38 | "Applicatiestarter;\n"
39 | "start applicaties en zoekt naar dingen.\n"
40 | "\n"
41 | "Huidige mogelijkheden:\n"
42 | "Berekeningen maken (rekenmachine)\n"
43 | "Zoeken naar recent geopende documenten\n"
44 | "Zoeken naar applicaties\n"
45 | "Zoeken naar uitvoerbare bestanden\n"
46 | "Zoeken naar lokale bladwijzers\n"
47 | "Inhoud van mappen opsommen\n"
48 | "Zoeken naar bestanden door het indexeren van door de gebruiker opgegeven "
49 | "mappen\n"
50 | "\n"
51 | "Ondersteunt externe plug-ins: zie bijv. External_plugin_locate.sh"
52 |
53 | #: FMain.class:486
54 | msgid "Execute file?"
55 | msgstr "Bestand uitvoeren?"
56 |
57 | #: FMain.class:990
58 | msgid "Bridge to external plugin"
59 | msgstr "Overbrugging naar externe plug-in"
60 |
61 | #: FMain.class:1204
62 | msgid "Do not auto-hide main window"
63 | msgstr "Hoofdvenster niet automatisch verbergen"
64 |
65 | #: FMain.class:1205
66 | msgid "Do not use a tray icon"
67 | msgstr "Geen systeemvakpictogram gebruiken"
68 |
69 | #: FMain.class:1206
70 | msgid "Clear the previous search on hide"
71 | msgstr "Vorige zoekopdracht wissen bij verbergen"
72 |
73 | #: FMain.class:1231
74 | msgid "Higgins is not configured"
75 | msgstr "Higgins is niet ingesteld"
76 |
77 | #: FMain.class:1232
78 | msgid "Please configure at least the hotkey"
79 | msgstr "Stel op zijn minst de sneltoets in"
80 |
81 | #: FMain.class:1233
82 | msgid "to show the higgins window."
83 | msgstr "om het Higgins-venster weer te geven."
84 |
85 | #: FMain.form:33
86 | msgid "TrayMenu"
87 | msgstr "Systeemvakmenu"
88 |
89 | #: FMain.form:37
90 | msgid "Options"
91 | msgstr "Opties"
92 |
93 | #: FMain.form:42
94 | msgid "Show"
95 | msgstr "Weergeven"
96 |
97 | #: FMain.form:47
98 | msgid "Quit"
99 | msgstr "Afsluiten"
100 |
101 | #: FMain.form:53
102 | msgid "Menu1"
103 | msgstr "Menu1"
104 |
105 | #: FMain.form:57
106 | msgid "Open containing folder"
107 | msgstr "Bijbehorende map openen"
108 |
109 | #: FMain.form:62
110 | msgid "Open File"
111 | msgstr "Bestand openen"
112 |
113 | #: FMain.form:67
114 | msgid "Copy to Clipboard"
115 | msgstr "Kopiëren naar klembord"
116 |
117 | #: hSettings.class:135
118 | msgid "Choose a picture"
119 | msgstr "Afbeelding kiezen"
120 |
121 | #: hSettings.class:285
122 | msgid "Load an image"
123 | msgstr "Afbeelding laden"
124 |
125 | #: hSettings.form:71
126 | msgid "Higgins settings"
127 | msgstr "Higgins-instellingen"
128 |
129 | #: hSettings.form:86
130 | msgid "General"
131 | msgstr "Algemeen"
132 |
133 | #: hSettings.form:104
134 | msgid "Hide/show shortcut:"
135 | msgstr "Sneltoets voor weergeven/verbergen:"
136 |
137 | #: hSettings.form:110
138 | msgid "Change"
139 | msgstr "Wijzigen"
140 |
141 | #: hSettings.form:123
142 | msgid "Terminal"
143 | msgstr "Terminal"
144 |
145 | #: hSettings.form:129
146 | msgid "gnome-terminal"
147 | msgstr "gnome-terminal"
148 |
149 | #: hSettings.form:129
150 | msgid "konsole"
151 | msgstr "konsole"
152 |
153 | #: hSettings.form:129
154 | msgid "lxterminal"
155 | msgstr "lxterminal"
156 |
157 | #: hSettings.form:129
158 | msgid "xfce4-terminal"
159 | msgstr "xfce4-terminal"
160 |
161 | #: hSettings.form:129
162 | msgid "xterm"
163 | msgstr "xterm"
164 |
165 | #: hSettings.form:141
166 | msgid "Fallback icons (or current desktop icon theme)"
167 | msgstr "Terugvalpictogramset (of huidig werkomgevingspictogramthema)"
168 |
169 | #: hSettings.form:163
170 | msgid "Input lag in seconds (responsivity vs cpu use)"
171 | msgstr "Invoervertraging in seconden (responsiviteit vs CPU-gebruik)"
172 |
173 | #: hSettings.form:169
174 | msgid "0.00 - immediate"
175 | msgstr "0.00 - onmiddelijk"
176 |
177 | #: hSettings.form:169
178 | msgid "0.05 - Very fast cpu"
179 | msgstr "0.05 - Erg snelle CPU"
180 |
181 | #: hSettings.form:169
182 | msgid "0.10 - Fast cpu"
183 | msgstr "0.10 - Snelle CPU"
184 |
185 | #: hSettings.form:169
186 | msgid "0.20 - Slow cpu"
187 | msgstr "0.20 - Langzame CPU"
188 |
189 | #: hSettings.form:169
190 | msgid "0.30 - Very slow cpu"
191 | msgstr "0.30 - Erg langzame CPU"
192 |
193 | #: hSettings.form:169
194 | msgid "0.40 "
195 | msgstr "0.40 "
196 |
197 | #: hSettings.form:169
198 | msgid "0.50 "
199 | msgstr "0.50 "
200 |
201 | #: hSettings.form:169
202 | msgid "Adaptive "
203 | msgstr "Dynamisch "
204 |
205 | #: hSettings.form:170
206 | msgid "0.10"
207 | msgstr "0.10"
208 |
209 | #: hSettings.form:175
210 | msgid "Plugins"
211 | msgstr "Plug-ins"
212 |
213 | #: hSettings.form:194
214 | msgid "Open External plugins directory"
215 | msgstr "Externe plug-insmap openen"
216 |
217 | #: hSettings.form:201
218 | msgid "Refresh External plugins list"
219 | msgstr "Externe plug-inslijst verversen"
220 |
221 | #: hSettings.form:206
222 | msgid "Style"
223 | msgstr "Stijl"
224 |
225 | #: hSettings.form:224
226 | msgid "Undecorated Window"
227 | msgstr "Venster zonder opmaak"
228 |
229 | #: hSettings.form:231
230 | msgid "Window border"
231 | msgstr "Vensterrand"
232 |
233 | #: hSettings.form:244
234 | msgid "Input field border"
235 | msgstr "Invoerveld-rand"
236 |
237 | #: hSettings.form:252
238 | msgid "Show scrollbar"
239 | msgstr "Scrollbalk weergeven"
240 |
241 | #: hSettings.form:267
242 | msgid "Window color"
243 | msgstr "Vensterkleur"
244 |
245 | #: hSettings.form:291
246 | msgid "Search (background, text, opacity)"
247 | msgstr "Zoeken (achtergrond, tekst, doorzichtigheid)"
248 |
249 | #: hSettings.form:326
250 | msgid "Results (background, text, opacity)"
251 | msgstr "Resultaten (achtergrond, tekst, doorzichtigheid)"
252 |
253 | #: hSettings.form:362
254 | msgid "Extra window padding"
255 | msgstr "Extra vensteropvulling"
256 |
257 | #: hSettings.form:379
258 | msgid "Background picture"
259 | msgstr "Achtergrondafbeelding"
260 |
261 | #: hSettings.form:394
262 | msgid "The followings need a compositor"
263 | msgstr "De volgende dingen vereisen een compositor"
264 |
265 | #: hSettings.form:404
266 | msgid "Shadow"
267 | msgstr "Schaduw"
268 |
269 | #: hSettings.form:416
270 | msgid "S:"
271 | msgstr "S:"
272 |
273 | #: hSettings.form:429
274 | msgid "G:"
275 | msgstr "G:"
276 |
277 | #: hSettings.form:442
278 | msgid "A:"
279 | msgstr "A:"
280 |
281 | #: hSettings.form:462
282 | msgid "Window corner round radius"
283 | msgstr "Rondheidsstraal van vensterhoek"
284 |
285 | #: plugin_009_history.class:4
286 | msgid "Finds previously selected items"
287 | msgstr "Zoekt naar eerder geselecteerde items"
288 |
289 | #: plugin_009_history.class:5
290 | msgid "History plugin"
291 | msgstr "Geschiedenisplug-in"
292 |
293 | #: plugin_010_calculator.class:4
294 | msgid "Expression evaluator"
295 | msgstr "Berekeningen maken"
296 |
297 | #: plugin_010_calculator.class:5
298 | msgid "Calculator"
299 | msgstr "Rekenmachine"
300 |
301 | #: plugin_010_calculator.class:150
302 | msgid "-1 (boolean TRUE)"
303 | msgstr "-1 (boolean TRUE)"
304 |
305 | #: plugin_010_calculator.class:151
306 | msgid "0 (boolean FALSE)"
307 | msgstr "0 (boolean FALSE)"
308 |
309 | #: plugin_015_recent.class:4
310 | msgid "Search for Recent Documents"
311 | msgstr "Zoeken naar recente documenten"
312 |
313 | #: plugin_015_recent.class:5
314 | msgid "Recent Documents"
315 | msgstr "Recente documenten"
316 |
317 | #: plugin_020_apps.class:4
318 | msgid "Find desktop applications"
319 | msgstr "Zoeken naar applicaties"
320 |
321 | #: plugin_020_apps.class:5
322 | msgid "Desktop apps"
323 | msgstr "Applicaties"
324 |
325 | #: plugin_020_apps.class:149
326 | msgid "In: "
327 | msgstr "In: "
328 |
329 | #: plugin_030_executable.class:4
330 | msgid "Executables launcher"
331 | msgstr "Uitvoerbare bestanden starten"
332 |
333 | #: plugin_030_executable.class:5
334 | msgid "Executables"
335 | msgstr "Uitvoerbare bestanden"
336 |
337 | #: plugin_040_fbookmarks.class:4
338 | msgid "Search through desktop bookmarks"
339 | msgstr "Zoeken in lokale bladwijzers"
340 |
341 | #: plugin_040_fbookmarks.class:5
342 | msgid "Folder bookmarks"
343 | msgstr "Bladwijzermap"
344 |
345 | #: plugin_050_ls.class:4
346 | msgid "List files from a folder"
347 | msgstr "Bestanden uit een map opsommen"
348 |
349 | #: plugin_050_ls.class:5
350 | msgid "list plugin"
351 | msgstr "Opsomplug-in"
352 |
353 | #: plugin_090_indexer.class:4
354 | msgid "Index filenames from user-defined folders."
355 | msgstr "Bestandsnamen indexeren uit door de gebruiker opgegeven mappen."
356 |
357 | #: plugin_090_indexer.class:5
358 | msgid "Indexer"
359 | msgstr "Indexeerder"
360 |
361 | #: plugin_999_template.class:4
362 | msgid "Example plugin description"
363 | msgstr "Omschrijving van voorbeeldplug-in"
364 |
365 | #: plugin_999_template.class:5
366 | msgid "Example plugin"
367 | msgstr "Voorbeeldplug-in"
368 |
369 | #: plugin_apps_gui.class:17 plugin_indexer_gui.class:51
370 | msgid "Directory"
371 | msgstr "Map"
372 |
373 | #: plugin_apps_gui.form:36
374 | msgid "Also search for apps in the following folders (Not recursive)"
375 | msgstr "Ook zoeken naar apps in de volgende mappen (niet-recursief)"
376 |
377 | #: plugin_apps_gui.form:117
378 | msgid "Identify desktop files by extension only (faster)"
379 | msgstr "Bestanden identificeren aan de hand van de extensie (sneller)"
380 |
381 | #: plugin_indexer_gui.class:50
382 | msgid "Depth"
383 | msgstr "Diepte"
384 |
385 | #: plugin_indexer_gui.class:140
386 | msgid "items indexed."
387 | msgstr "geïndexeerde items."
388 |
389 | #: plugin_indexer_gui.form:33
390 | msgid "indexer plugin config"
391 | msgstr "instellingen van indexeerplug-in"
392 |
393 | #: plugin_indexer_gui.form:49
394 | msgid "Directories to index"
395 | msgstr "Te indexeren mappen"
396 |
397 | #: plugin_indexer_gui.form:134
398 | msgid "Limit results to:"
399 | msgstr "Resultaten beperken tot:"
400 |
401 | #: plugin_indexer_gui.form:145
402 | msgid ""
403 | "Example:\n"
404 | "Path /aa/bb/cc exists. and you search for \"aa\" or \"bb\"\n"
405 | "Option checked -> You get \"/aa/bb/cc\"\n"
406 | "Option unchecked -> You DONT get \"/aa/bb/cc\""
407 | msgstr ""
408 | "Voorbeeld:\n"
409 | "Pad /aa/bb/cc bestaat en u zoekt naar \"aa\" of \"bb\"\n"
410 | "Indien optie is aangevinkt -> resultaat is \"/aa/bb/cc\"\n"
411 | "Indien optie is uitgevinkt -> resultaat is GEEN \"/aa/bb/cc\""
412 |
413 | #: plugin_indexer_gui.form:147
414 | msgid "Match Full Pathname"
415 | msgstr "Volledige padnaam moet overeenkomen"
416 |
417 | #: plugin_indexer_gui.form:152
418 | msgid ""
419 | "Show hidden files or not in search list.\n"
420 | "Hidden files are still shown if search begins with \".\""
421 | msgstr ""
422 | "Verborgen bestanden weergeven of verbergen in resultatenlijst.\n"
423 | "Verborgen bestanden worden nog steeds weergegeven als de zoekopdracht "
424 | "begint met \".\""
425 |
426 | #: plugin_indexer_gui.form:154
427 | msgid "Match hidden files"
428 | msgstr "Verborgen bestanden opnemen"
429 |
430 | #: plugin_indexer_gui.form:169
431 | msgid "Update index every:"
432 | msgstr "Index bijwerken, elke:"
433 |
434 | #: plugin_indexer_gui.form:175
435 | msgid "00:30"
436 | msgstr "00:30"
437 |
438 | #: plugin_indexer_gui.form:185
439 | msgid "Index Now"
440 | msgstr "Nu indexeren"
441 |
--------------------------------------------------------------------------------
/.src/plugins/plugin_090_indexer.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | Create Static
4 | Static Public Description As String = ("Index filenames from user-defined folders.")
5 | Static Public Friendly_name As String = ("Indexer")
6 | Static Public configurable As Boolean = True
7 | Static Public Default_enabled As Boolean = True
8 | Static Public default_blocking As Boolean = False 'Should the subsequent plugins be blocked when
9 | 'this plugin finds some results?
10 |
11 | Public id As Float
12 |
13 | Public Struct rItemT
14 | plugin As String 'the plugin name
15 | Text As String 'text displayed in the clipboard
16 | SubText As String 'text displayed under the main text
17 | Image_file As String 'optional image displayed (fullpath or "DefferredMimeIcon")
18 | Clipboard_data As String 'the data copied to the clipboard
19 | Action As String 'string that indicates an action
20 | Action_p As Variant 'the parameter for Action
21 | End Struct
22 |
23 | Private plugin As String
24 | Private iconsize As Integer
25 | Private minchar As Integer = 4 'exit if the search term is lower than that
26 |
27 | Public index_db As New String[]
28 | Private index_file As String
29 |
30 | Private caller As Object
31 |
32 | Private wait_time As Float = 0.0005
33 | Private ratio_wait_time As Integer = 10000
34 |
35 | Public Sub _new(p_plugin As String, p_iconsize As Integer)
36 | id = Rnd(0, 1)
37 | caller = Last
38 | index_file = fmain.Confpath & "/indexer.txt"
39 |
40 | plugin = p_plugin
41 | iconsize = p_iconsize
42 | Try index_db = Split(File.Load(index_file), "\n")
43 | plugin_indexer_gui.init(Me)
44 | plugin_indexer_gui.LoadSettings()
45 | restart_timer()
46 | End
47 |
48 |
49 | Public Sub Stop()
50 |
51 | 'not sure if this is the right way, but this should be called when the plugin has to be unloaded
52 | reindex_timer.stop
53 |
54 | End
55 |
56 | Public Sub _free()
57 |
58 | End
59 |
60 | Private Sub trigged(query As String) As Boolean
61 | If Len(query) < minchar Then Return False
62 | If Left(query) = "=" Then Return
63 | If Right(query) = "=" Then Return
64 | 'some more controls here (?)
65 | Return True
66 | End
67 |
68 |
69 |
70 | Public Sub find(textcontrol As Object) As RItemT[]
71 | 'search for filedialogs bookmarks
72 | Dim rResults As New RItemT[]
73 | Dim rResult As RItemT
74 | Dim current_search As String = Lower(textcontrol.text)
75 | Dim aline As String
76 | Dim i As Integer
77 | Dim results_pushed As Integer
78 | Dim got_items As New String[]
79 | Dim fd, fn As String
80 | Dim matched As Boolean = False
81 | Dim file_name As String
82 | Dim match_fullpath As Boolean = (plugin_indexer_gui.CheckboxMatchFullPath.value = CheckBox.true)
83 | Dim match_hidden As Boolean = (plugin_indexer_gui.CheckBoxMatchHidden.value = CheckBox.true)
84 | If Not trigged(textcontrol.text) Then Return
85 |
86 | 'directories whose name = query
87 | For i = 0 To index_db.Max
88 | aline = Lower(index_db[i])
89 | If aline Ends "/" Then 'isdir
90 | fd = File.Name(File.Dir(aline))
91 | If fd = current_search Then
92 | rResult = create_item(index_db[i])
93 | If rResult <> Null Then
94 | got_items.Add(i)
95 | rResults.Add(rResult)
96 | Raise new_results(rResults)
97 | rResults.clear
98 | Endif
99 | Endif
100 | Endif
101 | If (i Mod ratio_wait_time) = 0 Then
102 | Wait wait_time 'take a breath
103 | If current_search <> Lower(textcontrol.text) Then
104 | Debug "Cancelled previous search " & current_search
105 | Return
106 | Endif
107 | Endif
108 | Next
109 |
110 |
111 | 'files whose name = query
112 | For i = 0 To index_db.Max
113 | If got_items.Find(i) < 0 'this avoids searching for already displayed items
114 | aline = Lower(index_db[i])
115 | If Not (aline Ends "/") Then 'is not dir
116 | fn = File.Name(aline)
117 | If fn = current_search Then
118 | rResult = create_item(index_db[i])
119 | If rResult <> Null Then
120 | got_items.Add(i)
121 | rResults.Add(rResult)
122 | Raise new_results(rResults)
123 | rResults.clear
124 | Endif
125 | Endif
126 | Endif
127 | Endif
128 | If (i Mod ratio_wait_time) = 0 Then
129 | Wait wait_time 'take a breath
130 | If current_search <> Lower(textcontrol.text) Then
131 | Debug "Cancelled previous search " & current_search
132 | Return
133 | Endif
134 | Endif
135 | Next
136 |
137 |
138 | 'directories whose name begins with query
139 | For i = 0 To index_db.Max
140 | If got_items.Find(i) < 0 'this avoids searching for already displayed items
141 | aline = Lower(index_db[i])
142 | If aline Ends "/" Then 'isdir
143 | fd = File.Name(File.Dir(aline))
144 | If fd Begins current_search Then
145 | rResult = create_item(index_db[i])
146 | If rResult <> Null Then
147 | got_items.Add(i)
148 | rResults.Add(rResult)
149 | Raise new_results(rResults)
150 | rResults.clear
151 | Endif
152 | Endif
153 | Endif
154 | Endif
155 | If (i Mod ratio_wait_time) = 0 Then
156 | Wait wait_time 'take a breath
157 | If current_search <> Lower(textcontrol.text) Then
158 | Debug "Cancelled previous search " & current_search
159 | Return
160 | Endif
161 | Endif
162 | Next
163 |
164 |
165 | 'files whose name begins with query
166 | For i = 0 To index_db.Max
167 | If got_items.Find(i) < 0 'this avoids searching for already displayed items
168 | aline = Lower(index_db[i])
169 | If Not (aline Ends "/") Then 'is not dir
170 | fn = File.Name(aline)
171 | If fn Begins current_search Then
172 | rResult = create_item(index_db[i])
173 | If rResult <> Null Then
174 | got_items.Add(i)
175 | rResults.Add(rResult)
176 | Raise new_results(rResults)
177 | rResults.clear
178 | Endif
179 | Endif
180 | Endif
181 | Endif
182 | If (i Mod ratio_wait_time) = 0 Then
183 | Wait wait_time 'take a breath
184 | If current_search <> Lower(textcontrol.text) Then
185 | Debug "Cancelled previous search " & current_search
186 | Return
187 | Endif
188 | Endif
189 | Next
190 |
191 | 'all of the others
192 | For i = 0 To index_db.max
193 | matched = False
194 | If got_items.Find(i) < 0 'this avoids searching for already displayed items
195 | If match_fullpath Then
196 | file_name = index_db[i]
197 | Else
198 | file_name = File.name(index_db[i])
199 | Endif
200 | If file_name Begins "." Then
201 | If Not match_hidden Then Continue
202 | Endif
203 | If InStr(Lower(file_name), Lower(current_search)) Then matched = True
204 | If (Not matched) Then Try matched = (file_name Like "*" & current_search & "*")
205 | If matched Then
206 | rResult = create_item(index_db[i])
207 | If rResult <> Null Then
208 | rResults.Add(rResult)
209 | Raise new_results(rResults)
210 | results_pushed += rResults.Count
211 | If results_pushed >= plugin_indexer_gui.SpinMaxResults.value Then Return
212 | rResults.clear
213 | Endif
214 | If current_search <> Lower(textcontrol.text) Then
215 | Debug "Cancelled previous search " & current_search
216 | Return
217 | Endif
218 | Endif
219 | Endif
220 | If (i Mod (ratio_wait_time Div 100)) = 0 Then
221 | 'Debug "take a break" & Timer()
222 | Wait wait_time 'take a breath
223 | If current_search <> Lower(textcontrol.text) Then
224 | Debug "Cancelled previous search " & current_search
225 | Return
226 | Endif
227 | Endif
228 | Next
229 |
230 | If current_search <> Lower(textcontrol.text) Then Return
231 |
232 | Return rResults
233 | End
234 |
235 | Event new_results(rResults As RItemT[])
236 |
237 |
238 | Private Function create_item(path As String) As RItemT
239 | Dim return_item As RItemT
240 |
241 | If Not (Exist(path, True)) Then Return Null
242 | return_item = New RItemT
243 |
244 | If path Ends ".desktop" Then
245 | MyDesktop.init()
246 | MyDesktop.parse(path)
247 | return_item.image_file = "resize://" & MyDesktop.Get_file_Icon(MyDesktop.dIconName, iconsize)
248 | Else
249 | If Stat(path, True).type = gb.Directory Then
250 | return_item.image_file = "icon:/" & iconsize & "/directory"
251 | Else
252 | return_item.image_file = "mimetype://" & path
253 | Endif
254 | Endif
255 |
256 | return_item.plugin = plugin
257 | return_item.Action = "GUESS"
258 | return_item.Action_p = path
259 | return_item.Clipboard_data = path
260 |
261 | If path Ends "/" Then path = Left(path, -1)
262 | return_item.Text = File.Name(path)
263 | return_item.SubText = "In: " & File.Dir(path)
264 |
265 | Return return_item
266 |
267 | End
268 |
269 |
270 |
271 |
272 | Public reindex_timer As Timer
273 | Private reindex_minutes_timeout As Integer
274 |
275 | Public Sub restart_timer()
276 | Dim minutes_integer As Integer
277 | Dim minutes_timeout As Date = plugin_indexer_gui.ValueBoxReindex.value
278 | Dim gui As Object = plugin_indexer_gui
279 |
280 | minutes_integer = (Hour(minutes_timeout) * 60) + Minute(minutes_timeout)
281 | If gui.last_index_time = Null Then
282 | gui.last_index_time = Date(1900, 1, 1)
283 | Endif
284 |
285 | reindex_timer = New Timer As "reindex_timer"
286 | reindex_timer.delay = 60000
287 | reindex_minutes_timeout = minutes_integer
288 | reindex_timer.start
289 | reindex_timer.Trigger()
290 | End
291 |
292 |
293 |
294 | Public Sub reindex_timer_Timer()
295 | Dim time_diff As Integer
296 | time_diff = DateDiff(plugin_indexer_gui.last_index_time, Now(), gb.Minute)
297 | Debug reindex_minutes_timeout - time_diff, "minutes to go"
298 | If time_diff >= reindex_minutes_timeout Then
299 | reindex_timer.stop
300 | ReIndex()
301 | Endif
302 |
303 | End
304 |
305 |
306 | Public indexing As Boolean = False
307 | Private indexprocess As Process
308 | Public Sub ReIndex()
309 | Dim r As Integer
310 | Dim depth, dir As String
311 | Dim cmdline As String
312 | Dim agrid As Tableview = plugin_indexer_gui.GridIndex
313 | Dim sPath As String
314 | If indexing Then Return
315 | reindex_timer.stop
316 | Try indexprocess.kill
317 | For r = 0 To aGrid.Rows.max
318 | sPath = aGrid[r, 1].text
319 | If Not (sPath Ends "/") Then sPath &= "/"
320 | depth = aGrid[r, 0].text
321 | 'dir = "'" & sPath & "'"
322 | dir = Replace(sPath, " ", "\\ ")
323 | cmdline &= "; nice -n 19 ionice -c3 schedtool -B -e find -L " & dir & " -maxdepth " & depth & " \\( -xtype d -printf \"%p/\\n\" , -not -xtype d -print \\)"
324 | Next
325 | Try Kill index_file
326 | If cmdline Begins ";" Then cmdline = Right(cmdline, -1)
327 | cmdline = "sh -c " & "'" & cmdline & "'"
328 | cmdline &= "| sort -u > " & index_file
329 | Debug "Indexing..."
330 | Debug cmdline
331 | indexprocess = Shell cmdline As "indexprocess"
332 | indexing = True
333 | End
334 |
335 | Public Sub indexprocess_kill()
336 | Debug "find process has ended, building index db."
337 | Try index_db = Split(File.Load(index_file), "\n")
338 | Debug "Finished indexing"
339 | indexing = False
340 |
341 | plugin_indexer_gui.last_index_time = Now()
342 | plugin_indexer_gui.SaveSettings()
343 | reindex_timer.start
344 | plugin_indexer_gui.UpdateLabelIndexSize
345 | End
346 |
347 |
348 | Public Sub configure()
349 | 'this starts the configuration window.
350 | plugin_indexer_gui.Show()
351 | End
352 |
353 |
354 |
--------------------------------------------------------------------------------
/.settings:
--------------------------------------------------------------------------------
1 | [Bookmarks]
2 | FMain=[438,1378]
3 | plugin_indexer=[38]
4 |
5 | [Debug]
6 | Arguments=[["-c"]]
7 | Environment=["LANGUAGE=it_IT"]
8 | Breakpoints={}
9 | DebugInside=False
10 |
11 | [DebugWindow]
12 | Count=0
13 |
14 | [DebugWindow/$aApps]
15 | Geometry=[1176,178,726,870]
16 |
17 | [DebugWindow/$aDataDir]
18 | Geometry=[52,0,234,343]
19 |
20 | [DebugWindow/$aDataDir.Insert(Split(Env["XDG_DATA_DIRS"], ":", "", True))]
21 | Geometry=[47,-3,224,280]
22 |
23 | [DebugWindow/$cApps]
24 | Geometry=[1003,517,597,308]
25 |
26 | [DebugWindow/$cAppsPath]
27 | Geometry=[1056,491,224,280]
28 |
29 | [DebugWindow/CHILD]
30 | Geometry=[1280,-3,226,280]
31 |
32 | [DebugWindow/Classes]
33 | Geometry=[45,-3,224,280]
34 |
35 | [DebugWindow/Desktop.Windows]
36 | Geometry=[155,339,583,709]
37 |
38 | [DebugWindow/Desktop.Windows[0]]
39 | Geometry=[66,14,224,280]
40 |
41 | [DebugWindow/Desktop.Windows[10]]
42 | Geometry=[819,235,583,709]
43 |
44 | [DebugWindow/Desktop.Windows[11]]
45 | Geometry=[218,227,569,709]
46 |
47 | [DebugWindow/Desktop.Windows[16]]
48 | Geometry=[888,158,583,709]
49 |
50 | [DebugWindow/Desktop.Windows[1]]
51 | Geometry=[868,145,583,709]
52 |
53 | [DebugWindow/DesktopApps]
54 | Geometry=[1280,0,542,627]
55 |
56 | [DebugWindow/DesktopApps.ProcWarm]
57 | Geometry=[1031,409,542,627]
58 |
59 | [DebugWindow/DesktopApps.ProcWarm.Lines]
60 | Geometry=[1308,28,268,445]
61 |
62 | [DebugWindow/DesktopApps[app]]
63 | Geometry=[1297,307,224,458]
64 |
65 | [DebugWindow/DesktopIcon]
66 | Geometry=[1280,0,224,549]
67 |
68 | [DebugWindow/DesktopMime]
69 | Geometry=[1280,0,224,280]
70 |
71 | [DebugWindow/Dir("backgrounds|*.png")]
72 | Geometry=[47,0,224,280]
73 |
74 | [DebugWindow/Dir(kde_path, "*.desktop")]
75 | Geometry=[45,-3,224,280]
76 |
77 | [DebugWindow/Dir(kde_path, "*.desktop").Sort()]
78 | Geometry=[47,-3,273,380]
79 |
80 | [DebugWindow/Dir(s_path).Sort()]
81 | Geometry=[47,-3,224,280]
82 |
83 | [DebugWindow/DrawingArea(TextBox1.Children[0]).Children]
84 | Geometry=[1322,39,224,280]
85 |
86 | [DebugWindow/DrawingArea(TextBox1.Children[0]).Children[0]]
87 | Geometry=[1336,53,224,280]
88 |
89 | [DebugWindow/FMain]
90 | Geometry=[45,638,224,929]
91 |
92 | [DebugWindow/FileView1]
93 | Geometry=[47,0,224,280]
94 |
95 | [DebugWindow/FileView1.Children]
96 | Geometry=[61,14,224,280]
97 |
98 | [DebugWindow/FileView1.Children[0]]
99 | Geometry=[425,184,224,280]
100 |
101 | [DebugWindow/Global]
102 | Geometry=[122,314,224,280]
103 |
104 | [DebugWindow/GridIndex.Rows[GridIndex.row + 1]]
105 | Geometry=[61,307,224,280]
106 |
107 | [DebugWindow/GridIndex.Rows[GridIndex.row]]
108 | Geometry=[45,-3,224,280]
109 |
110 | [DebugWindow/Image.Load("ShapeNull.png").Resize(fmain.w, fmain.h).picture]
111 | Geometry=[52,0,224,280]
112 |
113 | [DebugWindow/Image.Load("ShapeNull.png").Resize(fmain.w, fmain.h).picture.Image]
114 | Geometry=[66,14,224,280]
115 |
116 | [DebugWindow/Label]
117 | Geometry=[45,-3,224,280]
118 |
119 | [DebugWindow/Me]
120 | Geometry=[86,357,224,280]
121 |
122 | [DebugWindow/MyCSock]
123 | Geometry=[1280,0,224,280]
124 |
125 | [DebugWindow/MyDesktop]
126 | Geometry=[1280,0,314,537]
127 |
128 | [DebugWindow/MySettings]
129 | Geometry=[1280,0,224,280]
130 |
131 | [DebugWindow/O.children]
132 | Geometry=[1280,-3,224,280]
133 |
134 | [DebugWindow/Object]
135 | Geometry=[45,-3,224,280]
136 |
137 | [DebugWindow/Picture["appicon.png"]]
138 | Geometry=[52,0,224,280]
139 |
140 | [DebugWindow/Picture["icon:|" & rSize & "|directory"]]
141 | Geometry=[1280,0,224,280]
142 |
143 | [DebugWindow/Picture["icon:|" & rSize & "|file"]]
144 | Geometry=[1280,0,224,280]
145 |
146 | [DebugWindow/ProcWarm]
147 | Geometry=[47,-3,224,280]
148 |
149 | [DebugWindow/PropertyValue]
150 | Geometry=[75,676,226,280]
151 |
152 | [DebugWindow/RDir(tPath & "|" & icon_theme, "*|*|*")]
153 | Geometry=[87,312,224,280]
154 |
155 | [DebugWindow/RItemT]
156 | Geometry=[45,0,224,280]
157 |
158 | [DebugWindow/ResultGrid]
159 | Geometry=[45,-3,224,280]
160 |
161 | [DebugWindow/Settings]
162 | Geometry=[71,555,224,280]
163 |
164 | [DebugWindow/Settings.Keys]
165 | Geometry=[85,569,224,280]
166 |
167 | [DebugWindow/Socket]
168 | Geometry=[1280,0,224,280]
169 |
170 | [DebugWindow/Split(File.Load(FMain.xb_rcpath), "\n", "", True)]
171 | Geometry=[45,0,224,280]
172 |
173 | [DebugWindow/Split(File.Load(desktopfile), "\n")]
174 | Geometry=[52,234,224,732]
175 |
176 | [DebugWindow/Split(File.Load(index_file))]
177 | Geometry=[52,0,224,280]
178 |
179 | [DebugWindow/Split(File.Load(sAppPath), "\n")]
180 | Geometry=[1280,0,224,280]
181 |
182 | [DebugWindow/Split(File.load(path), "\n")]
183 | Geometry=[45,-3,224,280]
184 |
185 | [DebugWindow/Split(Settings["plugin_history|history", ""], Chr(8), "", True)]
186 | Geometry=[47,-3,669,280]
187 |
188 | [DebugWindow/Split(fPath, ";| &\n")]
189 | Geometry=[45,-3,224,280]
190 |
191 | [DebugWindow/Split(ls_out, "\n", "", True)]
192 | Geometry=[45,-3,224,280]
193 |
194 | [DebugWindow/Split(out, "\n", "", True)]
195 | Geometry=[45,-3,224,280]
196 |
197 | [DebugWindow/Split(path, "\n")]
198 | Geometry=[45,-3,224,280]
199 |
200 | [DebugWindow/Split(results, "\n", "", True)]
201 | Geometry=[146,254,224,280]
202 |
203 | [DebugWindow/Stat(oLine, True)]
204 | Geometry=[45,-3,224,280]
205 |
206 | [DebugWindow/Stat(rcResult.uri, True)]
207 | Geometry=[1280,0,224,280]
208 |
209 | [DebugWindow/Stat(s_path, True)]
210 | Geometry=[45,-3,224,280]
211 |
212 | [DebugWindow/Stock[CStr(Size) &| "program"].Image]
213 | Geometry=[1280,-3,345,363]
214 |
215 | [DebugWindow/TextBox1]
216 | Geometry=[1280,-3,224,280]
217 |
218 | [DebugWindow/TextBox1.Children]
219 | Geometry=[1294,11,224,280]
220 |
221 | [DebugWindow/TextBox1.Children[0]]
222 | Geometry=[1308,25,224,280]
223 |
224 | [DebugWindow/args]
225 | Geometry=[52,0,224,280]
226 |
227 | [DebugWindow/b_files]
228 | Geometry=[1920,0,224,280]
229 |
230 | [DebugWindow/bookmarks]
231 | Geometry=[48,0,224,530]
232 |
233 | [DebugWindow/caller]
234 | Geometry=[38,712,610,423]
235 |
236 | [DebugWindow/child]
237 | Geometry=[0,612,242,448]
238 |
239 | [DebugWindow/class.load("plugin_template")]
240 | Geometry=[45,0,224,280]
241 |
242 | [DebugWindow/current_item]
243 | Geometry=[76,447,618,280]
244 |
245 | [DebugWindow/d]
246 | Geometry=[45,0,291,403]
247 |
248 | [DebugWindow/desktop_picture]
249 | Geometry=[47,0,224,280]
250 |
251 | [DebugWindow/eraseimg]
252 | Geometry=[47,0,224,280]
253 |
254 | [DebugWindow/ext]
255 | Geometry=[45,0,224,465]
256 |
257 | [DebugWindow/field_codes]
258 | Geometry=[52,0,224,280]
259 |
260 | [DebugWindow/fmain]
261 | Geometry=[1280,0,224,542]
262 |
263 | [DebugWindow/fmain.Picture.Image.Stretch(fmain.w, fmain.h)]
264 | Geometry=[47,0,224,280]
265 |
266 | [DebugWindow/global]
267 | Geometry=[47,0,224,280]
268 |
269 | [DebugWindow/good_matches]
270 | Geometry=[47,-3,224,280]
271 |
272 | [DebugWindow/gr]
273 | Geometry=[500,86,224,280]
274 |
275 | [DebugWindow/hDApps]
276 | Geometry=[348,734,224,280]
277 |
278 | [DebugWindow/hDApps.PropertyValue]
279 | Geometry=[78,644,224,280]
280 |
281 | [DebugWindow/hDApps.property]
282 | Geometry=[45,-3,224,280]
283 |
284 | [DebugWindow/hImage]
285 | Geometry=[1280,307,224,280]
286 |
287 | [DebugWindow/happ]
288 | Geometry=[1251,336,587,578]
289 |
290 | [DebugWindow/happ.PropertyValue]
291 | Geometry=[416,110,994,800]
292 |
293 | [DebugWindow/happ.property]
294 | Geometry=[1294,11,361,555]
295 |
296 | [DebugWindow/happs]
297 | Geometry=[406,712,224,280]
298 |
299 | [DebugWindow/happs[0]]
300 | Geometry=[627,311,471,400]
301 |
302 | [DebugWindow/hotkeys]
303 | Geometry=[45,-3,224,280]
304 |
305 | [DebugWindow/hsettings.frame1]
306 | Geometry=[941,119,224,767]
307 |
308 | [DebugWindow/hsettings.frame1.Children]
309 | Geometry=[1294,11,224,280]
310 |
311 | [DebugWindow/i]
312 | Geometry=[86,449,224,281]
313 |
314 | [DebugWindow/i.Picture]
315 | Geometry=[59,14,224,280]
316 |
317 | [DebugWindow/iconfiles]
318 | Geometry=[1727,165,408,649]
319 |
320 | [DebugWindow/iconfiles_scores]
321 | Geometry=[47,-3,224,280]
322 |
323 | [DebugWindow/img]
324 | Geometry=[45,-3,224,280]
325 |
326 | [DebugWindow/img.picture]
327 | Geometry=[45,299,224,280]
328 |
329 | [DebugWindow/index_db]
330 | Geometry=[52,69,1025,923]
331 |
332 | [DebugWindow/indexer_out]
333 | Geometry=[-240,589,689,449]
334 |
335 | [DebugWindow/indexprocess]
336 | Geometry=[45,-3,224,280]
337 |
338 | [DebugWindow/item]
339 | Geometry=[45,-3,224,280]
340 |
341 | [DebugWindow/items]
342 | Geometry=[45,-3,224,280]
343 |
344 | [DebugWindow/lastdata]
345 | Geometry=[52,0,224,280]
346 |
347 | [DebugWindow/locatep]
348 | Geometry=[1280,0,254,449]
349 |
350 | [DebugWindow/locatep.Lines]
351 | Geometry=[1294,11,254,449]
352 |
353 | [DebugWindow/matches]
354 | Geometry=[-298,636,516,699]
355 |
356 | [DebugWindow/my_bookmarks]
357 | Geometry=[889,153,224,280]
358 |
359 | [DebugWindow/my_plugin]
360 | Geometry=[45,-3,224,280]
361 |
362 | [DebugWindow/my_plugin.Symbols]
363 | Geometry=[59,11,224,280]
364 |
365 | [DebugWindow/my_screen]
366 | Geometry=[47,0,224,280]
367 |
368 | [DebugWindow/mydesktop]
369 | Geometry=[52,0,224,280]
370 |
371 | [DebugWindow/new_happ]
372 | Geometry=[32,670,224,280]
373 |
374 | [DebugWindow/o]
375 | Geometry=[931,542,224,280]
376 |
377 | [DebugWindow/obj]
378 | Geometry=[1280,0,224,280]
379 |
380 | [DebugWindow/out_img]
381 | Geometry=[47,0,224,280]
382 |
383 | [DebugWindow/parent.children]
384 | Geometry=[-2,-1,224,280]
385 |
386 | [DebugWindow/pic]
387 | Geometry=[1280,614,224,280]
388 |
389 | [DebugWindow/pic.image]
390 | Geometry=[1280,-3,224,280]
391 |
392 | [DebugWindow/picture_list]
393 | Geometry=[45,-3,224,280]
394 |
395 | [DebugWindow/plugin_indexer_gui]
396 | Geometry=[45,-3,224,280]
397 |
398 | [DebugWindow/plugins]
399 | Geometry=[45,0,224,280]
400 |
401 | [DebugWindow/plugins[plugin_name]]
402 | Geometry=[45,-3,224,280]
403 |
404 | [DebugWindow/plugins_all]
405 | Geometry=[55,470,224,280]
406 |
407 | [DebugWindow/plugins_available]
408 | Geometry=[45,-3,224,280]
409 |
410 | [DebugWindow/plugins_enabled]
411 | Geometry=[47,0,224,280]
412 |
413 | [DebugWindow/preserve]
414 | Geometry=[0,306,224,280]
415 |
416 | [DebugWindow/rResult]
417 | Geometry=[1054,371,737,260]
418 |
419 | [DebugWindow/rResults]
420 | Geometry=[1052,112,535,654]
421 |
422 | [DebugWindow/rResults.Last]
423 | Geometry=[870,596,851,352]
424 |
425 | [DebugWindow/rResults[0]]
426 | Geometry=[1066,126,535,654]
427 |
428 | [DebugWindow/rResults[1]]
429 | Geometry=[459,233,535,280]
430 |
431 | [DebugWindow/rResults[27]]
432 | Geometry=[1066,126,535,654]
433 |
434 | [DebugWindow/rResults[2]]
435 | Geometry=[1350,768,535,280]
436 |
437 | [DebugWindow/rResults[3]]
438 | Geometry=[1066,126,535,654]
439 |
440 | [DebugWindow/rResults[8]]
441 | Geometry=[1066,126,535,654]
442 |
443 | [DebugWindow/rcResult]
444 | Geometry=[141,168,464,335]
445 |
446 | [DebugWindow/reindex_timer]
447 | Geometry=[45,-3,224,280]
448 |
449 | [DebugWindow/result]
450 | Geometry=[1280,0,224,280]
451 |
452 | [DebugWindow/resultgrid]
453 | Geometry=[52,0,224,280]
454 |
455 | [DebugWindow/resultgrid.Data.Picture]
456 | Geometry=[45,0,224,280]
457 |
458 | [DebugWindow/resultgrid.Rows]
459 | Geometry=[66,14,224,280]
460 |
461 | [DebugWindow/resultgrid.children[0]]
462 | Geometry=[47,0,224,280]
463 |
464 | [DebugWindow/resultgrid[ResultGrid.Rows.max, 0]]
465 | Geometry=[1280,-3,224,280]
466 |
467 | [DebugWindow/results_list]
468 | Geometry=[89,513,643,535]
469 |
470 | [DebugWindow/results_list[0]]
471 | Geometry=[651,293,643,535]
472 |
473 | [DebugWindow/results_list[1022]]
474 | Geometry=[637,293,643,535]
475 |
476 | [DebugWindow/results_list[1]]
477 | Geometry=[651,293,643,535]
478 |
479 | [DebugWindow/results_list[ResultGrid.row]]
480 | Geometry=[1280,0,224,280]
481 |
482 | [DebugWindow/results_list[i]]
483 | Geometry=[45,-3,224,280]
484 |
485 | [DebugWindow/results_list[resultgrid.row]]
486 | Geometry=[122,226,705,394]
487 |
488 | [DebugWindow/return_item]
489 | Geometry=[45,0,224,280]
490 |
491 | [DebugWindow/right_geom]
492 | Geometry=[52,0,224,280]
493 |
494 | [DebugWindow/ritem]
495 | Geometry=[45,0,224,280]
496 |
497 | [DebugWindow/ritems]
498 | Geometry=[47,-3,224,280]
499 |
500 | [DebugWindow/ritems[0]]
501 | Geometry=[61,11,436,280]
502 |
503 | [DebugWindow/sLines]
504 | Geometry=[1280,307,224,280]
505 |
506 | [DebugWindow/scores]
507 | Geometry=[47,-3,229,280]
508 |
509 | [DebugWindow/selectable]
510 | Geometry=[1280,0,224,280]
511 |
512 | [DebugWindow/shadowimage]
513 | Geometry=[52,0,224,280]
514 |
515 | [DebugWindow/sizes]
516 | Geometry=[47,-3,224,280]
517 |
518 | [DebugWindow/sorted_db]
519 | Geometry=[1671,159,540,654]
520 |
521 | [DebugWindow/textbox1]
522 | Geometry=[45,-3,224,280]
523 |
524 | [DebugWindow/textcontrol]
525 | Geometry=[52,0,224,280]
526 |
527 | [DebugWindow/tmp]
528 | Geometry=[1280,-3,224,280]
529 |
530 | [DebugWindow/topimage]
531 | Geometry=[47,0,224,280]
532 |
533 | [DebugWindow/topimage.stretch(fw - (Sradius * 2), fh - (Sradius * 2))]
534 | Geometry=[47,0,224,280]
535 |
536 | [DebugWindow/tree]
537 | Geometry=[1534,194,422,815]
538 |
539 | [DebugWindow/update_apps_timer]
540 | Geometry=[45,-3,224,280]
541 |
542 | [DebugWindow/w]
543 | Geometry=[1920,0,338,524]
544 |
545 | [DebugWindow/xb]
546 | Geometry=[1280,-3,224,280]
547 |
548 | [Executable]
549 | Path="higgins.gambas"
550 | DoNotIncrementVersion=False
551 | NoTestModule=False
552 |
553 | [OpenFile]
554 | File[1]=".src/plugins/plugin_010_calculator.class:0.128"
555 | Active=9
556 | File[2]=".src/FMain.class:36.239"
557 | Count=14
558 | File[3]=".src/plugins/plugin_apps_gui.form"
559 | File[4]=".src/plugins/bridge.class:2.101"
560 | File[5]=".src/plugins/plugin_040_fbookmarks.class:43.104"
561 | File[6]=".src/FMain.form"
562 | File[7]=".src/DesktopApps.class:0.0"
563 | File[8]=".src/plugins/plugin_020_apps.class:23.87"
564 | File[9]=".src/plugins/plugin_050_ls.class:17.70"
565 | File[10]=".src/plugins/plugin_009_history.class:0.61"
566 | File[11]=".src/plugins/plugin_015_recent.class:35.78"
567 | File[12]=".src/plugins/plugin_030_executable.class:17.70"
568 | File[13]=".src/plugins/plugin_090_indexer.class:17.231"
569 | File[14]=".src/plugins/plugin_100_windows.class:0.112"
570 |
571 | [Watches]
572 | Count=0
573 |
574 |
--------------------------------------------------------------------------------
/.src/DesktopApps.class:
--------------------------------------------------------------------------------
1 | ' Gambas class file
2 |
3 | ' Innova Project - Launcher of APP
4 | '
5 | ' Copyright (C) Herberth Guzmán
6 | '
7 | ' This program is free software; you can redistribute it and/or modify
8 | ' it under the terms of the GNU General Public License as published by
9 | ' the Free Software Foundation; either version 2 of the License, or
10 | ' (at your option) any later version.
11 | '
12 | ' This program is distributed in the hope that it will be useful,
13 | ' but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | ' GNU General Public License for more details.
16 | '
17 | ' You should have received a copy of the GNU General Public License
18 | ' along with this program; if not, write to the Free Software
19 | ' Foundation, Inc., 51 Franklin St, Fifth Floor,
20 | ' Boston, MA 02110-1301 USA
21 |
22 | ' Homepage: http://http://sourceforge.net/projects/innovadesktop
23 | ' This code belongs to Fabien Bodard and was adapted for Innova Project
24 |
25 | Export
26 |
27 | Property Read IconName As String
28 | Property Read Exec_R As String
29 |
30 | Property Read XKDEServiceTypes As String
31 | 'Property Read XKDELibrary As String
32 |
33 | Property Read NoDisplay As Boolean
34 | Property Read DisplayOnlyIn As Boolean
35 |
36 | Property Read NotShowIn As String
37 |
38 | Property Read file_path As String
39 |
40 | Public _$IconName As String
41 | Public _$Path As String
42 | Public _$Exec As String
43 | Public _$NoDisplay As Boolean
44 | Public _$DisplayOnlyIn As String
45 | Public _$NotShowIn As String
46 | Public _$XKDEServiceTypes As String
47 | 'Public _$XKDELibrary As String
48 |
49 |
50 | Public Language As String = ((Left(System.Language, 2)))
51 |
52 | Public PropertyValue As New Collection
53 |
54 | Private $hImage As Image
55 | Static Private $aDataDir As String[]
56 | Static Private $cApps As New Collection
57 | Static Private $aApps As String[]
58 | Static Private $cAppsPath As New Collection
59 | Static Private anotherdirs As String[]
60 |
61 |
62 | Static Private sLanguage As String[] = Split(System.Language, "_", "", True, False)
63 |
64 | Static Public Sub MakeAppList()
65 | Dim path As String
66 | Dim sPath As String
67 |
68 | $aApps = New String[]
69 |
70 | For Each sPath In GetDataDir()
71 | If Not Exist(sPath &/ "applications", True) Then Continue
72 | AddFile(sPath &/ "applications")
73 | Next
74 |
75 | For Each path In anotherdirs
76 | AddFile(path, False)
77 | Next
78 |
79 | 'AddFile("/usr/share/kde4/services/")
80 | $aApps.Sort(gb.Natural)
81 |
82 | End
83 |
84 |
85 | Static Public ProcWarm As Process
86 |
87 | Static Public Sub WarmCache()
88 | 'load desktop files in the kernel pagecache in background, then load them into higgins
89 | Dim sPath As String
90 | Dim WarmList As String = " "
91 | Dim warmcmd As String = ""
92 |
93 | For Each sPath In GetDataDir()
94 | Debug "Warming recursive: " & (sPath &/ "applications")
95 | WarmList &= sPath &/ "applications" & " "
96 | Next
97 |
98 |
99 | For Each sPath In anotherdirs
100 | Debug "Warming norecursive " & sPath
101 | WarmList &= sPath & " "
102 | Next
103 |
104 | warmcmd = "nice -n 19 ionice -c3 find " & WarmList & " -iname \"*.desktop\" -type f -exec cat {} \\; > /dev/null ; "
105 | warmcmd &= "nice -n 19 ionice -c3 find " & WarmList & " -maxdepth 1 -iname \"*.desktop\" -type f -exec cat {} \\; > /dev/null ; "
106 |
107 | ProcWarm = Shell warmcmd For Read As "ProcWarm"
108 |
109 | End
110 |
111 | Static Public Sub ProcWarm_kill()
112 | If IsNull($aApps) Then
113 | MakeAppList()
114 | Endif
115 | End
116 |
117 |
118 |
119 |
120 |
121 | Static Private Sub AddFile(sPath As String, Optional recursive As Boolean = True)
122 |
123 | Dim s As String
124 | Dim IsDesktopFileOut As Boolean = False
125 | If Not Exist(sPath, True) Then Return
126 | For Each s In Dir(sPath)
127 | If IsDir(sPath &/ s) Then
128 | If Not recursive Then Continue
129 | AddFile(sPath &/ s)
130 | Else
131 |
132 | If s Ends ".desktop" Then
133 | s = File.BaseName(s)
134 | If Not $aApps.Exist(s) Then
135 | $aApps.Add(s)
136 | $cAppsPath[s] = sPath &/ s & ".desktop"
137 | '$cAppsPath[s] = sPath &/ s
138 | Endif
139 | Else
140 | If (Settings["plugin_apps/desktop_from_extension"] <> CheckBox.true) Then
141 |
142 | IsDesktopFileOut = Global.isDesktopFile(sPath &/ s)
143 | If IsDesktopFileOut Then
144 | If Not $aApps.Exist(s) Then
145 | $aApps.Add(s)
146 | $cAppsPath[s] = sPath &/ s
147 | Endif
148 | Endif
149 | Endif
150 | Endif
151 | Endif
152 | Next
153 |
154 | End
155 |
156 |
157 |
158 | Public Function GetAppName(sApp As String, Language As String) As String
159 |
160 | Dim hApp As DesktopApps = DesktopApps[sApp]
161 |
162 | If hApp.GetGenericName(Language) Then
163 | Return hApp.GetGenericName(Language)
164 | Else
165 | If hApp.GetName(Language) Then
166 | Return hApp.GetName(Language)
167 | Else
168 | If hApp.GenericName Then
169 | Return hApp.GenericName
170 | Endif
171 | Endif
172 | Endif
173 |
174 | Return hApp.Name
175 |
176 | End
177 |
178 | Public Function GetAppComment(sApp As String, Language As String) As String
179 |
180 | Dim hApp As DesktopApps = DesktopApps[sApp]
181 |
182 | If hApp.GetComment(Language) Then
183 | Return hApp.GetComment(Language)
184 | Else
185 | If hApp.GetComment(Language) Then
186 | Return hApp.GetComment(Language)
187 | Else
188 | If hApp.Comment Then
189 | Return hApp.Comment
190 | Endif
191 | Endif
192 | Endif
193 |
194 | Return hApp.Name
195 |
196 | End
197 |
198 | Static Public stop_get As Boolean = False
199 | Static Public getting As Boolean = False
200 |
201 |
202 | Static Public Function _get(AppName As String) As DesktopApps
203 |
204 | Dim sLine As String
205 | Dim sAppPath As String
206 | Dim hDApps As DesktopApps
207 |
208 | Dim sLines As New String[]
209 | Dim i As Integer
210 |
211 | Dim f, v As String
212 |
213 | If IsNull($aApps) Then MakeAppList
214 | If $cApps.Exist(AppName) Then Return $cApps[AppName]
215 | 'For Each sPath In GetDataDir()
216 | sAppPath = $cAppsPath[AppName]
217 | If Exist(sAppPath, True) Then
218 | hDApps = New DesktopApps
219 | hDApps._$Path = sAppPath
220 |
221 | 'find section "desktop entry"
222 | sLines = Split(File.Load(sAppPath), "\n")
223 | For i = 0 To sLines.max
224 | 'hack to allow responsiviness
225 | getting = True
226 | Wait
227 | If stop_get Then
228 | stop_get = False
229 | getting = False
230 | Return
231 | Endif
232 |
233 | sLine = sLines[i]
234 | If LCase(sLine) = "[desktop entry]" Then
235 | sLines.Extract(0, i + 1)
236 | Break
237 | Endif
238 | Next
239 |
240 | For Each sLine In sLines
241 | If sLine Begins "[" Then Break
242 | sLine = Trim(sLine)
243 | If sLine Begins "Exec" Then hDApps._$Exec = Right(sLine, -InStr(sLine, "="))
244 | If sLine Begins "Icon" Then hDApps._$IconName = Right(sLine, -InStr(sLine, "="))
245 | If sLine Begins "NoDisplay" Then hDApps._$NoDisplay = CBool(Right(sLine, -InStr(sLine, "=")))
246 | If sLine Begins "DisplayOnlyIn" Then hDApps._$DisplayOnlyIn = Right(sLine, -InStr(sLine, "="))
247 | If sLine Begins "NotShowIn" Then hDApps._$NotShowIn = Right(sLine, -InStr(sLine, "="))
248 | If sLine Begins "X-KDE-ServiceTypes" Then hDApps._$XKDEServiceTypes = Right(sLine, -InStr(sLine, "="))
249 | 'If sLine Begins "X-KDE-Library" Then hDApps._$XKDELibrary = Right(sLine, -InStr(sLine, "="))
250 |
251 | If sLine Like "*=*" Then
252 | f = Left(sLine, InStr(sLine, "=") - 1)
253 | v = Right(sLine, -InStr(sLine, "="))
254 | Try hDApps.PropertyValue[f] = v
255 | Endif
256 | Next
257 |
258 | $cApps[AppName] = hDApps
259 | getting = False
260 | Return hDApps
261 | Endif
262 |
263 | End
264 |
265 |
266 |
267 |
268 | Static Public Function _next() As String
269 |
270 | If IsNull($aApps) Then MakeAppList()
271 |
272 | If Not Enum.Index Then
273 | Enum.Index = 0
274 | Endif
275 | Enum.Index += 1
276 | If Enum.Index = $aApps.Count + 1 Then
277 | Enum.Stop
278 | Return
279 | Endif
280 | Return $aApps[Enum.Index - 1]
281 |
282 | End
283 |
284 |
285 | Private Function IconName_Read() As String
286 | Return _$IconName
287 | End
288 |
289 |
290 | Static Private Sub GetDataDir() As String[]
291 | Dim sPrev, sDir As String
292 | If Not $aDataDir Then
293 | $aDataDir = Split(Desktop.DataDir, ":", "", True)
294 | If Trim(Env["XDG_DATA_DIRS"]) <> "" Then
295 | sPrev = ""
296 | For Each sDir In Split(Env["XDG_DATA_DIRS"], ":", "", True).Sort()
297 | If Right(sDir) <> "/" Then sDir &= "/"
298 | If sDir <> sPrev
299 | $aDataDir.Add(sDir)
300 | sPrev = sDir
301 | Endif
302 | Next
303 | '$aDataDir.Insert(Split(Env["XDG_DATA_DIRS"], ":", "", True))
304 | Else
305 | If $aDataDir.find(User.home & "/.local/share/") = -1 Then
306 | $aDataDir.add(User.home & "/.local/share/")
307 | Endif
308 | If $aDataDir.find("/usr/share/") = -1 Then
309 | $aDataDir.add("/usr/share/")
310 | Endif
311 | If $aDataDir.find("/usr/local/share/") = -1 Then
312 | $aDataDir.add("/usr/local/share/")
313 | Endif
314 | Endif
315 | Endif
316 |
317 | Return $aDataDir
318 | End
319 |
320 | Static Public Sub Reset(Optional otherdirs As String[])
321 | $aApps = Null
322 | $cApps.Clear
323 | $cAppsPath.Clear
324 | anotherdirs = otherdirs
325 | End
326 |
327 |
328 | Public Sub GetIcon(Optional Size As Integer = 16) As Image
329 |
330 | Dim sPath As String
331 | Dim hImage As Image
332 |
333 | Dim sDir As String
334 | Dim sSize As String
335 | Dim hSvg As SvgImage
336 | Dim s As String
337 |
338 | If $hImage Then Return $hImage
339 | If Exist(_$IconName, True) Then
340 | If _$IconName Ends ".svg" Then
341 | hSvg = SvgImage.Load(_$IconName)
342 | hImage = New Image(Size, Size, Color.Transparent)
343 | Paint.Begin(hImage)
344 | hSvg.Resize(size, Size)
345 | hSvg.Paint
346 | Paint.End
347 | Else
348 | Try hImage = Image.Load(_$IconName)
349 | Endif
350 |
351 | Else
352 | If ((_$IconName Ends ".png") Or (_$IconName Ends ".xpm")) Then _$IconName = File.BaseName(_$IconName)
353 | 'If _$IconName Ends ".png" Then _$IconName = File.BaseName(_$IconName)
354 | For Each sDir In [Desktop.DataDir &/ "icons", "/usr/share/icons"]
355 | 'For Each sSize In [CStr(Size), "128", "64", "32"]
356 | For Each sSize In [CStr(Size), "256", "128", "64", "48", "32" "22", "16", "8"]
357 | sPath = Subst(sDir &/ "hicolor/&1x&1/apps/&2.png", sSize, _$IconName)
358 | If Exist(sPath, True) Then
359 | Try hImage = Image.Load(sPath)
360 | If hImage Then Break
361 | Endif
362 | sPath = Subst(sDir &/ "hicolor/&1x&1/apps/&2.xpm", sSize, _$IconName)
363 | If Exist(sPath, True) Then
364 | Try hImage = Image.Load(sPath)
365 | If hImage Then Break
366 | Endif
367 | Next
368 | If hImage Then Break
369 | Next
370 | If Not hImage Then
371 | sPath = Subst("/usr/share/pixmaps/&1.png", _$IconName)
372 | If Exist(sPath, True) Then Try hImage = Image.Load(sPath)
373 | Endif
374 |
375 | If Not hImage Then
376 | sPath = Subst("/usr/share/pixmaps/&1.xpm", _$IconName)
377 | If Exist(sPath, True) Then Try hImage = Image.Load(sPath)
378 | Endif
379 |
380 | Endif
381 | If Not hImage Then
382 | 'For Each s In ["apps", "actions", "places", "devices"]
383 | For Each s In ["apps", "actions", "places", "devices", "categories", "emblems", "mime", "misc", "status", "mimetypes"]
384 | Try hImage = Stock[CStr(Size) &/ s &/ _$IconName].Image
385 | If hImage Then Break
386 | Next
387 | Endif
388 | If Not hImage Then hImage = Stock[CStr(Size) &/ "program"].Image
389 | If hImage.W <> Size Or If hImage.H <> Size Then hImage = hImage.Stretch(Size, Size)
390 | $hImage = hImage
391 | Return hImage
392 | Catch
393 |
394 | End
395 |
396 | Private Function NoDisplay_Read() As Boolean
397 |
398 | Return _$NoDisplay
399 |
400 | End
401 |
402 | Private Function DisplayOnlyIn_Read() As Boolean
403 |
404 | Return _$DisplayOnlyIn
405 |
406 | End
407 |
408 | Private Function NotShowIn_Read() As String
409 |
410 | Return _$NotShowIn
411 |
412 | End
413 |
414 | Public Sub Exec(Optional Args As String)
415 |
416 | Dim ars As String[]
417 | Dim i As Integer
418 |
419 | ars = Split(_$Exec, " ")
420 | If ars.Count > 0 Then
421 |
422 | If Not Args Then
423 | Exec [ars[0]]
424 | Else
425 | For i = 0 To ars.Max
426 | If ars[i] Begins "%" Then
427 | Try ars.Remove(i, ars.Max - i)
428 | Break
429 | Endif
430 | Next
431 | If InStr(ars[ars.Max], "%") Then
432 | ars[ars.Max] = Args
433 | Endif
434 | Exec ars
435 | Endif
436 | Endif
437 |
438 | End
439 |
440 | Private Function Exec_R_Read() As String
441 |
442 | Return _$Exec
443 |
444 | End
445 |
446 | Private Function XKDEServiceTypes_Read() As String
447 |
448 | Return _$XKDEServiceTypes
449 |
450 | End
451 |
452 | 'Private Function XKDELibrary_Read() As String
453 |
454 | ' Return _$XKDELibrary
455 |
456 | 'End
457 |
458 |
459 |
460 | Private Function file_path_read() As String
461 |
462 | Return _$Path
463 |
464 | End
465 |
466 |
467 | Public Sub _free()
468 |
469 | ' $aDataDir = Null
470 | ' $cApps = Null
471 | ' $aApps = Null
472 | ' $cAppsPath = Null
473 |
474 | End
475 |
476 |
477 | Public Function Get(field As String, Optional localized As Boolean = True) As Variant
478 | Dim out As Variant
479 | If localized Then
480 | Try out = PropertyValue[field & "[" & sLanguage[0] & "_" & sLanguage[1] & "]"]
481 | If out <> Null Then Return out
482 | Try out = PropertyValue[field & "[" & sLanguage[0] & "]"]
483 | If out <> Null Then Return out
484 | Endif
485 | Try out = PropertyValue[field]
486 |
487 | Return out
488 | End
489 |
490 |
--------------------------------------------------------------------------------