diff --git a/modules/ags/config/scss/wim-widgets/quick-settings.scss b/modules/ags/config/scss/wim-widgets/quick-settings.scss index 40b9d7a..44c8678 100644 --- a/modules/ags/config/scss/wim-widgets/quick-settings.scss +++ b/modules/ags/config/scss/wim-widgets/quick-settings.scss @@ -17,7 +17,6 @@ margin-left: 15px; margin-right: 10px; min-width: 50px; - transition: color 0.3s ease-in-out; } .scrolled-indicator { @@ -147,6 +146,7 @@ .slider { min-height: 55px; + margin-right: -15px; scale { min-width: 400px; diff --git a/modules/ags/config/services/tablet.ts b/modules/ags/config/services/tablet.ts index cd526c1..5ce3d29 100644 --- a/modules/ags/config/services/tablet.ts +++ b/modules/ags/config/services/tablet.ts @@ -25,6 +25,7 @@ class Tablet extends Service { 'device-fetched': ['boolean'], 'autorotate-started': ['boolean'], 'autorotate-destroyed': ['boolean'], + 'autorotate-toggled': ['boolean'], 'inputs-blocked': ['boolean'], 'inputs-unblocked': ['boolean'], 'laptop-mode': ['boolean'], @@ -43,6 +44,10 @@ class Tablet extends Service { return this.#tabletMode; } + get autorotateState() { + return this.#autorotate !== null; + } + get oskState() { return this.#oskState; } @@ -144,6 +149,7 @@ class Tablet extends Service { }, ); this.emit('autorotate-started', true); + this.emit('autorotate-toggled', true); } killAutorotate() { @@ -151,6 +157,7 @@ class Tablet extends Service { this.#autorotate.force_exit(); this.#autorotate = null; this.emit('autorotate-destroyed', true); + this.emit('autorotate-toggled', false); } } diff --git a/modules/ags/config/ts/quick-settings/button-grid.ts b/modules/ags/config/ts/quick-settings/button-grid.ts index 401b182..536864d 100644 --- a/modules/ags/config/ts/quick-settings/button-grid.ts +++ b/modules/ags/config/ts/quick-settings/button-grid.ts @@ -1,6 +1,8 @@ const Bluetooth = await Service.import('bluetooth'); const Network = await Service.import('network'); +import Tablet from '../../services/tablet.ts'; + const { Box, Icon, Label, Revealer } = Widget; const { execAsync } = Utils; @@ -11,25 +13,29 @@ import Separator from '../misc/separator.ts'; import { NetworkMenu } from './network.ts'; import { BluetoothMenu } from './bluetooth.ts'; -// Types +/* Types */ import GObject from 'types/@girs/gobject-2.0/gobject-2.0'; import { Variable as Var } from 'types/variable.ts'; + import { BoxGeneric, IconGeneric, LabelGeneric, RevealerGeneric, } from 'global-types'; + type IconTuple = [ GObject.Object, - (self: IconGeneric) => void, + (self: IconGeneric, state?: boolean) => void, signal?: string, ]; + type IndicatorTuple = [ GObject.Object, (self: LabelGeneric) => void, signal?: string, ]; + type GridButtonType = { command?(): void secondary_command?(): void @@ -40,10 +46,11 @@ type GridButtonType = { menu?: Widget }; + +// TODO: do vpn button const SPACING = 28; const ButtonStates = [] as Array>; - const GridButton = ({ command = () => {/**/}, secondary_command = () => {/**/}, @@ -240,19 +247,6 @@ const FirstRow = () => Row({ on_open: () => Network.wifi.scan(), }), - // TODO: do vpn - GridButton({ - command: () => { - // - }, - - secondary_command: () => { - // - }, - - icon: 'airplane-mode-disabled-symbolic', - }), - GridButton({ command: () => Bluetooth.toggle(), @@ -285,6 +279,13 @@ const FirstRow = () => Row({ }, }), + GridButton({ + command: () => { + execAsync(['lock']).catch(print); + }, + secondary_command: () => App.openWindow('win-powermenu'), + icon: 'system-lock-screen-symbolic', + }), ], }); @@ -322,13 +323,21 @@ const SecondRow = () => Row({ }], }), - // TODO: replace this with Rotation Toggle and move lock to a separate section GridButton({ command: () => { - execAsync(['lock']).catch(print); + if (Tablet.autorotateState) { + Tablet.killAutorotate(); + } + else { + Tablet.startAutorotate(); + } }, - secondary_command: () => App.openWindow('win-powermenu'), - icon: 'system-lock-screen-symbolic', + + icon: [Tablet, (self, state) => { + self.icon = state ? + 'screen-rotate-auto-on-symbolic' : + 'screen-rotate-auto-off-symbolic'; + }, 'autorotate-toggled'], }), ], }); diff --git a/modules/ags/config/ts/setup.ts b/modules/ags/config/ts/setup.ts index 032fa2f..7fec5ac 100644 --- a/modules/ags/config/ts/setup.ts +++ b/modules/ags/config/ts/setup.ts @@ -49,7 +49,7 @@ export default () => { TouchGestures.addGesture({ name: 'openOverview', - nFingers: '4', + nFingers: '3', gesture: 'UD', command: 'hyprctl dispatch hyprexpo:expo on', });