sway/kanshi: Make it functional on miku
This commit is contained in:
parent
2bdb6d7f76
commit
299763ceaf
@ -1,15 +1,18 @@
|
||||
{
|
||||
config
|
||||
, lib
|
||||
, writeShellScript
|
||||
, kanshi
|
||||
, wallpapersPath ? "/home/${config.system.singleUser}/Data/Wallpapers"
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
kanshi = pkgs.kanshi;
|
||||
writeShellScript = pkgs.writeShellScript;
|
||||
wallpapersPath = "/home/${config.system.singleUser}/Data/Wallpaper";
|
||||
wallpapersHorizontal = "${wallpapersPath}/horizontal";
|
||||
wallpapersVertical = "${wallpapersPath}/vertical";
|
||||
wallpaperScript = writeShellScript "wallpaper.sh" ''
|
||||
set -x
|
||||
[[ $# -lt 1 ]] && echo "No profile specified" && exit 1
|
||||
|
||||
random_file() {
|
||||
@ -26,8 +29,8 @@ let
|
||||
horiz=$(random_file ${wallpapersHorizontal})
|
||||
vert=$(random_file ${wallpapersVertical})
|
||||
|
||||
setbg "eDP-1" $horiz
|
||||
setbg "HDMI-A-1" $vert
|
||||
setbg "DP-2" $horiz
|
||||
setbg "HDMI-A-3" $vert
|
||||
;;
|
||||
genericMultihead)
|
||||
horiz1=$(random_file ${wallpapersHorizontal})
|
||||
@ -51,62 +54,52 @@ let
|
||||
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";
|
||||
horizontal = "Samsung Electric Company C27F398 H4ZR101145";
|
||||
vertical = "Goldstar Company Ltd IPS235 305NDPHKN600";
|
||||
in {
|
||||
homeMultihead = mkProfile "homeMultihead" [
|
||||
{
|
||||
criteria = vertical;
|
||||
status = "enable";
|
||||
mode = "1920x1080";
|
||||
transform = "270";
|
||||
position = "1920,-1080";
|
||||
transform = "90";
|
||||
position = "-1080,0";
|
||||
}
|
||||
{
|
||||
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";
|
||||
}
|
||||
#{
|
||||
# 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";
|
||||
# }
|
||||
#];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -1,33 +1,51 @@
|
||||
{
|
||||
config
|
||||
, lib, writeScript
|
||||
, lib, pkgs
|
||||
, stdenv
|
||||
, sway, mako, bemenu
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
passwordDmenu = writeShellScript "password_menu" ''
|
||||
#!${stdenv.shell}
|
||||
password=$(gopass list --flat | bmenu)
|
||||
gopass show -c "$password
|
||||
'';
|
||||
in {
|
||||
environment.systemPackages = [ sway ];
|
||||
modifier = "Mod1";
|
||||
writeShellScript = pkgs.writeShellScript;
|
||||
|
||||
nwggrid = "${pkgs.nwg-launchers}/bin/nwggrid";
|
||||
gopass = "${pkgs.gopass}/bin/gopass";
|
||||
# TODO: Add shebangs
|
||||
passwordDmenu = writeShellScript "password_menu" ''
|
||||
password=$(${gopass} list --flat | ${pkgs.bemenu}/bin/bemenu)
|
||||
${gopass} show -c "$password"
|
||||
'';
|
||||
mkWrapperScript = binary: args: let
|
||||
pname = baseNameOf binary;
|
||||
in writeShellScript "${pname}-wrapper" ''
|
||||
ps -aux | grep ${pname} &> /dev/null
|
||||
[[ "$?" -eq 0 ]] && pkill ${pname}
|
||||
|
||||
${binary} ${args}
|
||||
'';
|
||||
makoWrapper = mkWrapperScript "${pkgs.mako}/bin/mako" "--default-timeout=3000";
|
||||
waybarWrapper = mkWrapperScript "${pkgs.waybar}/bin/waybar" "";
|
||||
kanshiWrapper = mkWrapperScript "${pkgs.kanshi}/bin/kanshi" "";
|
||||
in {
|
||||
home-manager.users."${config.system.singleUser}" = {
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
config = rec {
|
||||
config = {
|
||||
bars = [ ];
|
||||
startup = [
|
||||
{ command = "${mako}/bin/mako --default-timeout=3000"; }
|
||||
{ command = "${makoWrapper}"; always = true; }
|
||||
{ command = "${waybarWrapper}"; always = true; }
|
||||
{ command = "${kanshiWrapper}"; always = true; }
|
||||
{ command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; always = true; }
|
||||
];
|
||||
modifier = "Mod1";
|
||||
modifier = "${modifier}";
|
||||
gaps = {
|
||||
inner = 5;
|
||||
outer = 7;
|
||||
};
|
||||
input = {
|
||||
* = { xkb_layout = "de"; };
|
||||
"*" = { xkb_layout = "de"; };
|
||||
"2:7:SynPS/2_Synaptics_TouchPad" = {
|
||||
tap = "enabled";
|
||||
natural_scroll = "disabled";
|
||||
@ -36,16 +54,16 @@ in {
|
||||
"2:10:TPPS/2_Elan_TrackPoint" = { dwt = "enabled"; };
|
||||
};
|
||||
output = {
|
||||
* = { adaptive_sync = "on"; };;
|
||||
"*" = { adaptive_sync = "on"; };
|
||||
};
|
||||
keybindings = lib.mkOptionDefault let
|
||||
keybindings = let
|
||||
speakers = "alsa_output.pci-0000_00_1f.3.analog-stereo";
|
||||
in {
|
||||
in lib.mkOptionDefault {
|
||||
"${modifier}+Return" = "exec alacritty";
|
||||
"${modifier}+e" = "exec emacs";
|
||||
"${modifier}+Shift+q" = "kill";
|
||||
"${modifer}+f" = "exec firefox";
|
||||
"${modifier}+d" = "exec ${bemenu}/bin/bemenu-run";
|
||||
"${modifier}+f" = "exec firefox";
|
||||
"${modifier}+d" = "exec ${pkgs.nwg-launchers}/bin/nwggrid";
|
||||
"${modifier}+p" = "exec ${passwordDmenu}";
|
||||
"Mod4+s" = "exec systemctl suspend";
|
||||
# TODO: Screenlock
|
||||
|
Loading…
Reference in New Issue
Block a user