mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
@@ -0,0 +1,17 @@
|
||||
const { GLib } = imports.gi;
|
||||
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
const { execAsync, exec } = Utils;
|
||||
|
||||
export let monitors;
|
||||
|
||||
// ughh condition race theoretically but overview won't be open at init so i guess it's okay
|
||||
async function updateStuff() {
|
||||
monitors = JSON.parse(exec('hyprctl monitors -j'))
|
||||
monitors.forEach(monitor => {
|
||||
monitor.width /= monitor.scale;
|
||||
monitor.height /= monitor.scale;
|
||||
});
|
||||
}
|
||||
|
||||
updateStuff();
|
||||
@@ -1,7 +1,7 @@
|
||||
const { Gdk } = imports.gi;
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import PopupWindow from '../.widgethacks/popupwindow.js';
|
||||
import { SCREEN_HEIGHT, SCREEN_WIDTH } from '../../variables.js';
|
||||
import { monitors } from '../.miscutils/hyprlanddata.js';
|
||||
|
||||
const WINDOWS_NEED_CLICK2CLOSE = [
|
||||
'sideleft', 'sideright', 'overview', 'cheatsheet'
|
||||
@@ -43,8 +43,8 @@ export default (monitor = 0) => PopupWindow({
|
||||
child: Widget.Box({
|
||||
css: `
|
||||
${userOptions.appearance.layerSmoke ? 'background-color: rgba(0,0,0,' + String(userOptions.appearance.layerSmokeStrength) + ');' : ''}
|
||||
min-height: ${SCREEN_HEIGHT}px;
|
||||
min-width: ${SCREEN_WIDTH}px;
|
||||
min-height: ${monitors[monitor].height}px;
|
||||
min-width: ${monitors[monitor].width}px;
|
||||
`
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const { Gdk, GdkPixbuf, Gio, GLib, Gtk } = imports.gi;
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
import { SCREEN_HEIGHT, SCREEN_WIDTH } from '../../variables.js';
|
||||
const { exec, execAsync } = Utils;
|
||||
const { Box, Button, Label, Stack } = Widget;
|
||||
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
||||
@@ -9,6 +8,7 @@ import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
||||
import Wallpaper from '../../services/wallpaper.js';
|
||||
import { setupCursorHover } from '../.widgetutils/cursorhover.js';
|
||||
import { clamp } from '../.miscutils/mathfuncs.js';
|
||||
import { monitors } from '../.miscutils/hyprlanddata.js';
|
||||
|
||||
const DISABLE_AGS_WALLPAPER = true;
|
||||
|
||||
@@ -16,11 +16,9 @@ const SWITCHWALL_SCRIPT_PATH = `${App.configDir}/scripts/color_generation/switch
|
||||
const WALLPAPER_ZOOM_SCALE = 1.25; // For scrolling when we switch workspace
|
||||
const MAX_WORKSPACES = 10;
|
||||
|
||||
const WALLPAPER_OFFSCREEN_X = (WALLPAPER_ZOOM_SCALE - 1) * SCREEN_WIDTH;
|
||||
const WALLPAPER_OFFSCREEN_Y = (WALLPAPER_ZOOM_SCALE - 1) * SCREEN_HEIGHT;
|
||||
|
||||
|
||||
export default (monitor = 0) => {
|
||||
const WALLPAPER_OFFSCREEN_X = (WALLPAPER_ZOOM_SCALE - 1) * monitors[monitor].width;
|
||||
const WALLPAPER_OFFSCREEN_Y = (WALLPAPER_ZOOM_SCALE - 1) * monitors[monitor].height;
|
||||
const wallpaperImage = Widget.DrawingArea({
|
||||
attribute: {
|
||||
pixbuf: undefined,
|
||||
@@ -33,7 +31,7 @@ export default (monitor = 0) => {
|
||||
},
|
||||
className: 'bg-wallpaper-transition',
|
||||
setup: (self) => {
|
||||
self.set_size_request(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
self.set_size_request(monitors[monitor].width, monitors[monitor].height);
|
||||
self
|
||||
// TODO: reduced updates using timeouts to reduce lag
|
||||
// .hook(Hyprland.active.workspace, (self) => {
|
||||
@@ -61,8 +59,8 @@ export default (monitor = 0) => {
|
||||
if (!wallPath || wallPath === "") return;
|
||||
self.attribute.pixbuf = GdkPixbuf.Pixbuf.new_from_file(wallPath);
|
||||
|
||||
const scale_x = SCREEN_WIDTH * WALLPAPER_ZOOM_SCALE / self.attribute.pixbuf.get_width();
|
||||
const scale_y = SCREEN_HEIGHT * WALLPAPER_ZOOM_SCALE / self.attribute.pixbuf.get_height();
|
||||
const scale_x = monitors[monitor].width * WALLPAPER_ZOOM_SCALE / self.attribute.pixbuf.get_width();
|
||||
const scale_y = monitors[monitor].height * WALLPAPER_ZOOM_SCALE / self.attribute.pixbuf.get_height();
|
||||
const scale_factor = Math.max(scale_x, scale_y);
|
||||
|
||||
self.attribute.pixbuf = self.attribute.pixbuf.scale_simple(
|
||||
@@ -86,7 +84,7 @@ export default (monitor = 0) => {
|
||||
hpack: 'center',
|
||||
justification: 'center',
|
||||
className: 'txt-large',
|
||||
label: `No wallpaper loaded.\nAn image ≥ ${SCREEN_WIDTH * WALLPAPER_ZOOM_SCALE} × ${SCREEN_HEIGHT * WALLPAPER_ZOOM_SCALE} is recommended.`,
|
||||
label: `No wallpaper loaded.\nAn image ≥ ${monitors[monitor].width * WALLPAPER_ZOOM_SCALE} × ${monitors[monitor].height * WALLPAPER_ZOOM_SCALE} is recommended.`,
|
||||
}),
|
||||
Button({
|
||||
hpack: 'center',
|
||||
@@ -107,7 +105,7 @@ export default (monitor = 0) => {
|
||||
},
|
||||
setup: (self) => self
|
||||
.hook(Wallpaper, (self) => {
|
||||
if(DISABLE_AGS_WALLPAPER) {
|
||||
if (DISABLE_AGS_WALLPAPER) {
|
||||
self.shown = 'disabled';
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const { Gtk, GLib } = imports.gi;
|
||||
import { SCREEN_HEIGHT, SCREEN_WIDTH } from '../../variables.js';
|
||||
import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
@@ -263,45 +262,6 @@ export default (monitor = 0) => {
|
||||
const dockRevealer = Revealer({
|
||||
attribute: {
|
||||
'updateShow': self => { // I only use mouse to resize. I don't care about keyboard resize if that's a thing
|
||||
// const dockSize = [
|
||||
// dockContent.get_allocated_width(),
|
||||
// dockContent.get_allocated_height()
|
||||
// ]
|
||||
// const dockAt = [
|
||||
// SCREEN_WIDTH / 2 - dockSize[0] / 2,
|
||||
// SCREEN_HEIGHT - dockSize[1],
|
||||
// ];
|
||||
// const dockLeft = dockAt[0];
|
||||
// const dockRight = dockAt[0] + dockSize[0];
|
||||
// const dockTop = dockAt[1];
|
||||
// const dockBottom = dockAt[1] + dockSize[1];
|
||||
//
|
||||
// const currentWorkspace = Hyprland.active.workspace.id;
|
||||
// var toReveal = true;
|
||||
// const hyprlandClients = JSON.parse(exec('hyprctl clients -j'));
|
||||
// for (const index in hyprlandClients) {
|
||||
// const client = hyprlandClients[index];
|
||||
// const clientLeft = client.at[0];
|
||||
// const clientRight = client.at[0] + client.size[0];
|
||||
// const clientTop = client.at[1];
|
||||
// const clientBottom = client.at[1] + client.size[1];
|
||||
//
|
||||
// if (client.workspace.id == currentWorkspace) {
|
||||
// if (
|
||||
// // clientLeft < dockRight &&
|
||||
// // clientRight > dockLeft &&
|
||||
// // clientTop < dockBottom &&
|
||||
// // clientBottom > dockTop
|
||||
// ) {
|
||||
// self.revealChild = false;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // if (currentWorkspace === client.workspace.id) {
|
||||
// self.revealChild = true;
|
||||
// // }
|
||||
|
||||
if (userOptions.dock.monitorExclusivity)
|
||||
self.revealChild = Hyprland.active.monitor.id === monitor;
|
||||
else
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
//
|
||||
const { Gdk, Gtk } = imports.gi;
|
||||
const { Gravity } = imports.gi.Gdk;
|
||||
import { SCREEN_HEIGHT, SCREEN_WIDTH } from '../../variables.js';
|
||||
import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
@@ -15,13 +14,14 @@ const { execAsync, exec } = Utils;
|
||||
import { setupCursorHoverGrab } from '../.widgetutils/cursorhover.js';
|
||||
import { dumpToWorkspace, swapWorkspace } from "./actions.js";
|
||||
import { substitute } from "../.miscutils/icons.js";
|
||||
import { monitors } from '../.miscutils/hyprlanddata.js';
|
||||
|
||||
const NUM_OF_WORKSPACES_SHOWN = userOptions.overview.numOfCols * userOptions.overview.numOfRows;
|
||||
const TARGET = [Gtk.TargetEntry.new('text/plain', Gtk.TargetFlags.SAME_APP, 0)];
|
||||
|
||||
const overviewTick = Variable(false);
|
||||
|
||||
export default () => {
|
||||
export default (overviewMonitor = 0) => {
|
||||
const clientMap = new Map();
|
||||
let workspaceGroup = 0;
|
||||
const ContextMenuWorkspaceArray = ({ label, actionFunc, thisWorkspace }) => Widget.MenuItem({
|
||||
@@ -49,20 +49,20 @@ export default () => {
|
||||
}
|
||||
})
|
||||
|
||||
const Window = ({ address, at: [x, y], size: [w, h], workspace: { id, name }, class: c, title, xwayland }, screenCoords) => {
|
||||
const Window = ({ address, at: [x, y], size: [w, h], workspace: { id, name }, class: c, monitor, title, xwayland }, screenCoords) => {
|
||||
const revealInfoCondition = (Math.min(w, h) * userOptions.overview.scale > 70);
|
||||
if (w <= 0 || h <= 0 || (c === '' && title === '')) return null;
|
||||
// Non-primary monitors
|
||||
if (screenCoords.x != 0) x -= screenCoords.x;
|
||||
if (screenCoords.y != 0) y -= screenCoords.y;
|
||||
// Other offscreen adjustments
|
||||
if (x + w <= 0) x += (Math.floor(x / SCREEN_WIDTH) * SCREEN_WIDTH);
|
||||
if (x + w <= 0) x += (Math.floor(x / monitors[monitor].width) * monitors[monitor].width);
|
||||
else if (x < 0) { w = x + w; x = 0; }
|
||||
if (y + h <= 0) x += (Math.floor(y / SCREEN_HEIGHT) * SCREEN_HEIGHT);
|
||||
if (y + h <= 0) x += (Math.floor(y / monitors[monitor].height) * monitors[monitor].height);
|
||||
else if (y < 0) { h = y + h; y = 0; }
|
||||
// Truncate if offscreen
|
||||
if (x + w > SCREEN_WIDTH) w = SCREEN_WIDTH - x;
|
||||
if (y + h > SCREEN_HEIGHT) h = SCREEN_HEIGHT - y;
|
||||
if (x + w > monitors[monitor]) w = monitors[monitor] - x;
|
||||
if (y + h > monitors[monitor].height) h = monitors[monitor].height - y;
|
||||
|
||||
const appIcon = Widget.Icon({
|
||||
icon: substitute(c),
|
||||
@@ -141,8 +141,8 @@ export default () => {
|
||||
truncate: 'end',
|
||||
className: `margin-top-5 ${xwayland ? 'txt txt-italic' : 'txt'}`,
|
||||
css: `
|
||||
font-size: ${Math.min(SCREEN_WIDTH, SCREEN_HEIGHT) * userOptions.overview.scale / 14.6}px;
|
||||
margin: 0px ${Math.min(SCREEN_WIDTH, SCREEN_HEIGHT) * userOptions.overview.scale / 10}px;
|
||||
font-size: ${Math.min(monitors[monitor].width, monitors[monitor].height) * userOptions.overview.scale / 14.6}px;
|
||||
margin: 0px ${Math.min(monitors[monitor].width, monitors[monitor].height) * userOptions.overview.scale / 10}px;
|
||||
`,
|
||||
// If the title is too short, include the class
|
||||
label: (title.length <= 1 ? `${c}: ${title}` : title),
|
||||
@@ -213,8 +213,8 @@ export default () => {
|
||||
className: 'overview-tasks-workspace-number',
|
||||
label: `${index}`,
|
||||
css: `
|
||||
margin: ${Math.min(SCREEN_WIDTH, SCREEN_HEIGHT) * userOptions.overview.scale * userOptions.overview.wsNumMarginScale}px;
|
||||
font-size: ${SCREEN_HEIGHT * userOptions.overview.scale * userOptions.overview.wsNumScale}px;
|
||||
margin: ${Math.min(monitors[overviewMonitor].width, monitors[overviewMonitor].height) * userOptions.overview.scale * userOptions.overview.wsNumMarginScale}px;
|
||||
font-size: ${monitors[overviewMonitor].height * userOptions.overview.scale * userOptions.overview.wsNumScale}px;
|
||||
`,
|
||||
setup: (self) => self.hook(Hyprland.active.workspace, (self) => {
|
||||
// Update when going to new ws group
|
||||
@@ -227,8 +227,8 @@ export default () => {
|
||||
className: 'overview-tasks-workspace',
|
||||
vpack: 'center',
|
||||
css: `
|
||||
min-width: ${SCREEN_WIDTH * userOptions.overview.scale}px;
|
||||
min-height: ${SCREEN_HEIGHT * userOptions.overview.scale}px;
|
||||
min-width: ${monitors[overviewMonitor].width * userOptions.overview.scale}px;
|
||||
min-height: ${monitors[overviewMonitor].height * userOptions.overview.scale}px;
|
||||
`,
|
||||
children: [Widget.EventBox({
|
||||
hexpand: true,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// This is for the cool memory indicator on the sidebar
|
||||
// For the right pill of the bar, see system.js
|
||||
const { Gdk, Gtk } = imports.gi;
|
||||
import { SCREEN_HEIGHT, SCREEN_WIDTH } from '../../variables.js';
|
||||
import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
import { monitors } from '../.miscutils/hyprlanddata.js';
|
||||
|
||||
const { exec, execAsync } = Utils;
|
||||
|
||||
@@ -98,8 +98,8 @@ export default ({ id = '' }) => {
|
||||
return Widget.Box({
|
||||
className: 'session-bg',
|
||||
css: `
|
||||
min-width: ${SCREEN_WIDTH}px;
|
||||
min-height: ${SCREEN_HEIGHT}px;
|
||||
min-width: ${monitors[(id == '' ? 0 : id)].width}px;
|
||||
min-height: ${monitors[(id == '' ? 0 : id)].height}px;
|
||||
`, // idk why but height = screen height doesn't fill
|
||||
vertical: true,
|
||||
children: [
|
||||
|
||||
@@ -15,10 +15,6 @@ globalThis['openMusicControls'] = showMusicControls;
|
||||
globalThis['openColorScheme'] = showColorScheme;
|
||||
globalThis['mpris'] = Mpris;
|
||||
|
||||
// Screen size
|
||||
export const SCREEN_WIDTH = Number(exec(`bash -c "xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1 | head -1" | awk '{print $1}'`));
|
||||
export const SCREEN_HEIGHT = Number(exec(`bash -c "xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2 | head -1" | awk '{print $1}'`));
|
||||
|
||||
// Mode switching
|
||||
export const currentShellMode = Variable('normal', {}) // normal, focus
|
||||
globalThis['currentMode'] = currentShellMode;
|
||||
|
||||
Reference in New Issue
Block a user