Switch hyprpaper for swww using kanshi to update

Hopefully fixed kanshi issues with docking/undocking
This commit is contained in:
Evie Litherland-Smith 2023-08-08 08:21:51 +01:00
parent cf9f705e78
commit 353091e36b
6 changed files with 68 additions and 40 deletions

View file

@ -18,5 +18,4 @@
zotero zotero
]; ];
programs.home-manager.enable = true; programs.home-manager.enable = true;
xdg.configFile."wallpaper.jpg".source = wallpapers.outputs.default;
} }

View file

@ -27,24 +27,19 @@ in {
./gtk.nix ./gtk.nix
./mako.nix ./mako.nix
]; ];
home.packages = with pkgs; [ home.packages = [ configure-gtk ];
hyprpaper
configure-gtk
pipewire
wireplumber
wl-clipboard
grim
slurp
swayimg
pamixer
pavucontrol
playerctl
brightnessctl
];
programs = { programs = {
firefox.package = pkgs.firefox-wayland; firefox.package = pkgs.firefox-wayland;
rofi.package = pkgs.rofi-wayland; rofi.package = pkgs.rofi-wayland;
}; };
services.kanshi = {
enable = true;
systemdTarget = "hyprland-session.target";
profiles.wallpaper = {
outputs = [{ criteria = "*"; }];
exec = "${pkgs.swww}/bin/swww img ${wallpapers.outputs.default}";
};
};
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
package = null; # Use package from nixpkgs package = null; # Use package from nixpkgs
@ -55,10 +50,6 @@ in {
extraConfig = builtins.readFile ./hyprland.conf; extraConfig = builtins.readFile ./hyprland.conf;
}; };
xdg.configFile = { xdg.configFile = {
"hypr/hyprpaper.conf".text = lib.mkDefault ''
preload = ${wallpapers.outputs.default}
wallpaper = ,${wallpapers.outputs.default}
'';
"hypr/macchiato.conf".source = ./macchiato.conf; "hypr/macchiato.conf".source = ./macchiato.conf;
"hypr/display.conf".text = lib.mkDefault ""; "hypr/display.conf".text = lib.mkDefault "";
"hypr/autostart.conf".text = lib.mkDefault ""; "hypr/autostart.conf".text = lib.mkDefault "";

View file

@ -1,5 +1,6 @@
source = ./macchiato.conf source = ./macchiato.conf
source = ./display.conf source = ./display.conf
exec-once = swww init
monitor=,preferred,auto,auto monitor=,preferred,auto,auto
@ -238,6 +239,5 @@ windowrule = float,(nm-connection-editor)
windowrule = size 800 600,(nm-connection-editor) windowrule = size 800 600,(nm-connection-editor)
windowrule = move 100%-820 10%,(nm-connection-editor) windowrule = move 100%-820 10%,(nm-connection-editor)
exec-once = hyprpaper
exec-once = waybar exec-once = waybar
source = ./autostart.conf source = ./autostart.conf

View file

@ -0,0 +1,28 @@
#!/bin/sh
# This allows you to control which image to init the daemon with according
# to the time of day. You may change the match cases as you see fit.
# This currently only takes hours into account, but it should be easy to
# modify to also use minutes, or days of the week, if you want.
#
# Use it simply by calling this script instead of swww init
case $(date +%H) in
00 | 01 | 02 | 03 | 04 | 05 | 06 | 07) # First 8 hours of the day
# Uncomment below to setup the image you wish to display as your
# wallpaper if you run this script during the first 8 hours of the
# day
# swww init && swww img path/to/img
;;
08 | 09 | 10 | 11 | 12 | 13 | 14 | 15) # Middle 8 hours of the day
# Same as above, but for the middle 8 hours of the day
# swww init && swww img path/to/img
;;
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23) # Final 8 hours of the day
# Same as above, but for the final 8 hours of the day
# swww init && swww img path/to/img
;;
esac

View file

@ -1,4 +1,4 @@
{ pkgs, lib, shellConfig, ... }: { pkgs, lib, shellConfig, wallpapers, ... }:
let let
username = "elitherl"; username = "elitherl";
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";
@ -8,8 +8,7 @@ let
Dell = "preferred,1920x0,1,transform,1"; Dell = "preferred,1920x0,1,transform,1";
Acer = "highrr,auto,1"; Acer = "highrr,auto,1";
}; };
in in {
{
imports = [ shellConfig ../../home ]; imports = [ shellConfig ../../home ];
home = { home = {
inherit username homeDirectory; inherit username homeDirectory;
@ -44,8 +43,7 @@ in
"freia???" "freia???"
"heimdall" "heimdall"
"heimdall???" "heimdall???"
] ] { user = "elitherl"; };
{ user = "elitherl"; };
}; };
firefox.profiles.default = { firefox.profiles.default = {
settings."browser.startup.homepage" = "https://nucleus.ukaea.uk"; settings."browser.startup.homepage" = "https://nucleus.ukaea.uk";
@ -120,7 +118,8 @@ in
{ {
name = "KT3"; name = "KT3";
tags = [ "JET" "operations" "wiki" ]; tags = [ "JET" "operations" "wiki" ];
url = "https://wiki.jetdata.eu/open/index.php?title=KT3_Journals"; url =
"https://wiki.jetdata.eu/open/index.php?title=KT3_Journals";
} }
]; ];
} }
@ -148,15 +147,15 @@ in
}]; }];
}; };
}; };
services.kanshi = { services.kanshi.profiles = {
enable = true; undocked = {
systemdTarget = "hyprland-session.target"; outputs = [{
profiles = {
default.outputs = [{
criteria = "eDP-1"; criteria = "eDP-1";
status = "enable"; status = "enable";
}]; }];
workDock.outputs = [ };
work = {
outputs = [
{ {
criteria = "eDP-1"; criteria = "eDP-1";
status = "disable"; status = "disable";
@ -170,7 +169,9 @@ in
status = "enable"; status = "enable";
} }
]; ];
homeDock.outputs = [ };
home = {
outputs = [
{ {
criteria = "eDP-1"; criteria = "eDP-1";
status = "disable"; status = "disable";
@ -188,11 +189,7 @@ in
monitor=desc:Dell Inc. DELL U2417H 5K9YD872FY1L,${monitors.Dell} monitor=desc:Dell Inc. DELL U2417H 5K9YD872FY1L,${monitors.Dell}
monitor=desc:Acer Technologies ED270R TJMEE0043W01,${monitors.Acer} monitor=desc:Acer Technologies ED270R TJMEE0043W01,${monitors.Acer}
bindl=,switch:Lid Switch,exec,hyprctl reload
bindl=,switch:Lid Switch,exec,pkill -HUP kanshi bindl=,switch:Lid Switch,exec,pkill -HUP kanshi
bindl=,switch:Lid Switch,exec,pkill -9 hyprpaper && hyprctl dispatch exec hyprpaper
'';
xdg.configFile."hypr/autostart.conf".text = ''
exec-once=${pkgs.thunderbird}/bin/thunderbird
exec-once=${pkgs.teams-for-linux}/bin/teams-for-linux
''; '';
} }

View file

@ -3,6 +3,17 @@
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
xdg-utils xdg-utils
gsettings-desktop-schemas gsettings-desktop-schemas
swww
pipewire
wireplumber
wl-clipboard
grim
slurp
swayimg
pamixer
pavucontrol
playerctl
brightnessctl
]; ];
security.pam.services.swaylock = { }; security.pam.services.swaylock = { };
services = { services = {
@ -14,8 +25,10 @@
initial_session.command = "Hyprland"; initial_session.command = "Hyprland";
}; };
}; };
xdg.portal.enable = true; xdg.portal = {
xdg.portal.extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; enable = true;
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
};
programs = { programs = {
hyprland.enable = true; hyprland.enable = true;
thunar = { thunar = {