Skip to content

Commit

Permalink
update: add keybind to change wallpapers
Browse files Browse the repository at this point in the history
  • Loading branch information
Creator54 committed Aug 11, 2024
1 parent 4a0704a commit 92a752d
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions modules/local-system/desktop/pop-shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ in
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom11/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom12/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom13/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom14/"
];

# Set default screenshot keybindings to empty strings
Expand Down Expand Up @@ -295,6 +296,23 @@ in
binding = "<Alt>Return";
};

"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom14" = {
name = "Change Wallpapers";
command = ''
bash -c '
# Create temporary variables for the paths
WALLPAPER_PATH=$(${pkgs.findutils}/bin/find /home/${user}/Wallpapers -type f \( -name "*.jpg" -o -name "*.png" \) | ${pkgs.coreutils}/bin/shuf -n 1)
DARK_WALLPAPER_PATH=$(${pkgs.findutils}/bin/find /home/${user}/Wallpapers -type f \( -name "*.jpg" -o -name "*.png" \) | ${pkgs.coreutils}/bin/shuf -n 1)
# Set the wallpapers
${pkgs.glib.bin}/bin/gsettings set org.gnome.desktop.background picture-uri "file://$WALLPAPER_PATH"
${pkgs.glib.bin}/bin/gsettings set org.gnome.desktop.background picture-uri-dark "file://$DARK_WALLPAPER_PATH"
'
'';
binding = "<Super><Shift>w";
};


"org/gnome/desktop/wm/preferences".button-layout = ":";

"org/gnome/desktop/wm/keybindings" = {
Expand Down Expand Up @@ -385,8 +403,8 @@ in
"org/gnome/shell/extensions/pop-shell" = {
active-hint = true;
# does not work, ref: https://github.com/pop-os/shell/issues/1582
# as always gets formatted incorrectly
# active-hint-border-radius = 12;
# as always gets formatted incorrectly
# active-hint-border-radius = 12;
tile-by-default = true;
};

Expand Down Expand Up @@ -453,7 +471,7 @@ in
};

# Dependency for Super+/ shortcut
environment.systemPackages = with pkgs; [ wofi pop-launcher gnome.gnome-tweaks ];
environment.systemPackages = with pkgs; [ wofi pop-launcher gnome.gnome-tweaks ];

environment.gnome.excludePackages =
(with pkgs; [
Expand Down

0 comments on commit 92a752d

Please sign in to comment.