hyprland: separate settings for user and host
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
{ pkgs, lib, ... }: {
|
||||
wayland.windowManager.hyprland = let
|
||||
wallpaper = pkgs.fetchurl {
|
||||
name = "miku_wallpaper.jpg";
|
||||
url = "https://c.codrs.ru/pub/miku_wallpaper.jpeg?raw";
|
||||
hash = "sha256-inK4X5KzQk5FHwDw2DYy43nm7XtXlC6I0S1PkYUv+3w=";
|
||||
};
|
||||
in {
|
||||
settings = {
|
||||
monitor = [
|
||||
"DP-3 , 1920x1080@165, 0x0 , 1"
|
||||
"HDMI-A-1, preferred , -1080x0, 1, transform, 1"
|
||||
];
|
||||
|
||||
workspace = [
|
||||
"1, monitor:DP-3, default:true"
|
||||
"10, monitor:HDMI-A-1, default:true"
|
||||
];
|
||||
|
||||
exec-once = [
|
||||
"hyprctl dispatch workspace 1"
|
||||
"${lib.getExe pkgs.swww} img -o HDMI-A-1 ${wallpaper}"
|
||||
"${lib.getExe pkgs.linux-wallpaperengine} ~/.local/share/wpe/wallpaper --assets-dir ~/.local/share/wpe/assets --screen-root DP-3 --noautomute"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
{ pkgs, lib, ...}: {
|
||||
wayland.windowManager.hyprland = let
|
||||
monitor-switcher = pkgs.writers.writeBashBin "monitor_switcher" /*bash*/ ''
|
||||
MODE=$1
|
||||
|
||||
case $MODE in
|
||||
"tv")
|
||||
hyprctl keyword monitor "DP-3, 1920x1080@60, 3840x0, 1"
|
||||
hyprctl keyword monitor "HDMI-A-1, 3840x2160@60, 0x0, 1"
|
||||
notify-send "TV mode"
|
||||
;;
|
||||
|
||||
"mirror")
|
||||
hyprctl keyword monitor "HDMI-A-1, 3840x2160@60, 0x0, 1"
|
||||
hyprctl keyword monitor "DP-3, preferred, auto, 1, mirror, HDMI-A-1"
|
||||
notify-send "TV-only mode"
|
||||
;;
|
||||
|
||||
"display"|*)
|
||||
hyprctl keyword monitor "HDMI-A-1, disable"
|
||||
hyprctl keyword monitor "DP-3, 3440x1440@165, 0x0, 1"
|
||||
notify-send "Display mode"
|
||||
;;
|
||||
|
||||
esac
|
||||
'';
|
||||
in {
|
||||
settings = {
|
||||
monitor = [
|
||||
"DP-3, 3440x1440@165, auto-right, 1"
|
||||
# "HDMI-A-1, 3840x2160@60, auto-left, 2"
|
||||
"HDMI-A-1, disabled"
|
||||
];
|
||||
|
||||
bind = [
|
||||
'', XF86Calculator, exec, ghostty --title=pulsemixer -e pulsemixer''
|
||||
|
||||
''$mainMod, F1, exec, ${lib.getExe monitor-switcher} tv''
|
||||
''$mainMod, F2, exec, ${lib.getExe monitor-switcher} mirror''
|
||||
''$mainMod, F3, exec, ${lib.getExe monitor-switcher}''
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
wayland.windowManager.hyprland = {
|
||||
settings = {
|
||||
monitor = [
|
||||
"eDP-1, 1920x1080@60, 0x0, 1"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
./user/wofi.nix
|
||||
./user/mako.nix
|
||||
./user/ghostty.nix
|
||||
./user/hyprland.nix
|
||||
./user/packages/art.nix
|
||||
./user/packages/desktop.nix
|
||||
./user/packages/coding.nix
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
{ pkgs, lib, config, collection, swww_flags, inputs }: {
|
||||
{ pkgs, lib, config, osConfig, inputs, username, ... }: let
|
||||
optImport = path: lib.optional (builtins.pathExists path) path;
|
||||
hostname = osConfig.networking.hostName;
|
||||
in {
|
||||
imports =
|
||||
optImport ../../host/${hostname}/modules/hyprland.nix ++
|
||||
optImport ../../user/${username}/modules/hyprland.nix;
|
||||
|
||||
home.packages = with pkgs; [
|
||||
ghostty
|
||||
pamixer
|
||||
@@ -9,56 +16,8 @@
|
||||
xclip
|
||||
];
|
||||
|
||||
wayland.windowManager.hyprland =
|
||||
let
|
||||
wayland.windowManager.hyprland = let
|
||||
colors = config.lib.stylix.colors;
|
||||
|
||||
wallpaper_changer = pkgs.writers.writePython3Bin "wallpaper_changer" {
|
||||
libraries = [ pkgs.python3Packages.requests ];
|
||||
flakeIgnore = [ "E501" "E111" "E701" "E241" "E731" ];
|
||||
} /*py*/ ''
|
||||
import requests as requests
|
||||
from random import choice
|
||||
from os import system, mkdir, listdir
|
||||
from os.path import exists
|
||||
|
||||
notify = lambda s: system(f"notify-desktop Wallpaper '{s}'")
|
||||
folder = "${config.home.homeDirectory}/Wallpapers"
|
||||
url = "https://wallhaven.cc/api/v1/collections/${collection}"
|
||||
with open("${config.sops.secrets."tokens/apis/wallhaven".path}") as f:
|
||||
token = f.read()
|
||||
|
||||
notify("Updating wallpaper!")
|
||||
|
||||
try:
|
||||
json = requests.get(url, params={'apikey': token}).json()
|
||||
|
||||
wallpaper = choice(json['data'])
|
||||
link = wallpaper['path']
|
||||
format = wallpaper['file_type']
|
||||
id = wallpaper['id']
|
||||
|
||||
if format == "image/jpeg": ext = "jpg"
|
||||
else: ext = "png"
|
||||
|
||||
filename = f"{id}.{ext}"
|
||||
|
||||
if not exists(f"{folder}/{filename}"):
|
||||
if not exists(folder):
|
||||
mkdir(f"{folder}")
|
||||
|
||||
notify("Downloading...")
|
||||
with open(f"{folder}/{filename}", 'wb') as f:
|
||||
r = requests.get(link)
|
||||
f.write(r.content)
|
||||
|
||||
except requests.exceptions.ConnectionError:
|
||||
notify("Offline mode")
|
||||
filename = choice(listdir(folder))
|
||||
|
||||
finally:
|
||||
system(f"${lib.getExe pkgs.swww} img {folder}/{filename} ${swww_flags}")
|
||||
'';
|
||||
in {
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
@@ -136,10 +95,9 @@
|
||||
"size 622 652, title:(clipse)"
|
||||
];
|
||||
|
||||
exec-once = [
|
||||
exec-once = lib.mkBefore [
|
||||
"systemctl --user start plasma-polkit-agent"
|
||||
"${lib.getExe' pkgs.swww "swww-daemon"}"
|
||||
"${lib.getExe wallpaper_changer}"
|
||||
"wl-clip-persist --clipboard both"
|
||||
"clipse -listen"
|
||||
"${lib.getExe' pkgs.udiskie "udiskie"}"
|
||||
@@ -213,8 +171,6 @@
|
||||
", XF86AudioMute, exec, pamixer -t"
|
||||
", XF86AudioMicMute, exec, pamixer --default-source -m"
|
||||
", XF86AudioPlay, exec, ${lib.getExe pkgs.playerctl} play-pause"
|
||||
", XF86AudioPrev, exec, ${lib.getExe pkgs.playerctl} position 5-"
|
||||
", XF86AudioNext, exec, ${lib.getExe pkgs.playerctl} position 5+"
|
||||
|
||||
", XF86Explorer, exec, ghostty -e sh -c yazi"
|
||||
", XF86Mail, exec, thunderbird"
|
||||
@@ -223,12 +179,6 @@
|
||||
# Brightness control
|
||||
", XF86MonBrightnessDown, exec, ${lib.getExe pkgs.brightnessctl} set 5%- "
|
||||
", XF86MonBrightnessUp, exec, ${lib.getExe pkgs.brightnessctl} set +5% "
|
||||
|
||||
# Waybar
|
||||
"$mainMod, B, exec, pkill -SIGUSR1 waybar"
|
||||
#"$mainMod, W, exec, pkill -SIGUSR2 waybar"
|
||||
|
||||
"$mainMod, W, exec, ${lib.getExe wallpaper_changer}"
|
||||
];
|
||||
|
||||
binde = [
|
||||
@@ -236,6 +186,11 @@
|
||||
", XF86AudioLowerVolume, exec, pamixer -d 5 "
|
||||
];
|
||||
|
||||
bindc = [
|
||||
", XF86AudioPrev, exec, ${lib.getExe pkgs.playerctl} position 5-"
|
||||
", XF86AudioNext, exec, ${lib.getExe pkgs.playerctl} position 5+"
|
||||
];
|
||||
|
||||
bindo = [
|
||||
", XF86AudioPrev, exec, ${lib.getExe pkgs.playerctl} previous"
|
||||
", XF86AudioNext, exec, ${lib.getExe pkgs.playerctl} next"
|
||||
@@ -1,21 +1,8 @@
|
||||
{ pkgs, lib, config, inputs, ... }: {
|
||||
imports = [(
|
||||
import ../../../modules/user/patterns/hyprland.nix {
|
||||
inherit lib;
|
||||
inherit pkgs;
|
||||
inherit config;
|
||||
inherit inputs;
|
||||
collection = "cheeeest/1767552";
|
||||
swww_flags = "";
|
||||
}
|
||||
)];
|
||||
|
||||
wayland.windowManager.hyprland = let
|
||||
colors = config.lib.stylix.colors;
|
||||
in {
|
||||
settings = {
|
||||
monitor = ",preferred,auto,1";
|
||||
exec-once =["${lib.getExe pkgs.linux-wallpaperengine} ~/.local/share/wpe/wallpaper --assets-dir ~/.local/share/wpe/assets --screen-root DP-3 --noautomute"];
|
||||
general = {
|
||||
gaps_in = 5;
|
||||
gaps_out = 5;
|
||||
|
||||
+1
-1
@@ -13,7 +13,6 @@
|
||||
inputs.stylix.homeModules.stylix
|
||||
../modules/user.nix
|
||||
./${name}/modules/git.nix
|
||||
./${name}/modules/hyprland.nix
|
||||
./${name}/modules/style.nix
|
||||
./${name}/home.nix
|
||||
];
|
||||
@@ -35,6 +34,7 @@
|
||||
laptop = laptop;
|
||||
name = config.networking.hostName;
|
||||
};
|
||||
username = name;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,26 +1,55 @@
|
||||
{ pkgs, lib, config, inputs, ... }: {
|
||||
imports = [(
|
||||
import ../../../modules/user/patterns/hyprland.nix {
|
||||
inherit lib;
|
||||
inherit pkgs;
|
||||
inherit config;
|
||||
inherit inputs;
|
||||
collection = "sweetbread/1764377";
|
||||
swww_flags = "--transition-type center";
|
||||
}
|
||||
)];
|
||||
|
||||
wayland.windowManager.hyprland = let
|
||||
colors = config.lib.stylix.colors;
|
||||
|
||||
wallpaper_changer = pkgs.writers.writePython3Bin "wallpaper_changer" {
|
||||
libraries = [ pkgs.python3Packages.requests ];
|
||||
flakeIgnore = [ "E501" "E111" "E701" "E241" "E731" ];
|
||||
} /*py*/ ''
|
||||
import requests as requests
|
||||
from random import choice
|
||||
from os import system, mkdir, listdir
|
||||
from os.path import exists
|
||||
|
||||
notify = lambda s: system(f"notify-desktop Wallpaper '{s}'")
|
||||
folder = "${config.home.homeDirectory}/Wallpapers"
|
||||
url = "https://wallhaven.cc/api/v1/collections/sweetbread/1764377"
|
||||
with open("${config.sops.secrets."tokens/apis/wallhaven".path}") as f:
|
||||
token = f.read()
|
||||
|
||||
notify("Updating wallpaper!")
|
||||
|
||||
try:
|
||||
json = requests.get(url, params={'apikey': token}).json()
|
||||
|
||||
wallpaper = choice(json['data'])
|
||||
link = wallpaper['path']
|
||||
format = wallpaper['file_type']
|
||||
id = wallpaper['id']
|
||||
|
||||
if format == "image/jpeg": ext = "jpg"
|
||||
else: ext = "png"
|
||||
|
||||
filename = f"{id}.{ext}"
|
||||
|
||||
if not exists(f"{folder}/{filename}"):
|
||||
if not exists(folder):
|
||||
mkdir(f"{folder}")
|
||||
|
||||
notify("Downloading...")
|
||||
with open(f"{folder}/{filename}", 'wb') as f:
|
||||
r = requests.get(link)
|
||||
f.write(r.content)
|
||||
|
||||
except requests.exceptions.ConnectionError:
|
||||
notify("Offline mode")
|
||||
filename = choice(listdir(folder))
|
||||
|
||||
finally:
|
||||
system(f"${lib.getExe pkgs.swww} img {folder}/{filename} --transition-type center")
|
||||
'';
|
||||
in {
|
||||
settings = {
|
||||
monitor = [
|
||||
"DP-3, 3440x1440@165.00Hz, auto-right, 1"
|
||||
# "HDMI-A-1, 3840x2160@60.00Hz, auto-left, 2"
|
||||
"HDMI-A-1, disabled"
|
||||
",preferred,auto,1"
|
||||
];
|
||||
|
||||
general = {
|
||||
gaps_in = 5;
|
||||
gaps_out = 10;
|
||||
@@ -76,12 +105,16 @@
|
||||
enable_swallow = true;
|
||||
};
|
||||
|
||||
exec-once = [
|
||||
"${lib.getExe wallpaper_changer}"
|
||||
];
|
||||
|
||||
bind = [
|
||||
" , Print, exec, ${lib.getExe pkgs.hyprshot} -z -o ~/Screenshots -m active -m output"
|
||||
"CTRL, Print, exec, ${lib.getExe pkgs.hyprshot} -z -o ~/Screenshots -m region"
|
||||
"ALT , Print, exec, ${lib.getExe pkgs.hyprshot} -z -o ~/Screenshots -m active -m window"
|
||||
|
||||
'', XF86Calculator, exec, ghostty --title=pulsemixer -e pulsemixer''
|
||||
"$mainMod, W, exec, ${lib.getExe wallpaper_changer}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user