Skip to content

Commit

Permalink
feat(waybar): add power submenu to options menu
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenhoenle committed Dec 8, 2024
1 parent 662d987 commit d58b62f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
3 changes: 1 addition & 2 deletions home/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ let

# other stuff
xclip = "xclip -selection c";
hibernate = "systemctl hibernate";
open = "xdg-open";
gloww = "glow README.md";

logout = "exec ${pkgs.systemd}/bin/loginctl terminate-user $USER && ${pkgs.sway}/bin/swaymsg mode default";
logout = "exec ${pkgs.systemd}/bin/loginctl terminate-user $USER";

# wireguard
wgu = "systemctl start wg-quick-wg0";
Expand Down
20 changes: 18 additions & 2 deletions home/sway/sway.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
};
cfg = config.wayland.windowManager.sway.config;
modeScreenshot = "󰄄 (r) region (s) screen";
modeOptions = "󰄄 (s) sound (d) displays (n) network (b) bluetooth";
modeOptions = "(s) sound (d) displays (n) network (b) bluetooth (p) power";
modeShutdown = "(h) hibernate (l) lock (e) logout (r) reboot (u) suspend (s) shutdown";
colors = {
text = "#cccccc";
indicator = "#cccccc";
Expand Down Expand Up @@ -156,16 +157,19 @@
"${cfg.modifier}+f" = "fullscreen toggle";

# screen lock
"${cfg.modifier}+Shift+Space" = "exec ${pkgs.swaylock}/bin/swaylock && ${pkgs.sway}/bin/swaymsg mode default";
"${cfg.modifier}+p" = "exec ${pkgs.swaylock}/bin/swaylock";

# Screenshot mode
"Print" = "mode \"${modeScreenshot}\"";
"${cfg.modifier}+Shift+s" = "mode \"${modeScreenshot}\"";

# Options mode
"${cfg.modifier}+o" = "mode \"${modeOptions}\"";


# Multimedia Keys
"XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
"${cfg.modifier}+m" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"--locked XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
"--locked XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
Expand All @@ -189,6 +193,18 @@
"b" = "exec ${pkgs.sway}/bin/swaymsg mode default && ${pkgs.alacritty}/bin/alacritty --class floating_shell -o window.dimensions.columns=164 -o window.dimensions.lines=25 -e ${pkgs.bluetuith}/bin/bluetuith";
"s" = "exec ${pkgs.sway}/bin/swaymsg mode default && ${pkgs.swayfx}/bin/swaymsg exec \"${pkgs.alacritty}/bin/alacritty --class floating_shell -o window.dimensions.columns=82 -o window.dimensions.lines=25 -e ${pkgs.pulsemixer}/bin/pulsemixer\"";
"n" = "exec ${pkgs.sway}/bin/swaymsg mode default && ${pkgs.alacritty}/bin/alacritty --class floating_shell -o window.dimensions.columns=82 -o window.dimensions.lines=25 -e ${pkgs.networkmanager}/bin/nmtui connect";
"p" = "mode \"${modeShutdown}\"";
"${cfg.modifier}+o" = "mode default";
Escape = "mode default";
Return = "mode default";
};
"${modeShutdown}" = {
"h" = "exec ${pkgs.systemd}/bin/systemctl hibernate && ${pkgs.swayfx}/bin/swaymsg mode default";
"l" = "exec ${pkgs.swaylock}/bin/swaylock && ${pkgs.swayfx}/bin/swaymsg mode default";
"e" = "exec ${pkgs.systemd}/bin/loginctl terminate-user $USER && ${pkgs.swayfx}/bin/swaymsg mode default";
"r" = "exec ${pkgs.systemd}/bin/systemctl reboot && ${pkgs.swayfx}/bin/swaymsg mode default";
"u" = "exec ${pkgs.systemd}/bin/systemctl suspend && ${pkgs.swayfx}/bin/swaymsg mode default";
"s" = "exec ${pkgs.systemd}/bin/systemctl poweroff && ${pkgs.swayfx}/bin/swaymsg mode default";
"${cfg.modifier}+o" = "mode default";
Escape = "mode default";
Return = "mode default";
Expand Down
1 change: 0 additions & 1 deletion home/sway/waybar/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@
tooltip = false;
scroll-step = 0; # disables scroll
format-muted = "VOL: MUTE";
on-click = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
};
bluetooth = {
format = "BLUE: on";
Expand Down

0 comments on commit d58b62f

Please sign in to comment.