openSUSE / openSUSEway

dotfiles for Sway on openSUSE
MIT License
92 stars 17 forks source link

An other suggestion: wlsunset (redshift equivalent) #42

Open taschenlampe opened 3 years ago

taschenlampe commented 3 years ago

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 commented 3 years ago

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

jubalh commented 3 years ago

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

denisok commented 3 years ago

cool, interesting how to integrate it to the solution ?

denisok commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

denisok commented 3 years ago

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 commented 2 years ago

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

krishjainx commented 8 months ago

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 https://github.com/openSUSE/openSUSEway/pull/132 also

krishjainx commented 8 months ago

@denisok

denisok commented 8 months ago

@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 commented 8 months ago

@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()