Use glsl as a wallpaper
diff --git a/modules/glpaper.nix b/modules/glpaper.nix
deleted file mode 100644
index 7630b1c..0000000
--- a/modules/glpaper.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{ pkgs, ... }: {
- home.wayland.windowManager.sway.config.startup = [
- {
- command = "\"pkill glpaper; ${pkgs.glpaper}/bin/glpaper eDP-1 ${./glpaper/shader.glsl} -F -W 1920 -H 1080\"";
- always = true;
- }
- ];
-}
diff --git a/modules/glpaper/shader.glsl b/modules/glpaper/shader.glsl
deleted file mode 100644
index c0ac9ed..0000000
--- a/modules/glpaper/shader.glsl
+++ /dev/null
@@ -1,53 +0,0 @@
-#extension GL_OES_standard_derivatives : enable
-
-precision highp float;
-
-uniform float time;
-uniform vec2 mouse;
-uniform vec2 resolution;
-
-vec3 white = vec3(1, 1, 1);
-vec3 amaranth_pink = vec3(0.945, 0.612, 0.733);
-vec3 maya_blue = vec3(0.298, 0.624, 0.886);
-
-vec3 color_for_position (vec2 position) {
- vec3 color = white;
-
- if (sin(position.x + time / 30.0) / 2.0 - position.y + 0.4 < 0.0) {
- color = amaranth_pink;
- } else if (sin(position.x / 5.0 + time / 21.0 + 20.0) / 2.0 - position.y + 0.5 < 0.0) {
- color = maya_blue;
- }
-
- return color;
-}
-
-void main( void ) {
- vec2 position = ( gl_FragCoord.xy / resolution.xy );
-
- float r = 0.0;
- float g = 0.0;
- float b = 0.0;
-
- float sampleSqrt = 3.0;
-
- for (float x = 0.0; x < sampleSqrt; x++) {
- for (float y = 0.0; y < sampleSqrt; y++) {
- vec3 color = color_for_position(
- vec2(
- (x / (resolution.x * sampleSqrt)) + position.x,
- (y / (resolution.y * sampleSqrt)) + position.y
- )
- );
- r += color.r;
- g += color.g;
- b += color.b;
- }
- }
-
- r /= sampleSqrt * sampleSqrt * 0.75;
- g /= sampleSqrt * sampleSqrt * 0.75;
- b /= sampleSqrt * sampleSqrt * 0.75;
-
- gl_FragColor = vec4(vec3(r, g, b), 1.0);
-}
diff --git a/modules/wallpaper.nix b/modules/wallpaper.nix
new file mode 100644
index 0000000..cb5763e
--- /dev/null
+++ b/modules/wallpaper.nix
@@ -0,0 +1,6 @@
+{pkgs, ...}: {
+ home.home = {
+ packages = [pkgs.show];
+ file.".xmonad/wallpaper.glsl".source = ./wallpaper/wallpaper.glsl;
+ };
+}
diff --git a/modules/wallpaper/wallpaper.glsl b/modules/wallpaper/wallpaper.glsl
new file mode 100644
index 0000000..51c7d57
--- /dev/null
+++ b/modules/wallpaper/wallpaper.glsl
@@ -0,0 +1,21 @@
+#extension GL_OES_standard_derivatives : enable
+
+precision highp float;
+
+uniform float time;
+uniform vec2 resolution;
+
+void main( void ) {
+
+ float t = time / 50.0;
+ vec2 position = ( gl_FragCoord.xy / resolution.xy );
+
+ vec3 color = vec3(0, 0, 0);
+
+ color.r += sin(t + position.x + position.y);
+ color.g += cos(t + position.x - position.y);
+ color.b += sin(-t + position.x);
+
+ gl_FragColor = vec4( color, 1.0 );
+
+}
diff --git a/modules/xmonad/xmonad.hs b/modules/xmonad/xmonad.hs
index bbd949f..660db50 100644
--- a/modules/xmonad/xmonad.hs
+++ b/modules/xmonad/xmonad.hs
@@ -1,19 +1,23 @@
-- spell-checker:words xmonad
-import XMonad
+import XMonad
-import System.Exit
-import XMonad.Util.EZConfig
+import System.Exit
+import XMonad.Util.EZConfig
-import XMonad.Hooks.EwmhDesktops
-import XMonad.Hooks.ManageDocks
-import XMonad.Config.Desktop
+import XMonad.Config.Desktop
+import XMonad.Hooks.EwmhDesktops
+import XMonad.Hooks.ManageDocks
-import XMonadLog
-import XMonad.Hooks.DynamicLog
-import qualified DBus.Client as D
+import qualified DBus.Client as D
+import XMonad.Hooks.DynamicLog
+import XMonadLog
-import XMonad.Layout.Spacing
-import XMonad.Layout.Gaps
+import XMonad.Hooks.ManageHelpers (isInProperty, doLower)
+import XMonad.Layout.Gaps
+import XMonad.Layout.Spacing
+import Foreign.C
+import Blaze.ByteString.Builder (toByteString)
+import XMonad.Layout.Drawer (propertyToQuery)
terminal = "kitty" -- Kitty, my beloved <3
launcher = "pkill rofi; rofi -show combi"
@@ -22,7 +26,7 @@
statusBar = "pkill polybar; polybar"
compositor = "pkill picom; picom"
-background = "feh --no-fehbg --bg-fill .xmonad/background.png"
+background = "pkill show; show ~/.xmonad/wallpaper.glsl"
shift = shiftMask
@@ -30,13 +34,13 @@
spawn Main.statusBar
spawn Main.compositor
spawn background
-
+
main :: IO ()
main = XMonadLog.xmonadLog >>= main'
main' :: D.Client -> IO ()
-main' dbus = xmonad $ docks $ ewmh . ewmhFullscreen $ def
+main' dbus = xmonad $ ewmh . ewmhFullscreen $ docks $ def
{ modMask = modifierKey -- Use Super as our mod key
, borderWidth = 0
, XMonad.terminal = Main.terminal
@@ -46,10 +50,16 @@
smartSpacing 5 $
gaps [(U, 5), (D, 5), (L, 5), (R, 5)] $
layoutHook def
+ , XMonad.manageHook = composeAll
+ [ className =? "Show" --> doIgnore <+> doLower <+> doLower
+ -- You can't check if "Show" is a desktop window,
+ -- I believe it's because show doesn't instantly set
+ -- desktop. Do not try. It is not worth it.
+ ] <+> manageHook def
} `additionalKeys`
[ ((modifierKey, xK_d), spawn launcher)
, ((modifierKey, xK_n), spawn networkManager)
, ((modifierKey .|. shift, xK_q), kill)
, ((modifierKey, xK_q), spawn "xmonad --restart")
- , ((modifierKey .|. shift, xK_c), io (exitWith ExitSuccess))
+ , ((modifierKey .|. shift, xK_c), io exitSuccess)
]
diff --git a/packages/show.nix b/packages/show.nix
new file mode 100644
index 0000000..a8557d8
--- /dev/null
+++ b/packages/show.nix
@@ -0,0 +1,43 @@
+{ lib
+, fetchFromGitHub
+, python3
+, python3Packages
+, lowPrio
+}: let
+ mouse = python3.pkgs.buildPythonPackage rec {
+ pname = "mouse";
+ version = "0.7.1";
+
+ src = python3.pkgs.fetchPypi {
+ inherit pname version format;
+ sha256 = "sha256-00u5VIiQCJ/LEZiEAOJvVcYk5se3Qf/3X+39+9N8ABY=";
+ };
+
+ format = "wheel";
+ };
+in
+python3.pkgs.buildPythonApplication {
+ pname = "Show";
+ version = "unstable-2022-11-05";
+
+ format = "pyproject";
+
+ propagatedBuildInputs = with python3Packages; [
+ xcffib
+ cairocffi
+ pyopengl
+ screeninfo
+ glfw
+ scipy
+ pillow
+ poetry
+ mouse
+ ];
+
+ src = fetchFromGitHub {
+ owner = "Minion3665";
+ repo = "Show";
+ rev = "c16b2d2b5bd97fe893ae117b0e50808a3d0c611a";
+ sha256 = "sha256-ny75uG+7OhbZqw+KUtF/Ow66/rXW/EmHAuThdSB154M=";
+ };
+}