about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--home/profiles/gui/config/sway.nix16
-rw-r--r--home/profiles/gui/default.nix1
-rw-r--r--home/profiles/gui/scripts/aeroplane-mode.nix15
-rw-r--r--nixos/haruka/configuration.nix2
4 files changed, 27 insertions, 7 deletions
diff --git a/home/profiles/gui/config/sway.nix b/home/profiles/gui/config/sway.nix
index dddf9d9..08ffa4f 100644
--- a/home/profiles/gui/config/sway.nix
+++ b/home/profiles/gui/config/sway.nix
@@ -141,18 +141,22 @@ in
   # bindsym $mod+Shift+a
 
   # Volume control
-  bindsym XF86AudioRaiseVolume exec ~/.local/bin/volume up
-  bindsym XF86AudioLowerVolume exec ~/.local/bin/volume down
-  bindsym XF86AudioMute        exec ~/.local/bin/volume toggle
+  bindsym XF86AudioRaiseVolume exec amixer set Master 5%+
+  bindsym XF86AudioLowerVolume exec amixer set Master 5%-
+  bindsym XF86AudioMute        exec amixer set Master toggle
+  bindsym XF86AudioMicMute     exec amixer set Capture toggle
   # HHKB
-  bindsym $mod+equal           exec ~/.local/bin/volume up
-  bindsym $mod+minus           exec ~/.local/bin/volume down
-  bindsym $mod+backslash       exec ~/.local/bin/volume toggle
+  bindsym $mod+equal           exec amixer set Master 5%+
+  bindsym $mod+minus           exec amixer set Master 5%-
+  bindsym $mod+backslash       exec amixer set Master toggle
 
   # Brightness
   bindsym XF86MonBrightnessDown exec brightnessctl -q set 10%-
   bindsym XF86MonBrightnessUp   exec brightnessctl -q set 10%+
 
+  # Aeroplane mode
+  bindsym XF86WLAN exec ${pkgs.writeShellScript "aeroplane-mode" (import ../scripts/aeroplane-mode.nix)}
+
   # Screenshot
   bindsym $mod+Print exec grimshot copy area
   bindsym Print      exec grimshot copy active
diff --git a/home/profiles/gui/default.nix b/home/profiles/gui/default.nix
index edc1646..7da1339 100644
--- a/home/profiles/gui/default.nix
+++ b/home/profiles/gui/default.nix
@@ -78,6 +78,7 @@ in
     home.packages = [
       # Sway
       pkgs.autotiling
+      pkgs.brightnessctl
       pkgs.swaybg
       pkgs.wayland-utils
       pkgs.wl-clipboard
diff --git a/home/profiles/gui/scripts/aeroplane-mode.nix b/home/profiles/gui/scripts/aeroplane-mode.nix
new file mode 100644
index 0000000..9f09c05
--- /dev/null
+++ b/home/profiles/gui/scripts/aeroplane-mode.nix
@@ -0,0 +1,15 @@
+''
+set -euo pipefail
+
+rfkill_soft=$(rfkill -ro soft | tail -n +2 | sort -u)
+
+rfkill toggle all
+
+if [[ $rfkill_soft == "unblocked"  ]]; then
+    notify-send --urgency=critical "Aeroplane mode ACTIVATED"
+elif [[ $rfkill_soft == "blocked" ]]; then
+    notify-send --urgency=critical "Aeroplane mode DEACTIVATED"
+else
+    notify-send --urgency=critical "WARN: RFKill was in inconsistent state. Aeroplane mode ACTIVATED"
+fi
+''
diff --git a/nixos/haruka/configuration.nix b/nixos/haruka/configuration.nix
index 923cc9f..0013b88 100644
--- a/nixos/haruka/configuration.nix
+++ b/nixos/haruka/configuration.nix
@@ -84,7 +84,7 @@
 
   time.timeZone = "Asia/Tokyo";
 
-  environment.systemPackages = with pkgs; [ gcc git gnumake brightnessctl ];
+  environment.systemPackages = with pkgs; [ gcc git gnumake ];
 
   services.zfs.trim.enable = true;
   services.zfs.autoScrub.enable = true;