Added the ability to change bar locations. (#257)

* Added the ability to change bar locations.

* Update dropdown margins

* Make dropdown to bar gap configurable and organized code.
This commit is contained in:
Jas Singh
2024-09-14 23:29:00 -07:00
committed by GitHub
parent 4238a5516e
commit 8c2537b917
21 changed files with 420 additions and 367 deletions

View File

@@ -0,0 +1,33 @@
import { Attribute, BoxWidget } from 'lib/types/widget';
import EventBox from 'types/widgets/eventbox';
import { BarLocation } from 'lib/types/options';
const createEventBox = (className: string, windowName: string): EventBox<BoxWidget, Attribute> => {
return Widget.EventBox({
class_name: className,
hexpand: true,
vexpand: false,
can_focus: false,
child: Widget.Box(),
setup: (w) => {
w.on('button-press-event', () => App.toggleWindow(windowName));
},
});
};
export const barEventMargins = (
windowName: string,
location: BarLocation = 'top',
): [EventBox<BoxWidget, Attribute>, EventBox<BoxWidget, Attribute>] => {
if (location === 'top') {
return [
createEventBox('mid-eb event-top-padding-static', windowName),
createEventBox('mid-eb event-top-padding', windowName),
];
} else {
return [
createEventBox('mid-eb event-bottom-padding', windowName),
createEventBox('mid-eb event-bottom-padding-static', windowName),
];
}
};