Skip to content

Commit

Permalink
Launcher: Vertical/Horizontal option
Browse files Browse the repository at this point in the history
  • Loading branch information
alexispurslane authored and awesomekling committed Jul 2, 2019
1 parent 0b1ff2d commit 8a2123e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Applications/Launcher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,27 @@ class LauncherButton final : public GButton {
GWindow* make_launcher_window()
{
auto config = CConfigFile::get_for_app("Launcher");
auto vertical = config->read_bool_entry("Launcher", "vertical", true);

auto* window = new GWindow;
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);

auto* widget = new GWidget;
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_margins({ 5, 0, 5, 0 });
window->set_main_widget(widget);

for (auto& group : config->groups()) {
new LauncherButton(config->read_entry(group, "Name", group),
config->read_entry(group, "Icon", ""),
config->read_entry(group, "Path", ""),
widget);
if (group != "Launcher")
new LauncherButton(config->read_entry(group, "Name", group),
config->read_entry(group, "Icon", ""),
config->read_entry(group, "Path", ""),
widget);
}

return window;
Expand Down
3 changes: 3 additions & 0 deletions Base/home/anon/Launcher.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[Launcher]
vertical=false

[Terminal]
Path=/bin/Terminal
Icon=/res/icons/Terminal.png
Expand Down

0 comments on commit 8a2123e

Please sign in to comment.