diff --git a/monitors/src/backend/hyprland.rs b/monitors/src/backend/hyprland.rs index 8254f16..cd777d6 100644 --- a/monitors/src/backend/hyprland.rs +++ b/monitors/src/backend/hyprland.rs @@ -99,11 +99,12 @@ pub fn hy_save_monitor_configuration(monitors: &Vec) { let mut monitor_string = String::new(); for monitor in monitors { + let vrr = if monitor.vrr { 1 } else { 0 }; if !monitor.enabled { monitor_string += &format!("keyword monitor {},disabled;", monitor.name); } else { monitor_string += &format!( - "monitor={},{}x{}@{},{}x{},{:.6},transform,{}\n", + "monitor={},{}x{}@{},{}x{},{:.6},transform,{},vrr,{}\n", monitor.name, monitor.size.0, monitor.size.1, @@ -112,6 +113,7 @@ pub fn hy_save_monitor_configuration(monitors: &Vec) { monitor.offset.1, monitor.scale, monitor.transform, + vrr ); } } @@ -165,7 +167,7 @@ impl HyprMonitor { self.scale, self.transform as u32, self.vrr, - self.vrr, + false, self.x as i32, self.y as i32, self.width as i32, @@ -180,11 +182,12 @@ fn monitor_to_configstring(monitors: &Vec) -> String { let mut strings = Vec::new(); for monitor in monitors { + let vrr = if monitor.vrr { 1 } else { 0 }; if !monitor.enabled { strings.push(format!("keyword monitor {},disabled;", monitor.name)); } else { strings.push(format!( - "keyword monitor {},{}x{}@{},{}x{},{:.6},transform,{};", + "keyword monitor {},{}x{}@{},{}x{},{:.6},transform,{},vrr,{};", monitor.name, &monitor.size.0, &monitor.size.1, @@ -192,7 +195,8 @@ fn monitor_to_configstring(monitors: &Vec) -> String { &monitor.offset.0, &monitor.offset.1, &monitor.scale, - &monitor.transform + &monitor.transform, + vrr )); } } diff --git a/monitors/src/frontend/general.rs b/monitors/src/frontend/general.rs index 366a89f..31e04d7 100644 --- a/monitors/src/frontend/general.rs +++ b/monitors/src/frontend/general.rs @@ -17,8 +17,9 @@ pub fn arbitrary_add_scaling_adjustment( monitors: Rc>>, settings: &PreferencesGroup, ) { - let scaling_adjustment = gtk::Adjustment::new(scale, 0.1, 10.0, 0.05, 0.0, 0.0); + let scaling_adjustment = gtk::Adjustment::new(scale, 0.1, 4.0, 0.05, 0.0, 0.0); let scaling = adw::SpinRow::new(Some(&scaling_adjustment), 0.000001, 2); + scaling.set_tooltip_markup(Some("This allows you to set your own custom scale.\nPlease note, that the scale needs to result in a full number for both width and height of the resolution.")); scaling.set_title("Scaling"); scaling.connect_value_notify(move |state| { scaling_update(state, monitors.clone(), monitor_index); @@ -42,6 +43,7 @@ pub fn add_save_button( .halign(gtk::Align::End) .sensitive(false) .build(); + button.set_tooltip_markup(Some("Persistant saving of configuration")); button.connect_clicked(move |_| { apply_monitor_clicked( save_ref.clone(), @@ -78,6 +80,7 @@ pub fn add_primary_monitor_option( let primary = adw::SwitchRow::new(); primary.set_title("Primary Monitor"); primary.set_active(primary_value); + primary.set_tooltip_markup(Some("Changes your primary monitor")); if monitors.borrow().len() < 2 { return; @@ -119,6 +122,11 @@ pub fn add_vrr_monitor_option( let vrr = adw::SwitchRow::new(); vrr.set_title("Variable Refresh-Rate"); vrr.set_active(vrr_value); + if get_environment().as_str() == "Hyprland" { + vrr.set_tooltip_markup(Some("Please note that this option will set the configuration for this monitor, however, if your monitor does not offer VRR, this setting will fail to make a change.")); + } else { + vrr.set_tooltip_markup(Some("Enable or disable Variable Refresh Rate")); + } vrr.connect_active_notify(move |state| { monitors.borrow_mut().get_mut(monitor_index).unwrap().vrr = state.is_active(); state @@ -152,6 +160,7 @@ pub fn add_enabled_monitor_option( .subtitle(&monitor.make) .active(monitor.enabled) .build(); + enabled.set_tooltip_markup(Some("Disables or enables monitors")); let enabled_ref = monitors_ref.clone(); enabled.connect_active_notify(move |state| { enabled_ref diff --git a/monitors/src/frontend/handlers.rs b/monitors/src/frontend/handlers.rs index 97a8298..c623ae3 100644 --- a/monitors/src/frontend/handlers.rs +++ b/monitors/src/frontend/handlers.rs @@ -86,6 +86,7 @@ pub fn apply_monitor_clicked( }; } monitor_ref.replace(get_monitor_data()); + fallback.replace(monitor_ref.borrow().clone()); settings_ref.append(&get_monitor_settings_group( monitor_ref.clone(), index, @@ -234,6 +235,7 @@ pub fn get_monitor_settings_group( "270-flipped", ]); let transform = adw::ComboRow::new(); + transform.set_tooltip_markup(Some("Changes the orientation of the monitor")); transform.set_title("Transform"); transform.set_model(Some(&model_list)); match monitor.transform { @@ -290,6 +292,7 @@ pub fn get_monitor_settings_group( model_list.append(&(x.to_string() + "x" + &y.to_string())); } let resolution = adw::ComboRow::new(); + resolution.set_tooltip_markup(Some("Changes the current resolution")); resolution.set_title("Resolution"); resolution.set_model(Some(&model_list)); resolution.set_selected(index as u32); @@ -351,6 +354,7 @@ pub fn get_monitor_settings_group( let refresh_rate_model = StringList::new(&refresh_rates); refresh_rate.set_model(Some(&refresh_rate_model)); refresh_rate.set_title("Refresh-Rate"); + refresh_rate.set_tooltip_markup(Some("Changes the current refresh-rate")); refresh_rate.set_selected(index as u32); let refresh_rate_ref = clicked_monitor.clone(); refresh_rate.connect_selected_item_notify(move |dropdown| { @@ -650,12 +654,13 @@ pub fn drawing_callback( if monitor.drag_information.drag_active || monitor.drag_information.clicked { context.set_source_color(&selected_text_color); } - context.set_font_size((140 / factor) as f64); - context.move_to((offset_x + 10) as f64, (offset_y + 30) as f64); + // context.set_font_size((140 / factor) as f64); + context.set_font_size(20.0); + context.move_to((offset_x + 10) as f64, (offset_y + 25) as f64); context .show_text(&monitor.name.clone()) .expect("Could not draw text"); - context.move_to((offset_x + 10) as f64, (offset_y + 60) as f64); + context.move_to((offset_x + 10) as f64, (offset_y + 45) as f64); context .show_text(&(monitor.size.0.to_string() + ":" + &monitor.size.1.to_string())) .expect("Could not draw text"); diff --git a/monitors/src/frontend/mod.rs b/monitors/src/frontend/mod.rs index 21121d5..2baa298 100644 --- a/monitors/src/frontend/mod.rs +++ b/monitors/src/frontend/mod.rs @@ -78,6 +78,7 @@ pub extern "C" fn frontend_data() -> (SidebarInfo, Vec) { .sensitive(false) .build(); config_buttons.append(&apply); + apply.set_tooltip_markup(Some("Temporarily saves configuration")); let reset = gtk::Button::builder() .label("Reset") @@ -85,6 +86,9 @@ pub extern "C" fn frontend_data() -> (SidebarInfo, Vec) { .halign(gtk::Align::End) .sensitive(false) .build(); + reset.set_tooltip_markup(Some( + "Resets currently set configuration to the last saved/applied one", + )); config_buttons.append(&reset); let settings_box = gtk::Box::new(Orientation::Vertical, 5); @@ -213,7 +217,7 @@ pub extern "C" fn frontend_data() -> (SidebarInfo, Vec) { let env = get_environment(); let env = env.as_str(); - let disallow_gaps = is_gnome() || env == "KDE" ; + let disallow_gaps = is_gnome() || env == "KDE"; let gesture = GestureDrag::builder().build(); let drawing_ref_drag_start = drawing_area.clone(); gesture.connect_drag_begin(move |_drag, x, y| {