Skip to content

Commit

Permalink
Make the float menu list and window list open up or down depending on…
Browse files Browse the repository at this point in the history
… position

If the float menu's position is in the upper half of the screen, it will
open downwards, and vice versa
  • Loading branch information
CorbinWunderlich committed Jan 13, 2025
1 parent 4343ad0 commit 486838d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions html5/js/MenuCustom.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,29 @@ $(function () {
client.mouse_grabbed = false;
client.toolbar_position = "custom";
client.reconfigure_all_trays();

// If the float menu is in the upper half of the screen, the menu_list and open_windows_list will open downwards, and vice versa.
const float_menu_top_css = float_menu.css("top")
const float_menu_top = float_menu_top_css.substring(0, float_menu_top_css.length - 2);

if (Number(float_menu_top) > client.desktop_height / 2) {
$("#menu_list").css("bottom", "30px");
$("#open_windows_list").css({
"bottom": "30px",
"border-top-left-radius": "3px",
"border-top-right-radius": "3px",
"border-bottom-left-radius": "0px",
"border-bottom-right-radius": "0px"
});
} else {
$("#menu_list").css("bottom", "unset");
$("#open_windows_list").css({
"bottom": "unset",
"border-top-left-radius": "0px",
"border-top-right-radius": "0px",
"border-bottom-left-radius": "3px",
"border-bottom-right-radius": "3px"
});
}
});
});

0 comments on commit 486838d

Please sign in to comment.