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

An other suggestion: wlsunset (redshift equivalent) #42

Open
taschenlampe opened this issue Apr 28, 2021 · 12 comments
Open

An other suggestion: wlsunset (redshift equivalent) #42

taschenlampe opened this issue Apr 28, 2021 · 12 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@taschenlampe
Copy link
Collaborator

Just an other suggestion :-)
I use sway on my laptop and I really prefer a blue filter while looking at its screen at nights -> There is this nice little tool that adjusts the gamma for wayland/swaywm wlsunset. Though there is no rpm for opensuse yet, but it's pretty easy to install.

@m-rey
Copy link
Member

m-rey commented May 1, 2021

I've started packaging it here: https://build.opensuse.org/package/show/home:mrey/wlsunset

@jubalh
Copy link
Member

jubalh commented May 1, 2021

Accepted SR https://build.opensuse.org/request/show/889691 to devel project: https://build.opensuse.org/package/show/X11:Wayland/wlsunset

@denisok denisok added the enhancement New feature or request label May 2, 2021
@denisok
Copy link
Contributor

denisok commented May 2, 2021

cool, interesting how to integrate it to the solution ?

@denisok
Copy link
Contributor

denisok commented May 2, 2021

run it with something like:
curl -s http://ip-api.com/json/$(curl -s https://ipinfo.io/ip) | jq '.lat,.lon' | xargs bash -c 'wlsunset -l $0 -L $1' from sway config ? but what is the way to toggle on/off with way bar ? Something like pkill wlsunset ?

@jubalh
Copy link
Member

jubalh commented May 2, 2021

I'm fairly certain that people will complain about making connections to some website without them being aware :D But I don't see another solution out of the box.

@m-rey
Copy link
Member

m-rey commented May 3, 2021

wlsunset is packaged and in Factory now https://build.opensuse.org/package/show/openSUSE:Factory/wlsunset

@denisok
Copy link
Contributor

denisok commented May 3, 2021

I'm fairly certain that people will complain about making connections to some website without them being aware :D But I don't see another solution out of the box.

I agree :) we could just add it as config file for sway with everything commented out, and ppl could uncomment if they wish to use it.

@etam
Copy link

etam commented May 30, 2022

There is GeoClue for getting location: https://gitlab.freedesktop.org/geoclue/geoclue/-/wikis/home

Found it used here: https://phabricator.kde.org/source/plasma-redshift-control/browse/master/package/contents/ui/config/ConfigAdvanced.qml

@denisok denisok added the good first issue Good for newcomers label Jan 17, 2024
@krishjainx
Copy link
Contributor

I'm fairly certain that people will complain about making connections to some website without them being aware :D But I don't see another solution out of the box.

I agree :) we could just add it as config file for sway with everything commented out, and ppl could uncomment if they wish to use it.

I can do that. Is that fine? Please look at #132 also

@krishjainx
Copy link
Contributor

@denisok

@denisok
Copy link
Contributor

denisok commented Jan 18, 2024

@krishjainx sure, please do. I don't know though that it should be enabled by default, not everyone would like that feature. But having it as an option - cool

@krishjainx
Copy link
Contributor

krishjainx commented Feb 1, 2024

@denisok Using GeoClue and Dasbus (a DBus library from Red Hat), one could use the script below. The only dependency would be python3-dasbus.

What do you think?

from gi.repository import GLib
from dasbus.connection import SystemMessageBus
from dasbus.typing import get_variant

# Create an event loop
loop = GLib.MainLoop()

# Connect to the system bus
bus = SystemMessageBus()

# Get the Geoclue Manager interface
geoclue_manager = bus.get_proxy(
    "org.freedesktop.GeoClue2",
    "/org/freedesktop/GeoClue2/Manager"
)

# Get the client path and interface
client_path = geoclue_manager.GetClient()
geoclue_client = bus.get_proxy(
    "org.freedesktop.GeoClue2",
    client_path
)

# Set the DesktopId
geoclue_client.DesktopId = "wlsunset"

# Define a callback function to handle the LocationUpdated signal
def on_location_updated(old_path, new_path):
    # Get the location interface
    geoclue_location = bus.get_proxy(
        "org.freedesktop.GeoClue2",
        new_path
    )

    # Output the latitude and longitude
    print("Latitude:", geoclue_location.Latitude)
    print("Longitude:", geoclue_location.Longitude)

    # Stop the event loop
    loop.quit()

# Connect the callback function to the LocationUpdated signal
geoclue_client.LocationUpdated.connect(on_location_updated)

# Start the client
geoclue_client.Start()

# Run the event loop
loop.run()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: To do
Development

No branches or pull requests

6 participants