forked from Shinonome/dots-hyprland
more Hyprland.sendMessage
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { Service, Utils, Widget } from '../../imports.js';
|
import { Service, Utils, Widget } from '../../imports.js';
|
||||||
import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
|
import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
|
||||||
import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
|
import Audio from 'resource:///com/github/Aylur/ags/service/audio.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,8 +31,8 @@ const TrackProgress = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ModuleMusic = () => Widget.EventBox({
|
export const ModuleMusic = () => Widget.EventBox({
|
||||||
onScrollUp: () => execAsync('hyprctl dispatch workspace -1'),
|
onScrollUp: () => Hyprland.sendMessage(`dispatch workspace -1`),
|
||||||
onScrollDown: () => execAsync('hyprctl dispatch workspace +1'),
|
onScrollDown: () => Hyprland.sendMessage(`dispatch workspace +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: () => Mpris.getPlayer('')?.playPause(),
|
onMiddleClickRelease: () => Mpris.getPlayer('')?.playPause(),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { Service, Utils, Widget } from '../../imports.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";
|
||||||
@@ -173,8 +174,8 @@ const BarGroup = ({ child }) => Widget.Box({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const ModuleSystem = () => Widget.EventBox({
|
export const ModuleSystem = () => Widget.EventBox({
|
||||||
onScrollUp: () => execAsync('hyprctl dispatch workspace -1'),
|
onScrollUp: () => Hyprland.sendMessage(`dispatch workspace -1`),
|
||||||
onScrollDown: () => execAsync('hyprctl dispatch workspace +1'),
|
onScrollDown: () => Hyprland.sendMessage(`dispatch workspace +1`),
|
||||||
onPrimaryClick: () => App.toggleWindow('sideright'),
|
onPrimaryClick: () => App.toggleWindow('sideright'),
|
||||||
child: Widget.Box({
|
child: Widget.Box({
|
||||||
className: 'spacing-h-5',
|
className: 'spacing-h-5',
|
||||||
|
|||||||
@@ -126,10 +126,10 @@ const client = ({ address, size: [w, h], workspace: { id, name }, class: c, titl
|
|||||||
hpack: 'center',
|
hpack: 'center',
|
||||||
vpack: 'center',
|
vpack: 'center',
|
||||||
onClicked: () => {
|
onClicked: () => {
|
||||||
execAsync([`bash`, `-c`, `hyprctl dispatch focuswindow address:${address}`, `&`]).catch(print);
|
Hyprland.sendMessage(`dispatch focuswindow address:${address}`);
|
||||||
App.closeWindow('overview');
|
App.closeWindow('overview');
|
||||||
},
|
},
|
||||||
onMiddleClickRelease: () => execAsync([`bash`, `-c`, `hyprctl dispatch closewindow address:${address}`, `&`]).catch(print),
|
onMiddleClickRelease: () => Hyprland.sendMessage(`dispatch closewindow address:${address}`),
|
||||||
onSecondaryClick: (button) => {
|
onSecondaryClick: (button) => {
|
||||||
button.toggleClassName('overview-tasks-window-selected', true);
|
button.toggleClassName('overview-tasks-window-selected', true);
|
||||||
const menu = Widget.Menu({
|
const menu = Widget.Menu({
|
||||||
@@ -140,10 +140,7 @@ const client = ({ address, size: [w, h], workspace: { id, name }, class: c, titl
|
|||||||
xalign: 0,
|
xalign: 0,
|
||||||
label: "Close (Middle-click)",
|
label: "Close (Middle-click)",
|
||||||
}),
|
}),
|
||||||
onActivate: () => {
|
onActivate: () => Hyprland.sendMessage(`dispatch closewindow address:${address}`),
|
||||||
execAsync([`bash`, `-c`, `hyprctl dispatch closewindow address:${address}`, `&`])
|
|
||||||
.catch(print);
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
ContextWorkspaceArray({
|
ContextWorkspaceArray({
|
||||||
label: "Dump windows to workspace",
|
label: "Dump windows to workspace",
|
||||||
@@ -243,15 +240,15 @@ const workspace = index => {
|
|||||||
children: [Widget.EventBox({
|
children: [Widget.EventBox({
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
vexpand: true,
|
vexpand: true,
|
||||||
onPrimaryClickRelease: () => {
|
onPrimaryClick: () => {
|
||||||
execAsync([`bash`, `-c`, `hyprctl dispatch workspace ${index}`, `&`]).catch(print);
|
Hyprland.sendMessage(`dispatch workspace ${index}`)
|
||||||
App.closeWindow('overview');
|
App.closeWindow('overview');
|
||||||
},
|
},
|
||||||
setup: eventbox => {
|
setup: (eventbox) => {
|
||||||
eventbox.drag_dest_set(Gtk.DestDefaults.ALL, TARGET, Gdk.DragAction.COPY);
|
eventbox.drag_dest_set(Gtk.DestDefaults.ALL, TARGET, Gdk.DragAction.COPY);
|
||||||
eventbox.connect('drag-data-received', (_w, _c, _x, _y, data) => {
|
eventbox.connect('drag-data-received', (_w, _c, _x, _y, data) => {
|
||||||
overviewTick.value = !overviewTick.value;
|
overviewTick.value = !overviewTick.value;
|
||||||
execAsync([`bash`, `-c`, `hyprctl dispatch movetoworkspacesilent ${index},address:${data.get_text()}`, `&`]).catch(print);
|
Hyprland.sendMessage(`dispatch movetoworkspacesilent ${index},address:${data.get_text()}`)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: fixed,
|
child: fixed,
|
||||||
@@ -434,7 +431,7 @@ export const SearchAndWindows = () => {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
App.closeWindow('overview');
|
App.closeWindow('overview');
|
||||||
execAsync(['bash', '-c', `xdg-open 'https://www.google.com/search?q=${text} -site:quora.com' &`]).catch(print); // fuck quora
|
execAsync(['bash', '-c', `xdg-open 'https://www.google.com/search?q=${text} -site:quora.com' &`]).catch(print); // quora is useless
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Actually onChange but this is ta workaround for a bug
|
// Actually onChange but this is ta workaround for a bug
|
||||||
|
|||||||
@@ -167,6 +167,6 @@ export const SearchButton = ({ text = '' }) => searchItem({
|
|||||||
content: `${text}`,
|
content: `${text}`,
|
||||||
onActivate: () => {
|
onActivate: () => {
|
||||||
App.closeWindow('overview');
|
App.closeWindow('overview');
|
||||||
execAsync(['bash', '-c', `xdg-open 'https://www.google.com/search?q=${text} -site:quora.com' &`]).catch(print); // fuck quora
|
execAsync(['bash', '-c', `xdg-open 'https://www.google.com/search?q=${text} -site:quora.com' &`]).catch(print); // quora is useless
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user