Comments (6)
omg thats way better than mine can i get the code?
They are already public just a mess in the files, I think this is all of the required files, but could be more.
ags:
- weather service: https://github.com/cafetestrest/nixos/blob/main/config/ags/js/services/weather.js
- weather popup window: https://github.com/cafetestrest/nixos/blob/main/config/ags/js/dashboard/Weather.js
- weather widget logic: https://github.com/cafetestrest/nixos/blob/main/config/ags/js/bar/buttons/Weather.js
- add it in topbar: https://github.com/cafetestrest/nixos/blob/main/config/ags/js/bar/TopBar.js
- add it in QS: https://github.com/cafetestrest/nixos/blob/main/config/ags/js/quicksettings/QuickSettings.js
- add service in globals.js: https://github.com/cafetestrest/nixos/blob/main/config/ags/js/settings/globals.js
- weather scss: https://github.com/cafetestrest/nixos/blob/main/config/ags/scss/widgets/dashboard.scss
weather bash script:
- https://github.com/cafetestrest/nixos/blob/main/config/scripts/openweathermap.sh
- you need to create your own file for providing location and api key or update the code to hard-code it (ConfigFile variable in openweathermap.sh)
from dotfiles.
that is a left over from my eww setup. I might do it just to fill some space though
from dotfiles.
Hi @Aylur , I know that we can implement a custom widgets that suit us, have you ever tough about creating a weather widget for your own setup?
i have a close thing to what he might have done:
2024-01-30_19-47-18.mp4
this is the code:
main Weather.js
to be put in ~/.config/ags/js/bar/buttons/Weather.js
import { Widget, Variable } from '../../imports.js';
import App from 'resource:///com/github/Aylur/ags/app.js';
import PanelButton from '../PanelButton.js';
import Gdk from 'gi://Gdk';
const weather = Variable(
{},
{
poll: [
30000,
`python ${App.configDir}/assets/weather`,
out => JSON.parse(out),
],
}
);
export const Weather = () =>
PanelButton({
class_name: 'weather',
content: Widget.Label({
binds: [['label', weather, 'value', value => value.text || '']],
}),
window: 'weather-tooltip',
connections: [
[
weather,
(self, value) => {
if (value) {
self.set_tooltip_text(value.tooltip || 'Weather Data');
}
},
],
],
on_primary_click: btn => {
let menu = Widget.Menu({
children: [
Widget.MenuItem({
child: Widget.Label({
label: weather.value.tooltip || '',
use_markup: true, // Enable Pango markup
}),
}),
],
});
menu.popup_at_widget(
btn,
Gdk.Gravity.SOUTH,
Gdk.Gravity.NORTH,
null
);
},
});
imports.js
to be put in ~/.config/ags/js/
const resource = file => `resource:///com/github/Aylur/ags/${file}.js`;
const require = async file => (await import(resource(file))).default;
const service = async file => await require(`service/${file}`);
export const App = await require('app');
export const Widget = await require('widget');
export const Service = await require('service');
export const Variable = await require('variable');
export const Utils = await import(resource('utils'));
export const Applications = await service('applications');
export const Audio = await service('audio');
export const Battery = await service('battery');
export const Bluetooth = await service('bluetooth');
export const Hyprland = await service('hyprland');
export const Mpris = await service('mpris');
export const Network = await service('network');
export const Notifications = await service('notifications');
export const SystemTray = await service('systemtray');
see the code was copied from @PoSayDone's dotfiles and then refactored and edited a little bit for a better view.
from dotfiles.
Perhaps a suggestion of what I did while back, but I just over-complicated the logic :)
from dotfiles.
Perhaps a suggestion of what I did while back, but I just over-complicated the logic :)
omg thats way better than mine can i get the code?
from dotfiles.
Perhaps a suggestion of what I did while back, but I just over-complicated the logic :)
from dotfiles.
Related Issues (20)
- Missing Icons HOT 5
- requiring girepository but it has 2 version available HOT 1
- Bring back bar with gaps between blocks HOT 1
- Seperate top bar background color HOT 2
- Support non-Hyprland Wayland compositors? HOT 1
- QuickSettings: Network-Settings does not work. HOT 2
- [Bug] Notification view so wide HOT 3
- failed to build matugen because of material-colors HOT 2
- apps with default-workspace set as special workspace are crashing. HOT 1
- [Bug] Duplicate media controllers when playing in browser after installing plasma-browser-integration HOT 2
- Implement third party JS modules HOT 4
- Gnome Control Center Bluetooth Page HOT 2
- Prevent ags from changing hyprland config values HOT 2
- Enable/Disable greetd HOT 1
- Taskbar fix
- Current workspace indicator sometimes shows incorrect workspace HOT 3
- Anonymous lambda error/ 'home-manager.users.<username>.__ignoreNulls’ does not exist
- Which GUI utility is shown in the screenshots on the left ?
- error running ags
- How to resize a PopupWindow to the screen it is toggled on?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotfiles.