Add an option to disable hotcorners in fullscreen (#1806)

This commit is contained in:
Leo 2024-01-03 05:08:43 +09:00 committed by GitHub
parent 7de779cc06
commit c62024acd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 7 deletions

View File

@ -7,10 +7,11 @@
<value nick="minimize-current" value="3" />
<value nick="open-launcher" value="4" />
<value nick="custom-command" value="5" />
<value nick="window-overview-all" value="6" />
<value nick="switch-to-workspace-previous" value="7" />
<value nick="switch-to-workspace-next" value="8" />
<value nick="switch-to-workspace-last" value="9" />
<value nick="window-overview" value="6" />
<value nick="window-overview-all" value="7" />
<value nick="switch-to-workspace-previous" value="8" />
<value nick="switch-to-workspace-next" value="9" />
<value nick="switch-to-workspace-last" value="10" />
</enum>
<enum id="GalaWindowOverviewType">
<value nick='grid' value='0'/>
@ -116,6 +117,14 @@
</key>
</schema>
<schema path="/io/elementary/desktop/wm/behavior/" id="io.elementary.desktop.wm.behavior">
<key type="b" name="enable-hotcorners-in-fullscreen">
<default>false</default>
<summary>Whether hotcorners should be enabled when fullscreen window is opened</summary>
<description></description>
</key>
</schema>
<schema path="/org/pantheon/desktop/gala/keybindings/" id="org.pantheon.desktop.gala.keybindings">
<key type="as" name="switch-to-workspace-first">
<default><![CDATA[['<Super>Home']]]></default>

View File

@ -21,11 +21,12 @@ public class Gala.HotCornerManager : Object {
public WindowManager wm { get; construct; }
public GLib.Settings behavior_settings { get; construct; }
public GLib.Settings new_behavior_settings { get; construct; }
private GLib.GenericArray<HotCorner> hot_corners;
public HotCornerManager (WindowManager wm, GLib.Settings behavior_settings) {
Object (wm: wm, behavior_settings: behavior_settings);
public HotCornerManager (WindowManager wm, GLib.Settings behavior_settings, GLib.Settings new_behavior_settings) {
Object (wm: wm, behavior_settings: behavior_settings, new_behavior_settings: new_behavior_settings);
hot_corners = new GLib.GenericArray<HotCorner> ();
behavior_settings.changed.connect (configure);
@ -71,6 +72,13 @@ public class Gala.HotCornerManager : Object {
var hot_corner = new HotCorner (display, (int) x, (int) y, scale, hot_corner_position);
hot_corner.trigger.connect (() => {
if (
display.get_monitor_in_fullscreen (display.get_primary_monitor ()) &&
!new_behavior_settings.get_boolean ("enable-hotcorners-in-fullscreen")
) {
return;
}
if (action_type == ActionType.CUSTOM_COMMAND) {
run_custom_action (hot_corner_position);
} else {

View File

@ -114,6 +114,7 @@ namespace Gala {
private GLib.Settings animations_settings;
private GLib.Settings behavior_settings;
private GLib.Settings new_behavior_settings;
private GestureTracker gesture_tracker;
private bool animating_switch_workspace = false;
@ -142,6 +143,7 @@ namespace Gala {
animations_settings = new GLib.Settings (Config.SCHEMA + ".animations");
animations_settings.bind ("enable-animations", this, "enable-animations", GLib.SettingsBindFlags.GET);
behavior_settings = new GLib.Settings (Config.SCHEMA + ".behavior");
new_behavior_settings = new GLib.Settings ("io.elementary.desktop.wm.behavior");
enable_animations = animations_settings.get_boolean ("enable-animations");
}
@ -295,7 +297,7 @@ namespace Gala {
unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
monitor_manager.monitors_changed.connect (on_monitors_changed);
hot_corner_manager = new HotCornerManager (this, behavior_settings);
hot_corner_manager = new HotCornerManager (this, behavior_settings, new_behavior_settings);
hot_corner_manager.on_configured.connect (update_input_area);
hot_corner_manager.configure ();