Compare commits

...

3 Commits

4 changed files with 50 additions and 25 deletions

View File

@ -14,6 +14,8 @@ CONFIGMKS = \
$(CONFIGMKS_TO_REMOVE) \
config/3-defvars.mk
RUST_SRC = src/*.rs src/**/*.rs
MODULES_SRC = \
src/atoms.c \
src/drw.c \
@ -73,7 +75,7 @@ polytreewm: src/main.o $(MODULES_OBJ) target/debug/libpolytreewm.a
dwm.o: $(DWM_SRC) $(DWM_HDR)
target/debug/libpolytreewm.a:
target/debug/libpolytreewm.a: $(RUST_SRC)
$(CARGO) build
#########
@ -106,4 +108,4 @@ uninstall:
$(DESTDIR)$(BINDIR)/polytreewm \
$(DESTDIR)$(MANDIR)/man1/polytreewm.1
.PHONY: all clean distclean install uninstall test target/debug/libpolytreewm.a
.PHONY: all clean distclean install uninstall test

View File

@ -97,3 +97,28 @@ unsafe extern "C" fn settings_set_max_clients_in_master(value: c_int) {
Some(value)
});
}
#[no_mangle]
unsafe extern "C" fn settings_get_respect_resize_hints_in_floating_layout(
) -> bool {
SETTINGS.unwrap().respect_resize_hints_in_floating_layout()
}
#[no_mangle]
unsafe extern "C" fn settings_set_respect_resize_hints_in_floating_layout(
value: bool,
) {
SETTINGS
.unwrap()
.respect_resize_hints_in_floating_layout_set(value);
}
#[no_mangle]
unsafe extern "C" fn settings_get_show_bar_by_default() -> bool {
SETTINGS.unwrap().show_bar_by_default()
}
#[no_mangle]
unsafe extern "C" fn settings_set_show_bar_by_default(value: bool) {
SETTINGS.unwrap().show_bar_by_default_set(value);
}

View File

@ -5,8 +5,6 @@
static SettingsForSingleWindow border_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
static SettingsForSingleWindow gap_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
static UnitKind master_area_factor_per_unit = UNIT_MONITOR;
static bool respect_resize_hints_in_floating_layout = false;
static bool show_bar_by_default = true;
static UnitKind show_bar_per_unit = UNIT_MONITOR;
static unsigned int snap_distance = 32;
static bool swallow_floating = false;
@ -44,27 +42,6 @@ void settings_set_master_area_factor_per_unit(const UnitKind new_master_area_fac
// TODO: notify WM to rearrange clients
}
bool settings_get_respect_resize_hints_in_floating_layout()
{
return respect_resize_hints_in_floating_layout;
}
void settings_set_respect_resize_hints_in_floating_layout(const bool new_respect_resize_hints_in_floating_layout)
{
respect_resize_hints_in_floating_layout = new_respect_resize_hints_in_floating_layout;
// TODO: notify WM to rearrange clients
}
bool settings_get_show_bar_by_default()
{
return show_bar_by_default;
}
void settings_set_show_bar_by_default(const bool new_show_bar_by_default)
{
show_bar_by_default = new_show_bar_by_default;
}
UnitKind settings_get_show_bar_per_unit()
{
return show_bar_per_unit;

View File

@ -12,6 +12,8 @@ pub struct Settings {
focus_on_wheel: bool,
gap_size: c_int,
max_clients_in_master: Option<c_int>,
respect_resize_hints_in_floating_layout: bool,
show_bar_by_default: bool,
}
impl Default for Settings {
@ -25,6 +27,8 @@ impl Default for Settings {
focus_on_wheel: true,
gap_size: 10,
max_clients_in_master: None,
respect_resize_hints_in_floating_layout: false,
show_bar_by_default: true,
}
}
}
@ -99,4 +103,21 @@ impl Settings {
self.max_clients_in_master =
value.map(|value| constraints::max_clients_in_master(value));
}
pub fn respect_resize_hints_in_floating_layout(&self) -> bool {
self.respect_resize_hints_in_floating_layout
}
// TODO: notify WM to rearrange clients
pub fn respect_resize_hints_in_floating_layout_set(&mut self, value: bool) {
self.respect_resize_hints_in_floating_layout = value;
}
pub fn show_bar_by_default(&self) -> bool {
self.show_bar_by_default
}
pub fn show_bar_by_default_set(&mut self, value: bool) {
self.show_bar_by_default = value;
}
}