Giter VIP home page Giter VIP logo

Comments (6)

cafetestrest avatar cafetestrest commented on July 17, 2024 2

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 bash script:

from dotfiles.

Aylur avatar Aylur commented on July 17, 2024

that is a left over from my eww setup. I might do it just to fill some space though

from dotfiles.

daUnknownCoder avatar daUnknownCoder commented on July 17, 2024

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:
image
image

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.

cafetestrest avatar cafetestrest commented on July 17, 2024

Perhaps a suggestion of what I did while back, but I just over-complicated the logic :)
Screenshot_2024-02-01_18-19-48

from dotfiles.

daUnknownCoder avatar daUnknownCoder commented on July 17, 2024

Perhaps a suggestion of what I did while back, but I just over-complicated the logic :) Screenshot_2024-02-01_18-19-48

omg thats way better than mine can i get the code?

from dotfiles.

daUnknownCoder avatar daUnknownCoder commented on July 17, 2024

Perhaps a suggestion of what I did while back, but I just over-complicated the logic :) Screenshot_2024-02-01_18-19-48

mine looks like this:
image

from dotfiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.