mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
Launcher: Vertical/Horizontal option
This commit is contained in:
parent
0b1ff2d0eb
commit
8a2123e385
2 changed files with 12 additions and 6 deletions
|
@ -65,24 +65,27 @@ private:
|
||||||
GWindow* make_launcher_window()
|
GWindow* make_launcher_window()
|
||||||
{
|
{
|
||||||
auto config = CConfigFile::get_for_app("Launcher");
|
auto config = CConfigFile::get_for_app("Launcher");
|
||||||
|
auto vertical = config->read_bool_entry("Launcher", "vertical", true);
|
||||||
|
|
||||||
auto* window = new GWindow;
|
auto* window = new GWindow;
|
||||||
window->set_title("Launcher");
|
window->set_title("Launcher");
|
||||||
window->set_rect(50, 50, 50, config->groups().size() * 50);
|
int launcher_size = config->groups().size() * 50;
|
||||||
|
window->set_rect(50, 50, vertical ? 50 : launcher_size, vertical ? launcher_size : 50);
|
||||||
window->set_show_titlebar(false);
|
window->set_show_titlebar(false);
|
||||||
|
|
||||||
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::Vertical));
|
widget->set_layout(make<GBoxLayout>(vertical ? Orientation::Vertical : Orientation::Horizontal));
|
||||||
widget->layout()->set_spacing(0);
|
widget->layout()->set_spacing(0);
|
||||||
widget->layout()->set_margins({ 5, 0, 5, 0 });
|
widget->layout()->set_margins({ 5, 0, 5, 0 });
|
||||||
window->set_main_widget(widget);
|
window->set_main_widget(widget);
|
||||||
|
|
||||||
for (auto& group : config->groups()) {
|
for (auto& group : config->groups()) {
|
||||||
new LauncherButton(config->read_entry(group, "Name", group),
|
if (group != "Launcher")
|
||||||
config->read_entry(group, "Icon", ""),
|
new LauncherButton(config->read_entry(group, "Name", group),
|
||||||
config->read_entry(group, "Path", ""),
|
config->read_entry(group, "Icon", ""),
|
||||||
widget);
|
config->read_entry(group, "Path", ""),
|
||||||
|
widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
[Launcher]
|
||||||
|
vertical=false
|
||||||
|
|
||||||
[Terminal]
|
[Terminal]
|
||||||
Path=/bin/Terminal
|
Path=/bin/Terminal
|
||||||
Icon=/res/icons/Terminal.png
|
Icon=/res/icons/Terminal.png
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue