forked from Shinonome/dots-hyprland
ags: make not crash in sway
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
// Import
|
// Import
|
||||||
const { GLib } = imports.gi;
|
|
||||||
import App from 'resource:///com/github/Aylur/ags/app.js'
|
import App from 'resource:///com/github/Aylur/ags/app.js'
|
||||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js'
|
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js'
|
||||||
// Widgets
|
// Widgets
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const Applications = await service('applications');
|
|||||||
export const Audio = await service('audio');
|
export const Audio = await service('audio');
|
||||||
export const Battery = await service('battery');
|
export const Battery = await service('battery');
|
||||||
export const Bluetooth = await service('bluetooth');
|
export const Bluetooth = await service('bluetooth');
|
||||||
export const Hyprland = await service('hyprland');
|
// export const Hyprland = await service('hyprland');
|
||||||
export const Mpris = await service('mpris');
|
export const Mpris = await service('mpris');
|
||||||
export const Network = await service('network');
|
export const Network = await service('network');
|
||||||
export const Notifications = await service('notifications');
|
export const Notifications = await service('notifications');
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { MaterialIcon } from './materialicon.js';
|
|||||||
import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
|
import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
|
||||||
import Network from 'resource:///com/github/Aylur/ags/service/network.js';
|
import Network from 'resource:///com/github/Aylur/ags/service/network.js';
|
||||||
import Notifications from 'resource:///com/github/Aylur/ags/service/notifications.js';
|
import Notifications from 'resource:///com/github/Aylur/ags/service/notifications.js';
|
||||||
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
|
||||||
import { languages } from '../data/languages.js';
|
import { languages } from '../data/languages.js';
|
||||||
|
|
||||||
// A guessing func to try to support langs not listed in data/languages.js
|
// A guessing func to try to support langs not listed in data/languages.js
|
||||||
@@ -163,6 +162,8 @@ export const NetworkIndicator = () => Widget.Stack({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const HyprlandXkbKeyboardLayout = async ({ useFlag } = {}) => {
|
const HyprlandXkbKeyboardLayout = async ({ useFlag } = {}) => {
|
||||||
|
try {
|
||||||
|
const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default;
|
||||||
var initLangs = [];
|
var initLangs = [];
|
||||||
var languageStackArray = [];
|
var languageStackArray = [];
|
||||||
var currentKeyboard;
|
var currentKeyboard;
|
||||||
@@ -214,6 +215,9 @@ const HyprlandXkbKeyboardLayout = async ({ useFlag } = {}) => {
|
|||||||
});
|
});
|
||||||
widgetRevealer.child = widgetContent;
|
widgetRevealer.child = widgetContent;
|
||||||
return widgetRevealer;
|
return widgetRevealer;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const OptionalKeyboardLayout = async () => {
|
const OptionalKeyboardLayout = async () => {
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ apply_gtk() { # Using gradience-cli
|
|||||||
# (which is unreadable when broken when you use dark mode)
|
# (which is unreadable when broken when you use dark mode)
|
||||||
if [ "$lightdark" = "-l" ]; then
|
if [ "$lightdark" = "-l" ]; then
|
||||||
gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3'
|
gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3'
|
||||||
gsettings set org.gnome.desktop.interface color-scheme 'default'
|
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
|
||||||
else
|
else
|
||||||
gsettings set org.gnome.desktop.interface gtk-theme adw-gtk3-dark
|
gsettings set org.gnome.desktop.interface gtk-theme adw-gtk3-dark
|
||||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||||
|
|||||||
@@ -416,8 +416,8 @@ $onChatgpt: $onPrimary;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-todo-add {
|
.sidebar-todo-add {
|
||||||
@include full-rounding;
|
|
||||||
@include menu_decel;
|
@include menu_decel;
|
||||||
|
@include small-rounding;
|
||||||
min-width: 1.705rem;
|
min-width: 1.705rem;
|
||||||
min-height: 1.705rem;
|
min-height: 1.705rem;
|
||||||
color: $onSecondaryContainer;
|
color: $onSecondaryContainer;
|
||||||
@@ -435,7 +435,7 @@ $onChatgpt: $onPrimary;
|
|||||||
|
|
||||||
.sidebar-todo-add-available {
|
.sidebar-todo-add-available {
|
||||||
@include menu_decel;
|
@include menu_decel;
|
||||||
@include full-rounding;
|
@include small-rounding;
|
||||||
min-width: 1.705rem;
|
min-width: 1.705rem;
|
||||||
min-height: 1.705rem;
|
min-height: 1.705rem;
|
||||||
background-color: $primary;
|
background-color: $primary;
|
||||||
|
|||||||
@@ -1735,9 +1735,9 @@ tooltip {
|
|||||||
background-color: #52696f; }
|
background-color: #52696f; }
|
||||||
|
|
||||||
.sidebar-todo-add {
|
.sidebar-todo-add {
|
||||||
border-radius: 9999px;
|
|
||||||
-gtk-outline-radius: 9999px;
|
|
||||||
transition: 300ms cubic-bezier(0.1, 1, 0, 1);
|
transition: 300ms cubic-bezier(0.1, 1, 0, 1);
|
||||||
|
border-radius: 0.818rem;
|
||||||
|
-gtk-outline-radius: 0.818rem;
|
||||||
min-width: 1.705rem;
|
min-width: 1.705rem;
|
||||||
min-height: 1.705rem;
|
min-height: 1.705rem;
|
||||||
color: #cde7ed;
|
color: #cde7ed;
|
||||||
@@ -1752,8 +1752,8 @@ tooltip {
|
|||||||
|
|
||||||
.sidebar-todo-add-available {
|
.sidebar-todo-add-available {
|
||||||
transition: 300ms cubic-bezier(0.1, 1, 0, 1);
|
transition: 300ms cubic-bezier(0.1, 1, 0, 1);
|
||||||
border-radius: 9999px;
|
border-radius: 0.818rem;
|
||||||
-gtk-outline-radius: 9999px;
|
-gtk-outline-radius: 0.818rem;
|
||||||
min-width: 1.705rem;
|
min-width: 1.705rem;
|
||||||
min-height: 1.705rem;
|
min-height: 1.705rem;
|
||||||
background-color: #85e3f4;
|
background-color: #85e3f4;
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import App from 'resource:///com/github/Aylur/ags/app.js';
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
|
||||||
import { RoundedCorner } from "../../lib/roundedcorner.js";
|
import { RoundedCorner } from "../../lib/roundedcorner.js";
|
||||||
import Brightness from '../../services/brightness.js';
|
import Brightness from '../../services/brightness.js';
|
||||||
import Indicator from '../../services/indicator.js';
|
import Indicator from '../../services/indicator.js';
|
||||||
|
|
||||||
const WindowTitle = async () => Widget.Scrollable({
|
const WindowTitle = async () => {
|
||||||
|
try {
|
||||||
|
const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default;
|
||||||
|
return Widget.Scrollable({
|
||||||
hexpand: true, vexpand: true,
|
hexpand: true, vexpand: true,
|
||||||
hscroll: 'automatic', vscroll: 'never',
|
hscroll: 'automatic', vscroll: 'never',
|
||||||
child: Widget.Box({
|
child: Widget.Box({
|
||||||
@@ -27,16 +29,13 @@ const WindowTitle = async () => Widget.Scrollable({
|
|||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
|
|
||||||
const OptionalWindowTitle = async () => {
|
|
||||||
try {
|
|
||||||
return await WindowTitle();
|
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
const OptionalWindowTitleInstance = await OptionalWindowTitle();
|
|
||||||
|
const OptionalWindowTitleInstance = await WindowTitle();
|
||||||
|
|
||||||
export const ModuleLeftSpace = () => Widget.EventBox({
|
export const ModuleLeftSpace = () => Widget.EventBox({
|
||||||
onScrollUp: () => {
|
onScrollUp: () => {
|
||||||
|
|||||||
@@ -2,29 +2,25 @@ const { Gtk } = imports.gi;
|
|||||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
|
|
||||||
import { ModuleLeftSpace } from "./leftspace.js";
|
import { ModuleLeftSpace } from "./leftspace.js";
|
||||||
import { ModuleMusic } from "./music.js";
|
|
||||||
import { ModuleRightSpace } from "./rightspace.js";
|
import { ModuleRightSpace } from "./rightspace.js";
|
||||||
|
import { ModuleMusic } from "./music.js";
|
||||||
import { ModuleSystem } from "./system.js";
|
import { ModuleSystem } from "./system.js";
|
||||||
const OptionalWorkspaces = async () => {
|
const OptionalWorkspaces = async () => {
|
||||||
try {
|
try {
|
||||||
return (await import('./workspaces_hyprland.js')).default();
|
return (await import('./workspaces_hyprland.js')).default();
|
||||||
} catch {
|
} catch {
|
||||||
// return (await import('./workspaces_sway.js')).default();
|
// return (await import('./workspaces_sway.js')).default();
|
||||||
return Box({});
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const left = Widget.Box({
|
const left = Widget.Box({
|
||||||
className: 'bar-sidemodule',
|
className: 'bar-sidemodule',
|
||||||
children: [
|
children: [ ModuleMusic()],
|
||||||
ModuleMusic()
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const center = Widget.Box({
|
const center = Widget.Box({
|
||||||
children: [
|
children: [await OptionalWorkspaces()],
|
||||||
await OptionalWorkspaces(),
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const right = Widget.Box({
|
const right = Widget.Box({
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||||
import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
|
import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
|
||||||
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
|
||||||
const { execAsync, exec } = Utils;
|
const { execAsync, exec } = Utils;
|
||||||
import { AnimatedCircProg } from "../../lib/animatedcircularprogress.js";
|
import { AnimatedCircProg } from "../../lib/animatedcircularprogress.js";
|
||||||
import { showMusicControls } from '../../variables.js';
|
import { showMusicControls } from '../../variables.js';
|
||||||
@@ -30,9 +29,18 @@ const TrackProgress = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const moveToRelativeWorkspace = async (self, num) => {
|
||||||
|
try {
|
||||||
|
const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default;
|
||||||
|
Hyprland.sendMessage(`dispatch workspace ${num > 0 ? '+' : ''}${num}`);
|
||||||
|
} catch {
|
||||||
|
console.log(`TODO: Sway workspace ${num > 0 ? '+' : ''}${num}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const ModuleMusic = () => Widget.EventBox({ // TODO: use cairo to make button bounce smaller on click
|
export const ModuleMusic = () => Widget.EventBox({ // TODO: use cairo to make button bounce smaller on click
|
||||||
onScrollUp: () => Hyprland.sendMessage(`dispatch workspace -1`),
|
onScrollUp: (self) => moveToRelativeWorkspace(self, -1),
|
||||||
onScrollDown: () => Hyprland.sendMessage(`dispatch workspace +1`),
|
onScrollDown: (self) => moveToRelativeWorkspace(self, +1),
|
||||||
onPrimaryClickRelease: () => showMusicControls.setValue(!showMusicControls.value),
|
onPrimaryClickRelease: () => showMusicControls.setValue(!showMusicControls.value),
|
||||||
onSecondaryClickRelease: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` &']),
|
onSecondaryClickRelease: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` &']),
|
||||||
onMiddleClickRelease: () => execAsync('playerctl play-pause').catch(print),
|
onMiddleClickRelease: () => execAsync('playerctl play-pause').catch(print),
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ export const ModuleRightSpace = () => {
|
|||||||
Audio.speaker.volume -= 0.03;
|
Audio.speaker.volume -= 0.03;
|
||||||
Indicator.popup(1);
|
Indicator.popup(1);
|
||||||
},
|
},
|
||||||
// onHover: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', true) },
|
onHover: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', true) },
|
||||||
// onHoverLost: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', false) },
|
onHoverLost: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', false) },
|
||||||
onPrimaryClick: () => App.toggleWindow('sideright'),
|
onPrimaryClick: () => App.toggleWindow('sideright'),
|
||||||
onSecondaryClickRelease: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` &']).catch(print),
|
onSecondaryClickRelease: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` &']).catch(print),
|
||||||
onMiddleClickRelease: () => execAsync('playerctl play-pause').catch(print),
|
onMiddleClickRelease: () => execAsync('playerctl play-pause').catch(print),
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
|||||||
const { Box, Label, Button, Overlay, Revealer, Scrollable, Stack, EventBox } = Widget;
|
const { Box, Label, Button, Overlay, Revealer, Scrollable, Stack, EventBox } = Widget;
|
||||||
const { exec, execAsync } = Utils;
|
const { exec, execAsync } = Utils;
|
||||||
const { GLib } = imports.gi;
|
const { GLib } = imports.gi;
|
||||||
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
|
||||||
import Battery from 'resource:///com/github/Aylur/ags/service/battery.js';
|
import Battery from 'resource:///com/github/Aylur/ags/service/battery.js';
|
||||||
import { MaterialIcon } from '../../lib/materialicon.js';
|
import { MaterialIcon } from '../../lib/materialicon.js';
|
||||||
import { AnimatedCircProg } from "../../lib/animatedcircularprogress.js";
|
import { AnimatedCircProg } from "../../lib/animatedcircularprogress.js";
|
||||||
@@ -14,7 +13,7 @@ const BATTERY_LOW = 20;
|
|||||||
|
|
||||||
const BatBatteryProgress = () => {
|
const BatBatteryProgress = () => {
|
||||||
const _updateProgress = (circprog) => { // Set circular progress value
|
const _updateProgress = (circprog) => { // Set circular progress value
|
||||||
circprog.css = `font-size: ${Battery.percent}px;`
|
circprog.css = `font-size: ${Math.abs(Battery.percent)}px;`
|
||||||
|
|
||||||
circprog.toggleClassName('bar-batt-circprog-low', Battery.percent <= BATTERY_LOW);
|
circprog.toggleClassName('bar-batt-circprog-low', Battery.percent <= BATTERY_LOW);
|
||||||
circprog.toggleClassName('bar-batt-circprog-full', Battery.charged);
|
circprog.toggleClassName('bar-batt-circprog-full', Battery.charged);
|
||||||
@@ -187,9 +186,18 @@ const BarGroup = ({ child }) => Widget.Box({
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const moveToRelativeWorkspace = async (self, num) => {
|
||||||
|
try {
|
||||||
|
const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default;
|
||||||
|
Hyprland.sendMessage(`dispatch workspace ${num > 0 ? '+' : ''}${num}`);
|
||||||
|
} catch {
|
||||||
|
console.log(`TODO: Sway workspace ${num > 0 ? '+' : ''}${num}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const ModuleSystem = () => Widget.EventBox({
|
export const ModuleSystem = () => Widget.EventBox({
|
||||||
onScrollUp: () => Hyprland.sendMessage(`dispatch workspace -1`),
|
onScrollUp: (self) => moveToRelativeWorkspace(self, -1),
|
||||||
onScrollDown: () => Hyprland.sendMessage(`dispatch workspace +1`),
|
onScrollDown: (self) => moveToRelativeWorkspace(self, +1),
|
||||||
onPrimaryClick: () => App.toggleWindow('sideright'),
|
onPrimaryClick: () => App.toggleWindow('sideright'),
|
||||||
child: Widget.Box({
|
child: Widget.Box({
|
||||||
className: 'spacing-h-5',
|
className: 'spacing-h-5',
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const WorkspaceContents = (count = 10) => {
|
|||||||
let workspaceMask = 0;
|
let workspaceMask = 0;
|
||||||
for (let i = 0; i < workspaces.length; i++) {
|
for (let i = 0; i < workspaces.length; i++) {
|
||||||
const ws = workspaces[i];
|
const ws = workspaces[i];
|
||||||
if (ws.id < 0) continue; // Ignore scratchpads
|
if (ws.id <= 0) continue; // Ignore scratchpads
|
||||||
if (ws.id > count) return; // Not rendered
|
if (ws.id > count) return; // Not rendered
|
||||||
if (workspaces[i].windows > 0) {
|
if (workspaces[i].windows > 0) {
|
||||||
workspaceMask |= (1 << ws.id);
|
workspaceMask |= (1 << ws.id);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import GraphWidget from './graph.js'
|
|||||||
export default () => Widget.Window({
|
export default () => Widget.Window({
|
||||||
name: 'desktopbackground',
|
name: 'desktopbackground',
|
||||||
anchor: ['top', 'bottom', 'left', 'right'],
|
anchor: ['top', 'bottom', 'left', 'right'],
|
||||||
layer: 'background',
|
layer: 'bottom',
|
||||||
exclusivity: 'normal',
|
exclusivity: 'normal',
|
||||||
visible: true,
|
visible: true,
|
||||||
child: Widget.Overlay({
|
child: Widget.Overlay({
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
|||||||
import Service from 'resource:///com/github/Aylur/ags/service.js';
|
import Service from 'resource:///com/github/Aylur/ags/service.js';
|
||||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||||
|
|
||||||
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
|
||||||
const { Box, EventBox, Button, Revealer } = Widget;
|
const { Box, EventBox, Button, Revealer } = Widget;
|
||||||
const { execAsync, exec } = Utils;
|
const { execAsync, exec } = Utils;
|
||||||
import { MaterialIcon } from '../../lib/materialicon.js';
|
import { MaterialIcon } from '../../lib/materialicon.js';
|
||||||
@@ -146,12 +145,19 @@ const keyboardWindow = Box({
|
|||||||
|
|
||||||
const gestureEvBox = EventBox({ child: keyboardWindow })
|
const gestureEvBox = EventBox({ child: keyboardWindow })
|
||||||
const gesture = Gtk.GestureDrag.new(gestureEvBox);
|
const gesture = Gtk.GestureDrag.new(gestureEvBox);
|
||||||
gesture.connect('drag-begin', () => {
|
gesture.connect('drag-begin', async () => {
|
||||||
|
try {
|
||||||
|
const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default;
|
||||||
Hyprland.sendMessage('j/cursorpos').then((out) => {
|
Hyprland.sendMessage('j/cursorpos').then((out) => {
|
||||||
gesture.startY = JSON.parse(out).y;
|
gesture.startY = JSON.parse(out).y;
|
||||||
}).catch(print);
|
}).catch(print);
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
gesture.connect('drag-update', () => {
|
gesture.connect('drag-update', async () => {
|
||||||
|
try {
|
||||||
|
const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default;
|
||||||
Hyprland.sendMessage('j/cursorpos').then((out) => {
|
Hyprland.sendMessage('j/cursorpos').then((out) => {
|
||||||
const currentY = JSON.parse(out).y;
|
const currentY = JSON.parse(out).y;
|
||||||
const offset = gesture.startY - currentY;
|
const offset = gesture.startY - currentY;
|
||||||
@@ -162,6 +168,9 @@ gesture.connect('drag-update', () => {
|
|||||||
margin-bottom: ${offset}px;
|
margin-bottom: ${offset}px;
|
||||||
`);
|
`);
|
||||||
}).catch(print);
|
}).catch(print);
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
gesture.connect('drag-end', () => {
|
gesture.connect('drag-end', () => {
|
||||||
var offset = gesture.get_offset()[2];
|
var offset = gesture.get_offset()[2];
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const OptionalOverview = async () => {
|
|||||||
try {
|
try {
|
||||||
return (await import('./overview_hyprland.js')).default();
|
return (await import('./overview_hyprland.js')).default();
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return Widget.Box({});
|
||||||
// return (await import('./overview_hyprland.js')).default();
|
// return (await import('./overview_hyprland.js')).default();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,11 +22,8 @@ export const chatGPTTabIcon = Box({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const chatGPTInfo = Box({
|
const ChatGPTInfo = () => {
|
||||||
vertical: true,
|
const openAiLogo = Icon({
|
||||||
className: 'spacing-v-15',
|
|
||||||
children: [
|
|
||||||
Icon({
|
|
||||||
hpack: 'center',
|
hpack: 'center',
|
||||||
className: 'sidebar-chat-welcome-logo',
|
className: 'sidebar-chat-welcome-logo',
|
||||||
icon: `${App.configDir}/assets/openai-logomark.svg`,
|
icon: `${App.configDir}/assets/openai-logomark.svg`,
|
||||||
@@ -36,7 +33,12 @@ const chatGPTInfo = Box({
|
|||||||
const height = styleContext.get_property('min-height', Gtk.StateFlags.NORMAL);
|
const height = styleContext.get_property('min-height', Gtk.StateFlags.NORMAL);
|
||||||
self.size = Math.max(width, height, 1) * 116 / 180; // Why such a specific proportion? See https://openai.com/brand#logos
|
self.size = Math.max(width, height, 1) * 116 / 180; // Why such a specific proportion? See https://openai.com/brand#logos
|
||||||
})
|
})
|
||||||
}),
|
});
|
||||||
|
return Box({
|
||||||
|
vertical: true,
|
||||||
|
className: 'spacing-v-15',
|
||||||
|
children: [
|
||||||
|
openAiLogo,
|
||||||
Label({
|
Label({
|
||||||
className: 'txt txt-title-small sidebar-chat-welcome-txt',
|
className: 'txt txt-title-small sidebar-chat-welcome-txt',
|
||||||
wrap: true,
|
wrap: true,
|
||||||
@@ -62,9 +64,10 @@ const chatGPTInfo = Box({
|
|||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export const chatGPTSettings = MarginRevealer({
|
export const ChatGPTSettings = () => MarginRevealer({
|
||||||
transition: 'slide_down',
|
transition: 'slide_down',
|
||||||
revealChild: true,
|
revealChild: true,
|
||||||
extraSetup: (self) => self
|
extraSetup: (self) => self
|
||||||
@@ -124,7 +127,7 @@ export const chatGPTSettings = MarginRevealer({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
export const openaiApiKeyInstructions = Box({
|
export const OpenaiApiKeyInstructions = () => Box({
|
||||||
homogeneous: true,
|
homogeneous: true,
|
||||||
children: [Revealer({
|
children: [Revealer({
|
||||||
transition: 'slide_down',
|
transition: 'slide_down',
|
||||||
@@ -158,9 +161,9 @@ export const chatGPTWelcome = Box({
|
|||||||
vpack: 'center',
|
vpack: 'center',
|
||||||
vertical: true,
|
vertical: true,
|
||||||
children: [
|
children: [
|
||||||
chatGPTInfo,
|
ChatGPTInfo(),
|
||||||
openaiApiKeyInstructions,
|
OpenaiApiKeyInstructions(),
|
||||||
chatGPTSettings, ``
|
ChatGPTSettings(),
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
|||||||
|
|
||||||
import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
|
import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
|
||||||
import Network from 'resource:///com/github/Aylur/ags/service/network.js';
|
import Network from 'resource:///com/github/Aylur/ags/service/network.js';
|
||||||
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
|
||||||
const { execAsync, exec } = Utils;
|
const { execAsync, exec } = Utils;
|
||||||
import { BluetoothIndicator, NetworkIndicator } from "../../lib/statusicons.js";
|
import { BluetoothIndicator, NetworkIndicator } from "../../lib/statusicons.js";
|
||||||
import { setupCursorHover } from "../../lib/cursorhover.js";
|
import { setupCursorHover } from "../../lib/cursorhover.js";
|
||||||
@@ -62,7 +61,9 @@ export const ToggleIconBluetooth = (props = {}) => Widget.Button({
|
|||||||
...props,
|
...props,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const HyprToggleIcon = (icon, name, hyprlandConfigValue, props = {}) => Widget.Button({
|
export const HyprToggleIcon = async (icon, name, hyprlandConfigValue, props = {}) => {
|
||||||
|
try {
|
||||||
|
return Widget.Button({
|
||||||
className: 'txt-small sidebar-iconbutton',
|
className: 'txt-small sidebar-iconbutton',
|
||||||
tooltipText: `${name}`,
|
tooltipText: `${name}`,
|
||||||
onClicked: (button) => {
|
onClicked: (button) => {
|
||||||
@@ -80,6 +81,10 @@ export const HyprToggleIcon = (icon, name, hyprlandConfigValue, props = {}) => W
|
|||||||
},
|
},
|
||||||
...props,
|
...props,
|
||||||
})
|
})
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const ModuleNightLight = (props = {}) => Widget.Button({ // TODO: Make this work
|
export const ModuleNightLight = (props = {}) => Widget.Button({ // TODO: Make this work
|
||||||
attribute: {
|
attribute: {
|
||||||
@@ -104,7 +109,10 @@ export const ModuleNightLight = (props = {}) => Widget.Button({ // TODO: Make th
|
|||||||
...props,
|
...props,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ModuleInvertColors = (props = {}) => Widget.Button({
|
export const ModuleInvertColors = async (props = {}) => {
|
||||||
|
try {
|
||||||
|
const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default;
|
||||||
|
return Widget.Button({
|
||||||
className: 'txt-small sidebar-iconbutton',
|
className: 'txt-small sidebar-iconbutton',
|
||||||
tooltipText: 'Color inversion',
|
tooltipText: 'Color inversion',
|
||||||
onClicked: (button) => {
|
onClicked: (button) => {
|
||||||
@@ -129,6 +137,10 @@ export const ModuleInvertColors = (props = {}) => Widget.Button({
|
|||||||
setup: setupCursorHover,
|
setup: setupCursorHover,
|
||||||
...props,
|
...props,
|
||||||
})
|
})
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export const ModuleIdleInhibitor = (props = {}) => Widget.Button({ // TODO: Make this work
|
export const ModuleIdleInhibitor = (props = {}) => Widget.Button({ // TODO: Make this work
|
||||||
attribute: {
|
attribute: {
|
||||||
@@ -173,9 +185,9 @@ export const ModuleEditIcon = (props = {}) => Widget.Button({ // TODO: Make this
|
|||||||
export const ModuleReloadIcon = (props = {}) => Widget.Button({
|
export const ModuleReloadIcon = (props = {}) => Widget.Button({
|
||||||
...props,
|
...props,
|
||||||
className: 'txt-small sidebar-iconbutton',
|
className: 'txt-small sidebar-iconbutton',
|
||||||
tooltipText: 'Reload Hyprland',
|
tooltipText: 'Reload Environment config',
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
execAsync(['bash', '-c', 'hyprctl reload &']);
|
execAsync(['bash', '-c', 'hyprctl reload || swaymsg reload &']);
|
||||||
App.toggleWindow('sideright');
|
App.toggleWindow('sideright');
|
||||||
},
|
},
|
||||||
child: MaterialIcon('refresh', 'norm'),
|
child: MaterialIcon('refresh', 'norm'),
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ const togglesBox = Widget.Box({
|
|||||||
children: [
|
children: [
|
||||||
ToggleIconWifi(),
|
ToggleIconWifi(),
|
||||||
ToggleIconBluetooth(),
|
ToggleIconBluetooth(),
|
||||||
HyprToggleIcon('mouse', 'Raw input', 'input:force_no_accel', {}),
|
await HyprToggleIcon('mouse', 'Raw input', 'input:force_no_accel', {}),
|
||||||
HyprToggleIcon('front_hand', 'No touchpad while typing', 'input:touchpad:disable_while_typing', {}),
|
await HyprToggleIcon('front_hand', 'No touchpad while typing', 'input:touchpad:disable_while_typing', {}),
|
||||||
ModuleNightLight(),
|
ModuleNightLight(),
|
||||||
ModuleInvertColors(),
|
await ModuleInvertColors(),
|
||||||
ModuleIdleInhibitor(),
|
ModuleIdleInhibitor(),
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user