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