modules: Add kanshi, sway and mako config
This commit is contained in:
parent
2e19c185f6
commit
488dd977d1
112
modules/programs/kanshi/default.nix
Normal file
112
modules/programs/kanshi/default.nix
Normal file
@ -0,0 +1,112 @@
|
||||
{
|
||||
config
|
||||
, lib
|
||||
, writeShellScript
|
||||
, kanshi
|
||||
, wallpapersPath ? "/home/${config.system.singleUser}/Data/Wallpapers"
|
||||
}:
|
||||
|
||||
let
|
||||
wallpapersHorizontal = "${wallpapersPath}/horizontal";
|
||||
wallpapersVertical = "${wallpapersPath}/vertical";
|
||||
wallpaperScript = writeShellScript "wallpaper.sh" ''
|
||||
[[ $# -lt 1 ]] && echo "No profile specified" && exit 1
|
||||
|
||||
random_file() {
|
||||
find "$1" -maxdepth 1 -type f | shuf -n 1
|
||||
}
|
||||
|
||||
setbg() {
|
||||
# Sets the background of $1 to $2
|
||||
swaymsg "output \"$1\" background $2 fill"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
homeMultihead)
|
||||
horiz=$(random_file ${wallpapersHorizontal})
|
||||
vert=$(random_file ${wallpapersVertical})
|
||||
|
||||
setbg "eDP-1" $horiz
|
||||
setbg "HDMI-A-1" $vert
|
||||
;;
|
||||
genericMultihead)
|
||||
horiz1=$(random_file ${wallpapersHorizontal})
|
||||
horiz2=$(random_file ${wallpapersHorizontal})
|
||||
|
||||
setbg "eDP-1" $horiz1
|
||||
setbg "HDMI-A-1" $horiz2
|
||||
;;
|
||||
laptop)
|
||||
horiz=$(random_file ${wallpapersHorizontal})
|
||||
|
||||
setbg "eDP-1" $horiz
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
mkProfile = name: outputs: {
|
||||
outputs = outputs;
|
||||
|
||||
exec = "${wallpaperScript} ${name}";
|
||||
};
|
||||
in {
|
||||
environment.systemPackages = [ kanshi ];
|
||||
|
||||
systemd.user.services.kanshi = {
|
||||
description = "Dynamic display configuration tool";
|
||||
wantedBy = [ "default.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${kanshi}/bin/kanshi";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users."${config.system.singleUser}".services.kanshi = {
|
||||
enable = true;
|
||||
profiles = let
|
||||
horizontal = "Samsung Electric Company C27F398 H4ZN200596";
|
||||
vertical = "Goldstar Company Ltd IPS235 Serial Number";
|
||||
in {
|
||||
homeMultihead = mkProfile "homeMultihead" [
|
||||
{
|
||||
criteria = vertical;
|
||||
status = "enable";
|
||||
mode = "1920x1080";
|
||||
transform = "270";
|
||||
position = "1920,-1080";
|
||||
}
|
||||
{
|
||||
criteria = horizontal;
|
||||
status = "enable";
|
||||
mode = "1920x1080";
|
||||
position = "1920,-1080";
|
||||
}
|
||||
{
|
||||
criteria = "eDP-1";
|
||||
status = "enable";
|
||||
mode = "1920x1080";
|
||||
position = "0,0";
|
||||
}
|
||||
];
|
||||
genericMultihead = mkProfile "genericMultihead" [
|
||||
{
|
||||
criteria = "eDP-1";
|
||||
mode = "1920x1080";
|
||||
status = "enable";
|
||||
}
|
||||
{
|
||||
criteria = "HDMI-A-1";
|
||||
status = "enable";
|
||||
}
|
||||
];
|
||||
laptop = mkProfile "laptop" [
|
||||
{
|
||||
criteria = "eDP-1";
|
||||
status = "enable";
|
||||
mode = "1920x1080";
|
||||
position = "0,0";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
12
modules/programs/mako/default.nix
Normal file
12
modules/programs/mako/default.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
config
|
||||
, mako
|
||||
}:
|
||||
|
||||
{
|
||||
environment.systemPackages = [ mako ];
|
||||
|
||||
home-manager.users."${config.system.singleUser}".programs.mako = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
50
modules/programs/sway/default.nix
Normal file
50
modules/programs/sway/default.nix
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
config
|
||||
, lib
|
||||
, sway, mako
|
||||
}:
|
||||
|
||||
{
|
||||
environment.systemPackages = [ sway ];
|
||||
|
||||
home-manager.users."${config.system.singleUser}" = {
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
config = rec {
|
||||
startup = [
|
||||
{ command = "${mako}/bin/mako --default-timeout=3000"; }
|
||||
];
|
||||
modifier = "Mod1";
|
||||
gaps = {
|
||||
inner = 5;
|
||||
outer = 7;
|
||||
};
|
||||
input = {
|
||||
* = { xkb_layout = "de"; };
|
||||
"2:7:SynPS/2_Synaptics_TouchPad" = {
|
||||
tap = "enabled";
|
||||
natural_scroll = "disabled";
|
||||
dwt = "enabled";
|
||||
};
|
||||
"2:10:TPPS/2_Elan_TrackPoint" = { dwt = "enabled"; };
|
||||
};
|
||||
output = {
|
||||
* = { adaptive_sync = "on"; };;
|
||||
};
|
||||
keybindings = lib.mkOptionDefault let
|
||||
speakers = "alsa_output.pci-0000_00_1f.3.analog-stereo";
|
||||
in {
|
||||
"${modifier}+Return" = "exec alacritty";
|
||||
"${modifier}+e" = "exec emacs";
|
||||
"${modifier}+Shift+q" = "kill";
|
||||
"${modifer}+f" = "exec firefox";
|
||||
"F1" = "exec pactl set-sink-volume ${speakers} toggle";
|
||||
"F2" = "exec pactl set-sink-volume ${speakers} -10%";
|
||||
"F3" = "exec pactl set-sink-volume ${speakers} +10%";
|
||||
"F5" = "exec brightnessctl --device=intel_backlight set 10%-";
|
||||
"F6" = "exec brightnessctl --device=intel_backlight set +10%";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user