Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tiling-assistant@leleat-on-github/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"name": "Tiling Assistant",
"shell-version": [
"48",
"49"
"49",
"50"
],
"url": "https://github.com/Leleat/Tiling-Assistant",
"uuid": "tiling-assistant@leleat-on-github",
Expand Down
7 changes: 7 additions & 0 deletions tiling-assistant@leleat-on-github/src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* *and* prefs files
*/

import { Meta } from './dependencies/gi.js';

/**
* A Singleton providing access to the settings.
*/
Expand Down Expand Up @@ -321,3 +323,8 @@ var LayoutItem = class LayoutItem {
this.loopType = null;
}
};

export function is_wayland_compositor() {
return Meta.is_wayland_compositor === undefined ||
Meta.is_wayland_compositor();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Clutter, GLib, GObject, Gio, Meta, Mtk } from '../dependencies/gi.js';
import { Main, WindowManager } from '../dependencies/shell.js';
import { WINDOW_ANIMATION_TIME } from '../dependencies/unexported/windowManager.js';

import { Orientation, MoveModes, Settings } from '../common.js';
import { Orientation, MoveModes, Settings, is_wayland_compositor } from '../common.js';
import { Rect, Util } from './utility.js';
import { TilingWindowManager as Twm } from './tilingWindowManager.js';

Expand Down Expand Up @@ -319,7 +319,7 @@ export default class TilingMoveHandler {
const altL = Clutter.ModifierType.MOD1_MASK;
const altGr = Clutter.ModifierType.MOD5_MASK;
const meta = Clutter.ModifierType.MOD4_MASK;
const rmb = Meta.is_wayland_compositor()
const rmb = is_wayland_compositor()
? Clutter.ModifierType.BUTTON2_MASK
: Clutter.ModifierType.BUTTON3_MASK;
const pressed = [ // idxs come from settings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Clutter, GObject, Meta, St } from '../dependencies/gi.js';
import { Clutter, GObject, St } from '../dependencies/gi.js';
import { Main } from '../dependencies/shell.js';
import * as SwitcherPopup from '../dependencies/unexported/switcherPopup.js';

import { Direction, Orientation } from '../common.js';
import { Direction, Orientation, is_wayland_compositor } from '../common.js';
import { Util } from './utility.js';
import { TilingWindowManager as Twm } from './tilingWindowManager.js';
import * as AltTab from './altTab.js';
Expand Down Expand Up @@ -52,7 +52,7 @@ export const TilingSwitcherPopup = GObject.registerClass({

// Destroy popup when touching outside of popup
this.connect('touch-event', () => {
if (Meta.is_wayland_compositor())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can just use Meta.is_wayland_compositor?.() ?? true everywhere :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds true but I don't use Javascript often enough for that syntax to feel as natural.

if (is_wayland_compositor())
this.fadeAndDestroy();

return Clutter.EVENT_PROPAGATE;
Expand Down