1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 13:57:35 +00:00

Launcher loads applications from Launcher.ini, is started by default, and is resized automatically

Co-Authored-By: Andreas Kling <awesomekling@gmail.com>
This commit is contained in:
Christopher Dumas 2019-05-23 20:16:40 -07:00 committed by Andreas Kling
parent ad908f1395
commit dd84dcf31f
4 changed files with 48 additions and 16 deletions

View file

@ -4,6 +4,7 @@
#include <LibGUI/GButton.h> #include <LibGUI/GButton.h>
#include <LibGUI/GApplication.h> #include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h> #include <LibGUI/GBoxLayout.h>
#include <LibCore/CConfigFile.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
@ -60,22 +61,25 @@ private:
GWindow* make_launcher_window() GWindow* make_launcher_window()
{ {
auto config = CConfigFile::get_for_app("Launcher");
auto* window = new GWindow; auto* window = new GWindow;
window->set_title("Launcher"); window->set_title("Launcher");
window->set_rect(50, 50, 300, 60); window->set_rect(50, 50,
50, config->groups().size() * 55);
auto* widget = new GWidget; auto* widget = new GWidget;
widget->set_fill_with_background_color(true); widget->set_fill_with_background_color(true);
widget->set_layout(make<GBoxLayout>(Orientation::Horizontal)); widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
widget->layout()->set_margins({ 5, 5, 5, 5 }); widget->layout()->set_margins({ 5, 5, 5, 5 });
window->set_main_widget(widget); window->set_main_widget(widget);
new LauncherButton("Terminal", "/res/icons/Terminal.png", "/bin/Terminal", widget); for (auto& group : config->groups()) {
new LauncherButton("FontEditor", "/res/icons/FontEditor.png", "/bin/FontEditor", widget); new LauncherButton(config->read_entry(group, "Name", group),
new LauncherButton("FileManager", "/res/icons/32x32/filetype-folder.png", "/bin/FileManager", widget); config->read_entry(group, "Icon", ""),
new LauncherButton("TextEditor", "/res/icons/TextEditor.png", "/bin/TextEditor", widget); config->read_entry(group, "Path", ""),
new LauncherButton("VisualBuilder", "/res/icons/32x32/app-visual-builder.png", "/bin/VisualBuilder", widget); widget);
new LauncherButton("IRCClient", "/res/icons/32x32/app-irc-client.png", "/bin/IRCClient", widget); }
return window; return window;
} }

View file

@ -0,0 +1,35 @@
[Terminal]
Path=/bin/Terminal
Icon=/res/icons/Terminal.png
[FontEditor]
Path=/bin/FontEditor
Icon=/res/icons/FontEditor.png
[TextEditor]
Path=/bin/TextEditor
Icon=/res/icons/TextEditor.png
[VisualBuilder]
Path=/bin/VisualBuilder
Icon=/res/icons/32x32/app-visual-builder.png
[IRCClient]
Path=/bin/IRCClient
Icon=/res/icons/32x32/app-irc-client.png
[FileManager]
Path=/bin/FileManager
Icon=/res/icons/32x32/filetype-folder.png
[Minesweeper]
Path=/bin/Minesweeper
Icon=/res/icons/minesweeper/mine.png
[Snake]
Path=/bin/Snake
Icon=/res/icons/snake/eggplant.png
[ProcessManager]
Path=/bin/ProcessManager
Icon=/res/icons/32x32/msgbox-warning.png

View file

@ -27,7 +27,7 @@
#include <Kernel/Devices/DebugLogDevice.h> #include <Kernel/Devices/DebugLogDevice.h>
#define SPAWN_TERMINAL #define SPAWN_TERMINAL
//#define SPAWN_LAUNCHER #define SPAWN_LAUNCHER
//#define SPAWN_GUITEST2 //#define SPAWN_GUITEST2
//#define SPAWN_FILE_MANAGER //#define SPAWN_FILE_MANAGER
//#define SPAWN_PROCESS_MANAGER //#define SPAWN_PROCESS_MANAGER

View file

@ -72,15 +72,8 @@ WSWindowManager::WSWindowManager()
Vector<AppMenuItem> apps; Vector<AppMenuItem> apps;
apps.append({ "/bin/Terminal", "Open Terminal..." }); apps.append({ "/bin/Terminal", "Open Terminal..." });
apps.append({ "/bin/FontEditor", "Open FontEditor..." });
apps.append({ "/bin/TextEditor", "Open TextEditor..." });
apps.append({ "/bin/VisualBuilder", "Open VisualBuilder..." });
apps.append({ "/bin/IRCClient", "Open IRCClient..." });
apps.append({ "/bin/FileManager", "Open FileManager..." }); apps.append({ "/bin/FileManager", "Open FileManager..." });
apps.append({ "/bin/ProcessManager", "Open ProcessManager..." }); apps.append({ "/bin/ProcessManager", "Open ProcessManager..." });
apps.append({ "/bin/HelloWorld", "Open HelloWorld..." });
apps.append({ "/bin/Minesweeper", "Play Minesweeper..." });
apps.append({ "/bin/Snake", "Play Snake..." });
{ {
byte system_menu_name[] = { 0xf8, 0 }; byte system_menu_name[] = { 0xf8, 0 };