Coder Social home page Coder Social logo

setroot's People

Contributors

artturin avatar jmi2k avatar okraits avatar ttzhou avatar vain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

setroot's Issues

Setroot --store not creating .setroot-restore

When I use setroot --store (options + image path), it does not create the file needed. Instead it comes up with the error

"Could not write to file ~/.config/setroot/.setroot-restore"

This issue was resolved when I manually created the file itself, but I don't think that was the intended purpose.

Efficiently Setting Different Wallpapers for Multiple Monitors

Summary

First of all, I apologize that this issue is so long; I've added headings to make it less painful to look at, and the last section isn't as important I think. There's not really a short title that describes this well. This is a feature request and includes a potential bug I found while testing. Basically, I think it would be nice if at least the first of these was implemented:

  1. Being able to set wallpapers for monitor #s that aren't connected currently but may be later on with a --store, and then being able to use --restore after adding them.
  2. Being able to add onto a --restore by additionally setting wallpaper with a different --on <number>.
  3. Being able to set wallpaper for a certain --on <number> without resetting the wallpaper on another --on <number> by some other method.

I think that all 1 would need is for --store to work with commands that set wallpaper on multiple monitors with --on (it currently causes an error; see below) and to be able to ignore command sections for monitors that aren't connected while still storing them (possibly requiring a flag like --ignore-unconnected). That is the jist of my request. 2 and 3 might be nice for someone who changes wallpaper a lot and has a lot of monitors, but I think they're probably overkill and would be very happy if just the first idea worked.

Problem/Inconvenience

I have a laptop, so I don't always have it connected to extra monitors. If I just want to span a wallpaper, it's very easy to include use a --span and --store without an extra monitor connected and then use --restore after connecting one. However, I usually connect to a tv for another screen, and spanning doesn't look right. Since all the wallpapers have to be set at the same time, I have to do something like this to add a separate one and keep the original:

# initial wallpaper set
$ setroot --on 0 --fliph --brighten -0.1 -z /path/to/wallpaper1
# connect another monitor
$ setroot --on 0 --fliph --brighten -0.1 -z /path/to/wallpaper1 --on 1 --(other options) /path/to/wallpaper2

Possible Solution and Possible Bug With --store (1)

User workarounds (such as adding/changing increasingly long commands to aliases used for adding monitors) get pretty ugly and I think are inconvient enough to not bother with, so I think it would be great if a solution was implemented within setroot.

One possibility might be to set wallpapers for monitors that might be added before they are added and then restore:

# only one monitor; second `--on` is ignored but properly stored
$ setroot --store --on 0 /path/to/wallpaper1 --on 1 /path/to/wallpaper2
# added monitor
$ setroot --restore

Strangely, the first command does not give an error (maybe because at least one wallpaper was succesfully set) even though trying to set the wallpaper for just --on 1 will give the error No Xinerama monitor 1. Ignoring '--on' option. The first command, however, does give an error on a --restore: *** Error in setroot': realloc(): invalid next size: 0x0000000000914690 *** which is the potential bug I mentioned. I don't know if --store is already supposed to work for any command. If not, I guess coupled with this is a feature request for the ability to store even commands that use multiple --ons. If you decide not to implement this, I think that it should be at least mentioned in the documentation that --store will not work with such a command. For me, a --restore will give this error whether or not the specified monitors were/are connected.

It would be very nice if the options/wallpaper for monitors that weren't connected could be ignored but stored properly, so that a later --restore would not ignore them and work if they were connected. It might be best to have a flag dedicated to this such as --ignore-unconnected, and throw an error if this flag is not used with monitors that don't exist.

I think this would be the nicest possibility because it would require no manual resetting if all wallpapers were set, for example, in the .xinitrc (I could just add setroot --restore to my alias for adding or deleting a monitor, and this would work regardless of whether one wallpaper was initially spanned or multiple ones were set).

Less Important Suggestions (2-3)

If someone wants to change the wallpaper for just one monitor, they still have to set everything at once. This gets extremely complicated when more monitors are added. Imagine having to find the file paths for the wallpapers for two monitors that weren't set from the commandline (not in history) and then composing that into one command. I think it would also be nice if you could either set the wallpaper for different monitor numbers without affecting the others, or add onto/ override --restore commands:

# originally set wallpaper without any extra monitors connected
$ setroot --store --on 0 --(options) /path/to/wallpaper1
# connect an extra monitor; keep wallpaper for 0, add different wallpaper for 1
$ setroot --restore --on 1 --(options) /path/to/wallpaper2

or a more complicated scenario (with the possibility of storing the previous stored command with the addition of the new one):

$ setroot --store --on 0 /path/to/wallpaper1
# add new command for new wallpaper on a monitor to previously stored command
$ setroot --store --restore --on 1 /path/to/wallpaper2
# restore but override previously stored wallpaper/options for `--on 0`
$ setroot --restore --on 0 --(possibly different options) /path/to/wallpaper3

That seems like it might be really complicated to implement, so it's just an idea. I don't know if it's possible to not reset old wallpaper for different monitors without doing something like this. It's not a very important thing to me to be able to individually set wallpaper for different monitors without messing up the others if my first suggestion is implemented (because if I wanted to change the wallpaper for one monitor, I would just modify what I have in my .xinitrc and copy/paste). This would only be useful to someone who changes wallpaper for just one login or wanted to set their wallpaper randomly for specific monitors. Both use cases for this seem pretty small, but I think a lot of people could benefit from my first suggestion.

aur package breakage

hi @ttzhou and thanks for the program!

I'm getting this after trying to install setroot tonight on arch with pacaur -S setroot:

==> Finished making: setroot v2.0.gb4a4607-1 (Sun Sep 3 12:03:36 -03 2017)
==> Cleaning up...
:: Installing setroot package(s)...
:: setroot package(s) failed to install.
:: ensure package version does not mismatch between .SRCINFO and PKGBUILD
:: ensure package name has a VCS suffix if this is a devel package
:: imlib2 is now an orphan package

--restore uses incorrect path

--store writes to $XDG_CONFIG_HOME/setroot/ which is correct. However, --restore fails because it attempts to locate the .setroot-restore file in the wrong path:

setroot --restore
Could not find file /home/jason/setroot/setroot/.setroot-restore.

This is because the FHS spec is for $XDG_CONFIG_HOME not $XDG_CONFIG_DIR, so in line 209 of setroot.c, the expansion will always fail, and then on line 231, it all goes pear shaped :)

Solid Color Flag not Working

From my understanding, the --solid-color flag should take a hex colour code including "#" and set the background to it. When I try setroot --solid-color "#ff0000", I get the error "Image #ff0000 not found." setroot --solid-color ff0000 gives this error:

Invalid color ff0000; defaulting to black.
Image ff0000 not found.

To see if it would work if an image was provided, I tried other commands, but I always get errors. I get the first error when trying setroot big.jpg --solid-color "#ff0000" or setroot --solid-color "#ff0000" big.jpg or setroot --solid-color \#ff0000. However, if I try setroot --solid-color big.jpg "#ff0000", I get the second error:

Invalid color big.jpg; defaulting to black.
Image #ff0000 not found.

Storing Does not Save Full File Path

If a fullpath is not given for a wallpaper, setroot will store the relative path, meaning that a --restore will only work if called in the same directory as the orginal setroot command that stored the arguments.

abs / fabs build warning

Just compiled and got this build warning:

❯ make xinerama=1 && make PREFIX=$HOME/.local install
cc setroot.c -std=c99 -Wall -g -Wextra     -lImlib2 -lX11 -lXinerama -DHAVE_LIBXINERAMA -o setroot
setroot.c: In function ‘fit_height’:
setroot.c:655:21: warning: using integer absolute value function ‘abs’ when argument is of floating-point type ‘float’ [-Wabsolute-value]
  655 |     float max_xtl = abs(mon->width - scaled_width);
      |                     ^~~
setroot.c: In function ‘fit_width’:
setroot.c:700:21: warning: using integer absolute value function ‘abs’ when argument is of floating-point type ‘float’ [-Wabsolute-value]
  700 |     float max_ytl = abs(mon->height - scaled_height);
      |                     ^~~
mkdir -p         /usr/local/google/home/butoi/.local/bin
mkdir -p         /usr/local/google/home/butoi/.local/share/man/man1
cp setroot       /usr/local/google/home/butoi/.local/bin
cp man/setroot.1 /usr/local/google/home/butoi/.local/share/man/man1

This should probably be s/abs/fabs/, no?

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.