diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..8392d15 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/.gitignore b/.gitignore index 00c1844..1af4b5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.direnv/ \ No newline at end of file +.direnv/ +node_modules/ \ No newline at end of file diff --git a/extension.ts b/extension.ts index 0edfd6c..9d515ea 100644 --- a/extension.ts +++ b/extension.ts @@ -1,14 +1,29 @@ import { Extension } from "resource:///org/gnome/shell/extensions/extension.js" -import * as Main from "resource:///org/gnome/shell/ui/main.js" -import * as MessageTray from "resource:///org/gnome/shell/ui/messageTray.js" +import Gio from "gi://Gio" -export default class MyExtension extends Extension { +export default class AutoRotate extends Extension { + _listenerId?: number enable() { - Main.notify( - "Simple Notification", - "A notification with a title and body" + this._listenerId = global.display.connect( + "in-fullscreen-changed", + () => { + const monitors = global.display.get_n_monitors() + const isFullscreen = + [...new Array(monitors)].findIndex((_, index) => + global.display.get_monitor_in_fullscreen(index) + ) != -1 + + const { Meta } = imports.gi; + const monitorManager = Meta.MonitorManager.; + if (isFullscreen) { + } else { + } + } ) } - disable() {} + disable() { + if (this._listenerId != null) + global.display.disconnect(this._listenerId) + } } diff --git a/flake.nix b/flake.nix index 2a7728b..c458e4c 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,10 @@ in { _module.args.pkgs = import inputs.nixpkgs {inherit system;}; + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [nodejs]; + }; + packages.default = pkgs.buildNpmPackage (finalAttrs: { pname = name; version = "1.0.0"; @@ -46,7 +50,7 @@ }; }); - apps.install = { + apps.default = { type = "app"; program = let file = "/tmp/${uuid}.zip"; @@ -54,6 +58,7 @@ pkgs.writeShellScriptBin "build" '' env -C ${self'.packages.default}/${extDir} ${lib.getExe pkgs.zip} ${file} -FS9r . gnome-extensions install --force ${file} + dbus-run-session -- gnome-shell --nested --wayland ''; }; };