Giter Club home page Giter Club logo

swayblur's Introduction

swayblur

Basic i3ipc based script to blur an output's wallpaper when a client is present in it. Available via pypi, the AUR, or the NUR.

Installation

Stable Release

Swayblur is available in the AUR, NUR or from pypi:

pip install --user swayblur

Building from Source

git clone https://github.com/willpower3309/swayblur
cd swayblur
pip install --user .

Dependencies

  • python-i3ipc: build dependency for communicating with Sway
  • ImageMagick: used to generate the blurred wallpaper
  • `swww: used to set the wallpaper (#16)

Usage

In order for the script to run as expected, your sway config should not set any wallpaper. Remove the output * bg PATH line.

swayblur does not spawn swww at launch. If spawning swayblur with a sway config via exec, ensure that exec swww init occurs before swayblur is executed!

swayblur [-h] [-b BLUR] [-a ANIMATE] [-c CONFIG-PATH] [-v] [--verbose]

Option Description
-b, --blur blur strength (default: 20, min: 5, max: 100)
-a, --animate animation duration (default: 1, min: 1, max: 20)
-c, --config-path config path (default: $XDG_CONFIG_HOME/swayblur/config)
--verbose prints additional information
-v, --version show program's version number and exit
-h, --help show the help message and exit

Configuration

Swayblur reads a config file in ~/.config/swayblur/config.

Each section title follows the name [output <OUTPUT>] and configures the given output.

The output name * will match any output not specified elsewhere in the file. To find your output names, consult your compositor's manual.

The key image must be present and its value must be your wallpaper.

The other keys are all available options for swww img, with leading dashes, and without value for flags without arguments.

I personally use the below config, it's about as minimal as you can get:

[output *]
image=PATH_TO_YOUR_WALLPAPER
--transition-step=255

swayblur's People

Contributors

el-tata avatar forgottenumbrella avatar i60r avatar willpower3309 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

swayblur's Issues

Unable to connect to oguri socket: No such file or directory

This is displayed when spawning swayblur when oguri daemon isn't run. Maybe it would be better to spawn a new instance instead of printing the error?

Also, it seems that currently oguri conflicts with swaybg and it's a bit of a puzzle to figure this out, especially if the latter is launched through setting wallpaper in sway config. Although, it's not directly related to swayblur it could be handled here (by killing swaybg process) until it gets fixed upstream

add no wallpaper handling

Users can have a monitor with no wallpaper. While this is an atypical use case for someone to have with this script, it's best that we handle it just in case

clean up blurManager.py

This is a horribly and needlessly complicated file, with hash vs imageHash vs imageHashPath etc, it could be optimized as well, lots of python list generator expressions that could likely be reduced down to one or two

Better cache invalidation

When changing wallpapers sometimes I see some frames from previous wallpaper when animation is run. Removing ~/.cache/swayblur helps to fix it

Swayblur doesn't work with 'sleep' delay.

I'm on Arch Linux I have dual monitors so it takes a sec for oguri to recognize the two.

I wrote a script combining oguri and swayblur to starts within split seconds from launch.

Oguri works as expected, but I always have to run a manual command to get swayblur working under this condition.

Otherwise swayblur runs only when I don't put a sleep command in front. But then the wallpaper doesn't get set correctly. So I have to manually run oguri .

Any thoughts as to why?

Read from oguri config

The script could be made much more simple if it read the values from the oguri config

Better Multi Monitor Handling

As it currently stands, the script perfectly supports multi-monitor setups for all operations except when switching the first / last client from one monitor's focused workspace to another monitor's currently open but unfocused workspace.

Crashes when a window is moved to the scratchpad

Here's the traceback

Traceback (most recent call last):
  File "/usr/sbin/swayblur", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.10/site-packages/swayblur/__main__.py", line 122, in main
    blurManager.start()
  File "/usr/lib/python3.10/site-packages/swayblur/blurManager.py", line 92, in start
    self.SWAY.main()
  File "/usr/lib/python3.10/site-packages/i3ipc/connection.py", line 514, in main
    raise loop_exception
  File "/usr/lib/python3.10/site-packages/i3ipc/connection.py", line 497, in main
    while not self._event_socket_poll():
  File "/usr/lib/python3.10/site-packages/i3ipc/connection.py", line 477, in _event_socket_poll
    raise e
  File "/usr/lib/python3.10/site-packages/i3ipc/connection.py", line 474, in _event_socket_poll
    self._pubsub.emit(event_name, event)
  File "/usr/lib/python3.10/site-packages/i3ipc/_private/pubsub.py", line 28, in emit
    s['handler'](self.conn, data)
  File "/usr/lib/python3.10/site-packages/swayblur/blurManager.py", line 97, in handleMove
    containerOutput = container.workspace().ipc_data['output']
KeyError: 'output'

Better blurred<->unblurred transition

An enhancement suggestion

Right now the delay just pauses before switching the wallpaper which is too sudden

If a series of images with a blur gradually increasing/decreasing is generated based on the delay, then that can be merged into a GIF and played by oguri...

This would make the transition from blurred to unblurred way smoother when you close a window

Swayblur and Azote

I understand this program uses Oguri, but on a dual monitor landscape & portrait setup oguri always starts the portrait orientation wrong, and it doesn't correct until I open up an app. I wondering how hard would it be to tweak the code to read .azotebg file in the home folder instead of oguri config?

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.