added mkscreenshots, a script that automates screenshots for the github repo and also keeps the readme up to date with the revision hash

This commit is contained in:
pagedmov
2024-11-06 02:43:23 -05:00
parent cf20f8ef68
commit 2721e0ec31
6 changed files with 67 additions and 5 deletions

View File

@@ -13,7 +13,7 @@ If you are on NixOS and have flakes enabled, you can just clone the repo and run
![desktop-neofetch](./assets/screens/desktop-neofetch.png)
![busy-desktop](./assets/screens/desktop-busy.png)
![toolbelt](./assets/screens/toolbelt_hq.gif)
Screenshots up to date as of [this commit](https://github.com/pagedMov/nixos-config/commit/cf20f8ef68783d8313c21e8811304f1ac6634699)
## Programs

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 KiB

After

Width:  |  Height:  |  Size: 2.4 MiB

View File

@@ -136,9 +136,6 @@ in {
decoration = {
rounding = 10;
# active_opacity = 0.90;
inactive_opacity = 0.90;
fullscreen_opacity = 1.0;
blur = {
enabled = true;

View File

@@ -11,7 +11,7 @@
splash = import ./commands/splash.nix { inherit self pkgs; };
runbg = import ./commands/runbg.nix { inherit self pkgs; };
mkbackup = import ./commands/mkbackup.nix { inherit pkgs; };
icanhazip = import ./commands/icanhazip.nix { inherit pkgs; };
icanhazip = import ./commands/icanhazip.nix { inherit pkgs; };
garbage-collect = import ./nix/garbage-collect.nix { inherit self pkgs; };
nsp = import ./nix/nsp.nix { inherit self pkgs; };
scheck = import ./wm-controls/s_check.nix { inherit self pkgs; };
@@ -22,6 +22,7 @@
viconf = import ./commands/viconf.nix { inherit pkgs; };
chscheme = import ./wm-controls/chscheme.nix { inherit pkgs; };
chpaper = import ./wm-controls/chpaper.nix { inherit pkgs; };
mkscreenshots = import ./wm-controls/mkscreenshots.nix { inherit pkgs; };
scriptOverride =
doc:
group:
@@ -70,6 +71,9 @@ in {
scriptOverride "Ensures floating windows remain on screen" "hyprlandControls" "moveonscreen";
movScripts.hyprlandControls.switchmon.enable =
scriptOverride "Moves cursor to the center of the second monitor" "hyprlandControls" "switchmon";
movScripts.hyprlandControls.mkscreenshots.enable =
scriptOverride "Generates screenshots, and updates the README.md with the current rev hash" "hyprlandControls" "switchmon";
movScripts.nixShortcuts.garbage-collect.enable =
scriptOverride "Enables the garbage-collect script" "nixShortcuts" "garbage-collect";
@@ -94,6 +98,7 @@ in {
++ lib.optionals config.movScripts.hyprlandControls.keyring.enable [ keyring ]
++ lib.optionals config.movScripts.hyprlandControls.moveonscreen.enable [ moveonscreen ]
++ lib.optionals config.movScripts.hyprlandControls.switchmon.enable [ switchmon ]
++ lib.optionals config.movScripts.hyprlandControls.mkscreenshots.enable [ mkscreenshots ]
++ lib.optionals config.movScripts.nixShortcuts.garbage-collect.enable [ garbage-collect ]
++ lib.optionals config.movScripts.nixShortcuts.nsp.enable [ nsp ]

View File

@@ -0,0 +1,60 @@
{ pkgs }:
pkgs.writeShellScriptBin "mkscreenshots" ''
if [ -n "$(hyprctl clients -j | jq -r '.[] | select(.workspace.name == "4")')" ]; then
echo "There are windows in workspace 4. This script uses workspace 4, so move those windows and run it again."
exit 1
fi
prev_workspace=$(hyprctl activeworkspace -j | jq '.id')
hyprctl dispatch focusmonitor 0
screenshotfetch() {
neofetch
kitty @ scroll-window 20-
exec sleep infinity
}
closewindows() {
hyprctl clients -j | jq -r '.[] | select(.workspace.name == "4") | .address' | while read -r addr; do
hyprctl dispatch closewindow address:"$addr"
done
}
temp_script=$(mktemp)
screenshotfetch_var=$(declare -f screenshotfetch)
echo "$screenshotfetch_var" > "$temp_script"
echo "screenshotfetch" >> "$temp_script"
chmod +x "$temp_script"
hyprctl dispatch workspace 4
hyprctl dispatch exec "[float;size 40% 25%;move 1% 66%] kitty bash -c '$temp_script'"
hyprctl dispatch exec "[float;size 40% 50%;move 57% 5%] nemo"
sleep 0.5
grimblast save output "$FLAKEPATH"/assets/screens/desktop-neofetch.png
sleep 0.5
closewindows
hyprctl dispatch exec 'kitty nvim'
hyprctl dispatch exec 'kitty yazi'
hyprctl dispatch exec 'kitty'
sleep 0.5
grimblast save output "$FLAKEPATH"/assets/screens/desktop-busy.png
sleep 0.5
(
cd "$FLAKEPATH"
latest_hash=$(git rev-parse HEAD)
sed -i "s|\(https://github.com/pagedMov/nixos-config/commit/\)[a-f0-9]\{40\}|\1$latest_hash|" "$FLAKEPATH"/README.md
)
closewindows
hyprctl dispatch workspace "$prev_workspace"
''