Added the ability to assign shortcuts to all bar modules. (#278)

This commit is contained in:
Jas Singh
2024-09-21 16:47:59 -07:00
committed by GitHub
parent 6be9030ac5
commit b47864d8e1
28 changed files with 497 additions and 94 deletions

View File

@@ -2,13 +2,13 @@ import options from 'options';
import { module } from '../module';
import { inputHandler } from 'customModules/utils';
import { computeNetwork } from './computeNetwork';
import { Module, NetstatLabelType } from 'lib/types/bar';
import Gtk from 'types/@girs/gtk-3.0/gtk-3.0';
import { BarBoxChild, NetstatLabelType } from 'lib/types/bar';
import Button from 'types/widgets/button';
import { NetworkResourceData } from 'lib/types/customModules/network';
import { NETWORK_LABEL_TYPES } from 'lib/types/defaults/bar';
import { GET_DEFAULT_NETSTAT_DATA } from 'lib/types/defaults/netstat';
import { pollVariable } from 'customModules/PollVar';
import { Attribute, Child } from 'lib/types/widget';
const {
label,
@@ -46,7 +46,7 @@ pollVariable(
rateUnit,
);
export const Netstat = (): Module => {
export const Netstat = (): BarBoxChild => {
const renderNetworkLabel = (lblType: NetstatLabelType, network: NetworkResourceData): string => {
switch (lblType) {
case 'in':
@@ -70,7 +70,7 @@ export const Netstat = (): Module => {
boxClass: 'netstat',
showLabelBinding: label.bind('value'),
props: {
setup: (self: Button<Gtk.Widget, Gtk.Widget>) => {
setup: (self: Button<Child, Attribute>) => {
inputHandler(self, {
onPrimaryClick: {
cmd: leftClick,