diff --git a/.direnv/bin/nix-direnv-reload b/.direnv/bin/nix-direnv-reload index 059b68b..6f1652e 100755 --- a/.direnv/bin/nix-direnv-reload +++ b/.direnv/bin/nix-direnv-reload @@ -1,19 +1,19 @@ #!/usr/bin/env bash set -e -if [[ ! -d "/home/benag/.nix-config/configuration/modules/dots/wayland_panel" ]]; then +if [[ ! -d "/mnt/removable/Projects/Rust/wayland_panel" ]]; then echo "Cannot find source directory; Did you move it?" - echo "(Looking for "/home/benag/.nix-config/configuration/modules/dots/wayland_panel")" + echo "(Looking for "/mnt/removable/Projects/Rust/wayland_panel")" echo 'Cannot force reload with this script - use "direnv reload" manually and then try again' exit 1 fi # rebuild the cache forcefully -_nix_direnv_force_reload=1 direnv exec "/home/benag/.nix-config/configuration/modules/dots/wayland_panel" true +_nix_direnv_force_reload=1 direnv exec "/mnt/removable/Projects/Rust/wayland_panel" true # Update the mtime for .envrc. # This will cause direnv to reload again - but without re-building. -touch "/home/benag/.nix-config/configuration/modules/dots/wayland_panel/.envrc" +touch "/mnt/removable/Projects/Rust/wayland_panel/.envrc" # Also update the timestamp of whatever profile_rc we have. # This makes sure that we know we are up to date. -touch -r "/home/benag/.nix-config/configuration/modules/dots/wayland_panel/.envrc" "/home/benag/.nix-config/configuration/modules/dots/wayland_panel/.direnv"/*.rc +touch -r "/mnt/removable/Projects/Rust/wayland_panel/.envrc" "/mnt/removable/Projects/Rust/wayland_panel/.direnv"/*.rc diff --git a/.direnv/flake-inputs/f1fvmylh0lvki8f5b9p2l1s9g4bm69vx-source b/.direnv/flake-inputs/f1fvmylh0lvki8f5b9p2l1s9g4bm69vx-source new file mode 120000 index 0000000..7f51c26 --- /dev/null +++ b/.direnv/flake-inputs/f1fvmylh0lvki8f5b9p2l1s9g4bm69vx-source @@ -0,0 +1 @@ +/nix/store/f1fvmylh0lvki8f5b9p2l1s9g4bm69vx-source \ No newline at end of file diff --git a/.direnv/flake-inputs/f5cfz7byd8pwcv6dyg34b66fck7iqsc0-source b/.direnv/flake-inputs/f5cfz7byd8pwcv6dyg34b66fck7iqsc0-source new file mode 120000 index 0000000..af3dc82 --- /dev/null +++ b/.direnv/flake-inputs/f5cfz7byd8pwcv6dyg34b66fck7iqsc0-source @@ -0,0 +1 @@ +/nix/store/f5cfz7byd8pwcv6dyg34b66fck7iqsc0-source \ No newline at end of file diff --git a/.direnv/flake-inputs/wygnldpfirbkskf6qpjbghvaqh3kkczb-source b/.direnv/flake-inputs/wygnldpfirbkskf6qpjbghvaqh3kkczb-source new file mode 120000 index 0000000..5253257 --- /dev/null +++ b/.direnv/flake-inputs/wygnldpfirbkskf6qpjbghvaqh3kkczb-source @@ -0,0 +1 @@ +/nix/store/wygnldpfirbkskf6qpjbghvaqh3kkczb-source \ No newline at end of file diff --git a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa index d8b34ee..1196720 120000 --- a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa +++ b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa @@ -1 +1 @@ -/nix/store/19sic4f4w000jj6fscbhz98zaib4f4ml-nix-shell-env \ No newline at end of file +/nix/store/sw4zwpy7r16mhiqlx6niqmrfa16niy10-nix-shell-env \ No newline at end of file diff --git a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc index e5832b6..65e0266 100644 --- a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc +++ b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc @@ -35,7 +35,7 @@ LD='ld' export LD LD_FOR_TARGET='ld' export LD_FOR_TARGET -LD_LIBRARY_PATH='/run/opengl-driver/lib:/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib:/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib:/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib:/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib:/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib:/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib' +LD_LIBRARY_PATH='/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib:/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib:/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib:/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib:/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib:/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib' export LD_LIBRARY_PATH LINENO='76' MACHTYPE='x86_64-pc-linux-gnu' @@ -47,7 +47,7 @@ NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu NIX_BINTOOLS_WRAPPER_TARGET_TARGET_x86_64_unknown_linux_gnu='1' export NIX_BINTOOLS_WRAPPER_TARGET_TARGET_x86_64_unknown_linux_gnu -NIX_BUILD_CORES='4' +NIX_BUILD_CORES='16' export NIX_BUILD_CORES NIX_CC='/nix/store/kbw2j1vag664b3sj3rjwz9v53cqx87sb-gcc-wrapper-15.2.0' export NIX_CC @@ -57,7 +57,7 @@ NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu NIX_CC_WRAPPER_TARGET_TARGET_x86_64_unknown_linux_gnu='1' export NIX_CC_WRAPPER_TARGET_TARGET_x86_64_unknown_linux_gnu -NIX_CFLAGS_COMPILE=' -frandom-seed=19sic4f4w0 -isystem /nix/store/d0irz6jq0d16h6iggq1mcwwvvxzi4lvy-gnumake-4.4.1/include -isystem /nix/store/d0irz6jq0d16h6iggq1mcwwvvxzi4lvy-gnumake-4.4.1/include -isystem /nix/store/blr5zdnxfckm1690cdx6anmh3s17sx5p-wayland-1.24.0-dev/include -isystem /nix/store/blr5zdnxfckm1690cdx6anmh3s17sx5p-wayland-1.24.0-dev/include -isystem /nix/store/ixxx8nb52qxl25lix063rb35lk94p7r8-libxkbcommon-1.11.0-dev/include -isystem /nix/store/ixxx8nb52qxl25lix063rb35lk94p7r8-libxkbcommon-1.11.0-dev/include -isystem /nix/store/jhb15l57qmqxck5ddd1dh2ys729vc8gb-glib-2.86.3-dev/include -isystem /nix/store/jhb15l57qmqxck5ddd1dh2ys729vc8gb-glib-2.86.3-dev/include -isystem /nix/store/87y9237m9c9m9mxk9ajwdfmn78vz6w2y-zlib-1.3.1-dev/include -isystem /nix/store/87y9237m9c9m9mxk9ajwdfmn78vz6w2y-zlib-1.3.1-dev/include -isystem /nix/store/xff3v3hj0slzkxhksrsrscva5scf35an-libffi-3.5.2-dev/include -isystem /nix/store/xff3v3hj0slzkxhksrsrscva5scf35an-libffi-3.5.2-dev/include -isystem /nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/include -isystem /nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/include -isystem /nix/store/p73x5sdhi1wgas4d6mm8yxbzawih2yp2-glibc-iconv-2.42/include -isystem /nix/store/p73x5sdhi1wgas4d6mm8yxbzawih2yp2-glibc-iconv-2.42/include -isystem /nix/store/3drkfkyzxfb9rcpnv1xy0nvdj78qngy8-libglvnd-1.7.0-dev/include -isystem /nix/store/3drkfkyzxfb9rcpnv1xy0nvdj78qngy8-libglvnd-1.7.0-dev/include -isystem /nix/store/d0irz6jq0d16h6iggq1mcwwvvxzi4lvy-gnumake-4.4.1/include -isystem /nix/store/d0irz6jq0d16h6iggq1mcwwvvxzi4lvy-gnumake-4.4.1/include -isystem /nix/store/blr5zdnxfckm1690cdx6anmh3s17sx5p-wayland-1.24.0-dev/include -isystem /nix/store/blr5zdnxfckm1690cdx6anmh3s17sx5p-wayland-1.24.0-dev/include -isystem /nix/store/ixxx8nb52qxl25lix063rb35lk94p7r8-libxkbcommon-1.11.0-dev/include -isystem /nix/store/ixxx8nb52qxl25lix063rb35lk94p7r8-libxkbcommon-1.11.0-dev/include -isystem /nix/store/jhb15l57qmqxck5ddd1dh2ys729vc8gb-glib-2.86.3-dev/include -isystem /nix/store/jhb15l57qmqxck5ddd1dh2ys729vc8gb-glib-2.86.3-dev/include -isystem /nix/store/87y9237m9c9m9mxk9ajwdfmn78vz6w2y-zlib-1.3.1-dev/include -isystem /nix/store/87y9237m9c9m9mxk9ajwdfmn78vz6w2y-zlib-1.3.1-dev/include -isystem /nix/store/xff3v3hj0slzkxhksrsrscva5scf35an-libffi-3.5.2-dev/include -isystem /nix/store/xff3v3hj0slzkxhksrsrscva5scf35an-libffi-3.5.2-dev/include -isystem /nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/include -isystem /nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/include -isystem /nix/store/p73x5sdhi1wgas4d6mm8yxbzawih2yp2-glibc-iconv-2.42/include -isystem /nix/store/p73x5sdhi1wgas4d6mm8yxbzawih2yp2-glibc-iconv-2.42/include -isystem /nix/store/3drkfkyzxfb9rcpnv1xy0nvdj78qngy8-libglvnd-1.7.0-dev/include -isystem /nix/store/3drkfkyzxfb9rcpnv1xy0nvdj78qngy8-libglvnd-1.7.0-dev/include' +NIX_CFLAGS_COMPILE=' -frandom-seed=sw4zwpy7r1 -isystem /nix/store/d0irz6jq0d16h6iggq1mcwwvvxzi4lvy-gnumake-4.4.1/include -isystem /nix/store/d0irz6jq0d16h6iggq1mcwwvvxzi4lvy-gnumake-4.4.1/include -isystem /nix/store/blr5zdnxfckm1690cdx6anmh3s17sx5p-wayland-1.24.0-dev/include -isystem /nix/store/blr5zdnxfckm1690cdx6anmh3s17sx5p-wayland-1.24.0-dev/include -isystem /nix/store/ixxx8nb52qxl25lix063rb35lk94p7r8-libxkbcommon-1.11.0-dev/include -isystem /nix/store/ixxx8nb52qxl25lix063rb35lk94p7r8-libxkbcommon-1.11.0-dev/include -isystem /nix/store/jhb15l57qmqxck5ddd1dh2ys729vc8gb-glib-2.86.3-dev/include -isystem /nix/store/jhb15l57qmqxck5ddd1dh2ys729vc8gb-glib-2.86.3-dev/include -isystem /nix/store/87y9237m9c9m9mxk9ajwdfmn78vz6w2y-zlib-1.3.1-dev/include -isystem /nix/store/87y9237m9c9m9mxk9ajwdfmn78vz6w2y-zlib-1.3.1-dev/include -isystem /nix/store/xff3v3hj0slzkxhksrsrscva5scf35an-libffi-3.5.2-dev/include -isystem /nix/store/xff3v3hj0slzkxhksrsrscva5scf35an-libffi-3.5.2-dev/include -isystem /nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/include -isystem /nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/include -isystem /nix/store/p73x5sdhi1wgas4d6mm8yxbzawih2yp2-glibc-iconv-2.42/include -isystem /nix/store/p73x5sdhi1wgas4d6mm8yxbzawih2yp2-glibc-iconv-2.42/include -isystem /nix/store/3drkfkyzxfb9rcpnv1xy0nvdj78qngy8-libglvnd-1.7.0-dev/include -isystem /nix/store/3drkfkyzxfb9rcpnv1xy0nvdj78qngy8-libglvnd-1.7.0-dev/include -isystem /nix/store/d0irz6jq0d16h6iggq1mcwwvvxzi4lvy-gnumake-4.4.1/include -isystem /nix/store/d0irz6jq0d16h6iggq1mcwwvvxzi4lvy-gnumake-4.4.1/include -isystem /nix/store/blr5zdnxfckm1690cdx6anmh3s17sx5p-wayland-1.24.0-dev/include -isystem /nix/store/blr5zdnxfckm1690cdx6anmh3s17sx5p-wayland-1.24.0-dev/include -isystem /nix/store/ixxx8nb52qxl25lix063rb35lk94p7r8-libxkbcommon-1.11.0-dev/include -isystem /nix/store/ixxx8nb52qxl25lix063rb35lk94p7r8-libxkbcommon-1.11.0-dev/include -isystem /nix/store/jhb15l57qmqxck5ddd1dh2ys729vc8gb-glib-2.86.3-dev/include -isystem /nix/store/jhb15l57qmqxck5ddd1dh2ys729vc8gb-glib-2.86.3-dev/include -isystem /nix/store/87y9237m9c9m9mxk9ajwdfmn78vz6w2y-zlib-1.3.1-dev/include -isystem /nix/store/87y9237m9c9m9mxk9ajwdfmn78vz6w2y-zlib-1.3.1-dev/include -isystem /nix/store/xff3v3hj0slzkxhksrsrscva5scf35an-libffi-3.5.2-dev/include -isystem /nix/store/xff3v3hj0slzkxhksrsrscva5scf35an-libffi-3.5.2-dev/include -isystem /nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/include -isystem /nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/include -isystem /nix/store/p73x5sdhi1wgas4d6mm8yxbzawih2yp2-glibc-iconv-2.42/include -isystem /nix/store/p73x5sdhi1wgas4d6mm8yxbzawih2yp2-glibc-iconv-2.42/include -isystem /nix/store/3drkfkyzxfb9rcpnv1xy0nvdj78qngy8-libglvnd-1.7.0-dev/include -isystem /nix/store/3drkfkyzxfb9rcpnv1xy0nvdj78qngy8-libglvnd-1.7.0-dev/include' export NIX_CFLAGS_COMPILE NIX_CFLAGS_COMPILE_FOR_TARGET=' -isystem /nix/store/d0irz6jq0d16h6iggq1mcwwvvxzi4lvy-gnumake-4.4.1/include -isystem /nix/store/blr5zdnxfckm1690cdx6anmh3s17sx5p-wayland-1.24.0-dev/include -isystem /nix/store/ixxx8nb52qxl25lix063rb35lk94p7r8-libxkbcommon-1.11.0-dev/include -isystem /nix/store/jhb15l57qmqxck5ddd1dh2ys729vc8gb-glib-2.86.3-dev/include -isystem /nix/store/87y9237m9c9m9mxk9ajwdfmn78vz6w2y-zlib-1.3.1-dev/include -isystem /nix/store/xff3v3hj0slzkxhksrsrscva5scf35an-libffi-3.5.2-dev/include -isystem /nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/include -isystem /nix/store/p73x5sdhi1wgas4d6mm8yxbzawih2yp2-glibc-iconv-2.42/include -isystem /nix/store/3drkfkyzxfb9rcpnv1xy0nvdj78qngy8-libglvnd-1.7.0-dev/include' export NIX_CFLAGS_COMPILE_FOR_TARGET @@ -65,7 +65,7 @@ NIX_ENFORCE_NO_NATIVE='1' export NIX_ENFORCE_NO_NATIVE NIX_HARDENING_ENABLE='bindnow format fortify fortify3 libcxxhardeningextensive libcxxhardeningfast pic relro stackclashprotection stackprotector strictoverflow zerocallusedregs' export NIX_HARDENING_ENABLE -NIX_LDFLAGS='-rpath /home/benag/.nix-config/configuration/modules/dots/wayland_panel/outputs/out/lib -L/nix/store/fv438zxk1mvcfi2sj20mgn4s91qpjdcd-rust-default-1.94.0/lib -L/nix/store/fv438zxk1mvcfi2sj20mgn4s91qpjdcd-rust-default-1.94.0/lib -L/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib -L/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib -L/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib -L/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib -L/nix/store/vl8jkqpr0l3fac3cxiy4nwc5paiww1lv-zlib-1.3.1/lib -L/nix/store/vl8jkqpr0l3fac3cxiy4nwc5paiww1lv-zlib-1.3.1/lib -L/nix/store/5mnq195cx3cagnpbbvf5ncbp4fjgy0sz-libffi-3.5.2/lib -L/nix/store/5mnq195cx3cagnpbbvf5ncbp4fjgy0sz-libffi-3.5.2/lib -L/nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/lib -L/nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/lib -L/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib -L/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib -L/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib -L/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib -L/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib -L/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib -L/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib -L/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib -L/nix/store/fv438zxk1mvcfi2sj20mgn4s91qpjdcd-rust-default-1.94.0/lib -L/nix/store/fv438zxk1mvcfi2sj20mgn4s91qpjdcd-rust-default-1.94.0/lib -L/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib -L/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib -L/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib -L/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib -L/nix/store/vl8jkqpr0l3fac3cxiy4nwc5paiww1lv-zlib-1.3.1/lib -L/nix/store/vl8jkqpr0l3fac3cxiy4nwc5paiww1lv-zlib-1.3.1/lib -L/nix/store/5mnq195cx3cagnpbbvf5ncbp4fjgy0sz-libffi-3.5.2/lib -L/nix/store/5mnq195cx3cagnpbbvf5ncbp4fjgy0sz-libffi-3.5.2/lib -L/nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/lib -L/nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/lib -L/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib -L/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib -L/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib -L/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib -L/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib -L/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib -L/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib -L/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib' +NIX_LDFLAGS='-rpath /mnt/removable/Projects/Rust/wayland_panel/outputs/out/lib -L/nix/store/fv438zxk1mvcfi2sj20mgn4s91qpjdcd-rust-default-1.94.0/lib -L/nix/store/fv438zxk1mvcfi2sj20mgn4s91qpjdcd-rust-default-1.94.0/lib -L/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib -L/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib -L/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib -L/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib -L/nix/store/vl8jkqpr0l3fac3cxiy4nwc5paiww1lv-zlib-1.3.1/lib -L/nix/store/vl8jkqpr0l3fac3cxiy4nwc5paiww1lv-zlib-1.3.1/lib -L/nix/store/5mnq195cx3cagnpbbvf5ncbp4fjgy0sz-libffi-3.5.2/lib -L/nix/store/5mnq195cx3cagnpbbvf5ncbp4fjgy0sz-libffi-3.5.2/lib -L/nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/lib -L/nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/lib -L/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib -L/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib -L/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib -L/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib -L/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib -L/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib -L/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib -L/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib -L/nix/store/fv438zxk1mvcfi2sj20mgn4s91qpjdcd-rust-default-1.94.0/lib -L/nix/store/fv438zxk1mvcfi2sj20mgn4s91qpjdcd-rust-default-1.94.0/lib -L/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib -L/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib -L/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib -L/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib -L/nix/store/vl8jkqpr0l3fac3cxiy4nwc5paiww1lv-zlib-1.3.1/lib -L/nix/store/vl8jkqpr0l3fac3cxiy4nwc5paiww1lv-zlib-1.3.1/lib -L/nix/store/5mnq195cx3cagnpbbvf5ncbp4fjgy0sz-libffi-3.5.2/lib -L/nix/store/5mnq195cx3cagnpbbvf5ncbp4fjgy0sz-libffi-3.5.2/lib -L/nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/lib -L/nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/lib -L/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib -L/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib -L/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib -L/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib -L/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib -L/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib -L/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib -L/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib' export NIX_LDFLAGS NIX_LDFLAGS_FOR_TARGET=' -L/nix/store/fv438zxk1mvcfi2sj20mgn4s91qpjdcd-rust-default-1.94.0/lib -L/nix/store/jcc9imfj4samq59gwsskxalcd9rjicip-wayland-1.24.0/lib -L/nix/store/k1gvr4prs9736r1lhqyy1plxrrvv9b4m-libxkbcommon-1.11.0/lib -L/nix/store/vl8jkqpr0l3fac3cxiy4nwc5paiww1lv-zlib-1.3.1/lib -L/nix/store/5mnq195cx3cagnpbbvf5ncbp4fjgy0sz-libffi-3.5.2/lib -L/nix/store/md592gfars4m9madyrpj9yrq5jhckgjf-gettext-0.26/lib -L/nix/store/1qm74vf93ik1xjrr9kl6qvjrklljlcqh-glib-2.86.3/lib -L/nix/store/1il4q8s87v0p8xp1g2q8mmbswbwkj23l-vulkan-loader-1.4.341.0/lib -L/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/lib -L/nix/store/wwckb31fcbwj479g7qwcb3b7cv6416pf-libglvnd-1.7.0/lib' export NIX_LDFLAGS_FOR_TARGET @@ -115,6 +115,8 @@ STRIP='strip' export STRIP STRIP_FOR_TARGET='strip' export STRIP_FOR_TARGET +VK_ICD_FILENAMES='/nix/store/g7wjwz546f510jv95318n23330c3ni7k-mesa-26.0.2/share/vulkan/icd.d/intel_icd.x86_64.json' +export VK_ICD_FILENAMES XDG_DATA_DIRS='/nix/store/590yx3aynyhs48jyk8ip37fk1mjqfhkb-patchelf-0.15.2/share' export XDG_DATA_DIRS __structuredAttrs='' @@ -176,7 +178,7 @@ name='nix-shell-env' export name nativeBuildInputs='' export nativeBuildInputs -out='/home/benag/.nix-config/configuration/modules/dots/wayland_panel/outputs/out' +out='/mnt/removable/Projects/Rust/wayland_panel/outputs/out' export out outputBin='out' outputDev='out' @@ -209,7 +211,7 @@ declare -a preFixupHooks=('_moveToShare' '_multioutDocs' '_multioutDevs' ) preInstallPhases=' glibPreInstallPhase' preferLocalBuild='1' export preferLocalBuild -prefix='/home/benag/.nix-config/configuration/modules/dots/wayland_panel/outputs/out' +prefix='/mnt/removable/Projects/Rust/wayland_panel/outputs/out' declare -a propagatedBuildDepFiles=('propagated-build-build-deps' 'propagated-native-build-inputs' 'propagated-build-target-deps' ) propagatedBuildInputs='' export propagatedBuildInputs diff --git a/.gitignore b/.gitignore index 75e92a9..eb5a316 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ target -.direnv diff --git a/Cargo.lock b/Cargo.lock index 6f563be..33c5b7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -94,137 +94,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "async-broadcast" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" -dependencies = [ - "event-listener", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-channel" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-executor" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "pin-project-lite", - "slab", -] - -[[package]] -name = "async-io" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" -dependencies = [ - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix 1.1.4", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-lock" -version = "3.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" -dependencies = [ - "event-listener", - "event-listener-strategy", - "pin-project-lite", -] - -[[package]] -name = "async-process" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" -dependencies = [ - "async-channel", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "rustix 1.1.4", -] - -[[package]] -name = "async-recursion" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "async-signal" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43c070bbf59cd3570b6b2dd54cd772527c7c3620fce8be898406dd3ed6adc64c" -dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if", - "futures-core", - "futures-io", - "rustix 1.1.4", - "signal-hook-registry", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - -[[package]] -name = "async-trait" -version = "0.1.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "atomic-waker" version = "1.1.2" @@ -279,19 +148,6 @@ dependencies = [ "objc2 0.5.2", ] -[[package]] -name = "blocking" -version = "1.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" -dependencies = [ - "async-channel", - "async-task", - "futures-io", - "futures-lite", - "piper", -] - [[package]] name = "bumpalo" version = "3.20.2" @@ -693,12 +549,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" -[[package]] -name = "endi" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" - [[package]] name = "enumflags2" version = "0.7.12" @@ -706,7 +556,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" dependencies = [ "enumflags2_derive", - "serde", ] [[package]] @@ -761,27 +610,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "event-listener" -version = "5.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" -dependencies = [ - "event-listener", - "pin-project-lite", -] - [[package]] name = "fastrand" version = "2.3.0" @@ -919,19 +747,6 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" -[[package]] -name = "futures-lite" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] - [[package]] name = "futures-macro" version = "0.3.32" @@ -1161,12 +976,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - [[package]] name = "hexf-parse" version = "0.2.1" @@ -1707,15 +1516,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - [[package]] name = "metal" version = "0.32.0" @@ -2123,16 +1923,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "ordered-stream" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" -dependencies = [ - "futures-core", - "pin-project-lite", -] - [[package]] name = "owned_ttf_parser" version = "0.25.1" @@ -2142,12 +1932,6 @@ dependencies = [ "ttf-parser", ] -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - [[package]] name = "parking_lot" version = "0.12.5" @@ -2209,17 +1993,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "piper" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" -dependencies = [ - "atomic-waker", - "fastrand", - "futures-io", -] - [[package]] name = "pkg-config" version = "0.3.32" @@ -2543,33 +2316,12 @@ dependencies = [ "zmij", ] -[[package]] -name = "serde_repr" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - [[package]] name = "skrifa" version = "0.37.0" @@ -2947,17 +2699,6 @@ dependencies = [ "core_maths", ] -[[package]] -name = "uds_windows" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" -dependencies = [ - "memoffset", - "tempfile", - "windows-sys 0.61.2", -] - [[package]] name = "unicode-bidi" version = "0.3.18" @@ -3000,17 +2741,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "uuid" -version = "1.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37" -dependencies = [ - "js-sys", - "serde_core", - "wasm-bindgen", -] - [[package]] name = "version_check" version = "0.9.5" @@ -3310,9 +3040,7 @@ dependencies = [ "chrono", "iced", "iced_layershell", - "tokio", "winit", - "zbus", ] [[package]] @@ -3935,67 +3663,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5" -[[package]] -name = "zbus" -version = "5.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca82f95dbd3943a40a53cfded6c2d0a2ca26192011846a1810c4256ef92c60bc" -dependencies = [ - "async-broadcast", - "async-executor", - "async-io", - "async-lock", - "async-process", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "enumflags2", - "event-listener", - "futures-core", - "futures-lite", - "hex", - "libc", - "ordered-stream", - "rustix 1.1.4", - "serde", - "serde_repr", - "tracing", - "uds_windows", - "uuid", - "windows-sys 0.61.2", - "winnow", - "zbus_macros", - "zbus_names", - "zvariant", -] - -[[package]] -name = "zbus_macros" -version = "5.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897e79616e84aac4b2c46e9132a4f63b93105d54fe8c0e8f6bffc21fa8d49222" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", - "zbus_names", - "zvariant", - "zvariant_utils", -] - -[[package]] -name = "zbus_names" -version = "4.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffd8af6d5b78619bab301ff3c560a5bd22426150253db278f164d6cf3b72c50f" -dependencies = [ - "serde", - "winnow", - "zvariant", -] - [[package]] name = "zeno" version = "0.3.3" @@ -4027,43 +3694,3 @@ name = "zmij" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" - -[[package]] -name = "zvariant" -version = "5.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5708299b21903bbe348e94729f22c49c55d04720a004aa350f1f9c122fd2540b" -dependencies = [ - "endi", - "enumflags2", - "serde", - "winnow", - "zvariant_derive", - "zvariant_utils", -] - -[[package]] -name = "zvariant_derive" -version = "5.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b59b012ebe9c46656f9cc08d8da8b4c726510aef12559da3e5f1bf72780752c" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", - "zvariant_utils", -] - -[[package]] -name = "zvariant_utils" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f75c23a64ef8f40f13a6989991e643554d9bef1d682a281160cf0c1bc389c5e9" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn", - "winnow", -] diff --git a/Cargo.toml b/Cargo.toml index 539476c..0c90d4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,9 +7,7 @@ edition = "2024" chrono = "0.4.44" iced = { version = "0.14.0", default-features = false, features = ["wgpu", "wayland", "tokio"] } iced_layershell = { version = "0.15.0", default-features = false } -tokio = { version = "1.50.0", features = ["time"] } winit = { version = "0.30.12", default-features = false, features = ["wayland"] } -zbus = "5.14.0" [profile.release] opt-level = 3 diff --git a/flake.nix b/flake.nix index 7f6c799..19350f2 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,8 @@ ] ++ runtimeLibs; - LD_LIBRARY_PATH = "/run/opengl-driver/lib:${pkgs.lib.makeLibraryPath runtimeLibs}"; + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath runtimeLibs; + VK_ICD_FILENAMES = "${pkgs.mesa}/share/vulkan/icd.d/intel_icd.x86_64.json"; }; }; } diff --git a/src/app.rs b/src/app.rs deleted file mode 100644 index ade6afd..0000000 --- a/src/app.rs +++ /dev/null @@ -1,77 +0,0 @@ -use crate::widget::{Message, PanelWidget}; -use crate::widgets::battery::BatteryWidget; -use crate::widgets::clock::ClockWidget; -use crate::widgets::focused_window::FocusedWindowWidget; -use crate::widgets::powerbutton::ShutdownWidget; -use crate::widgets::spacer::Spacer; -use iced::Color; -use iced::Element; -use iced::Subscription; -use iced::Task; - -pub struct App { - widgets: Vec>, -} - -impl App { - pub const WINDOW_HEIGHT: u32 = 32; - - pub fn new() -> Self { - Self { - widgets: vec![ - Box::new(ClockWidget::new()), - Box::new(Spacer::new(iced::Length::Fill)), - Box::new(ShutdownWidget::new()), - Box::new(Spacer::new(iced::Length::Fill)), - Box::new(BatteryWidget::new()), - Box::new(FocusedWindowWidget::new()), - ], - } - } - - pub fn name() -> String { - "wayland_panel".into() - } - - pub fn view(&self, id: iced::window::Id) -> Element<'_, Message> { - if let Some(elem) = self - .widgets - .iter() - .find(|widget| widget.has_window(id)) - .map(|widget| widget.view(id)) - { - return elem; - } - - iced::widget::Row::with_children(self.widgets.iter().map(|widget| widget.view(id))) - .padding(iced::Padding::from([0, 5])) - .height(iced::Length::Fill) - .width(iced::Length::Fill) - .align_y(iced::Alignment::Center) - .into() - } - - pub fn update(&mut self, message: Message) -> Task { - let mut output = Vec::new(); - for widget in &mut self.widgets { - output.push(widget.update(&message)); - } - - Task::batch(output) - } - - pub fn style(&self, theme: &iced::Theme) -> iced::theme::Style { - iced::theme::Style { - background_color: Color::TRANSPARENT, - text_color: theme.palette().text, - } - } - - pub fn theme(&self, _id: iced::window::Id) -> iced::Theme { - iced::Theme::GruvboxDark - } - - pub fn subscription(&self) -> iced::Subscription { - Subscription::batch(self.widgets.iter().map(|w| w.subscribe())) - } -} diff --git a/src/main.rs b/src/main.rs index 3ca9b28..6a2f76f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,22 +1,28 @@ +use iced::Color; +use iced::Element; +use iced::Task; +use iced::widget::button; +use iced::widget::container; +use iced::widget::row; +use iced::widget::text; use iced_layershell::daemon; use iced_layershell::reexport::Anchor; +use iced_layershell::reexport::NewLayerShellSettings; use iced_layershell::settings::LayerShellSettings; use iced_layershell::settings::Settings; - -mod app; -mod widget; -mod widgets; -use app::App; +use iced_layershell::to_layer_message; +use std::collections::HashMap; +use std::time::Duration; pub fn main() -> Result<(), iced_layershell::Error> { - daemon(App::new, App::name, App::update, App::view) + daemon(App::default, App::name, App::update, App::view) .style(App::style) .theme(App::theme) .subscription(App::subscription) .settings(Settings { layer_settings: LayerShellSettings { - size: Some((0, App::WINDOW_HEIGHT)), - exclusive_zone: App::WINDOW_HEIGHT as i32, + size: Some((0, 32)), + exclusive_zone: 32, anchor: Anchor::Top | Anchor::Left | Anchor::Right, start_mode: iced_layershell::settings::StartMode::AllScreens, ..Default::default() @@ -26,3 +32,216 @@ pub fn main() -> Result<(), iced_layershell::Error> { .run() } +struct App { + popups: HashMap, + power_off_widget: PowerOffWidget, + time_widget: TimeWidget, + battery_widget: BatteryWidget, +} + +enum PopupKind { + PowerOff, +} + +impl Default for App { + fn default() -> Self { + let mut output = Self { + popups: HashMap::new(), + power_off_widget: PowerOffWidget(None), + time_widget: Default::default(), + battery_widget: Default::default(), + }; + let _ = output.update(Message::Clock); + + output + } +} + +impl App { + fn name() -> String { + "wayland_panel".into() + } + + fn close_popup(&mut self, id: iced::window::Id) -> Task { + self.popups.remove(&id); + return Task::done(Message::RemoveWindow(id)); + } + + fn view(&self, id: iced::window::Id) -> Element<'_, Message> { + if let Some(kind) = self.popups.get(&id) { + return match kind { + PopupKind::PowerOff => container( + row![ + text("Shut down?"), + button("✓").on_press(Message::PowerOffConfirm), + button("✗").on_press(Message::PowerOffCancel), + ] + .spacing(8) + .align_y(iced::Alignment::Center), + ) + .center(iced::Length::Fill) + .into(), + }; + } + + // default: the bar + let content = row![ + self.time_widget.view(), + iced::widget::space().width(iced::Length::Fill), + self.power_off_widget.view(), + iced::widget::space().width(iced::Length::Fill), + self.battery_widget.view(), + ] + .padding(iced::Padding::from([0, 5])) + .height(iced::Length::Fill) + .width(iced::Length::Fill) + .align_y(iced::Alignment::Center); + + container(content).into() + } + + fn update(&mut self, message: Message) -> Task { + match message { + Message::Clock => { + self.time_widget.update(); + self.battery_widget.update(); + + Task::none() + } + Message::PowerOff => { + let id = iced::window::Id::unique(); + self.popups.insert(id, PopupKind::PowerOff); + + self.power_off_widget.0 = Some(id); + + Task::done(Message::NewLayerShell { + settings: NewLayerShellSettings { + size: Some((220, 40)), + anchor: Anchor::Top, + layer: iced_layershell::reexport::Layer::Overlay, + keyboard_interactivity: + iced_layershell::reexport::KeyboardInteractivity::OnDemand, + exclusive_zone: None, + ..Default::default() + }, + id, + }) + } + Message::PowerOffConfirm => { + std::process::Command::new("poweroff").spawn().ok(); + Task::none() + } + Message::PowerOffCancel => self.close_popup(self.power_off_widget.0.unwrap()), + _ => Task::none(), + } + } + + fn style(&self, theme: &iced::Theme) -> iced::theme::Style { + iced::theme::Style { + background_color: Color::TRANSPARENT, + text_color: theme.palette().text, + } + } + + fn theme(&self, _id: iced::window::Id) -> iced::Theme { + iced::Theme::GruvboxDark + } + + fn subscription(&self) -> iced::Subscription { + iced::time::every(Duration::from_secs(1)).map(|_| Message::Clock) + } +} + +trait PanelWidget { + fn update(&mut self); + fn view(&self) -> Element<'_, Message>; +} + +#[derive(Default)] +struct BatteryWidget { + battery: Option, +} + +impl PanelWidget for BatteryWidget { + fn update(&mut self) { + let file_content = std::fs::read_to_string(std::path::Path::new( + "/sys/class/power_supply/BAT0/capacity", + )); + + let Ok(file_string) = file_content else { + self.battery = None; + return; + }; + + let file_string = file_string.trim(); + + let Ok(value) = file_string.parse::() else { + self.battery = None; + return; + }; + + self.battery = Some(value); + } + + fn view(&self) -> Element<'_, Message> { + match self.battery { + Some(battery) => text!("{} {}", battery.to_string(), Self::get_icon(battery)), + None => text("󰂃"), + } + .into() + } +} + +impl BatteryWidget { + fn get_icon(battery: usize) -> &'static str { + match battery { + 0..6 => "󰂎", + 6..11 => "󰁺", + 11..21 => "󰁻", + 21..31 => "󰁼", + 31..41 => "󰁽", + 41..51 => "󰁾", + 51..61 => "󰁿", + 61..71 => "󰂀", + 71..81 => "󰂁", + 81..91 => "󰂂", + 91..101 => "󰁹", + _ => "󰂃", + } + } +} + +#[derive(Default)] +struct TimeWidget { + current_time: chrono::DateTime, +} + +impl PanelWidget for TimeWidget { + fn update(&mut self) { + self.current_time = chrono::Local::now(); + } + + fn view(&self) -> Element<'_, Message> { + text!("{}", self.current_time.format("%H:%m")).into() + } +} + +#[derive(Default)] +struct PowerOffWidget(Option); + +impl PanelWidget for PowerOffWidget { + fn update(&mut self) {} + + fn view(&self) -> Element<'_, Message> { + button("⏻").on_press(Message::PowerOff).into() + } +} + +#[to_layer_message(multi)] +#[derive(Debug, Clone)] +pub enum Message { + Clock, + PowerOff, + PowerOffConfirm, + PowerOffCancel, +} diff --git a/src/widget.rs b/src/widget.rs deleted file mode 100644 index 17beceb..0000000 --- a/src/widget.rs +++ /dev/null @@ -1,23 +0,0 @@ -use iced::Element; -use iced::Subscription; -use iced::Task; -use iced_layershell::to_layer_message; - -use crate::widgets::powerbutton::ShutdownEvents; - -pub trait PanelWidget { - fn update(&mut self, message: &Message) -> Task; - fn subscribe(&self) -> Subscription; - fn view(&self, id: iced::window::Id) -> Element<'_, Message>; - fn has_window(&self, _id: iced::window::Id) -> bool { - false - } -} - -#[to_layer_message(multi)] -#[derive(Debug, Clone)] -pub enum Message { - Battery(Option), - Time, - ShutdownEvent(ShutdownEvents), -} diff --git a/src/widgets/battery.rs b/src/widgets/battery.rs deleted file mode 100644 index bfe8ded..0000000 --- a/src/widgets/battery.rs +++ /dev/null @@ -1,94 +0,0 @@ -use crate::widget::{Message, PanelWidget}; -use iced::Element; -use iced::Subscription; -use iced::Task; -use iced::futures::SinkExt; -use iced::futures::StreamExt; -use iced::widget::text; -use std::time::Duration; - -#[zbus::proxy( - interface = "org.freedesktop.UPower.Device", - default_service = "org.freedesktop.UPower", - default_path = "/org/freedesktop/UPower/devices/DisplayDevice" -)] -trait UPowerDevice { - #[zbus(property)] - fn percentage(&self) -> zbus::Result; -} - -pub struct BatteryWidget { - capacity: Option, -} - -impl BatteryWidget { - pub fn new() -> Self { - Self { capacity: None } - } -} - -impl PanelWidget for BatteryWidget { - fn update(&mut self, message: &Message) -> Task { - if let Message::Battery(capacity) = message { - self.capacity = *capacity; - } - Task::none() - } - - fn subscribe(&self) -> Subscription { - Subscription::run(|| { - iced::stream::channel(16, async |mut tx| { - loop { - let Ok(conn) = zbus::Connection::system().await else { - tokio::time::sleep(Duration::from_secs(5)).await; - continue; - }; - let Ok(proxy) = UPowerDeviceProxy::new(&conn).await else { - tokio::time::sleep(Duration::from_secs(5)).await; - continue; - }; - - if let Ok(pct) = proxy.percentage().await { - tx.send(Message::Battery(Some(pct))).await.ok(); - } - - let mut changes = proxy.receive_percentage_changed().await; - while let Some(change) = changes.next().await { - if let Ok(pct) = change.get().await { - tx.send(Message::Battery(Some(pct))).await.ok(); - } - } - - tx.send(Message::Battery(None)).await.ok(); - } - }) - }) - } - - fn view(&self, _id: iced::window::Id) -> Element<'_, Message> { - match self.capacity { - Some(cap) => text!("{} {}", cap, Self::icon(cap)), - None => text!("󰂃"), - } - .into() - } -} - -impl BatteryWidget { - fn icon(capacity: f64) -> &'static str { - match capacity { - 0f64..6f64 => "󰂎", - 6f64..11f64 => "󰁺", - 11f64..21f64 => "󰁻", - 21f64..31f64 => "󰁼", - 31f64..41f64 => "󰁽", - 41f64..51f64 => "󰁾", - 51f64..61f64 => "󰁿", - 61f64..71f64 => "󰂀", - 71f64..81f64 => "󰂁", - 81f64..91f64 => "󰂂", - 91f64..=100f64 => "󰁹", - _ => "󰂃", - } - } -} diff --git a/src/widgets/clock.rs b/src/widgets/clock.rs deleted file mode 100644 index d29f7d7..0000000 --- a/src/widgets/clock.rs +++ /dev/null @@ -1,35 +0,0 @@ -use crate::widget::{Message, PanelWidget}; -use iced::Task; -use std::time::Duration; - -pub struct ClockWidget { - current_time: chrono::DateTime, -} - -impl ClockWidget { - pub fn new() -> Self { - Self { - current_time: chrono::Local::now(), - } - } -} - -impl PanelWidget for ClockWidget { - fn update(&mut self, message: &Message) -> Task { - let Message::Time = message else { - return Task::none(); - }; - - self.current_time = chrono::Local::now(); - Task::none() - } - - fn subscribe(&self) -> iced::Subscription { - iced::time::every(Duration::from_secs(1)).map(|_| Message::Time) - } - - fn view(&self, _id: iced::window::Id) -> iced::Element<'_, Message> { - let formatted_time = self.current_time.format("%H:%M"); - iced::widget::text!("{}", formatted_time).into() - } -} diff --git a/src/widgets/focused_window.rs b/src/widgets/focused_window.rs deleted file mode 100644 index 53d4c37..0000000 --- a/src/widgets/focused_window.rs +++ /dev/null @@ -1,30 +0,0 @@ -use iced::{Subscription, Task}; -use wayland_protocols_wlr::foreign_toplevel; - -use crate::widget::PanelWidget; - -pub struct FocusedWindowWidget { - focused_window: String, -} - -impl FocusedWindowWidget { - pub fn new() -> Self { - Self { - focused_window: foreign_toplevel::v1::client::zwlr_foreign_toplevel_manager_v1::Event, - } - } -} - -impl PanelWidget for FocusedWindowWidget { - fn update(&mut self, _message: &crate::widget::Message) -> iced::Task { - Task::none() - } - - fn subscribe(&self) -> iced::Subscription { - Subscription::none() - } - - fn view(&self, _id: iced::window::Id) -> iced::Element<'_, crate::widget::Message> { - iced::widget::text!("{}", self.focused_window).into() - } -} diff --git a/src/widgets/mod.rs b/src/widgets/mod.rs deleted file mode 100644 index ae671a2..0000000 --- a/src/widgets/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod battery; -pub mod clock; -pub mod focused_window; -pub mod powerbutton; -pub mod spacer; diff --git a/src/widgets/powerbutton.rs b/src/widgets/powerbutton.rs deleted file mode 100644 index 841d5c3..0000000 --- a/src/widgets/powerbutton.rs +++ /dev/null @@ -1,90 +0,0 @@ -use crate::widget::{Message, PanelWidget}; -use iced::{ - Subscription, Task, - widget::{button, row, text}, -}; -use iced_layershell::reexport::{Anchor, NewLayerShellSettings}; - -pub struct ShutdownWidget { - window: Option, -} - -#[derive(Debug, Clone)] -pub enum ShutdownEvents { - PowerButtonPressed, - ShutdownConfirmed, - ShutdownCanceled, -} - -impl ShutdownWidget { - pub fn new() -> Self { - Self { window: None } - } -} - -impl PanelWidget for ShutdownWidget { - fn update(&mut self, message: &crate::widget::Message) -> iced::Task { - let Message::ShutdownEvent(event) = message else { - return Task::none(); - }; - - match event { - ShutdownEvents::PowerButtonPressed => match self.window { - Some(child) => { - self.window = None; - Task::done(Message::RemoveWindow(child)) - } - None => { - let id = iced::window::Id::unique(); - self.window = Some(id); - - Task::done(Message::NewLayerShell { - settings: NewLayerShellSettings { - size: Some((220, 40)), - anchor: Anchor::Top, - layer: iced_layershell::reexport::Layer::Overlay, - keyboard_interactivity: - iced_layershell::reexport::KeyboardInteractivity::OnDemand, - exclusive_zone: None, - ..Default::default() - }, - id, - }) - } - }, - ShutdownEvents::ShutdownConfirmed => Task::none(), - ShutdownEvents::ShutdownCanceled => match self.window { - Some(child) => { - self.window = None; - Task::done(Message::RemoveWindow(child)) - } - None => Task::none(), - }, - } - } - - fn subscribe(&self) -> iced::Subscription { - Subscription::none() - } - - fn has_window(&self, id: iced::window::Id) -> bool { - self.window == Some(id) - } - - fn view(&self, id: iced::window::Id) -> iced::Element<'_, crate::widget::Message> { - match self.window { - Some(child_id) if id == child_id => row![ - text("Shut down?"), - button("✓").on_press(Message::ShutdownEvent(ShutdownEvents::ShutdownConfirmed)), - button("✗").on_press(Message::ShutdownEvent(ShutdownEvents::ShutdownCanceled)), - ] - .spacing(8) - .align_y(iced::Alignment::Center) - .into(), - - _ => button("⏻") - .on_press(Message::ShutdownEvent(ShutdownEvents::PowerButtonPressed)) - .into(), - } - } -} diff --git a/src/widgets/spacer.rs b/src/widgets/spacer.rs deleted file mode 100644 index 68e720f..0000000 --- a/src/widgets/spacer.rs +++ /dev/null @@ -1,25 +0,0 @@ -use crate::widget::PanelWidget; - -pub struct Spacer { - space: iced::Length, -} - -impl Spacer { - pub fn new(space: iced::Length) -> Self { - Self { space } - } -} - -impl PanelWidget for Spacer { - fn update(&mut self, _message: &crate::widget::Message) -> iced::Task { - iced::Task::none() - } - - fn subscribe(&self) -> iced::Subscription { - iced::Subscription::none() - } - - fn view(&self, _id: iced::window::Id) -> iced::Element<'_, crate::widget::Message> { - iced::widget::space().width(self.space).into() - } -}