-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revamp for GNOME 45 #207
base: main
Are you sure you want to change the base?
Revamp for GNOME 45 #207
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
build/ | ||
node_modules/ | ||
node_modules/ | ||
.idea/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright Sebastian Wiesner <[email protected]> | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0.If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Alternatively, the contents of this file may be used under the terms | ||
// of the GNU General Public License Version 2 or later, as described below: | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
import type Gio from "@gi-types/gio2"; | ||
|
||
// See https://gjs.guide/extensions/topics/extension.html#types | ||
export declare interface ExtensionMetadata { | ||
readonly uuid: string; | ||
readonly name: string; | ||
readonly description: string; | ||
readonly "shell-version": readonly string[]; | ||
readonly dir: Gio.File; | ||
readonly path: string; | ||
readonly url: string; | ||
} | ||
|
||
declare class ExtensionBase { | ||
constructor(metadata: ExtensionMetadata); | ||
|
||
get metadata(): ExtensionMetadata; | ||
getSettings(schema?: string): Gio.Settings; | ||
public static lookupByUUID(uuid: string): ExtensionBase; | ||
} | ||
|
||
export declare class Extension extends ExtensionBase { | ||
constructor(metadata: ExtensionMetadata); | ||
|
||
enable(): void; | ||
|
||
disable(): void; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare function spawn(argv: string[]): void; | ||
export declare function lerp(start: number, end: number, progress: number): number; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright Sebastian Wiesner <[email protected]> | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0.If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
// | ||
// Alternatively, the contents of this file may be used under the terms | ||
// of the GNU General Public License Version 2 or later, as described below: | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
import type Gtk from "@gi-types/gtk4"; | ||
import type Adw from "@gi-types/adw1"; | ||
import { ExtensionBase } from "./extension"; | ||
// import { ExtensionBase } from "resource:///org/gnome/shell/extensions/extension.js"; | ||
|
||
export declare class ExtensionPreferences extends ExtensionBase { | ||
getPreferencesWidget(): Gtk.Widget; | ||
|
||
fillPreferencesWindow(window: Adw.PreferencesWindow): void; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Meta from '../../../meta12'; | ||
import St from '../../../st12'; | ||
|
||
declare class WindowSwitcherPopup extends St.Widget { | ||
_items: St.Widget & { | ||
window: Meta.Window | ||
}[]; | ||
|
||
_switcherList: St.Widget & { | ||
_scrollView: { | ||
hscroll: { | ||
adjustment: St.Adjustment | ||
} | ||
} | ||
}; | ||
|
||
_select(n: number): void; | ||
_resetNoModsTimeout(): void; | ||
_popModal(): void; | ||
|
||
_noModsTimeoutId: number; | ||
_initialDelayTimeoutId: number; | ||
_selectedIndex: number; | ||
|
||
show(backward: boolean, binding: string, mask: number); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Clutter from '../../../clutter12'; | ||
|
||
declare class MonitorConstraint extends Clutter.Constraint { | ||
constructor(params: Partial<{ primary: boolean, index: number }>); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import Clutter from '../../../clutter12'; | ||
import Gio from '@gi-types/gio2'; | ||
import GObject from '@gi-types/gobject2'; | ||
import Meta from '../../../meta12'; | ||
import Shell from '../../../shell12'; | ||
import St from '../../../st12'; | ||
|
||
const actionMode: Shell.ActionMode; | ||
function notify(message: string): void; | ||
function activateWindow(window: Meta.Window, time?: number, workspaceNum?: number): void; | ||
|
||
const panel: { | ||
addToStatusArea(role: string, indicator: Clutter.Actor, position?: number, box?: string): void, | ||
} & Clutter.Actor; | ||
|
||
const overview: { | ||
dash: { | ||
showAppsButton: St.Button | ||
}; | ||
searchEntry: St.Entry, | ||
shouldToggleByCornerOrButton(): boolean, | ||
visible: boolean, | ||
show(): void, | ||
hide(): void, | ||
showApps(): void, | ||
connect(signal: 'showing' | 'hiding' | 'hidden' | 'shown', callback: () => void): number, | ||
disconnect(id: number): void, | ||
_overview: { | ||
_controls: overviewControls.OverviewControlsManager | ||
} & St.Widget | ||
_gestureBegin(tracker: { | ||
confirmSwipe: typeof swipeTracker.SwipeTracker.prototype.confirmSwipe; | ||
}): void; | ||
_gestureUpdate(tracker: swipeTracker.SwipeTracker, progress: number); | ||
_gestureEnd(tracker: swipeTracker.SwipeTracker, duration: number, endProgress: number); | ||
|
||
_swipeTracker: swipeTracker.SwipeTracker; | ||
}; | ||
|
||
const layoutManager: GObject.Object & { | ||
uiGroup: St.Widget, | ||
panelBox: St.BoxLayout, | ||
monitors: __shell_private_types.IMonitorState[], | ||
primaryMonitor: __shell_private_types.IMonitorState, | ||
currentMonitor: __shell_private_types.IMonitorState, | ||
getWorkAreaForMonitor: (index: number) => Meta.Rectangle, | ||
|
||
connect(id: 'monitors-changed', callback: () => void); | ||
}; | ||
|
||
const wm: { | ||
skipNextEffect(actor: Meta.WindowActor): void; | ||
_workspaceAnimation: workspaceAnimation.WorkspaceAnimationController; | ||
}; | ||
|
||
const osdWindowManager: { | ||
hideAll(): void; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import Clutter from '../../../clutter12'; | ||
import St from '../../../st12'; | ||
import { SwipeTracker } from './swipeTracker'; | ||
|
||
export enum ControlsState { | ||
HIDDEN, | ||
WINDOW_PICKER, | ||
APP_GRID | ||
} | ||
|
||
declare class OverviewAdjustment extends St.Adjustment { | ||
getStateTransitionParams(): { | ||
initialState: ControlsState, | ||
finalState: ControlsState | ||
currentState: number, | ||
progress: number | ||
} | ||
} | ||
|
||
declare class OverviewControlsManager extends St.Widget { | ||
_stateAdjustment: OverviewAdjustment; | ||
glayoutManager: Clutter.BoxLayout & { | ||
_searchEntry: St.Bin | ||
}; | ||
|
||
_toggleAppsPage(): void | ||
|
||
_workspacesDisplay: { | ||
_swipeTracker: SwipeTracker | ||
}; | ||
|
||
_appDisplay: { | ||
_swipeTracker: SwipeTracker | ||
}; | ||
|
||
_searchController: { | ||
searchActive: boolean | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import Clutter from '@gi-types/clutter'; | ||
import GObject from '@gi-types/gobject2'; | ||
import Shell from '@gi-types/shell'; | ||
|
||
const global: import('@gi-types/shell').Global; | ||
|
||
// types | ||
export type CustomEventType = Pick< | ||
import('../../../clutter12').Event, | ||
'type' | 'get_gesture_phase' | | ||
'get_touchpad_gesture_finger_count' | 'get_time' | | ||
'get_coords' | 'get_gesture_motion_delta_unaccelerated' | | ||
'get_gesture_pinch_scale' | 'get_gesture_pinch_angle_delta' | ||
>; | ||
|
||
declare namespace __shell_private_types { | ||
class TouchpadGesture extends GObject.Object { | ||
destroy(): void; | ||
_handleEvent(actor: Clutter.Actor | undefined, event: CustomEventType): boolean; | ||
} | ||
|
||
interface IMonitorState { | ||
x: number, | ||
y: number, | ||
width: number, | ||
height: number, | ||
geometry_scale: number, | ||
index: number, | ||
inFullscreen: () => boolean, | ||
} | ||
} | ||
|
||
declare class SwipeTracker extends GObject.Object { | ||
orientation: Clutter.Orientation; | ||
enabled: boolean; | ||
allowLongSwipes: boolean; | ||
confirmSwipe(distance: number, snapPoints: number[], currentProgress: number, cancelProgress: number): void; | ||
destroy(): void; | ||
|
||
_touchGesture?: Clutter.GestureAction; | ||
_touchpadGesture?: __shell_private_types.TouchpadGesture; | ||
// custom | ||
__oldTouchpadGesture?: __shell_private_types.TouchpadGesture; | ||
// | ||
_allowedModes: Shell.ActionMode; | ||
|
||
_progress: number; | ||
_beginGesture(): void; | ||
_updateGesture(): void; | ||
_endTouchpadGesture(): void; | ||
_history: { | ||
reset(): void; | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Clutter from '../../../clutter12'; | ||
import Meta from '../../../meta12'; | ||
import { SwipeTracker } from './swipeTracker'; | ||
|
||
declare class WorkspaceAnimationController { | ||
_swipeTracker: SwipeTracker; | ||
_switchWorkspaceBegin(tracker: { | ||
orientation: Clutter.Orientation, | ||
confirmSwipe: typeof SwipeTracker.prototype.confirmSwipe | ||
}, monitor: number); | ||
|
||
_switchWorkspaceUpdate(tracker: SwipeTracker, progress: number); | ||
_switchWorkspaceEnd(tracker: SwipeTracker, duration: number, progress: number); | ||
|
||
movingWindow: Meta.Window | undefined; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import GLib from '@gi-types/glib2'; | ||
import { imports } from 'gnome-shell'; | ||
import { Extension } from 'resource:///org/gnome/shell/extensions/extension'; | ||
import { AllSettingsKeys, GioSettings, PinchGestureType } from './common/settings'; | ||
import * as Constants from './constants'; | ||
import { AltTabConstants, ExtSettings, TouchpadConstants } from './constants'; | ||
|
@@ -13,16 +13,17 @@ import { SnapWindowExtension } from './src/snapWindow'; | |
import * as DBusUtils from './src/utils/dbus'; | ||
import * as VKeyboard from './src/utils/keyboard'; | ||
|
||
const ExtensionUtils = imports.misc.extensionUtils; | ||
const extensionObject = Extension.lookupByUUID('gestureImprovements@gestures'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not necessary |
||
|
||
class Extension { | ||
class GNOMEGestureImprovementsExtension extends Extension { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. export default class GnomeGestureImprovements extends Extension { line 156 is not necessary?? |
||
private _extensions: ISubExtension[]; | ||
settings?: GioSettings; | ||
private _settingChangedId = 0; | ||
private _reloadWaitId = 0; | ||
private _addReloadDelayFor: AllSettingsKeys[]; | ||
|
||
constructor() { | ||
super(extensionObject.metadata); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. constructor(metadata: ExtensionMetadata) { |
||
this._extensions = []; | ||
this._addReloadDelayFor = [ | ||
'touchpad-speed-scale', | ||
|
@@ -32,7 +33,7 @@ class Extension { | |
} | ||
|
||
enable() { | ||
this.settings = ExtensionUtils.getSettings(); | ||
this.settings = this.getSettings(); | ||
this._settingChangedId = this.settings.connect('changed', this.reload.bind(this)); | ||
this._enable(); | ||
} | ||
|
@@ -152,5 +153,5 @@ class Extension { | |
} | ||
|
||
export function init(): IExtension { | ||
return new Extension(); | ||
return new GNOMEGestureImprovementsExtension(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
// import Gtk from '@gi-types/gtk4'; | ||
import Adw from '@gi-types/adw1'; | ||
import Gio from '@gi-types/gio2'; | ||
|
||
import { imports } from 'gnome-shell'; | ||
// import { imports } from 'gnome-shell'; | ||
import { buildPrefsWidget } from './common/prefs'; | ||
|
||
const ExtensionUtils = imports.misc.extensionUtils; | ||
const ExtMe = ExtensionUtils.getCurrentExtension(); | ||
import { ExtensionPreferences } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
export function init(): void { } | ||
interface TracksSettings { | ||
/** | ||
* The settings object backing the settings window. | ||
*/ | ||
_settings?: Gio.Settings; | ||
} | ||
|
||
export function fillPreferencesWindow(prefsWindow: Adw.PreferencesWindow) { | ||
const UIDirPath = ExtMe.dir.get_child('ui').get_path() ?? ''; | ||
const settings = ExtensionUtils.getSettings(); | ||
buildPrefsWidget(prefsWindow, settings, UIDirPath); | ||
// const ExtensionUtils = imports.misc.extensionUtils; | ||
// const ExtMe = ExtensionUtils.getCurrentExtension(); | ||
|
||
export default class GNOMEGestureImprovementsPreferences extends ExtensionPreferences { | ||
override fillPreferencesWindow(prefsWindow: Adw.PreferencesWindow & TracksSettings) { | ||
const UIDirPath = this.metadata.dir.get_child('ui').get_path() ?? ''; | ||
const settings = this.getSettings(); | ||
buildPrefsWidget(prefsWindow, settings, UIDirPath); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
( Extension, ExtensionMetadata} from ....