Skip to content

Commit

Permalink
Demo configurable window decorations in miral-shell
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanGriffiths committed Jul 8, 2024
1 parent 1b60c40 commit 965736d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions examples/miral-shell/shell_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,38 @@
#include <miral/internal_client.h>
#include <miral/command_line_option.h>
#include <miral/cursor_theme.h>
#include <miral/decorations.h>
#include <miral/keymap.h>
#include <miral/toolkit_event.h>
#include <miral/x11_support.h>
#include <miral/wayland_extensions.h>

#include <xkbcommon/xkbcommon-keysyms.h>

#include <cstring>

namespace
{
struct ConfigureDecorations
{
miral::Decorations const decorations{[]
{
if (auto const strategy = getenv("MIRAL_SHELL_DECORATIONS"))
{
if (strcmp(strategy, "always-ssd") == 0) return miral::Decorations::always_ssd();
if (strcmp(strategy, "prefer-ssd") == 0) return miral::Decorations::prefer_ssd();
if (strcmp(strategy, "always-csd") == 0) return miral::Decorations::always_csd();
}
return miral::Decorations::prefer_csd();
}()};

void operator()(mir::Server& s) const
{
decorations(s);
}
};
}

int main(int argc, char const* argv[])
{
using namespace miral;
Expand Down Expand Up @@ -113,6 +138,7 @@ int main(int argc, char const* argv[])
CursorTheme{"default:DMZ-White"},
WaylandExtensions{},
X11Support{},
ConfigureDecorations{},
window_managers,
display_configuration_options,
external_client_launcher,
Expand Down

0 comments on commit 965736d

Please sign in to comment.