Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ags(statusicons): add customizable order for utilities #818

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .config/ags/modules/.configuration/user_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ let configOptions = {
// Array of bar modes for each monitor. Hit Ctrl+Alt+Slash to cycle.
// Modes: "normal", "focus" (workspace indicator only), "nothing"
// Example for four monitors: ["normal", "focus", "normal", "nothing"]
'modes': ["normal"]
'modes': ["normal"],
// Change Order to reorder, remove to hide
'utilities': ['snip', 'picker', 'keyboard']
},
}

Expand Down
53 changes: 35 additions & 18 deletions .config/ags/modules/bar/normal/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,45 @@ const UtilButton = ({ name, icon, onClicked }) => Button({
label: `${icon}`,
})

const Utilities = () => Box({
hpack: 'center',
className: 'spacing-h-4',
children: [
UtilButton({
name: 'Screen snip', icon: 'screenshot_region', onClicked: () => {
Utils.execAsync(`${App.configDir}/scripts/grimblast.sh copy area`)
.catch(print)
const Utilities = () => {
const availableUtilities = {
snip: {
name: "Screen snip",
icon: "screenshot_region",
onClicked: () => {
Utils.execAsync(`${App.configDir}/scripts/grimblast.sh copy area`).catch(print);
}
}),
UtilButton({
name: 'Color picker', icon: 'colorize', onClicked: () => {
Utils.execAsync(['hyprpicker', '-a']).catch(print)
},
picker: {
name: "Color picker",
icon: "colorize",
onClicked: () => {
Utils.execAsync(['hyprpicker', '-a']).catch(print);
}
}),
UtilButton({
name: 'Toggle on-screen keyboard', icon: 'keyboard', onClicked: () => {
},
keyboard: {
name: "Toggle on-screen keyboard",
icon: "keyboard",
onClicked: () => {
toggleWindowOnAllMonitors('osk');
}
}),
]
})
},
};

const utilityButtons = userOptions.bar.utilities
.filter(utility => availableUtilities[utility])
.map(utility => UtilButton({
name: availableUtilities[utility].name,
icon: availableUtilities[utility].icon,
onClicked: availableUtilities[utility].onClicked,
}));

return Box({
hpack: 'center',
className: 'spacing-h-4',
children: utilityButtons,
});
}

const BarBattery = () => Box({
className: 'spacing-h-4 bar-batt-txt',
Expand Down