reujab / wallpaper Goto Github PK
View Code? Open in Web Editor NEWA cross-platform Golang library for getting and setting desktop wallpapers
License: The Unlicense
A cross-platform Golang library for getting and setting desktop wallpapers
License: The Unlicense
//file, err := os.Create(filepath.Join(cacheDir, "wallpaper"))
tsNano := strconv.FormatInt(time.Now().UnixNano()/1e6, 10)
file, err := os.Create(filepath.Join(cacheDir, "wallpaper"+tsNano))
If the wallpaper file is in use on MacOS, it cannot be overwritten again;
Add the time parameter to the temporary file wallpaper to solve this problem
Hi, would it be possible to add a feature to enable setting the wallpaper only on one screen? So I can set separate wallpapers across different screens.
My output from env
is here
from what i can see DESKTOP_SESSION
and KDG_CURRENT_DESKTOP
are unset (this is what causes the message)
think detection could be implemented by checking first the environment then if thats empty checking if the process "i3" is running.
this or this could help, i'll also try and find a fix myself and if i do i'll pr it :)
EDIT: possible fix on linux, looking in /proc
The code i used to test your library is here
Cheers!
I know win7 is outdated now, but my mobile development laptop is win7.
NOTE: go build
and go run
don't work, No errors, they act like nothing is wrong, but the results have no effect on the wallpaper, FOR EXAMPLE, these two exe files attached, were build on the systems labeled, and below is the EXACT SAME SOURCE code (one file, wallpaper.go)
package main
import (
"fmt"
"os"
"time"
"github.com/reujab/wallpaper"
)
var URL = "https://mgo.azureedge.net/cloudcache/7/c/2/f/3/4/7c2f345bdfcadb8a3faf483ebaa2e9aea712bbdb.jpg"
var file = ""
func main() {
//Check to see if image is provided
if len(os.Args) >= 2 {
file = os.Args[1]
}
//If no image provided, set wallpaper to Default Windows 10 wallpaper
if file == "" {
wallpaper.SetFromURL(URL)
fmt.Println("")
fmt.Println("To use, drag and drop a image onto the exe, as if you were moving it to a folder.")
fmt.Println("Default behavior is to reset to the default windows wallpaper")
time.Sleep(30 * time.Second)
} else {
// If a image is provided, set that as the wallpaper
wallpaper.SetFromFile(file)
}
}
TL;DR
go build
/go run
returns no results on windows 7
prebuilt exe from win10 results in the wallpaper working
Hi.
I am using your library in my project. Some one opened an issue indicating that connecting a secundary screen on MacOS the program did not changed the wallpaper on that screen. It was changed only in the primary screen.
Is there a flag to set the wallpaper on all screens?
Thanks mate!
when i run the example code in linux(deepin/ubuntu):
panic: exec: "dconf": executable file not found in $PATH
goroutine 1 [running]:
main.main()
/home/lizi/space/gospace/test/wallpaper.go:13 +0xe5
exit status 2
I am unable to make the program use a PNG image as a wallpaper in windows 7
The wallpaper library works fine on windows, but fails to set wallpaper on Fedora LXDE as well as Fedora GNOME. I get a black screen as wallpaper on LXDE and a blank blue screen on GNOME.
Try these
wallpaper.SetFromFile("C:\\some\\image.jpg")
wallpaper.Get()
// gives the exact same path i.e. C:\some\image.jpg
I know this is a systemParametersInfo
implementation issue.
But is there something that can be done to extract the wallpaper more reliably?
So that something like wallpaper.Get().save(path)
can be implemented without no worries.
To my understanding if you use SetFromURL
, the donwloadImage
function names the downloaded image as the last part of the URL path. Here is the issue with that. If you use a URL path with certain characters, the whole thing will crash, as some characters aren't allowed to be used as file name on Windows (not sure about other OSes). Would it make sense to add an option to allow manual naming of the downloaded image file? Or maybe just removing special characters from file name could also suffice?
As the title says, on macOS only the active desktop changes.
It just sets the default wallpaper.
I tried running the command the package uses in the command line and it didn't work either.
I can work on this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.