GithubHelp home page GithubHelp logo

Comments (4)

jdf221 avatar jdf221 commented on June 11, 2024 1

I don't have the time to set this up with a PR for the wallpaper plugin but here is a bash script that will generate a 1x1 BMP file for a specific hex code:

hexCode="b3a33e"

# Below are the bytes representing a 1x1 BMP. We substitute in the HEX color values from the above hex code into the appropriate byte positions
# Note that BMP uses BGR (Blue Green Red) instead of RGB (Red Green Blue)
bmpBytes="\x42\x4D\x44\x00\x00\x00\x00\x00\x00\x00\x3E\x00\x00\x00\x28\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x01\x00\x01\x00\x00\x00\x00\x00\x06\x00\x00\x00\x12\x0B\x00\x00\x12\x0B\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x${hexCode:4:2}\x${hexCode:2:2}\x${hexCode:0:2}\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
targetTempFile=$(mktemp)
echo -n -e "$bmpBytes" > "$targetTempFile"


echo "$targetTempFile"

Tested setting my wallpaper to this BMP and it fills the whole screen as long as the wallpaper is set to a setting that attempts to fill the screen.

from m-cli.

0ihsan avatar 0ihsan commented on June 11, 2024 1

Great idea @jdf221! I found out that bmp file can be even smaller.
I have improved that script a bit and now it works perfectly. Thanks.

#!/bin/sh

# hex2bmp 

while read -r hex; do

  out=$(mktemp)
  printf "424d1e000000000000001a0000000c0000000100010001001800%s00" \
         "${hex:4:2}${hex:2:2}${hex:0:2}" | xxd -p -r > "$out"
  echo "$out"

done
m wallpaper $(echo 2B3339 | hex2bmp)

from m-cli.

bensleveritt avatar bensleveritt commented on June 11, 2024 1

That's a great solution, if I get time I'll try putting a PR together for it

from m-cli.

bensleveritt avatar bensleveritt commented on June 11, 2024

An interesting request. I'm terrible with Applescript, and I suspect that's the way to do it. If anyone else knows of a way, I'm happy to help, otherwise this might take a while...

from m-cli.

Related Issues (20)

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.