Skip to content

Commit

Permalink
Add an option to disable hotcorners in fullscreen (#1806)
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter authored Jan 2, 2024
1 parent 7de779c commit c62024a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
17 changes: 13 additions & 4 deletions data/gala.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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'/>
Expand Down Expand Up @@ -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>
Expand Down
12 changes: 10 additions & 2 deletions src/HotCorners/HotCornerManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -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 ();

Expand Down

0 comments on commit c62024a

Please sign in to comment.