forked from Shinonome/dots-hyprland
workspace widget: side mouse btn for special ws
This commit is contained in:
@@ -175,15 +175,17 @@ export default () => EventBox({
|
|||||||
.catch(print);
|
.catch(print);
|
||||||
})
|
})
|
||||||
self.on('button-press-event', (self, event) => {
|
self.on('button-press-event', (self, event) => {
|
||||||
if (!(event.get_button()[1] === 1)) return; // We're only interested in left-click here
|
if (event.get_button()[1] === 1) {
|
||||||
self.attribute.clicked = true;
|
self.attribute.clicked = true;
|
||||||
const [_, cursorX, cursorY] = event.get_coords();
|
const [_, cursorX, cursorY] = event.get_coords();
|
||||||
const widgetWidth = self.get_allocation().width;
|
const widgetWidth = self.get_allocation().width;
|
||||||
// const wsId = Math.ceil(cursorX * NUM_OF_WORKSPACES_PER_GROUP / widgetWidth) + self.attribute.ws_group * NUM_OF_WORKSPACES_PER_GROUP;
|
const wsId = Math.ceil(cursorX * userOptions.workspaces.shown / widgetWidth);
|
||||||
// Hyprland.messageAsync(`dispatch workspace ${wsId}`).catch(print);
|
Utils.execAsync([`${App.configDir}/scripts/hyprland/workspace_action.sh`, 'workspace', `${wsId}`])
|
||||||
const wsId = Math.ceil(cursorX * userOptions.workspaces.shown / widgetWidth);
|
.catch(print);
|
||||||
Utils.execAsync([`${App.configDir}/scripts/hyprland/workspace_action.sh`, 'workspace', `${wsId}`])
|
}
|
||||||
.catch(print);
|
else if (event.get_button()[1] === 8) {
|
||||||
|
Hyprland.messageAsync(`dispatch togglespecialworkspace`).catch(print);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
self.on('button-release-event', (self) => self.attribute.clicked = false);
|
self.on('button-release-event', (self) => self.attribute.clicked = false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user