many changed, added nixos-hardware
This commit is contained in:
parent
f4f1c5bba7
commit
2accd81424
149 changed files with 19124 additions and 238 deletions
163
modules/styling/config/widgets/overview/searchbuttons.js
Normal file
163
modules/styling/config/widgets/overview/searchbuttons.js
Normal file
|
@ -0,0 +1,163 @@
|
|||
const { Gtk } = imports.gi;
|
||||
import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
const { execAsync, exec } = Utils;
|
||||
import { searchItem } from './searchitem.js';
|
||||
import { execAndClose, couldBeMath, launchCustomCommand } from './miscfunctions.js';
|
||||
|
||||
export const DirectoryButton = ({ parentPath, name, type, icon }) => {
|
||||
const actionText = Widget.Revealer({
|
||||
revealChild: false,
|
||||
transition: "crossfade",
|
||||
transitionDuration: 200,
|
||||
child: Widget.Label({
|
||||
className: 'overview-search-results-txt txt txt-small txt-action',
|
||||
label: 'Open',
|
||||
})
|
||||
});
|
||||
const actionTextRevealer = Widget.Revealer({
|
||||
revealChild: false,
|
||||
transition: "slide_left",
|
||||
transitionDuration: 300,
|
||||
child: actionText,
|
||||
});
|
||||
return Widget.Button({
|
||||
className: 'overview-search-result-btn',
|
||||
onClicked: () => {
|
||||
App.closeWindow('overview');
|
||||
execAsync(['bash', '-c', `xdg-open '${parentPath}/${name}'`, `&`]).catch(print);
|
||||
},
|
||||
child: Widget.Box({
|
||||
children: [
|
||||
Widget.Box({
|
||||
vertical: false,
|
||||
children: [
|
||||
Widget.Box({
|
||||
className: 'overview-search-results-icon',
|
||||
homogeneous: true,
|
||||
child: Widget.Icon({
|
||||
icon: icon,
|
||||
}),
|
||||
}),
|
||||
Widget.Label({
|
||||
className: 'overview-search-results-txt txt txt-norm',
|
||||
label: name,
|
||||
}),
|
||||
Widget.Box({ hexpand: true }),
|
||||
actionTextRevealer,
|
||||
]
|
||||
})
|
||||
]
|
||||
}),
|
||||
setup: (self) => self
|
||||
.on('focus-in-event', (button) => {
|
||||
actionText.revealChild = true;
|
||||
actionTextRevealer.revealChild = true;
|
||||
})
|
||||
.on('focus-out-event', (button) => {
|
||||
actionText.revealChild = false;
|
||||
actionTextRevealer.revealChild = false;
|
||||
})
|
||||
,
|
||||
})
|
||||
}
|
||||
|
||||
export const CalculationResultButton = ({ result, text }) => searchItem({
|
||||
materialIconName: 'calculate',
|
||||
name: `Math result`,
|
||||
actionName: "Copy",
|
||||
content: `${result}`,
|
||||
onActivate: () => {
|
||||
App.closeWindow('overview');
|
||||
execAsync(['wl-copy', `${result}`]).catch(print);
|
||||
},
|
||||
});
|
||||
|
||||
export const DesktopEntryButton = (app) => {
|
||||
const actionText = Widget.Revealer({
|
||||
revealChild: false,
|
||||
transition: "crossfade",
|
||||
transitionDuration: 200,
|
||||
child: Widget.Label({
|
||||
className: 'overview-search-results-txt txt txt-small txt-action',
|
||||
label: 'Launch',
|
||||
})
|
||||
});
|
||||
const actionTextRevealer = Widget.Revealer({
|
||||
revealChild: false,
|
||||
transition: "slide_left",
|
||||
transitionDuration: 300,
|
||||
child: actionText,
|
||||
});
|
||||
return Widget.Button({
|
||||
className: 'overview-search-result-btn',
|
||||
onClicked: () => {
|
||||
App.closeWindow('overview');
|
||||
app.launch();
|
||||
},
|
||||
child: Widget.Box({
|
||||
children: [
|
||||
Widget.Box({
|
||||
vertical: false,
|
||||
children: [
|
||||
Widget.Box({
|
||||
className: 'overview-search-results-icon',
|
||||
homogeneous: true,
|
||||
child: Widget.Icon({
|
||||
icon: app.iconName,
|
||||
}),
|
||||
}),
|
||||
Widget.Label({
|
||||
className: 'overview-search-results-txt txt txt-norm',
|
||||
label: app.name,
|
||||
}),
|
||||
Widget.Box({ hexpand: true }),
|
||||
actionTextRevealer,
|
||||
]
|
||||
})
|
||||
]
|
||||
}),
|
||||
setup: (self) => self
|
||||
.on('focus-in-event', (button) => {
|
||||
actionText.revealChild = true;
|
||||
actionTextRevealer.revealChild = true;
|
||||
})
|
||||
.on('focus-out-event', (button) => {
|
||||
actionText.revealChild = false;
|
||||
actionTextRevealer.revealChild = false;
|
||||
})
|
||||
,
|
||||
})
|
||||
}
|
||||
|
||||
export const ExecuteCommandButton = ({ command, terminal = false }) => searchItem({
|
||||
materialIconName: `${terminal ? 'terminal' : 'settings_b_roll'}`,
|
||||
name: `Run command`,
|
||||
actionName: `Execute ${terminal ? 'in terminal' : ''}`,
|
||||
content: `${command}`,
|
||||
onActivate: () => execAndClose(command, terminal),
|
||||
extraClassName: 'techfont',
|
||||
})
|
||||
|
||||
export const CustomCommandButton = ({ text = '' }) => searchItem({
|
||||
materialIconName: 'settings_suggest',
|
||||
name: 'Action',
|
||||
actionName: 'Run',
|
||||
content: `${text}`,
|
||||
onActivate: () => {
|
||||
App.closeWindow('overview');
|
||||
launchCustomCommand(text);
|
||||
},
|
||||
});
|
||||
|
||||
export const SearchButton = ({ text = '' }) => searchItem({
|
||||
materialIconName: 'travel_explore',
|
||||
name: 'Search Google',
|
||||
actionName: 'Go',
|
||||
content: `${text}`,
|
||||
onActivate: () => {
|
||||
App.closeWindow('overview');
|
||||
execAsync(['bash', '-c', `xdg-open 'https://www.google.com/search?q=${text} -site:quora.com' &`]).catch(print); // quora is useless
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue