diff --git a/lib/types/options.d.ts b/lib/types/options.d.ts index 6c913f1..beb31f3 100644 --- a/lib/types/options.d.ts +++ b/lib/types/options.d.ts @@ -213,3 +213,5 @@ type MatugenTheme = 'light' | 'dark'; export type ColorMapKey = keyof typeof defaultColorMap; export type ColorMapValue = (typeof defaultColorMap)[ColorMapKey]; + +export type ScalingPriority = 'gdk' | 'hyprland' | 'both'; diff --git a/modules/menus/shared/dropdown/locationHandler/index.ts b/modules/menus/shared/dropdown/locationHandler/index.ts index 71752a7..5625cee 100644 --- a/modules/menus/shared/dropdown/locationHandler/index.ts +++ b/modules/menus/shared/dropdown/locationHandler/index.ts @@ -1,5 +1,6 @@ const hyprland = await Service.import('hyprland'); +import options from 'options'; import { bash } from 'lib/utils'; import { Widget as TWidget } from 'types/@girs/gtk-3.0/gtk-3.0.cjs'; import { Monitor } from 'types/service/hyprland'; @@ -12,6 +13,7 @@ type NestedBox = Box; type NestedEventBox = EventBox; const { location } = options.theme.bar; +const { scalingPriority } = options; export const moveBoxToCursor = (self: T, fixed: boolean): void => { if (fixed) { @@ -49,7 +51,14 @@ export const moveBoxToCursor = (self: T, fixed: boolea // end of the monitor is the 1430th pixel. const gdkScale = Utils.exec('bash -c "echo $GDK_SCALE"'); - if (/^\d+(.\d+)?$/.test(gdkScale)) { + if (scalingPriority.value === 'both') { + const scale = parseFloat(gdkScale); + monWidth = monWidth / scale; + monHeight = monHeight / scale; + + monWidth = monWidth / hyprScaling; + monHeight = monHeight / hyprScaling; + } else if (/^\d+(.\d+)?$/.test(gdkScale) && scalingPriority.value === 'gdk') { const scale = parseFloat(gdkScale); monWidth = monWidth / scale; monHeight = monHeight / scale; diff --git a/options.ts b/options.ts index 104e7c7..c711d28 100644 --- a/options.ts +++ b/options.ts @@ -16,6 +16,7 @@ import { NotificationAnchor, OSDAnchor, OSDOrientation, + ScalingPriority, WindowLayer, } from 'lib/types/options'; import { MatugenScheme, MatugenTheme, MatugenVariations } from 'lib/types/options'; @@ -1053,6 +1054,8 @@ const options = mkOptions(OPTIONS, { }, }, + scalingPriority: opt('gdk'), + terminal: opt('kitty'), tear: opt(false), diff --git a/widget/settings/pages/config/general/index.ts b/widget/settings/pages/config/general/index.ts index 4bf629b..3dc6c4a 100644 --- a/widget/settings/pages/config/general/index.ts +++ b/widget/settings/pages/config/general/index.ts @@ -50,6 +50,12 @@ export const BarGeneral = (): Scrollable => { }), Header('Scaling'), + Option({ + opt: options.scalingPriority, + title: 'Scaling Priority', + type: 'enum', + enums: ['both', 'gdk', 'hyprland'], + }), Option({ opt: options.theme.bar.scaling, title: 'Bar',