diff options
author | Karel Kočí <cynerd@email.cz> | 2022-02-21 21:54:09 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2022-06-10 14:05:48 +0200 |
commit | 93b0545d11bf8c7f065203f7f3eaf1d0e3730dce (patch) | |
tree | da93fa5fcd14c493d8ccd86c98f40d26c9697869 /pkgs/theme | |
download | nixos-personal-93b0545d11bf8c7f065203f7f3eaf1d0e3730dce.tar.gz nixos-personal-93b0545d11bf8c7f065203f7f3eaf1d0e3730dce.tar.bz2 nixos-personal-93b0545d11bf8c7f065203f7f3eaf1d0e3730dce.zip |
Add initial version
Diffstat (limited to 'pkgs/theme')
-rw-r--r-- | pkgs/theme/background-lnxpcs.nix | 41 | ||||
-rw-r--r-- | pkgs/theme/delft-icon-theme.nix | 35 | ||||
-rw-r--r-- | pkgs/theme/myswaylock.nix | 19 | ||||
-rwxr-xr-x | pkgs/theme/myswaylock.sh | 19 | ||||
-rw-r--r-- | pkgs/theme/swaybackground.nix | 19 | ||||
-rwxr-xr-x | pkgs/theme/swaybackground.sh | 43 |
6 files changed, 176 insertions, 0 deletions
diff --git a/pkgs/theme/background-lnxpcs.nix b/pkgs/theme/background-lnxpcs.nix new file mode 100644 index 0000000..a3983af --- /dev/null +++ b/pkgs/theme/background-lnxpcs.nix @@ -0,0 +1,41 @@ +{ lib, stdenvNoCC, fetchFromGitHub, imagemagick }: + +stdenvNoCC.mkDerivation rec { + pname = "background-lnxpcs"; + version = "20190411"; + + src = fetchFromGitHub { + owner = "cynerd"; + repo = "lnxpcs"; + rev = "fd4487e1989fc040490fa437a2651d37afcde637"; + sha256 = "vtyyG0EHRmgWlxHmHgeckwtOv7t3C+hsuTt/vBdrRQM="; + }; + + nativeBuildInputs = [ imagemagick ]; + + wallpapers = "bash cron gcc gnu gnu-linux iptables kernel kill python root su sudo vim"; + buildPhase = '' + for img in $wallpapers; do + echo "Generating: $img" + ./makemywall 1920 1080 "cards/black/$img-card-black.png" + ./makemywall 2560 1440 "cards/black/$img-card-black.png" + ./makemywall 2560 1600 "cards/black/$img-card-black.png" + done + ''; + + installPhase = '' + mkdir -p $out + for img in $wallpapers; do + mv $img-card-black-1920x1080.png $out/ + mv $img-card-black-2560x1440.png $out/ + mv $img-card-black-2560x1600.png $out/ + done + ''; + + meta = with lib; { + description = "Background pictures from lnxpcs and relevant scripts"; + homepage = "https://mega.nz/#F!mXgW3apI!Tdikb01SoOaTmNLiaTRhMg"; + license = licenses.gpl3Only; + platforms = platforms.linux; + }; +} diff --git a/pkgs/theme/delft-icon-theme.nix b/pkgs/theme/delft-icon-theme.nix new file mode 100644 index 0000000..08ed773 --- /dev/null +++ b/pkgs/theme/delft-icon-theme.nix @@ -0,0 +1,35 @@ +{ lib, stdenv, stdenvNoCC, fetchFromGitHub, gtk3, gnome-icon-theme, hicolor-icon-theme }: + +stdenv.mkDerivation rec { + pname = "delft-icon-theme"; + version = "1.15"; + + src = fetchFromGitHub { + owner = "madmaxms"; + repo = "iconpack-delft"; + rev = "v${version}"; + sha256 = "fluSh2TR1CdIW54wkUp1QRB0m9akFKnSn4d+0z6gkLA="; + }; + + nativeBuildInputs = [ gtk3 ]; + + propagatedBuildInputs = [ gnome-icon-theme hicolor-icon-theme ]; + + dontDropIconThemeCache = true; + + installPhase = '' + mkdir -p $out/share/icons + cp -a Delft* $out/share/icons/ + + for theme in $out/share/icons/*; do + gtk-update-icon-cache $theme + done + ''; + + meta = with lib; { + description = "Delft icon theme"; + homepage = "https://github.com/madmaxms/iconpack-delft"; + license = licenses.gpl3Only; + platforms = platforms.linux; + }; +} diff --git a/pkgs/theme/myswaylock.nix b/pkgs/theme/myswaylock.nix new file mode 100644 index 0000000..6b74ce1 --- /dev/null +++ b/pkgs/theme/myswaylock.nix @@ -0,0 +1,19 @@ +{ lib, stdenvNoCC, makeWrapper +, bash, jq, sway, swaylock +, background-lnxpcs +}: + +stdenvNoCC.mkDerivation { + pname = "myswaylock"; + version = "1.0"; + + nativeBuildInputs = [ makeWrapper ]; + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/bin + cp ${./myswaylock.sh} $out/bin/myswaylock + wrapProgram $out/bin/myswaylock \ + --prefix PATH : ${lib.makeBinPath [ bash jq sway swaylock ]} \ + --prefix BACKGROUND_LNXPCS : ${ background-lnxpcs } + ''; +} diff --git a/pkgs/theme/myswaylock.sh b/pkgs/theme/myswaylock.sh new file mode 100755 index 0000000..c204a57 --- /dev/null +++ b/pkgs/theme/myswaylock.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Switch to the US keyboard (to make sure that we have the correct one) +swaymsg input type:keyboard xkb_layout us + +resolution="$(swaymsg -t get_outputs \ + | jq -r '.[0].rect | [.width,.height] | join("x")')" +case "$resolution" in + 1920x1080|2560x1440|2560x1600) + ;; + *) + resolution="1920x1080" + ;; +esac + +exec swaylock -f \ + -n -c 000000 \ + -i "$(shuf -n1 -e "$BACKGROUND_LNXPCS"/*"$resolution.png")" \ + -s fill diff --git a/pkgs/theme/swaybackground.nix b/pkgs/theme/swaybackground.nix new file mode 100644 index 0000000..856d774 --- /dev/null +++ b/pkgs/theme/swaybackground.nix @@ -0,0 +1,19 @@ +{ lib, stdenvNoCC, makeWrapper +, bash, jq, sway +, background-lnxpcs +}: + +stdenvNoCC.mkDerivation { + pname = "swaybackground"; + version = "1.0"; + + nativeBuildInputs = [ makeWrapper ]; + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/bin + cp ${./swaybackground.sh} $out/bin/swaybackground + wrapProgram $out/bin/swaybackground \ + --prefix PATH : ${lib.makeBinPath [ bash jq sway ]} \ + --prefix BACKGROUND_LNXPCS : ${ background-lnxpcs } + ''; +} diff --git a/pkgs/theme/swaybackground.sh b/pkgs/theme/swaybackground.sh new file mode 100755 index 0000000..0999943 --- /dev/null +++ b/pkgs/theme/swaybackground.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +_background() { + local resolution="${1:-1920x1080}" + case "$resolution" in + 1920x1080|2560x1440|2560x1600) + ;; + *) + resolution="1920x1080" + ;; + esac + find "$BACKGROUND_LNXPCS" -type f -name "*-$resolution.png" | shuf -n 1 +} + +background() { + local width="$1" + local height="$2" + local res + res="$(_background "${width}x${height}")" + if [ -n "$res" ]; then + res="$(_background)" + fi + echo "$res" +} + +set_backgrounds() { + local ipc="$1" + swaymsg -t get_outputs | jq -r '.[] | [.name,.rect.width,.rect.height] | join(",")' \ + | while IFS=, read -r name width height; do + swaymsg $ipc \ + output "$name" \ + background "$(background "$width" "$height")" fill + done +} + +if [ -n "$WAYLAND_DISPLAY" ]; then + set_backgrounds +else + find "/run/user/$(id -u)/" -name "sway-ipc*" \ + | while read -r ipc; do + set_backgrounds "-s '$ipc'" + done +fi |