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:
33
modules/menus/shared/dropdown/eventBoxes/index.ts
Normal file
33
modules/menus/shared/dropdown/eventBoxes/index.ts
Normal 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),
|
||||
];
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user