1 #ifndef __HERBSTLUFT_SETTINGS_H_
2 #define __HERBSTLUFT_SETTINGS_H_
3 
4 #include <string>
5 
6 #include "attribute_.h"
7 #include "commandio.h"
8 #include "globals.h"
9 #include "object.h"
10 #include "x11-types.h"
11 
12 class Root;
13 class Completion;
14 
15 class Settings : public Object {
16 public:
17     using string = std::string;
18     Settings();
19     void injectDependencies(Root* root);
20     // commands:
21     int set_cmd(Input input, Output output);
22     void set_complete(Completion& complete);
23     int get_cmd(Input argv, Output output);
24     void get_complete(Completion& complete);
25     int toggle_cmd(Input argv, Output output);
26     void toggle_complete(Completion& complete);
27     int cycle_value_cmd(Input argv, Output output);
28     void cycle_value_complete(Completion& complete);
29 
30     // all the settings:
31     Attribute_<bool>          verbose = {"verbose", false};
32     Attribute_<int>           frame_gap = {"frame_gap", 5};
33     Attribute_<int>           frame_padding = {"frame_padding", 0};
34     Attribute_<int>           window_gap = {"window_gap", 0};
35     Attribute_<int>           snap_distance = {"snap_distance", 10};
36     Attribute_<int>           snap_gap = {"snap_gap", 5};
37     Attribute_<int>           mouse_recenter_gap = {"mouse_recenter_gap", 0};
38     Attribute_<Color>         frame_border_active_color = {"frame_border_active_color", {"red"}};
39     Attribute_<Color>         frame_border_normal_color = {"frame_border_normal_color", {"blue"}};
40     Attribute_<Color>         frame_border_inner_color = {"frame_border_inner_color", {"black"}};
41     Attribute_<Color>         frame_bg_normal_color = {"frame_bg_normal_color", {"black"}};
42     Attribute_<Color>         frame_bg_active_color = {"frame_bg_active_color", {"black"}};
43     Attribute_<bool>          frame_bg_transparent = {"frame_bg_transparent", false};
44     Attribute_<int>           frame_transparent_width = {"frame_transparent_width", 0};
45     Attribute_<int>           frame_border_width = {"frame_border_width", 2};
46     Attribute_<int>           frame_border_inner_width = {"frame_border_inner_width", 0};
47     Attribute_<int>           frame_active_opacity = {"frame_active_opacity", 100};
48     Attribute_<int>           frame_normal_opacity = {"frame_normal_opacity", 100};
49     Attribute_<bool>          focus_crosses_monitor_boundaries = {"focus_crosses_monitor_boundaries", true};
50     Attribute_<bool>          always_show_frame = {"always_show_frame", false};
51     Attribute_<bool>          default_direction_external_only = {"default_direction_external_only", false};
52     Attribute_<unsigned long> default_frame_layout = {"default_frame_layout", 0};
53     Attribute_<bool>          focus_follows_mouse = {"focus_follows_mouse", false};
54     Attribute_<bool>          focus_stealing_prevention = {"focus_stealing_prevention", true};
55     Attribute_<bool>          swap_monitors_to_get_tag = {"swap_monitors_to_get_tag", true};
56     Attribute_<bool>          raise_on_focus = {"raise_on_focus", false};
57     Attribute_<bool>          raise_on_focus_temporarily = {"raise_on_focus_temporarily", false};
58     Attribute_<bool>          raise_on_click = {"raise_on_click", true};
59     Attribute_<bool>          gapless_grid = {"gapless_grid", true};
60     Attribute_<bool>          hide_covered_windows = {"hide_covered_windows", false};
61     Attribute_<bool>          smart_frame_surroundings = {"smart_frame_surroundings", false};
62     Attribute_<bool>          smart_window_surroundings = {"smart_window_surroundings", false};
63     Attribute_<int>           monitors_locked = {"monitors_locked", 0};
64     Attribute_<bool>          auto_detect_monitors = {"auto_detect_monitors", false};
65     Attribute_<bool>          auto_detect_panels = {"auto_detect_panels", true};
66     Attribute_<int>           pseudotile_center_threshold = {"pseudotile_center_threshold", 10};
67     Attribute_<bool>          update_dragged_clients = {"update_dragged_clients", false};
68     Attribute_<string>        tree_style = {"tree_style", "*| +`--."};
69     Attribute_<string>        wmname = {"wmname", WINDOW_MANAGER_NAME};
70     // for compatibility
71     DynAttribute_<int>         window_border_width;
72     DynAttribute_<int>         window_border_inner_width;
73     DynAttribute_<Color>       window_border_inner_color;
74     DynAttribute_<Color>       window_border_active_color;
75     DynAttribute_<Color>       window_border_normal_color;
76     DynAttribute_<Color>       window_border_urgent_color;
77 private:
78     std::function<int()> getIntAttr(std::string name);
79     std::function<Color()> getColorAttr(std::string name);
80     std::function<string(int)> setIntAttr(std::string name);
81     std::function<string(Color)> setColorAttr(std::string name);
82     Root* root_ = nullptr;
83 };
84 
85 extern Settings* g_settings;
86 
87 #endif
88 
89