diff --git a/options/custom/desktops/hyprland/binds.nix b/options/custom/desktops/hyprland/binds.nix
index 3f9ec73..3245089 100644
--- a/options/custom/desktops/hyprland/binds.nix
+++ b/options/custom/desktops/hyprland/binds.nix
@@ -7,6 +7,7 @@
}:
with lib; let
audio = "~/.local/bin/audio";
+ cat = "${pkgs.coreutils}/bin/cat";
clipse = "${pkgs.clipse}/bin/clipse";
codium = "${config.home-manager.users.${config.custom.username}.programs.vscode.package}/bin/codium";
firefox-esr = "${config.home-manager.users.${config.custom.username}.programs.firefox.finalPackage}/bin/firefox-esr";
@@ -28,6 +29,7 @@ with lib; let
onlyoffice = "${pkgs.onlyoffice-bin}/bin/onlyoffice-desktopeditors --system-title-bar --xdg-desktop-portal";
pkill = "${pkgs.procps}/bin/pkill";
playerctl = "${pkgs.playerctl}/bin/playerctl";
+ remote = config.home-manager.users.${config.custom.username}.home.file.".local/bin/remote".source;
rofi-rbw = "${pkgs.rofi-rbw}/bin/rofi-rbw";
rm = "${pkgs.coreutils}/bin/rm";
screenshot = "~/.local/bin/screenshot";
@@ -38,7 +40,6 @@ with lib; let
systemctl = "${pkgs.systemd}/bin/systemctl";
toggle = "~/.local/bin/toggle";
virt-manager = "${config.programs.virt-manager.package}/bin/virt-manager";
- vm = config.home-manager.users.${config.custom.username}.home.file.".local/bin/vm".source;
vrr = config.home-manager.users.${config.custom.username}.home.file.".local/bin/vrr".source;
walker = "${config.home-manager.users.${config.custom.username}.programs.walker.package}/bin/walker";
waydroid = "${pkgs.waydroid}/bin/waydroid";
@@ -50,222 +51,233 @@ with lib; let
in {
options.custom.desktops.hyprland.binds.enable = mkOption {default = false;};
- config.home-manager.users.${config.custom.username} = mkIf cfg.enable {
- wayland.windowManager.hyprland.settings = let
- # Reverse mods and key for alphabetical sorting
- #?? key <"KEY"> <"MODS"|null> <"DISPATCHER"> <"PARAMS"|null>
- key = key: mods: dispatcher: params: "${
- if (isNull mods)
- then ""
- else mods
- }, ${key}, ${dispatcher}${
- if (isNull params)
- then ""
- else ", ${params}"
- }";
+ config = mkIf cfg.enable {
+ age.secrets = let
+ secret = filename: {
+ file = "${inputs.self}/secrets/${filename}";
+ owner = config.custom.username;
+ group = "users";
+ };
in {
- # https://wiki.hyprland.org/Configuring/Binds
- #?? bind = MODS, KEY, DISPATCHER, [PARAMS]
- #?? wev
+ "desktop/vm/myndows.pass" = secret "desktop/vm/myndows.pass";
+ };
- # Lockscreen binds
- bindl = [
- (key "Delete" "Ctrl" "exec" "${hyprctl} reload")
- (key "Delete" "Ctrl+Alt" "exec" "${loginctl} terminate-user ''") # Current user sessions
- (key "Delete" "Super" "exec" inhibit)
+ home-manager.users.${config.custom.username} = {
+ wayland.windowManager.hyprland.settings = let
+ # Reverse mods and key for alphabetical sorting
+ #?? key <"KEY"> <"MODS"|null> <"DISPATCHER"> <"PARAMS"|null>
+ key = key: mods: dispatcher: params: "${
+ if (isNull mods)
+ then ""
+ else mods
+ }, ${key}, ${dispatcher}${
+ if (isNull params)
+ then ""
+ else ", ${params}"
+ }";
+ in {
+ # https://wiki.hyprland.org/Configuring/Binds
+ #?? bind = MODS, KEY, DISPATCHER, [PARAMS]
+ #?? wev
- (key "L" "Super" "exec" "${hyprlock} --immediate & ${sleep} 1 && ${hyprctl} dispatch dpms off")
+ # Lockscreen binds
+ bindl = [
+ (key "Delete" "Ctrl" "exec" "${hyprctl} reload")
+ (key "Delete" "Ctrl+Alt" "exec" "${loginctl} terminate-user ''") # Current user sessions
+ (key "Delete" "Super" "exec" inhibit)
- # Laptop lid switches
- # https://wiki.hyprland.org/Configuring/Binds/#switches
- #?? hyprctl devices
- (key "switch:off:Lid Switch" null "dpms" "on") # Open
- (key "switch:on:Lid Switch" null "dpms" "off") # Close
- ];
+ (key "L" "Super" "exec" "${hyprlock} --immediate & ${sleep} 1 && ${hyprctl} dispatch dpms off")
- # Mouse binds
- bindm = [
- (key "mouse:272" "Super" "movewindow" null) # LMB
- (key "mouse:273" "Super" "resizewindow" null) # RMB
- ];
+ # Laptop lid switches
+ # https://wiki.hyprland.org/Configuring/Binds/#switches
+ #?? hyprctl devices
+ (key "switch:off:Lid Switch" null "dpms" "on") # Open
+ (key "switch:on:Lid Switch" null "dpms" "off") # Close
+ ];
- # Repeat binds
- binde = [
- # Media keys
- # https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
- (key "XF86AudioMute" null "exec" "${swayosd-client} --output-volume mute-toggle") # F1
- (key "XF86AudioLowerVolume" null "exec" "${swayosd-client} --output-volume lower") # F2
- (key "XF86AudioRaiseVolume" null "exec" "${swayosd-client} --output-volume raise") # F3
- (key "XF86AudioPrev" null "exec" "${playerctl} previous") # F4
- (key "XF86AudioPlay" null "exec" "${playerctl} play-pause") # F5
- (key "XF86AudioNext" null "exec" "${playerctl} next") # F6
- (key "XF86MonBrightnessDown" null "exec" "${swayosd-client} --brightness lower") # F7
- (key "XF86MonBrightnessUp" null "exec" "${swayosd-client} --brightness raise") # F8
- (key "XF86AudioMedia" null "exec" "${notify-send} test") # F12
- ];
+ # Mouse binds
+ bindm = [
+ (key "mouse:272" "Super" "movewindow" null) # LMB
+ (key "mouse:273" "Super" "resizewindow" null) # RMB
+ ];
- # Release binds
- bindr = [
- (key "Alt_L" "Super+Alt" "togglespecialworkspace" "wallpaper")
- (key "Alt_L" "Super+Alt+Shift" "movetoworkspacesilent" "special:wallpaper")
- (key "Control_L" "Super+Ctrl" "exec" workspace)
- (key "Shift_L" "Super+Shift" "workspace" "previous")
- (key "Super_L" "Super" "exec" "${menu}")
- #// (key "Super_L" "Super+Alt" "exec" "${menu} --passwords")
- (key "Super_L" "Super+Ctrl" "exec" "${menu} --calculator")
- (key "Super_L" "Super+Ctrl+Shift" "exec" "${menu} --networks")
- (key "Super_L" "Super+Shift" "exec" "${menu} --search")
- ];
+ # Repeat binds
+ binde = [
+ # Media keys
+ # https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
+ (key "XF86AudioMute" null "exec" "${swayosd-client} --output-volume mute-toggle") # F1
+ (key "XF86AudioLowerVolume" null "exec" "${swayosd-client} --output-volume lower") # F2
+ (key "XF86AudioRaiseVolume" null "exec" "${swayosd-client} --output-volume raise") # F3
+ (key "XF86AudioPrev" null "exec" "${playerctl} previous") # F4
+ (key "XF86AudioPlay" null "exec" "${playerctl} play-pause") # F5
+ (key "XF86AudioNext" null "exec" "${playerctl} next") # F6
+ (key "XF86MonBrightnessDown" null "exec" "${swayosd-client} --brightness lower") # F7
+ (key "XF86MonBrightnessUp" null "exec" "${swayosd-client} --brightness raise") # F8
+ (key "XF86AudioMedia" null "exec" "${notify-send} test") # F12
+ ];
- # Regular binds
- bind = [
- (key "mouse:274" "Super" "layoutmsg" "swapwithmaster auto")
- (key "mouse:274" "Super+Shift" "layoutmsg" "addmaster")
- (key "mouse:274" "Super+Ctrl+Shift" "layoutmsg" "removemaster")
+ # Release binds
+ bindr = [
+ (key "Alt_L" "Super+Alt" "togglespecialworkspace" "wallpaper")
+ (key "Alt_L" "Super+Alt+Shift" "movetoworkspacesilent" "special:wallpaper")
+ (key "Control_L" "Super+Ctrl" "exec" workspace)
+ (key "Shift_L" "Super+Shift" "workspace" "previous")
+ (key "Super_L" "Super" "exec" "${menu}")
+ #// (key "Super_L" "Super+Alt" "exec" "${menu} --passwords")
+ (key "Super_L" "Super+Ctrl" "exec" "${menu} --calculator")
+ (key "Super_L" "Super+Ctrl+Shift" "exec" "${menu} --networks")
+ (key "Super_L" "Super+Shift" "exec" "${menu} --search")
+ ];
- (key "Backslash" "Super" "layoutmsg" "orientationcycle center left")
- (key "Backslash" "Super+Shift" "splitratio" "exact 0.5") # Reset layout ratio
- (key "Backspace" "Super" "changegroupactive" "f")
- (key "Backspace" "Super+Ctrl" "togglegroup" null)
- (key "Backspace" "Super+Ctrl+Shift" "lockactivegroup" "toggle")
- (key "Backspace" "Super+Shift" "movegroupwindow" null)
- (key "Bracketleft" "Super" "layoutmsg" "rollnext")
- (key "Bracketleft" "Super+Shift" "splitratio" "-0.1")
- (key "Bracketright" "Super" "layoutmsg" "rollprev")
- (key "Bracketright" "Super+Shift" "splitratio" "+0.1")
- (key "Comma" "Super" "layoutmsg" "swapprev")
- (key "Down" "Super" "movewindoworgroup" "d")
- (key "Down" "Super+Shift" "movewindow" "d")
- (key "Equal" "Super" "exec" "${swayosd-client} --output-volume raise")
- (key "Equal" "Super+Shift" "exec" "${zoom} +0.1")
- (key "Escape" "Super" "togglefloating" null)
- (key "Escape" "Super+Alt" "exec" "lifx state --color red")
- (key "Escape" "Super+Shift" "centerwindow" null)
- (key "Grave" "Super" "exec" smile)
- (key "Left" "Super" "movewindoworgroup" "l")
- (key "Left" "Super+Alt" "exec" "${left} --scroll kensington-orbit-wireless-tb-mouse")
- (key "Left" "Super+Shift" "movewindow" "l")
- (key "Minus" "Super" "exec" "${swayosd-client} --output-volume lower")
- (key "Minus" "Super+Shift" "exec" "${zoom} -0.1")
- (key "Period" "Super" "layoutmsg" "swapnext")
- (key "Apostrophe" "Super" "exec" "${screenshot} selection")
- (key "Apostrophe" "Super+Shift" "exec" "${screenshot} display")
- (key "Apostrophe" "Super+Alt" "exec" "${screenshot} selection --edit")
- (key "Apostrophe" "Super+Alt+Shift" "exec" "${screenshot} display --edit")
- (key "Return" "Super" "fullscreen" "1") # Maximize
- (key "Return" "Super+Shift" "fullscreen" "0") # Fullscreen
- (key "Right" "Super" "movewindoworgroup" "r")
- (key "Right" "Super+Shift" "movewindow" "r")
- (key "Semicolon" "Super" "exec" "${hyprpicker} --autocopy")
- (key "Semicolon" "Super+Shift" "exec" "${hyprpicker} --autocopy --format rgb")
- (key "Slash" "Super" "exec" vrr)
- (key "Space" "Ctrl" "exec" (concatStringsSep " " [
- "${toggle}"
- "--focus"
- "--type class"
- "--expression '^dropdown$'"
- "--workspace special:dropdown"
- "--"
- "${kitty} --app-id dropdown --override font_size=12"
- ]))
- (key "Space" "Ctrl+Alt" "exec" "lifx toggle")
- (key "Space" "Ctrl+Shift" "exec" (concatStringsSep " " [
- "${toggle}"
- "--type title"
- "--expression '^Picture.in.[Pp]icture$'"
- "--workspace special:pip"
- ]))
- (key "Space" "Super" "togglespecialworkspace" "scratchpad")
- (key "Space" "Super+Shift" "movetoworkspacesilent" "special:scratchpad")
- (key "Space" "Super+Ctrl+Shift" "exec" (with config.custom;
- concatStringsSep " " [
- "${window} move"
- "--current"
- "--property title"
- "'^Picture.in.[Pp]icture$'"
- "${toString (gap + border)},${toString (gap + border)}"
+ # Regular binds
+ bind = [
+ (key "mouse:274" "Super" "layoutmsg" "swapwithmaster auto")
+ (key "mouse:274" "Super+Shift" "layoutmsg" "addmaster")
+ (key "mouse:274" "Super+Ctrl+Shift" "layoutmsg" "removemaster")
+
+ (key "Backslash" "Super" "layoutmsg" "orientationcycle center left")
+ (key "Backslash" "Super+Shift" "splitratio" "exact 0.5") # Reset layout ratio
+ (key "Backspace" "Super" "changegroupactive" "f")
+ (key "Backspace" "Super+Ctrl" "togglegroup" null)
+ (key "Backspace" "Super+Ctrl+Shift" "lockactivegroup" "toggle")
+ (key "Backspace" "Super+Shift" "movegroupwindow" null)
+ (key "Bracketleft" "Super" "layoutmsg" "rollnext")
+ (key "Bracketleft" "Super+Shift" "splitratio" "-0.1")
+ (key "Bracketright" "Super" "layoutmsg" "rollprev")
+ (key "Bracketright" "Super+Shift" "splitratio" "+0.1")
+ (key "Comma" "Super" "layoutmsg" "swapprev")
+ (key "Down" "Super" "movewindoworgroup" "d")
+ (key "Down" "Super+Shift" "movewindow" "d")
+ (key "Equal" "Super" "exec" "${swayosd-client} --output-volume raise")
+ (key "Equal" "Super+Shift" "exec" "${zoom} +0.1")
+ (key "Escape" "Super" "togglefloating" null)
+ (key "Escape" "Super+Alt" "exec" "lifx state --color red")
+ (key "Escape" "Super+Shift" "centerwindow" null)
+ (key "Grave" "Super" "exec" smile)
+ (key "Left" "Super" "movewindoworgroup" "l")
+ (key "Left" "Super+Alt" "exec" "${left} --scroll kensington-orbit-wireless-tb-mouse")
+ (key "Left" "Super+Shift" "movewindow" "l")
+ (key "Minus" "Super" "exec" "${swayosd-client} --output-volume lower")
+ (key "Minus" "Super+Shift" "exec" "${zoom} -0.1")
+ (key "Period" "Super" "layoutmsg" "swapnext")
+ (key "Apostrophe" "Super" "exec" "${screenshot} selection")
+ (key "Apostrophe" "Super+Shift" "exec" "${screenshot} display")
+ (key "Apostrophe" "Super+Alt" "exec" "${screenshot} selection --edit")
+ (key "Apostrophe" "Super+Alt+Shift" "exec" "${screenshot} display --edit")
+ (key "Return" "Super" "fullscreen" "1") # Maximize
+ (key "Return" "Super+Shift" "fullscreen" "0") # Fullscreen
+ (key "Right" "Super" "movewindoworgroup" "r")
+ (key "Right" "Super+Shift" "movewindow" "r")
+ (key "Semicolon" "Super" "exec" "${hyprpicker} --autocopy")
+ (key "Semicolon" "Super+Shift" "exec" "${hyprpicker} --autocopy --format rgb")
+ (key "Slash" "Super" "exec" vrr)
+ (key "Space" "Ctrl" "exec" (concatStringsSep " " [
+ "${toggle}"
+ "--focus"
+ "--type class"
+ "--expression '^dropdown$'"
+ "--workspace special:dropdown"
+ "--"
+ "${kitty} --app-id dropdown --override font_size=12"
]))
- (key "Tab" "Super" "layoutmsg" "cyclenext")
- (key "Tab" "Super+Shift" "alterzorder" "top")
- (key "Tab" "Super+Shift" "cyclenext" "floating")
- (key "Up" "Super" "movewindoworgroup" "u")
- (key "Up" "Super+Shift" "movewindow" "u")
+ (key "Space" "Ctrl+Alt" "exec" "lifx toggle")
+ (key "Space" "Ctrl+Shift" "exec" (concatStringsSep " " [
+ "${toggle}"
+ "--type title"
+ "--expression '^Picture.in.[Pp]icture$'"
+ "--workspace special:pip"
+ ]))
+ (key "Space" "Super" "togglespecialworkspace" "scratchpad")
+ (key "Space" "Super+Shift" "movetoworkspacesilent" "special:scratchpad")
+ (key "Space" "Super+Ctrl+Shift" "exec" (with config.custom;
+ concatStringsSep " " [
+ "${window} move"
+ "--current"
+ "--property title"
+ "'^Picture.in.[Pp]icture$'"
+ "${toString (gap + border)},${toString (gap + border)}"
+ ]))
+ (key "Tab" "Super" "layoutmsg" "cyclenext")
+ (key "Tab" "Super+Shift" "alterzorder" "top")
+ (key "Tab" "Super+Shift" "cyclenext" "floating")
+ (key "Up" "Super" "movewindoworgroup" "u")
+ (key "Up" "Super+Shift" "movewindow" "u")
- (key "0" "Super" "exec" "${swayosd-client} --output-volume mute-toggle")
- (key "0" "Super+Shift" "exec" "${zoom}")
- (key "1" "Ctrl+Alt" "exec" "lifx state --brightness 0.01")
- (key "1" "Super" "workspace" "1")
- (key "1" "Super+Alt" "exec" "lifx state --kelvin 1500")
- (key "1" "Super+Shift" "movetoworkspacesilent" "1")
- (key "2" "Ctrl+Alt" "exec" "lifx state --brightness 0.25")
- (key "2" "Super" "workspace" "2")
- (key "2" "Super+Alt" "exec" "lifx state --kelvin 2500")
- (key "2" "Super+Shift" "movetoworkspacesilent" "2")
- (key "3" "Ctrl+Alt" "exec" "lifx state --brightness 0.50")
- (key "3" "Super" "workspace" "3")
- (key "3" "Super+Alt" "exec" "lifx state --kelvin 3000")
- (key "3" "Super+Shift" "movetoworkspacesilent" "3")
- (key "4" "Ctrl+Alt" "exec" "lifx state --brightness 0.75")
- (key "4" "Super" "workspace" "4")
- (key "4" "Super+Alt" "exec" "lifx state --kelvin 4000")
- (key "4" "Super+Shift" "movetoworkspacesilent" "4")
- (key "5" "Ctrl+Alt" "exec" "lifx state --brightness 1.00")
- (key "5" "Super" "workspace" "5")
- (key "5" "Super+Alt" "exec" "lifx state --kelvin 5000")
- (key "5" "Super+Shift" "movetoworkspacesilent" "5")
- (key "6" "Super" "workspace" "6")
- (key "6" "Super+Shift" "movetoworkspacesilent" "6")
- (key "7" "Super" "workspace" "7")
- (key "7" "Super+Shift" "movetoworkspacesilent" "7")
- (key "8" "Super" "workspace" "8")
- (key "8" "Super+Shift" "movetoworkspacesilent" "8")
- (key "9" "Super" "exec" "${audio}")
- (key "A" "Ctrl+Alt" "exec" "${waydroid} session stop")
- (key "A" "Super" "togglespecialworkspace" "android")
- (key "A" "Super+Shift" "movetoworkspacesilent" "special:android")
- (key "B" "Super" "exec" firefox-esr)
- (key "C" "Super" "exec" codium)
- (key "E" "Super" "exec" gnome-text-editor)
- (key "F" "Super" "exec" "${nautilus} --new-window")
- (key "G" "Super" "workspace" "name:game")
- (key "G" "Super+Alt" "togglespecialworkspace" "gamescope")
- (key "G" "Super+Ctrl+Alt" "exec" "${pkill} gamescope")
- (key "G" "Super+Shift" "movetoworkspacesilent" "name:game")
- (key "K" "Super" "exec" obsidian)
- (key "M" "Super" "togglespecialworkspace" "music")
- (key "M" "Super+Shift" "movetoworkspacesilent" "special:music")
- (key "O" "Super" "togglespecialworkspace" "office")
- (key "O" "Super+Ctrl" "exec" "${onlyoffice}")
- (key "O" "Super+Shift" "movetoworkspacesilent" "special:office")
- (key "P" "Ctrl+Alt" "exec" "${pkill} 1password")
- (key "P" "Super" "togglespecialworkspace" "password")
- (key "P" "Super+Shift" "movetoworkspacesilent" "special:password")
- (key "Q" "Ctrl+Alt" "exec" "${kill} -9 $(${hyprctl} -j activewindow | ${jq} .pid)")
- #// (key "Q" "Ctrl+Alt+Shift" "exec" "close") # Quit all windows
- (key "Q" "Super" "killactive" null)
- (key "S" "Ctrl+Alt" "exec" "${pkill} steam")
- (key "S" "Super" "togglespecialworkspace" "steam")
- (key "S" "Super+Shift" "movetoworkspacesilent" "special:steam")
- (key "S" "Super+Shift" "exec" steam)
- (key "T" "Ctrl+Alt" "exec" "${pkill} kitty")
- (key "T" "Super" "togglespecialworkspace" "terminal")
- (key "T" "Super+Ctrl" "exec" kitty)
- (key "T" "Super+Shift" "movetoworkspacesilent" "special:terminal")
- (key "V" "Super" "exec" "${kitty} --app-id clipboard --override font_size=12 ${clipse}")
- (key "V" "Super+Shift" "exec" "${clipse} --clear && ${notify-send} clipse 'Clipboard cleared' --urgency low")
- (key "W" "Super" "togglespecialworkspace" "vm")
- (key "W" "Super+Ctrl" "exec" "${vm} -x ${
- if config.custom.hidpi
- then "/scale:140 +f"
- else ""
- }")
- (key "W" "Super+Ctrl+Shift" "exec" "${vm} ${virt-manager} --show-domain-console myndows")
- (key "W" "Super+Shift" "movetoworkspacesilent" "special:vm")
- (key "X" "Super" "workspace" "+1")
- (key "X" "Super+Shift" "movetoworkspacesilent" "+1")
- (key "Z" "Super" "workspace" "-1")
- (key "Z" "Super+Shift" "movetoworkspacesilent" "-1")
- ];
+ (key "0" "Super" "exec" "${swayosd-client} --output-volume mute-toggle")
+ (key "0" "Super+Shift" "exec" "${zoom}")
+ (key "1" "Ctrl+Alt" "exec" "lifx state --brightness 0.01")
+ (key "1" "Super" "workspace" "1")
+ (key "1" "Super+Alt" "exec" "lifx state --kelvin 1500")
+ (key "1" "Super+Shift" "movetoworkspacesilent" "1")
+ (key "2" "Ctrl+Alt" "exec" "lifx state --brightness 0.25")
+ (key "2" "Super" "workspace" "2")
+ (key "2" "Super+Alt" "exec" "lifx state --kelvin 2500")
+ (key "2" "Super+Shift" "movetoworkspacesilent" "2")
+ (key "3" "Ctrl+Alt" "exec" "lifx state --brightness 0.50")
+ (key "3" "Super" "workspace" "3")
+ (key "3" "Super+Alt" "exec" "lifx state --kelvin 3000")
+ (key "3" "Super+Shift" "movetoworkspacesilent" "3")
+ (key "4" "Ctrl+Alt" "exec" "lifx state --brightness 0.75")
+ (key "4" "Super" "workspace" "4")
+ (key "4" "Super+Alt" "exec" "lifx state --kelvin 4000")
+ (key "4" "Super+Shift" "movetoworkspacesilent" "4")
+ (key "5" "Ctrl+Alt" "exec" "lifx state --brightness 1.00")
+ (key "5" "Super" "workspace" "5")
+ (key "5" "Super+Alt" "exec" "lifx state --kelvin 5000")
+ (key "5" "Super+Shift" "movetoworkspacesilent" "5")
+ (key "6" "Super" "workspace" "6")
+ (key "6" "Super+Shift" "movetoworkspacesilent" "6")
+ (key "7" "Super" "workspace" "7")
+ (key "7" "Super+Shift" "movetoworkspacesilent" "7")
+ (key "8" "Super" "workspace" "8")
+ (key "8" "Super+Shift" "movetoworkspacesilent" "8")
+ (key "9" "Super" "exec" "${audio}")
+ (key "A" "Ctrl+Alt" "exec" "${waydroid} session stop")
+ (key "A" "Super" "togglespecialworkspace" "android")
+ (key "A" "Super+Shift" "movetoworkspacesilent" "special:android")
+ (key "B" "Super" "exec" firefox-esr)
+ (key "C" "Super" "exec" codium)
+ (key "E" "Super" "exec" gnome-text-editor)
+ (key "F" "Super" "exec" "${nautilus} --new-window")
+ (key "G" "Super" "workspace" "name:game")
+ (key "G" "Super+Alt" "togglespecialworkspace" "gamescope")
+ (key "G" "Super+Ctrl+Alt" "exec" "${pkill} gamescope")
+ (key "G" "Super+Shift" "movetoworkspacesilent" "name:game")
+ (key "K" "Super" "exec" obsidian)
+ (key "M" "Super" "togglespecialworkspace" "music")
+ (key "M" "Super+Shift" "movetoworkspacesilent" "special:music")
+ (key "O" "Super" "togglespecialworkspace" "office")
+ (key "O" "Super+Ctrl" "exec" "${onlyoffice}")
+ (key "O" "Super+Shift" "movetoworkspacesilent" "special:office")
+ (key "P" "Ctrl+Alt" "exec" "${pkill} 1password")
+ (key "P" "Super" "togglespecialworkspace" "password")
+ (key "P" "Super+Shift" "movetoworkspacesilent" "special:password")
+ (key "Q" "Ctrl+Alt" "exec" "${kill} -9 $(${hyprctl} -j activewindow | ${jq} .pid)")
+ #// (key "Q" "Ctrl+Alt+Shift" "exec" "close") # Quit all windows
+ (key "Q" "Super" "killactive" null)
+ (key "S" "Ctrl+Alt" "exec" "${pkill} steam")
+ (key "S" "Super" "togglespecialworkspace" "steam")
+ (key "S" "Super+Shift" "movetoworkspacesilent" "special:steam")
+ (key "S" "Super+Shift" "exec" steam)
+ (key "T" "Ctrl+Alt" "exec" "${pkill} kitty")
+ (key "T" "Super" "togglespecialworkspace" "terminal")
+ (key "T" "Super+Ctrl" "exec" kitty)
+ (key "T" "Super+Shift" "movetoworkspacesilent" "special:terminal")
+ (key "V" "Super" "exec" "${kitty} --app-id clipboard --override font_size=12 ${clipse}")
+ (key "V" "Super+Shift" "exec" "${clipse} --clear && ${notify-send} clipse 'Clipboard cleared' --urgency low")
+ (key "W" "Super" "togglespecialworkspace" "vm")
+ (key "W" "Super+Ctrl" "exec" ''${remote} --vm --username Myned --password "$(${cat} ${config.age.secrets."desktop/vm/myndows.pass".path})" ${
+ if config.custom.hidpi
+ then "--scale 140"
+ else ""
+ } myndows'')
+ (key "W" "Super+Shift" "movetoworkspacesilent" "special:vm")
+ (key "X" "Super" "workspace" "+1")
+ (key "X" "Super+Shift" "movetoworkspacesilent" "+1")
+ (key "Z" "Super" "workspace" "-1")
+ (key "Z" "Super+Shift" "movetoworkspacesilent" "-1")
+ ];
+ };
};
};
}
diff --git a/options/custom/programs/waybar/default.nix b/options/custom/programs/waybar/default.nix
index 6b34e21..23d3c02 100644
--- a/options/custom/programs/waybar/default.nix
+++ b/options/custom/programs/waybar/default.nix
@@ -1,5 +1,6 @@
{
config,
+ inputs,
lib,
pkgs,
...
@@ -24,6 +25,7 @@ with lib; let
pkill = "${pkgs.procps}/bin/pkill";
playerctl = "${pkgs.playerctl}/bin/playerctl";
power = config.home-manager.users.${config.custom.username}.home.file.".local/bin/power".source;
+ remote = config.home-manager.users.${config.custom.username}.home.file.".local/bin/remote".source;
rfkill = "${pkgs.util-linux}/bin/rfkill";
sleep = "${pkgs.coreutils}/bin/sleep";
swaync-client = "${config.home-manager.users.${config.custom.username}.services.swaync.package}/bin/swaync-client";
@@ -32,7 +34,6 @@ with lib; let
systemd-inhibit = "${pkgs.systemd}/bin/systemd-inhibit";
tailscale = "${pkgs.tailscale}/bin/tailscale";
tr = "${pkgs.coreutils}/bin/tr";
- vm = config.home-manager.users.${config.custom.username}.home.file.".local/bin/vm".source;
vpn = config.home-manager.users.${config.custom.username}.home.file.".local/bin/vpn".source;
wttrbar = "${pkgs.wttrbar}/bin/wttrbar";
@@ -40,373 +41,385 @@ with lib; let
in {
options.custom.programs.waybar.enable = mkOption {default = false;};
- config.home-manager.users.${config.custom.username} = mkIf cfg.enable {
- # https://github.com/Alexays/Waybar
- # https://www.nerdfonts.com/cheat-sheet
- programs.waybar = {
- enable = true;
- systemd.enable = true; # Start on login
+ config = mkIf cfg.enable {
+ age.secrets = let
+ secret = filename: {
+ file = "${inputs.self}/secrets/${filename}";
+ owner = config.custom.username;
+ group = "users";
+ };
+ in {
+ "desktop/vm/myndows.pass" = secret "desktop/vm/myndows.pass";
+ };
- # ?? waybar --log-level debug
- style = ''
- ${readFile ./style.css}
+ home-manager.users.${config.custom.username} = {
+ # https://github.com/Alexays/Waybar
+ # https://www.nerdfonts.com/cheat-sheet
+ programs.waybar = {
+ enable = true;
+ systemd.enable = true; # Start on login
- .horizontal > box {
- margin: 0 ${toString config.custom.gap}px ${toString config.custom.gap}px;
- }
- '';
+ # ?? waybar --log-level debug
+ style = ''
+ ${readFile ./style.css}
- ### SETTINGS ###
- # https://github.com/Alexays/Waybar/wiki/Configuration
- #?? pkill -SIGUSR2 -x waybar
- settings = let
- ## INHERIT ##
- #!! Module defaults are not accurate to documentation
- # TODO: Submit pull request to fix in addition to inconsistent hyphen vs underscore
- # https://github.com/Alexays/Waybar/wiki/Module:-Cava
- cava-config = {
- cava_config = null; # Default: null?
- framerate = 30; # Default: 30?
- autosens = 1; # Default: 1
- # sensitivity = 0; # Default: 100?
- bars = 16; # Default: 2
- lower_cutoff_freq = 50; # Default: 50?
- higher_cutoff_freq = 10000; # Default: 10000?
- sleep_timer = 5; # Default: 0
- hide_on_silence = true; # Default: false
- method = "pipewire"; # Default: pulse
- source = "auto"; # Default: auto?
- sample_rate = 44100; # Default: 44100?
- sample_bits = 16; # Default: 16?
- stereo = false; # Default: true
- reverse = false; # Default: false
- bar_delimiter = 32; # ASCII code for space, default: 59 or ;
- monstercat = true; # Default: false?
- waves = true; # Default: false?
- noise_reduction = 0.2; # Default: 0.77?
- input_delay = 1; # Default: 4
- format-icons = [
- "▁"
- "▂"
- "▃"
- "▄"
- "▅"
- "▆"
- "▇"
- "█"
- ]; # !! Required
- on-click = easyeffects;
- on-scroll-up = "${swayosd-client} --output-volume raise";
- on-scroll-down = "${swayosd-client} --output-volume lower";
- rotate = 180;
- };
- in {
- status = {
- reload_style_on_change = true; # Reload CSS when modified
+ .horizontal > box {
+ margin: 0 ${toString config.custom.gap}px ${toString config.custom.gap}px;
+ }
+ '';
- ## GLOBAL ##
- layer = "top";
- position = "bottom";
-
- ## POSITION ##
- modules-left = [
- "custom/power"
- "custom/inhibitor"
- "custom/vpn"
- "custom/vm"
- "hyprland/workspaces"
- ];
- modules-center = [
- "clock"
- "custom/weather"
- ];
- modules-right = [
- "mpris"
- "tray"
- "custom/equalizer"
- "wireplumber"
- "bluetooth"
- "network"
- "battery"
- ];
-
- ## MODULES ##
- # https://github.com/Alexays/Waybar/wiki/Module:-Custom
- "custom/power" = {
- format = "";
- on-click = "${systemctl} poweroff";
- on-click-right = "${systemctl} reboot";
- on-click-middle = "${loginctl} terminate-session ''";
- };
-
- "custom/inhibitor" = {
- interval = 5;
- exec = "~/.config/waybar/scripts/inhibitor.sh";
- on-click = inhibit;
- };
-
- "custom/vm" = {
- interval = 5;
- exec = "~/.config/waybar/scripts/vm.sh";
- on-click = "${vm} -x ${
- if config.custom.hidpi
- then "/scale:140"
- else ""
- }";
- };
-
- "custom/vpn" = {
- interval = 5;
- exec = "~/.config/waybar/scripts/vpn.sh";
- on-click = "${vpn} mypi3";
- };
-
- # https://github.com/Alexays/Waybar/wiki/Module:-Idle-Inhibitor
- # FIXME: Not currently usable
- # https://github.com/Alexays/Waybar/issues/690
- idle_inhibitor = {
- format = "{icon}";
- format-icons = {
- activated = "";
- deactivated = "";
- };
- };
-
- # https://github.com/Alexays/Waybar/wiki/Module:-Hyprland
- # https://www.nerdfonts.com/cheat-sheet
- "hyprland/workspaces" = {
- show-special = true;
- format = "{icon}";
- format-icons = {
- android = "";
- dropdown = "";
- game = "";
- hidden = "";
- music = "";
- office = "";
- password = "";
- pip = "";
- scratchpad = "";
- steam = "";
- terminal = "";
- vm = "";
- wallpaper = "";
- };
- };
-
- cava = cava-config;
-
- # https://github.com/Alexays/Waybar/wiki/Module:-Clock
- clock = {
- # https://fmt.dev/latest/syntax.html#chrono-specs
- format = "{:%a %b %d %I:%M %p}"; # Mon Jan 01 12:00 AM
- tooltip-format = "{calendar}";
- calendar.format = {
- months = "{}";
- weeks = "{}";
- weekdays = "{}";
- days = "{}";
- today = "{}";
- };
-
- # FIXME: Click release event sends to incorrect layer without sleeping
- # https://github.com/hyprwm/Hyprland/issues/1348
- on-click = "${swaync-client} --toggle-panel";
- # on-click-right = easyeffects;
- on-scroll-up = "${swayosd-client} --output-volume raise";
- on-scroll-down = "${swayosd-client} --output-volume lower";
- };
-
- # https://github.com/bjesus/wttrbar
- "custom/weather" = {
- format = "{}°";
- interval = 60 * 60;
- return-type = "json";
-
- exec = lib.strings.concatStringsSep " " [
- "${wttrbar}"
- "--ampm"
- "--fahrenheit"
- "--hide-conditions"
- "--main-indicator temp_F"
- ];
- };
-
- "cava#reverse" =
- cava-config
- // {
- reverse = true;
- };
-
- "custom/equalizer" = {
- interval = 5;
- on-click = audio;
- exec = pkgs.writeShellScript "equalizer.sh" ''
- ${echo}
- ${echo} "$(${cat} ~/.audio)"
- ${echo} "$(${cat} ~/.audio | ${tr} '[:upper:]' '[:lower:]')"
- '';
- };
-
- # https://github.com/Alexays/Waybar/wiki/Module:-MPRIS
- mpris = {
- format = "{player_icon} {dynamic}";
- format-paused = "{status_icon} {dynamic}";
- dynamic-len = 50;
- dynamic-order = [
- "title"
- "artist"
- ];
- dynamic-separator = " ";
- player-icons.default = "";
- status-icons.paused = "";
- on-click-middle = ""; # TODO: Close music player
- on-scroll-up = "${swayosd-client} --output-volume raise";
- on-scroll-down = "${swayosd-client} --output-volume lower";
- };
-
- # https://github.com/Alexays/Waybar/wiki/Module:-WirePlumber
- wireplumber = {
- format = "{icon} {volume}%";
- format-muted = "";
+ ### SETTINGS ###
+ # https://github.com/Alexays/Waybar/wiki/Configuration
+ #?? pkill -SIGUSR2 -x waybar
+ settings = let
+ ## INHERIT ##
+ #!! Module defaults are not accurate to documentation
+ # TODO: Submit pull request to fix in addition to inconsistent hyphen vs underscore
+ # https://github.com/Alexays/Waybar/wiki/Module:-Cava
+ cava-config = {
+ cava_config = null; # Default: null?
+ framerate = 30; # Default: 30?
+ autosens = 1; # Default: 1
+ # sensitivity = 0; # Default: 100?
+ bars = 16; # Default: 2
+ lower_cutoff_freq = 50; # Default: 50?
+ higher_cutoff_freq = 10000; # Default: 10000?
+ sleep_timer = 5; # Default: 0
+ hide_on_silence = true; # Default: false
+ method = "pipewire"; # Default: pulse
+ source = "auto"; # Default: auto?
+ sample_rate = 44100; # Default: 44100?
+ sample_bits = 16; # Default: 16?
+ stereo = false; # Default: true
+ reverse = false; # Default: false
+ bar_delimiter = 32; # ASCII code for space, default: 59 or ;
+ monstercat = true; # Default: false?
+ waves = true; # Default: false?
+ noise_reduction = 0.2; # Default: 0.77?
+ input_delay = 1; # Default: 4
format-icons = [
- ""
- ""
- ""
- ];
+ "▁"
+ "▂"
+ "▃"
+ "▄"
+ "▅"
+ "▆"
+ "▇"
+ "█"
+ ]; # !! Required
on-click = easyeffects;
- on-click-right = "${swayosd-client} --output-volume mute-toggle";
on-scroll-up = "${swayosd-client} --output-volume raise";
on-scroll-down = "${swayosd-client} --output-volume lower";
+ rotate = 180;
};
+ in {
+ status = {
+ reload_style_on_change = true; # Reload CSS when modified
- # https://github.com/Alexays/Waybar/wiki/Module:-Bluetooth
- bluetooth = {
- format-disabled = "";
- format-off = "";
- format-on = "";
- format-connected = "";
- on-click = blueberry;
- on-click-right = "${bluetoothctl} disconnect";
- on-click-middle = "${rfkill} toggle bluetooth"; # Toggle bluetooth on/off
- };
+ ## GLOBAL ##
+ layer = "top";
+ position = "bottom";
- # https://github.com/Alexays/Waybar/wiki/Module:-Network
- network = {
- format = "{icon}";
- format-icons = {
- disabled = "";
- disconnected = "";
- ethernet = "";
- linked = "";
- wifi = [
- ""
- ""
- ""
- ""
- ""
+ ## POSITION ##
+ modules-left = [
+ "custom/power"
+ "custom/inhibitor"
+ "custom/vpn"
+ "custom/vm"
+ "hyprland/workspaces"
+ ];
+ modules-center = [
+ "clock"
+ "custom/weather"
+ ];
+ modules-right = [
+ "mpris"
+ "tray"
+ "custom/equalizer"
+ "wireplumber"
+ "bluetooth"
+ "network"
+ "battery"
+ ];
+
+ ## MODULES ##
+ # https://github.com/Alexays/Waybar/wiki/Module:-Custom
+ "custom/power" = {
+ format = "";
+ on-click = "${systemctl} poweroff";
+ on-click-right = "${systemctl} reboot";
+ on-click-middle = "${loginctl} terminate-session ''";
+ };
+
+ "custom/inhibitor" = {
+ interval = 5;
+ exec = "~/.config/waybar/scripts/inhibitor.sh";
+ on-click = inhibit;
+ };
+
+ "custom/vm" = {
+ interval = 5;
+ exec = "~/.config/waybar/scripts/vm.sh";
+ on-click = ''${remote} --vm --username Myned --password "$(${cat} ${config.age.secrets."desktop/vm/myndows.pass".path})" ${
+ if config.custom.hidpi
+ then "--scale 140"
+ else ""
+ } myndows'';
+ };
+
+ "custom/vpn" = {
+ interval = 5;
+ exec = "~/.config/waybar/scripts/vpn.sh";
+ on-click = "${vpn} mypi3";
+ };
+
+ # https://github.com/Alexays/Waybar/wiki/Module:-Idle-Inhibitor
+ # FIXME: Not currently usable
+ # https://github.com/Alexays/Waybar/issues/690
+ idle_inhibitor = {
+ format = "{icon}";
+ format-icons = {
+ activated = "";
+ deactivated = "";
+ };
+ };
+
+ # https://github.com/Alexays/Waybar/wiki/Module:-Hyprland
+ # https://www.nerdfonts.com/cheat-sheet
+ "hyprland/workspaces" = {
+ show-special = true;
+ format = "{icon}";
+ format-icons = {
+ android = "";
+ dropdown = "";
+ game = "";
+ hidden = "";
+ music = "";
+ office = "";
+ password = "";
+ pip = "";
+ scratchpad = "";
+ steam = "";
+ terminal = "";
+ vm = "";
+ wallpaper = "";
+ };
+ };
+
+ cava = cava-config;
+
+ # https://github.com/Alexays/Waybar/wiki/Module:-Clock
+ clock = {
+ # https://fmt.dev/latest/syntax.html#chrono-specs
+ format = "{:%a %b %d %I:%M %p}"; # Mon Jan 01 12:00 AM
+ tooltip-format = "{calendar}";
+ calendar.format = {
+ months = "{}";
+ weeks = "{}";
+ weekdays = "{}";
+ days = "{}";
+ today = "{}";
+ };
+
+ # FIXME: Click release event sends to incorrect layer without sleeping
+ # https://github.com/hyprwm/Hyprland/issues/1348
+ on-click = "${swaync-client} --toggle-panel";
+ # on-click-right = easyeffects;
+ on-scroll-up = "${swayosd-client} --output-volume raise";
+ on-scroll-down = "${swayosd-client} --output-volume lower";
+ };
+
+ # https://github.com/bjesus/wttrbar
+ "custom/weather" = {
+ format = "{}°";
+ interval = 60 * 60;
+ return-type = "json";
+
+ exec = lib.strings.concatStringsSep " " [
+ "${wttrbar}"
+ "--ampm"
+ "--fahrenheit"
+ "--hide-conditions"
+ "--main-indicator temp_F"
];
};
- on-click = nm-connection-editor;
- on-click-right = network; # Toggle networking on/off
- };
+ "cava#reverse" =
+ cava-config
+ // {
+ reverse = true;
+ };
- # https://github.com/Alexays/Waybar/wiki/Module:-Battery
- "battery" = {
- format = "{icon} {power:.0f}W";
- format-icons = [
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- ""
- ];
- interval = 5;
- states = {
- critical = 15;
- warning = 30;
+ "custom/equalizer" = {
+ interval = 5;
+ on-click = audio;
+ exec = pkgs.writeShellScript "equalizer.sh" ''
+ ${echo}
+ ${echo} "$(${cat} ~/.audio)"
+ ${echo} "$(${cat} ~/.audio | ${tr} '[:upper:]' '[:lower:]')"
+ '';
};
- on-click = power; # Toggle power-saver mode
+ # https://github.com/Alexays/Waybar/wiki/Module:-MPRIS
+ mpris = {
+ format = "{player_icon} {dynamic}";
+ format-paused = "{status_icon} {dynamic}";
+ dynamic-len = 50;
+ dynamic-order = [
+ "title"
+ "artist"
+ ];
+ dynamic-separator = " ";
+ player-icons.default = "";
+ status-icons.paused = "";
+ on-click-middle = ""; # TODO: Close music player
+ on-scroll-up = "${swayosd-client} --output-volume raise";
+ on-scroll-down = "${swayosd-client} --output-volume lower";
+ };
+
+ # https://github.com/Alexays/Waybar/wiki/Module:-WirePlumber
+ wireplumber = {
+ format = "{icon} {volume}%";
+ format-muted = "";
+ format-icons = [
+ ""
+ ""
+ ""
+ ];
+ on-click = easyeffects;
+ on-click-right = "${swayosd-client} --output-volume mute-toggle";
+ on-scroll-up = "${swayosd-client} --output-volume raise";
+ on-scroll-down = "${swayosd-client} --output-volume lower";
+ };
+
+ # https://github.com/Alexays/Waybar/wiki/Module:-Bluetooth
+ bluetooth = {
+ format-disabled = "";
+ format-off = "";
+ format-on = "";
+ format-connected = "";
+ on-click = blueberry;
+ on-click-right = "${bluetoothctl} disconnect";
+ on-click-middle = "${rfkill} toggle bluetooth"; # Toggle bluetooth on/off
+ };
+
+ # https://github.com/Alexays/Waybar/wiki/Module:-Network
+ network = {
+ format = "{icon}";
+ format-icons = {
+ disabled = "";
+ disconnected = "";
+ ethernet = "";
+ linked = "";
+ wifi = [
+ ""
+ ""
+ ""
+ ""
+ ""
+ ];
+ };
+
+ on-click = nm-connection-editor;
+ on-click-right = network; # Toggle networking on/off
+ };
+
+ # https://github.com/Alexays/Waybar/wiki/Module:-Battery
+ "battery" = {
+ format = "{icon} {power:.0f}W";
+ format-icons = [
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ""
+ ];
+ interval = 5;
+ states = {
+ critical = 15;
+ warning = 30;
+ };
+
+ on-click = power; # Toggle power-saver mode
+ };
};
};
};
- };
- # TODO: Convert to writeShellApplication
- ### SCRIPTS ###
- #?? text
- #?? tooltip
- #?? class
- home.file = {
- # Return inhibit idle status
- ".config/waybar/scripts/inhibitor.sh" = {
- executable = true;
- text = ''
- #! /usr/bin/env ${bash}
+ # TODO: Convert to writeShellApplication
+ ### SCRIPTS ###
+ #?? text
+ #?? tooltip
+ #?? class
+ home.file = {
+ # Return inhibit idle status
+ ".config/waybar/scripts/inhibitor.sh" = {
+ executable = true;
+ text = ''
+ #! /usr/bin/env ${bash}
- if ${pgrep} systemd-inhibit &> /dev/null; then
- ${echo}
- ${echo} Enabled
- ${echo} enabled
- else
- ${echo}
- ${echo} Disabled
- ${echo} disabled
- fi
- '';
- };
+ if ${pgrep} systemd-inhibit &> /dev/null; then
+ ${echo}
+ ${echo} Enabled
+ ${echo} enabled
+ else
+ ${echo}
+ ${echo} Disabled
+ ${echo} disabled
+ fi
+ '';
+ };
- # Return tailscale status
- ".config/waybar/scripts/vm.sh" = {
- executable = true;
- text = ''
- #! /usr/bin/env ${bash}
+ # Return tailscale status
+ ".config/waybar/scripts/vm.sh" = {
+ executable = true;
+ text = ''
+ #! /usr/bin/env ${bash}
- case "$(virsh domstate myndows)" in
- 'running')
- ${echo}
- ${echo} Online
- ${echo} online;;
- 'paused')
- ${echo}
- ${echo} Paused
- ${echo} paused;;
- 'shut off')
- ${echo}
- ${echo} Offline
- ${echo} offline;;
- *)
- ${echo}
- ${echo} Unknown
- ${echo} unknown;;
- esac
- '';
- };
+ case "$(virsh domstate myndows)" in
+ 'running')
+ ${echo}
+ ${echo} Online
+ ${echo} online;;
+ 'paused')
+ ${echo}
+ ${echo} Paused
+ ${echo} paused;;
+ 'shut off')
+ ${echo}
+ ${echo} Offline
+ ${echo} offline;;
+ *)
+ ${echo}
+ ${echo} Unknown
+ ${echo} unknown;;
+ esac
+ '';
+ };
- # Return tailscale status
- ".config/waybar/scripts/vpn.sh" = {
- executable = true;
- text = ''
- #! /usr/bin/env ${bash}
+ # Return tailscale status
+ ".config/waybar/scripts/vpn.sh" = {
+ executable = true;
+ text = ''
+ #! /usr/bin/env ${bash}
- if [[ $(${tailscale} status --json | ${jq} .ExitNodeStatus.Online) == 'true' ]]; then
- ${echo}
- ${echo} Connected
- ${echo} connected
- else
- ${echo}
- ${echo} Disconnected
- ${echo} disconnected
- fi
- '';
+ if [[ $(${tailscale} status --json | ${jq} .ExitNodeStatus.Online) == 'true' ]]; then
+ ${echo}
+ ${echo} Connected
+ ${echo} connected
+ else
+ ${echo}
+ ${echo} Disconnected
+ ${echo} disconnected
+ fi
+ '';
+ };
};
};
};
diff --git a/options/custom/scripts/default.nix b/options/custom/scripts/default.nix
index ffe5d00..667a044 100644
--- a/options/custom/scripts/default.nix
+++ b/options/custom/scripts/default.nix
@@ -143,6 +143,15 @@ in {
libnotify
power-profiles-daemon
])
+ (bash "remote" [
+ argc
+ coreutils
+ freerdp3
+ iputils
+ libnotify
+ libvirt
+ remmina
+ ])
(bash "scratchpad" [
coreutils
libnotify
@@ -166,14 +175,6 @@ in {
jq
libnotify
])
- (bash "vm" [
- coreutils
- freerdp3
- iputils
- libnotify
- libvirt
- remmina
- ])
(bash "vpn" [
gnused
jq
diff --git a/options/custom/scripts/remote.sh b/options/custom/scripts/remote.sh
new file mode 100644
index 0000000..03b498e
--- /dev/null
+++ b/options/custom/scripts/remote.sh
@@ -0,0 +1,73 @@
+#! /usr/bin/env bash
+
+# @describe Wrapper for connecting to remote desktops
+#
+# https://github.com/sigoden/argc
+
+# @meta combine-shorts
+# @option -C --client=remmina Remote desktop client to connect with (remmina or -freerdp)
+# @option -P --password Password to connect with
+# @option -S --scale=100 Set FreeRDP resolution scale
+# @option -U --username! Username to connect with
+# @flag -v --vm Handle libvirt VM domain state for connection
+# @arg host! Remote host/VM to connect to
+
+eval "$(argc --argc-eval "$0" "$@")"
+
+# Handle VM state
+#!! Requires libvirt networking with hostname resolution
+if [[ "${argc_vm:-}" ]]; then
+ state="$(virsh domstate "${argc_host:-}")"
+
+ if [[ "$state" == "paused" ]]; then
+ virsh resume "${argc_host:-}"
+ notify-send "> remote" "${argc_host:-} resumed" --urgency low
+ elif [[ "$state" == "shut off" ]]; then
+ virsh start "${argc_host:-}"
+ notify-send "> remote" "${argc_host:-} starting..." --urgency low
+
+ # Wait for guest to become available
+ #!! Requires ICMP firewall access on guest
+ c=0
+ while ! ping -c 1 "${argc_host:-}"; do
+ if ((c > 60)); then
+ notify-send "> remote" "${argc_host:-} timed out" --urgency critical
+ exit 1
+ fi
+ ((c += 1))
+ sleep 1
+ done
+ else
+ notify-send "> remote" "${argc_host:-} online" --urgency low
+ fi
+fi
+
+if [[ "${argc_client:-}" == "remmina" ]]; then
+ remmina --connect "rdp://${argc_username:-}:${argc_password:-}@${argc_host:-}"
+elif [[ "${argc_client:-}" =~ ^.+freerdp$ ]]; then
+ export SDL_VIDEODRIVER=wayland
+
+ flags=(
+ "/cert:ignore"
+ "/v:${argc_host:-}"
+ "/u:${argc_username:-}"
+ "/p:${argc_password:-}"
+ "/kbd:remap:015b=0154" # VK_LWIN=<00> #?? xfreerdp /list:kbd-scancode
+ "/scale:${argc_scale:-}"
+ "/dynamic-resolution"
+ "/sound"
+ "+auto-reconnect"
+ "+clipboard"
+ "+menu-anims"
+ "-grab-keyboard"
+ "-grab-mouse"
+ )
+
+ "${argc_client:-}" "${flags[@]}"
+fi
+
+# Suspend VM after connection ends
+if [[ "${argc_vm:-}" ]]; then
+ virsh suspend "${argc_host:-}"
+ notify-send "> remote" "${argc_host:-} paused" --urgency low
+fi
diff --git a/options/custom/scripts/vm.sh b/options/custom/scripts/vm.sh
deleted file mode 100644
index 18871d8..0000000
--- a/options/custom/scripts/vm.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#! /usr/bin/env bash
-
-# Start/resume VM if needed and launch viewer
-#?? man xfreerdp
-
-state="$(virsh domstate myndows)"
-
-if [[ "$state" == 'paused' ]]; then
- virsh resume myndows
- notify-send '> vm' 'Resumed' --urgency low
-elif [[ "$state" == 'shut off' ]]; then
- virsh start myndows
- notify-send '> vm' 'Starting...' --urgency low
-
- # Wait for guest to become available
- #!! Requires ICMP firewall access on guest
- while ! ping -c 1 myndows; do
- sleep 1
- done
-else
- notify-send '> vm' 'Online' --urgency low
-fi
-
-flags=(
- '/cert:ignore'
- '/v:myndows'
- '/u:Myned'
- '/p:'
- '/kbd:remap:015b=0154' # VK_LWIN=<00> #?? xfreerdp /list:kbd-scancode
- '/dynamic-resolution'
- '/sound'
- '+auto-reconnect'
- '+clipboard'
- '+menu-anims'
- '-grab-keyboard'
- '-grab-mouse'
-)
-
-if [[ "${1-}" == '-s' ]]; then
- SDL_VIDEODRIVER=wayland sdl-freerdp "${flags[@]}" "${@:2}"
- virsh suspend myndows
- notify-send '> vm' 'Paused' --urgency low
-elif [[ "${1-}" == '-w' ]]; then
- wlfreerdp "${flags[@]}" "${@:2}"
- virsh suspend myndows
- notify-send '> vm' 'Paused' --urgency low
-elif [[ "${1-}" == '-x' ]]; then
- xfreerdp "${flags[@]}" "${@:2}"
- virsh suspend myndows
- notify-send '> vm' 'Paused' --urgency low
-elif [[ "${1-}" == '-e' ]]; then
- "$@"
- virsh suspend myndows
- notify-send '> vm' 'Paused' --urgency low
-else
- "$@"
-fi
diff --git a/secrets/desktop/vm/myndows.pass b/secrets/desktop/vm/myndows.pass
new file mode 100644
index 0000000..9afb5db
--- /dev/null
+++ b/secrets/desktop/vm/myndows.pass
@@ -0,0 +1,11 @@
+age-encryption.org/v1
+-> ssh-ed25519 8E6j8Q 8osU9NmgeeyA6MiQv1gNNDFvAheWZINmFoxTPgsr1Dw
+OjviEydBFd1u9doZYGDdqQkMYe4pq7Q9U2qqBTqEcwY
+-> ssh-ed25519 sfxzoQ 4ve1W5A9VYReikSUNX2J5hRSvQXvteVl5AXL+rH5tHw
+cA1A8vrUXexDu4Z67TmUoHyRqKbC4PIrKRlb5PZyWbg
+-> ssh-ed25519 g5GcDQ zhhW9p+0Bgs24yLBZgl51mKyYuZwm9sbj7UWPt5/ZTw
+pYYHhUX7VVVkoB1EewK27cacZf4eNZJg73zogfQbTVg
+-> ssh-ed25519 T/dATA nhTYHjuLQxq9Kn2xHLpPNOYiAnEsut+6pxY35ooMAik
+Dgr+wBPVI9lD2+SLsvkom+0WJ3XlRZsysMQoMjVeCZA
+--- 234YbLb3XbZts393OGxe2Gmxrup7cbcQGXAb5gQLrhQ
+0g(]/u&*EǵijetAPZ8*
\ No newline at end of file
diff --git a/secrets/secrets.nix b/secrets/secrets.nix
index 567b157..04bfc7b 100644
--- a/secrets/secrets.nix
+++ b/secrets/secrets.nix
@@ -55,6 +55,7 @@ in {
"desktop/bitwarden/client_secret".publicKeys = desktop;
"desktop/users/myned.pass".publicKeys = desktop;
"desktop/users/root.pass".publicKeys = desktop;
+ "desktop/vm/myndows.pass".publicKeys = desktop;
### SBC
"sbc/borgmatic/borgbase.mypi3".publicKeys = sbc;