summaryrefslogtreecommitdiff
path: root/home/wayland/modules/sway
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-06-03 22:07:43 +0530
committersinanmohd <sinan@sinanmohd.com>2024-06-04 10:14:48 +0530
commit45c9ec49e05daf1f0f4d8ba5ac6dc28b646622d1 (patch)
tree7156a0500b12086bef581601a560f42a89650a98 /home/wayland/modules/sway
parentd4f7650cd0735d1fe9173530cc31c24b65ed44ff (diff)
home/wayland/sway/swayidle: init
Diffstat (limited to 'home/wayland/modules/sway')
-rw-r--r--home/wayland/modules/sway/home.nix24
-rw-r--r--home/wayland/modules/sway/swayidle.nix36
-rw-r--r--home/wayland/modules/sway/swaylock.nix3
3 files changed, 51 insertions, 12 deletions
diff --git a/home/wayland/modules/sway/home.nix b/home/wayland/modules/sway/home.nix
index eb2bf41..38e2cb3 100644
--- a/home/wayland/modules/sway/home.nix
+++ b/home/wayland/modules/sway/home.nix
@@ -6,18 +6,19 @@
up = "k";
menu = "${pkgs.bemenu}/bin/bemenu-run --prompt ' '";
- term = lib.getExe config.programs.foot.package;
- status = lib.getExe config.programs.i3status.package;
- lock = lib.getExe config.programs.swaylock.package;
+ foot = lib.getExe config.programs.foot.package;
+ i3status = lib.getExe config.programs.i3status.package;
+ swaylock = lib.getExe config.programs.swaylock.package;
nnn = lib.getExe pkgs.nnn;
wpctl = "${pkgs.wireplumber}/bin/wpctl";
brightnessctl = lib.getExe pkgs.brightnessctl;
- notification = lib.getExe config.services.mako.package;
+ mako = lib.getExe config.services.mako.package;
firefox = lib.getExe config.programs.firefox.finalPackage;
in {
imports = [
./mako.nix
+ ./swayidle.nix
./swaylock.nix
./i3status.nix
];
@@ -25,6 +26,7 @@ in {
home.packages = [
pkgs.nnn
pkgs.bemenu
+ pkgs.swayidle
pkgs.brightnessctl
];
@@ -36,7 +38,7 @@ in {
bar = {
position = "top";
font = "sans";
- status_command = status;
+ status_command = i3status;
colors = {
background = "#000000";
focused_workspace = "#000000 #000000 #ffba08";
@@ -47,7 +49,7 @@ in {
bindgesture = {
"swipe:left" = "workspace next";
"swipe:right" = "workspace prev";
- "swipe:down" = "exec ${lock}";
+ "swipe:down" = "exec ${swaylock}";
};
input = {
"type:touchpad" = {
@@ -61,10 +63,9 @@ in {
};
bindsym = {
- # sway
+ # basics
"${mod}+q" = "kill";
"${mod}+shift+c" = "reload";
- "${mod}+tab" = "workspace back_and_forth";
"${mod}+shift+e" = ''
exec swaynag -t warning -m 'Do you really want to exit sway?' \
-B 'Yes, exit sway' 'swaymsg exit'
@@ -80,6 +81,7 @@ in {
"${mod}+7" = "workspace number 7";
"${mod}+8" = "workspace number 8";
"${mod}+9" = "workspace number 9";
+ "${mod}+tab" = "workspace back_and_forth";
"${mod}+shift+1" = "move container to workspace number 1";
"${mod}+shift+2" = "move container to workspace number 2";
"${mod}+shift+3" = "move container to workspace number 3";
@@ -113,10 +115,10 @@ in {
"${mod}+minus" = "scratchpad show";
# exec
- "${mod}+return" = "exec ${term}";
+ "${mod}+return" = "exec ${foot}";
"${mod}+p" = "exec ${menu}";
"${mod}+w" = "exec ${firefox}";
- "${mod}+n" = "exec ${term} -- ${nnn} -decC";
+ "${mod}+n" = "exec ${foot} -- ${nnn} -decC";
XF86MonBrightnessDown = "exec ${brightnessctl} set 1%-";
XF86MonBrightnessUp = "exec ${brightnessctl} set 1%+";
@@ -134,8 +136,8 @@ in {
return = "mode default";
};
+ exec = [ mako ];
gaps.inner = 10;
- exec = notification;
default_border.pixel = 2;
floating_modifier = "${mod} normal";
"client.focused" = "#4c7899 #285577 #ffffff #285577";
diff --git a/home/wayland/modules/sway/swayidle.nix b/home/wayland/modules/sway/swayidle.nix
new file mode 100644
index 0000000..1aa16c5
--- /dev/null
+++ b/home/wayland/modules/sway/swayidle.nix
@@ -0,0 +1,36 @@
+{ config, lib, pkgs, ... }: let
+ swaylock = lib.getExe config.programs.swaylock.package;
+ brightnessctl = lib.getExe pkgs.brightnessctl;
+ swaymsg = "${pkgs.sway}/bin/swaymsg";
+in {
+ services.swayidle = {
+ enable = true;
+ systemdTarget = "sway-session.target";
+
+ timeouts = [
+ {
+ timeout = 250;
+ command =
+ "${brightnessctl} --save; "
+ + "${brightnessctl} set 10%-";
+ resumeCommand = "${brightnessctl} --restore";
+ }
+
+ {
+ timeout = 300;
+ command = swaylock;
+ }
+
+ {
+ timeout = 600;
+ command =
+ "${swaymsg} --type command 'output * dpms off'; "
+ + "${brightnessctl} -c leds -d platform::kbd_backlight --save; "
+ + "${brightnessctl} -c leds -d platform::kbd_backlight set 0";
+ resumeCommand =
+ "${brightnessctl} -c leds -d platform::kbd_backlight --restore; "
+ + "${swaymsg} --type command 'output * dpms on'";
+ }
+ ];
+ };
+}
diff --git a/home/wayland/modules/sway/swaylock.nix b/home/wayland/modules/sway/swaylock.nix
index dcbe165..dbac0db 100644
--- a/home/wayland/modules/sway/swaylock.nix
+++ b/home/wayland/modules/sway/swaylock.nix
@@ -5,10 +5,11 @@
settings = {
clock = true;
+ daemonize = true;
+ color = "404040";
timestr = "%H:%M";
datestr = "%a,%e %b";
indicator-idle-visible = true;
- color = "404040";
};
};
}