Coder Social home page Coder Social logo

imhemish / wallman Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 2.0 15 KB

A dart library to get and set backgrounds on multiple GUI linux platforms.

License: BSD 3-Clause "New" or "Revised" License

Dart 100.00%
dart linux gnome cinnamon wallpaper background wallpaper-changer

wallman's Introduction

A Dart library for linux platforms to get and set backgrounds, which supports multiple desktop environments and window managers

Features

  • Can automatically sense desktop environments and return the respective backend
  • Get list of wallpaper(s) set
  • Set a wallpaper
  • Provides a way to write your own custom backend and add it to lib/src/backends directory

Getting started

You just require a working GUI linux system, satisfy all the dependencies and then see the usage.

Usage

If you dont wanna read any documentation and just want to use this package, just headup to example/example.dart and just copy-paste required code from there. Otherwise, you can read the following documentation.

First, import the wallman library.

import 'package:wallman/wallman.dart';
  • Auto detect backend (this is what you would generally want to do):
var wall = getBackend();
  • Specifically use a backend (if you want it to use it for specific desktop/WM):
var wall = GnomeBackend();

The wallman library exposes a variable (property) called "availableBackends" which returns list of names of available backends.

The Backend object exposes a 'name' property of String type which gives the name of backend currently in use.

print(wall.name)

You can use getWall and setWall functions as given:

print(await wall.getWall());

wall.setWall("/usr/share/backgrounds/xfce/xfce-teal.jpg");

The getWall function returns a Future<List<String>>.

The setWall function is of Future<void> type.

Additional information

  • The library code during execution would return empty values if any error occurs and would not fail, but would write warnings, information to STDERR. So, if you are using it in some program, be sure to discard STDERR or redirect it to /dev/null.
  • setWall of WlrootsBackend is currently unusable. Although I implemented it, still I can't figure out how can I detach swaybg process. Current implementation uses 'setsid'.
  • To create your own custom backend, see documentation or source of Backend class (present in lib/src/generic_backend.dart). To see examples of backends and analyse how they are created, analyse the code of lib/src/backends. The simplest to understand would be backman.dart. Understanding gsettings.dart would help a lot.
  • If your custom backend would anyhow utilise gsettings, better check gsettings.dart and analyse the implementation of MateBackend in lib/src/backends/gsettings.dart and implement your own taking it as example, instead of creating your backend from scratch. You can also use gsettings without implementing new backend class, you can just use Gsettings class and set interface, key, and value type in your program itself in which you are gonna use this library; for doing that see example/custom_gsettings.dart
  • Pull requests adding new backends are welcome.
  • Any general pull requests are also welcome.
  • Pull requests are accepted at https://github.com/securearth/wallman

Todo:

  • Write warnings
  • Fix backgroundExec in utils.dart which is making setWall of WlrootsBackend unusable.
  • Check if the user has set solid color instead of picture and return the colour

wallman's People

Contributors

imhemish avatar starfreck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wallman's Issues

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.