1
1
Fork 0

vm.sh: refactor into remote.sh with argc

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2024-11-17 13:38:09 -06:00
parent 8452222017
commit 3237b034b9
Signed by: myned
GPG key ID: C7224454F7881A34
7 changed files with 667 additions and 613 deletions

View file

@ -7,6 +7,7 @@
}: }:
with lib; let with lib; let
audio = "~/.local/bin/audio"; audio = "~/.local/bin/audio";
cat = "${pkgs.coreutils}/bin/cat";
clipse = "${pkgs.clipse}/bin/clipse"; clipse = "${pkgs.clipse}/bin/clipse";
codium = "${config.home-manager.users.${config.custom.username}.programs.vscode.package}/bin/codium"; 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"; 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"; onlyoffice = "${pkgs.onlyoffice-bin}/bin/onlyoffice-desktopeditors --system-title-bar --xdg-desktop-portal";
pkill = "${pkgs.procps}/bin/pkill"; pkill = "${pkgs.procps}/bin/pkill";
playerctl = "${pkgs.playerctl}/bin/playerctl"; 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"; rofi-rbw = "${pkgs.rofi-rbw}/bin/rofi-rbw";
rm = "${pkgs.coreutils}/bin/rm"; rm = "${pkgs.coreutils}/bin/rm";
screenshot = "~/.local/bin/screenshot"; screenshot = "~/.local/bin/screenshot";
@ -38,7 +40,6 @@ with lib; let
systemctl = "${pkgs.systemd}/bin/systemctl"; systemctl = "${pkgs.systemd}/bin/systemctl";
toggle = "~/.local/bin/toggle"; toggle = "~/.local/bin/toggle";
virt-manager = "${config.programs.virt-manager.package}/bin/virt-manager"; 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; 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"; walker = "${config.home-manager.users.${config.custom.username}.programs.walker.package}/bin/walker";
waydroid = "${pkgs.waydroid}/bin/waydroid"; waydroid = "${pkgs.waydroid}/bin/waydroid";
@ -50,222 +51,233 @@ with lib; let
in { in {
options.custom.desktops.hyprland.binds.enable = mkOption {default = false;}; options.custom.desktops.hyprland.binds.enable = mkOption {default = false;};
config.home-manager.users.${config.custom.username} = mkIf cfg.enable { config = mkIf cfg.enable {
wayland.windowManager.hyprland.settings = let age.secrets = let
# Reverse mods and key for alphabetical sorting secret = filename: {
#?? key <"KEY"> <"MODS"|null> <"DISPATCHER"> <"PARAMS"|null> file = "${inputs.self}/secrets/${filename}";
key = key: mods: dispatcher: params: "${ owner = config.custom.username;
if (isNull mods) group = "users";
then "" };
else mods
}, ${key}, ${dispatcher}${
if (isNull params)
then ""
else ", ${params}"
}";
in { in {
# https://wiki.hyprland.org/Configuring/Binds "desktop/vm/myndows.pass" = secret "desktop/vm/myndows.pass";
#?? bind = MODS, KEY, DISPATCHER, [PARAMS] };
#?? wev
# Lockscreen binds home-manager.users.${config.custom.username} = {
bindl = [ wayland.windowManager.hyprland.settings = let
(key "Delete" "Ctrl" "exec" "${hyprctl} reload") # Reverse mods and key for alphabetical sorting
(key "Delete" "Ctrl+Alt" "exec" "${loginctl} terminate-user ''") # Current user sessions #?? key <"KEY"> <"MODS"|null> <"DISPATCHER"> <"PARAMS"|null>
(key "Delete" "Super" "exec" inhibit) 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 (key "L" "Super" "exec" "${hyprlock} --immediate & ${sleep} 1 && ${hyprctl} dispatch dpms off")
# 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
];
# Mouse binds # Laptop lid switches
bindm = [ # https://wiki.hyprland.org/Configuring/Binds/#switches
(key "mouse:272" "Super" "movewindow" null) # LMB #?? hyprctl devices
(key "mouse:273" "Super" "resizewindow" null) # RMB (key "switch:off:Lid Switch" null "dpms" "on") # Open
]; (key "switch:on:Lid Switch" null "dpms" "off") # Close
];
# Repeat binds # Mouse binds
binde = [ bindm = [
# Media keys (key "mouse:272" "Super" "movewindow" null) # LMB
# https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h (key "mouse:273" "Super" "resizewindow" null) # RMB
(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
];
# Release binds # Repeat binds
bindr = [ binde = [
(key "Alt_L" "Super+Alt" "togglespecialworkspace" "wallpaper") # Media keys
(key "Alt_L" "Super+Alt+Shift" "movetoworkspacesilent" "special:wallpaper") # https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
(key "Control_L" "Super+Ctrl" "exec" workspace) (key "XF86AudioMute" null "exec" "${swayosd-client} --output-volume mute-toggle") # F1
(key "Shift_L" "Super+Shift" "workspace" "previous") (key "XF86AudioLowerVolume" null "exec" "${swayosd-client} --output-volume lower") # F2
(key "Super_L" "Super" "exec" "${menu}") (key "XF86AudioRaiseVolume" null "exec" "${swayosd-client} --output-volume raise") # F3
#// (key "Super_L" "Super+Alt" "exec" "${menu} --passwords") (key "XF86AudioPrev" null "exec" "${playerctl} previous") # F4
(key "Super_L" "Super+Ctrl" "exec" "${menu} --calculator") (key "XF86AudioPlay" null "exec" "${playerctl} play-pause") # F5
(key "Super_L" "Super+Ctrl+Shift" "exec" "${menu} --networks") (key "XF86AudioNext" null "exec" "${playerctl} next") # F6
(key "Super_L" "Super+Shift" "exec" "${menu} --search") (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 # Release binds
bind = [ bindr = [
(key "mouse:274" "Super" "layoutmsg" "swapwithmaster auto") (key "Alt_L" "Super+Alt" "togglespecialworkspace" "wallpaper")
(key "mouse:274" "Super+Shift" "layoutmsg" "addmaster") (key "Alt_L" "Super+Alt+Shift" "movetoworkspacesilent" "special:wallpaper")
(key "mouse:274" "Super+Ctrl+Shift" "layoutmsg" "removemaster") (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") # Regular binds
(key "Backslash" "Super+Shift" "splitratio" "exact 0.5") # Reset layout ratio bind = [
(key "Backspace" "Super" "changegroupactive" "f") (key "mouse:274" "Super" "layoutmsg" "swapwithmaster auto")
(key "Backspace" "Super+Ctrl" "togglegroup" null) (key "mouse:274" "Super+Shift" "layoutmsg" "addmaster")
(key "Backspace" "Super+Ctrl+Shift" "lockactivegroup" "toggle") (key "mouse:274" "Super+Ctrl+Shift" "layoutmsg" "removemaster")
(key "Backspace" "Super+Shift" "movegroupwindow" null)
(key "Bracketleft" "Super" "layoutmsg" "rollnext") (key "Backslash" "Super" "layoutmsg" "orientationcycle center left")
(key "Bracketleft" "Super+Shift" "splitratio" "-0.1") (key "Backslash" "Super+Shift" "splitratio" "exact 0.5") # Reset layout ratio
(key "Bracketright" "Super" "layoutmsg" "rollprev") (key "Backspace" "Super" "changegroupactive" "f")
(key "Bracketright" "Super+Shift" "splitratio" "+0.1") (key "Backspace" "Super+Ctrl" "togglegroup" null)
(key "Comma" "Super" "layoutmsg" "swapprev") (key "Backspace" "Super+Ctrl+Shift" "lockactivegroup" "toggle")
(key "Down" "Super" "movewindoworgroup" "d") (key "Backspace" "Super+Shift" "movegroupwindow" null)
(key "Down" "Super+Shift" "movewindow" "d") (key "Bracketleft" "Super" "layoutmsg" "rollnext")
(key "Equal" "Super" "exec" "${swayosd-client} --output-volume raise") (key "Bracketleft" "Super+Shift" "splitratio" "-0.1")
(key "Equal" "Super+Shift" "exec" "${zoom} +0.1") (key "Bracketright" "Super" "layoutmsg" "rollprev")
(key "Escape" "Super" "togglefloating" null) (key "Bracketright" "Super+Shift" "splitratio" "+0.1")
(key "Escape" "Super+Alt" "exec" "lifx state --color red") (key "Comma" "Super" "layoutmsg" "swapprev")
(key "Escape" "Super+Shift" "centerwindow" null) (key "Down" "Super" "movewindoworgroup" "d")
(key "Grave" "Super" "exec" smile) (key "Down" "Super+Shift" "movewindow" "d")
(key "Left" "Super" "movewindoworgroup" "l") (key "Equal" "Super" "exec" "${swayosd-client} --output-volume raise")
(key "Left" "Super+Alt" "exec" "${left} --scroll kensington-orbit-wireless-tb-mouse") (key "Equal" "Super+Shift" "exec" "${zoom} +0.1")
(key "Left" "Super+Shift" "movewindow" "l") (key "Escape" "Super" "togglefloating" null)
(key "Minus" "Super" "exec" "${swayosd-client} --output-volume lower") (key "Escape" "Super+Alt" "exec" "lifx state --color red")
(key "Minus" "Super+Shift" "exec" "${zoom} -0.1") (key "Escape" "Super+Shift" "centerwindow" null)
(key "Period" "Super" "layoutmsg" "swapnext") (key "Grave" "Super" "exec" smile)
(key "Apostrophe" "Super" "exec" "${screenshot} selection") (key "Left" "Super" "movewindoworgroup" "l")
(key "Apostrophe" "Super+Shift" "exec" "${screenshot} display") (key "Left" "Super+Alt" "exec" "${left} --scroll kensington-orbit-wireless-tb-mouse")
(key "Apostrophe" "Super+Alt" "exec" "${screenshot} selection --edit") (key "Left" "Super+Shift" "movewindow" "l")
(key "Apostrophe" "Super+Alt+Shift" "exec" "${screenshot} display --edit") (key "Minus" "Super" "exec" "${swayosd-client} --output-volume lower")
(key "Return" "Super" "fullscreen" "1") # Maximize (key "Minus" "Super+Shift" "exec" "${zoom} -0.1")
(key "Return" "Super+Shift" "fullscreen" "0") # Fullscreen (key "Period" "Super" "layoutmsg" "swapnext")
(key "Right" "Super" "movewindoworgroup" "r") (key "Apostrophe" "Super" "exec" "${screenshot} selection")
(key "Right" "Super+Shift" "movewindow" "r") (key "Apostrophe" "Super+Shift" "exec" "${screenshot} display")
(key "Semicolon" "Super" "exec" "${hyprpicker} --autocopy") (key "Apostrophe" "Super+Alt" "exec" "${screenshot} selection --edit")
(key "Semicolon" "Super+Shift" "exec" "${hyprpicker} --autocopy --format rgb") (key "Apostrophe" "Super+Alt+Shift" "exec" "${screenshot} display --edit")
(key "Slash" "Super" "exec" vrr) (key "Return" "Super" "fullscreen" "1") # Maximize
(key "Space" "Ctrl" "exec" (concatStringsSep " " [ (key "Return" "Super+Shift" "fullscreen" "0") # Fullscreen
"${toggle}" (key "Right" "Super" "movewindoworgroup" "r")
"--focus" (key "Right" "Super+Shift" "movewindow" "r")
"--type class" (key "Semicolon" "Super" "exec" "${hyprpicker} --autocopy")
"--expression '^dropdown$'" (key "Semicolon" "Super+Shift" "exec" "${hyprpicker} --autocopy --format rgb")
"--workspace special:dropdown" (key "Slash" "Super" "exec" vrr)
"--" (key "Space" "Ctrl" "exec" (concatStringsSep " " [
"${kitty} --app-id dropdown --override font_size=12" "${toggle}"
])) "--focus"
(key "Space" "Ctrl+Alt" "exec" "lifx toggle") "--type class"
(key "Space" "Ctrl+Shift" "exec" (concatStringsSep " " [ "--expression '^dropdown$'"
"${toggle}" "--workspace special:dropdown"
"--type title" "--"
"--expression '^Picture.in.[Pp]icture$'" "${kitty} --app-id dropdown --override font_size=12"
"--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 "Space" "Ctrl+Alt" "exec" "lifx toggle")
(key "Tab" "Super+Shift" "alterzorder" "top") (key "Space" "Ctrl+Shift" "exec" (concatStringsSep " " [
(key "Tab" "Super+Shift" "cyclenext" "floating") "${toggle}"
(key "Up" "Super" "movewindoworgroup" "u") "--type title"
(key "Up" "Super+Shift" "movewindow" "u") "--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" "exec" "${swayosd-client} --output-volume mute-toggle")
(key "0" "Super+Shift" "exec" "${zoom}") (key "0" "Super+Shift" "exec" "${zoom}")
(key "1" "Ctrl+Alt" "exec" "lifx state --brightness 0.01") (key "1" "Ctrl+Alt" "exec" "lifx state --brightness 0.01")
(key "1" "Super" "workspace" "1") (key "1" "Super" "workspace" "1")
(key "1" "Super+Alt" "exec" "lifx state --kelvin 1500") (key "1" "Super+Alt" "exec" "lifx state --kelvin 1500")
(key "1" "Super+Shift" "movetoworkspacesilent" "1") (key "1" "Super+Shift" "movetoworkspacesilent" "1")
(key "2" "Ctrl+Alt" "exec" "lifx state --brightness 0.25") (key "2" "Ctrl+Alt" "exec" "lifx state --brightness 0.25")
(key "2" "Super" "workspace" "2") (key "2" "Super" "workspace" "2")
(key "2" "Super+Alt" "exec" "lifx state --kelvin 2500") (key "2" "Super+Alt" "exec" "lifx state --kelvin 2500")
(key "2" "Super+Shift" "movetoworkspacesilent" "2") (key "2" "Super+Shift" "movetoworkspacesilent" "2")
(key "3" "Ctrl+Alt" "exec" "lifx state --brightness 0.50") (key "3" "Ctrl+Alt" "exec" "lifx state --brightness 0.50")
(key "3" "Super" "workspace" "3") (key "3" "Super" "workspace" "3")
(key "3" "Super+Alt" "exec" "lifx state --kelvin 3000") (key "3" "Super+Alt" "exec" "lifx state --kelvin 3000")
(key "3" "Super+Shift" "movetoworkspacesilent" "3") (key "3" "Super+Shift" "movetoworkspacesilent" "3")
(key "4" "Ctrl+Alt" "exec" "lifx state --brightness 0.75") (key "4" "Ctrl+Alt" "exec" "lifx state --brightness 0.75")
(key "4" "Super" "workspace" "4") (key "4" "Super" "workspace" "4")
(key "4" "Super+Alt" "exec" "lifx state --kelvin 4000") (key "4" "Super+Alt" "exec" "lifx state --kelvin 4000")
(key "4" "Super+Shift" "movetoworkspacesilent" "4") (key "4" "Super+Shift" "movetoworkspacesilent" "4")
(key "5" "Ctrl+Alt" "exec" "lifx state --brightness 1.00") (key "5" "Ctrl+Alt" "exec" "lifx state --brightness 1.00")
(key "5" "Super" "workspace" "5") (key "5" "Super" "workspace" "5")
(key "5" "Super+Alt" "exec" "lifx state --kelvin 5000") (key "5" "Super+Alt" "exec" "lifx state --kelvin 5000")
(key "5" "Super+Shift" "movetoworkspacesilent" "5") (key "5" "Super+Shift" "movetoworkspacesilent" "5")
(key "6" "Super" "workspace" "6") (key "6" "Super" "workspace" "6")
(key "6" "Super+Shift" "movetoworkspacesilent" "6") (key "6" "Super+Shift" "movetoworkspacesilent" "6")
(key "7" "Super" "workspace" "7") (key "7" "Super" "workspace" "7")
(key "7" "Super+Shift" "movetoworkspacesilent" "7") (key "7" "Super+Shift" "movetoworkspacesilent" "7")
(key "8" "Super" "workspace" "8") (key "8" "Super" "workspace" "8")
(key "8" "Super+Shift" "movetoworkspacesilent" "8") (key "8" "Super+Shift" "movetoworkspacesilent" "8")
(key "9" "Super" "exec" "${audio}") (key "9" "Super" "exec" "${audio}")
(key "A" "Ctrl+Alt" "exec" "${waydroid} session stop") (key "A" "Ctrl+Alt" "exec" "${waydroid} session stop")
(key "A" "Super" "togglespecialworkspace" "android") (key "A" "Super" "togglespecialworkspace" "android")
(key "A" "Super+Shift" "movetoworkspacesilent" "special:android") (key "A" "Super+Shift" "movetoworkspacesilent" "special:android")
(key "B" "Super" "exec" firefox-esr) (key "B" "Super" "exec" firefox-esr)
(key "C" "Super" "exec" codium) (key "C" "Super" "exec" codium)
(key "E" "Super" "exec" gnome-text-editor) (key "E" "Super" "exec" gnome-text-editor)
(key "F" "Super" "exec" "${nautilus} --new-window") (key "F" "Super" "exec" "${nautilus} --new-window")
(key "G" "Super" "workspace" "name:game") (key "G" "Super" "workspace" "name:game")
(key "G" "Super+Alt" "togglespecialworkspace" "gamescope") (key "G" "Super+Alt" "togglespecialworkspace" "gamescope")
(key "G" "Super+Ctrl+Alt" "exec" "${pkill} gamescope") (key "G" "Super+Ctrl+Alt" "exec" "${pkill} gamescope")
(key "G" "Super+Shift" "movetoworkspacesilent" "name:game") (key "G" "Super+Shift" "movetoworkspacesilent" "name:game")
(key "K" "Super" "exec" obsidian) (key "K" "Super" "exec" obsidian)
(key "M" "Super" "togglespecialworkspace" "music") (key "M" "Super" "togglespecialworkspace" "music")
(key "M" "Super+Shift" "movetoworkspacesilent" "special:music") (key "M" "Super+Shift" "movetoworkspacesilent" "special:music")
(key "O" "Super" "togglespecialworkspace" "office") (key "O" "Super" "togglespecialworkspace" "office")
(key "O" "Super+Ctrl" "exec" "${onlyoffice}") (key "O" "Super+Ctrl" "exec" "${onlyoffice}")
(key "O" "Super+Shift" "movetoworkspacesilent" "special:office") (key "O" "Super+Shift" "movetoworkspacesilent" "special:office")
(key "P" "Ctrl+Alt" "exec" "${pkill} 1password") (key "P" "Ctrl+Alt" "exec" "${pkill} 1password")
(key "P" "Super" "togglespecialworkspace" "password") (key "P" "Super" "togglespecialworkspace" "password")
(key "P" "Super+Shift" "movetoworkspacesilent" "special:password") (key "P" "Super+Shift" "movetoworkspacesilent" "special:password")
(key "Q" "Ctrl+Alt" "exec" "${kill} -9 $(${hyprctl} -j activewindow | ${jq} .pid)") (key "Q" "Ctrl+Alt" "exec" "${kill} -9 $(${hyprctl} -j activewindow | ${jq} .pid)")
#// (key "Q" "Ctrl+Alt+Shift" "exec" "close") # Quit all windows #// (key "Q" "Ctrl+Alt+Shift" "exec" "close") # Quit all windows
(key "Q" "Super" "killactive" null) (key "Q" "Super" "killactive" null)
(key "S" "Ctrl+Alt" "exec" "${pkill} steam") (key "S" "Ctrl+Alt" "exec" "${pkill} steam")
(key "S" "Super" "togglespecialworkspace" "steam") (key "S" "Super" "togglespecialworkspace" "steam")
(key "S" "Super+Shift" "movetoworkspacesilent" "special:steam") (key "S" "Super+Shift" "movetoworkspacesilent" "special:steam")
(key "S" "Super+Shift" "exec" steam) (key "S" "Super+Shift" "exec" steam)
(key "T" "Ctrl+Alt" "exec" "${pkill} kitty") (key "T" "Ctrl+Alt" "exec" "${pkill} kitty")
(key "T" "Super" "togglespecialworkspace" "terminal") (key "T" "Super" "togglespecialworkspace" "terminal")
(key "T" "Super+Ctrl" "exec" kitty) (key "T" "Super+Ctrl" "exec" kitty)
(key "T" "Super+Shift" "movetoworkspacesilent" "special:terminal") (key "T" "Super+Shift" "movetoworkspacesilent" "special:terminal")
(key "V" "Super" "exec" "${kitty} --app-id clipboard --override font_size=12 ${clipse}") (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 "V" "Super+Shift" "exec" "${clipse} --clear && ${notify-send} clipse 'Clipboard cleared' --urgency low")
(key "W" "Super" "togglespecialworkspace" "vm") (key "W" "Super" "togglespecialworkspace" "vm")
(key "W" "Super+Ctrl" "exec" "${vm} -x ${ (key "W" "Super+Ctrl" "exec" ''${remote} --vm --username Myned --password "$(${cat} ${config.age.secrets."desktop/vm/myndows.pass".path})" ${
if config.custom.hidpi if config.custom.hidpi
then "/scale:140 +f" then "--scale 140"
else "" else ""
}") } myndows'')
(key "W" "Super+Ctrl+Shift" "exec" "${vm} ${virt-manager} --show-domain-console myndows") (key "W" "Super+Shift" "movetoworkspacesilent" "special:vm")
(key "W" "Super+Shift" "movetoworkspacesilent" "special:vm") (key "X" "Super" "workspace" "+1")
(key "X" "Super" "workspace" "+1") (key "X" "Super+Shift" "movetoworkspacesilent" "+1")
(key "X" "Super+Shift" "movetoworkspacesilent" "+1") (key "Z" "Super" "workspace" "-1")
(key "Z" "Super" "workspace" "-1") (key "Z" "Super+Shift" "movetoworkspacesilent" "-1")
(key "Z" "Super+Shift" "movetoworkspacesilent" "-1") ];
]; };
}; };
}; };
} }

View file

@ -1,5 +1,6 @@
{ {
config, config,
inputs,
lib, lib,
pkgs, pkgs,
... ...
@ -24,6 +25,7 @@ with lib; let
pkill = "${pkgs.procps}/bin/pkill"; pkill = "${pkgs.procps}/bin/pkill";
playerctl = "${pkgs.playerctl}/bin/playerctl"; playerctl = "${pkgs.playerctl}/bin/playerctl";
power = config.home-manager.users.${config.custom.username}.home.file.".local/bin/power".source; 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"; rfkill = "${pkgs.util-linux}/bin/rfkill";
sleep = "${pkgs.coreutils}/bin/sleep"; sleep = "${pkgs.coreutils}/bin/sleep";
swaync-client = "${config.home-manager.users.${config.custom.username}.services.swaync.package}/bin/swaync-client"; 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"; systemd-inhibit = "${pkgs.systemd}/bin/systemd-inhibit";
tailscale = "${pkgs.tailscale}/bin/tailscale"; tailscale = "${pkgs.tailscale}/bin/tailscale";
tr = "${pkgs.coreutils}/bin/tr"; 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; vpn = config.home-manager.users.${config.custom.username}.home.file.".local/bin/vpn".source;
wttrbar = "${pkgs.wttrbar}/bin/wttrbar"; wttrbar = "${pkgs.wttrbar}/bin/wttrbar";
@ -40,373 +41,385 @@ with lib; let
in { in {
options.custom.programs.waybar.enable = mkOption {default = false;}; options.custom.programs.waybar.enable = mkOption {default = false;};
config.home-manager.users.${config.custom.username} = mkIf cfg.enable { config = mkIf cfg.enable {
# https://github.com/Alexays/Waybar age.secrets = let
# https://www.nerdfonts.com/cheat-sheet secret = filename: {
programs.waybar = { file = "${inputs.self}/secrets/${filename}";
enable = true; owner = config.custom.username;
systemd.enable = true; # Start on login group = "users";
};
in {
"desktop/vm/myndows.pass" = secret "desktop/vm/myndows.pass";
};
# ?? waybar --log-level debug home-manager.users.${config.custom.username} = {
style = '' # https://github.com/Alexays/Waybar
${readFile ./style.css} # https://www.nerdfonts.com/cheat-sheet
programs.waybar = {
enable = true;
systemd.enable = true; # Start on login
.horizontal > box { # ?? waybar --log-level debug
margin: 0 ${toString config.custom.gap}px ${toString config.custom.gap}px; style = ''
} ${readFile ./style.css}
'';
### SETTINGS ### .horizontal > box {
# https://github.com/Alexays/Waybar/wiki/Configuration margin: 0 ${toString config.custom.gap}px ${toString config.custom.gap}px;
#?? 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
## GLOBAL ## ### SETTINGS ###
layer = "top"; # https://github.com/Alexays/Waybar/wiki/Configuration
position = "bottom"; #?? pkill -SIGUSR2 -x waybar
settings = let
## POSITION ## ## INHERIT ##
modules-left = [ #!! Module defaults are not accurate to documentation
"custom/power" # TODO: Submit pull request to fix in addition to inconsistent hyphen vs underscore
"custom/inhibitor" # https://github.com/Alexays/Waybar/wiki/Module:-Cava
"custom/vpn" cava-config = {
"custom/vm" cava_config = null; # Default: null?
"hyprland/workspaces" framerate = 30; # Default: 30?
]; autosens = 1; # Default: 1
modules-center = [ # sensitivity = 0; # Default: 100?
"clock" bars = 16; # Default: 2
"custom/weather" lower_cutoff_freq = 50; # Default: 50?
]; higher_cutoff_freq = 10000; # Default: 10000?
modules-right = [ sleep_timer = 5; # Default: 0
"mpris" hide_on_silence = true; # Default: false
"tray" method = "pipewire"; # Default: pulse
"custom/equalizer" source = "auto"; # Default: auto?
"wireplumber" sample_rate = 44100; # Default: 44100?
"bluetooth" sample_bits = 16; # Default: 16?
"network" stereo = false; # Default: true
"battery" reverse = false; # Default: false
]; bar_delimiter = 32; # ASCII code for space, default: 59 or ;
monstercat = true; # Default: false?
## MODULES ## waves = true; # Default: false?
# https://github.com/Alexays/Waybar/wiki/Module:-Custom noise_reduction = 0.2; # Default: 0.77?
"custom/power" = { input_delay = 1; # Default: 4
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 = "<span color='#eee8d5'>{}</span>";
weeks = "<span color='#eee8d5'>{}</span>";
weekdays = "<span color='#93a1a1'>{}</span>";
days = "<span color='#586e75'>{}</span>";
today = "<span color='#eee8d5'>{}</span>";
};
# 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 = "󰸈";
format-icons = [ format-icons = [
"󰕿" ""
"󰖀" ""
"󰕾" ""
]; ""
""
""
""
""
]; # !! Required
on-click = easyeffects; on-click = easyeffects;
on-click-right = "${swayosd-client} --output-volume mute-toggle";
on-scroll-up = "${swayosd-client} --output-volume raise"; on-scroll-up = "${swayosd-client} --output-volume raise";
on-scroll-down = "${swayosd-client} --output-volume lower"; 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 ## GLOBAL ##
bluetooth = { layer = "top";
format-disabled = "󰂲"; position = "bottom";
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 ## POSITION ##
network = { modules-left = [
format = "{icon}"; "custom/power"
format-icons = { "custom/inhibitor"
disabled = ""; "custom/vpn"
disconnected = ""; "custom/vm"
ethernet = "󰈀"; "hyprland/workspaces"
linked = ""; ];
wifi = [ 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 = "<span color='#eee8d5'>{}</span>";
weeks = "<span color='#eee8d5'>{}</span>";
weekdays = "<span color='#93a1a1'>{}</span>";
days = "<span color='#586e75'>{}</span>";
today = "<span color='#eee8d5'>{}</span>";
};
# 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; "cava#reverse" =
on-click-right = network; # Toggle networking on/off cava-config
}; // {
reverse = true;
};
# https://github.com/Alexays/Waybar/wiki/Module:-Battery "custom/equalizer" = {
"battery" = { interval = 5;
format = "{icon} {power:.0f}W"; on-click = audio;
format-icons = [ exec = pkgs.writeShellScript "equalizer.sh" ''
"󰂃" ${echo} 󰺢
"󰁺" ${echo} "$(${cat} ~/.audio)"
"󰁻" ${echo} "$(${cat} ~/.audio | ${tr} '[:upper:]' '[:lower:]')"
"󰁼" '';
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
interval = 5;
states = {
critical = 15;
warning = 30;
}; };
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 # TODO: Convert to writeShellApplication
### SCRIPTS ### ### SCRIPTS ###
#?? text #?? text
#?? tooltip #?? tooltip
#?? class #?? class
home.file = { home.file = {
# Return inhibit idle status # Return inhibit idle status
".config/waybar/scripts/inhibitor.sh" = { ".config/waybar/scripts/inhibitor.sh" = {
executable = true; executable = true;
text = '' text = ''
#! /usr/bin/env ${bash} #! /usr/bin/env ${bash}
if ${pgrep} systemd-inhibit &> /dev/null; then if ${pgrep} systemd-inhibit &> /dev/null; then
${echo} 󰅶 ${echo} 󰅶
${echo} Enabled ${echo} Enabled
${echo} enabled ${echo} enabled
else else
${echo} 󰾪 ${echo} 󰾪
${echo} Disabled ${echo} Disabled
${echo} disabled ${echo} disabled
fi fi
''; '';
}; };
# Return tailscale status # Return tailscale status
".config/waybar/scripts/vm.sh" = { ".config/waybar/scripts/vm.sh" = {
executable = true; executable = true;
text = '' text = ''
#! /usr/bin/env ${bash} #! /usr/bin/env ${bash}
case "$(virsh domstate myndows)" in case "$(virsh domstate myndows)" in
'running') 'running')
${echo} ${echo}
${echo} Online ${echo} Online
${echo} online;; ${echo} online;;
'paused') 'paused')
${echo} ${echo}
${echo} Paused ${echo} Paused
${echo} paused;; ${echo} paused;;
'shut off') 'shut off')
${echo} ${echo}
${echo} Offline ${echo} Offline
${echo} offline;; ${echo} offline;;
*) *)
${echo} ${echo}
${echo} Unknown ${echo} Unknown
${echo} unknown;; ${echo} unknown;;
esac esac
''; '';
}; };
# Return tailscale status # Return tailscale status
".config/waybar/scripts/vpn.sh" = { ".config/waybar/scripts/vpn.sh" = {
executable = true; executable = true;
text = '' text = ''
#! /usr/bin/env ${bash} #! /usr/bin/env ${bash}
if [[ $(${tailscale} status --json | ${jq} .ExitNodeStatus.Online) == 'true' ]]; then if [[ $(${tailscale} status --json | ${jq} .ExitNodeStatus.Online) == 'true' ]]; then
${echo} 󰖂 ${echo} 󰖂
${echo} Connected ${echo} Connected
${echo} connected ${echo} connected
else else
${echo} 󰖂 ${echo} 󰖂
${echo} Disconnected ${echo} Disconnected
${echo} disconnected ${echo} disconnected
fi fi
''; '';
};
}; };
}; };
}; };

View file

@ -143,6 +143,15 @@ in {
libnotify libnotify
power-profiles-daemon power-profiles-daemon
]) ])
(bash "remote" [
argc
coreutils
freerdp3
iputils
libnotify
libvirt
remmina
])
(bash "scratchpad" [ (bash "scratchpad" [
coreutils coreutils
libnotify libnotify
@ -166,14 +175,6 @@ in {
jq jq
libnotify libnotify
]) ])
(bash "vm" [
coreutils
freerdp3
iputils
libnotify
libvirt
remmina
])
(bash "vpn" [ (bash "vpn" [
gnused gnused
jq jq

View file

@ -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 <x|w|sdl>-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

View file

@ -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

View file

@ -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ǵijeæðtAP¦áŽ—Üîö¸ˆéäÈ ™åýZ8Ÿ*

View file

@ -55,6 +55,7 @@ in {
"desktop/bitwarden/client_secret".publicKeys = desktop; "desktop/bitwarden/client_secret".publicKeys = desktop;
"desktop/users/myned.pass".publicKeys = desktop; "desktop/users/myned.pass".publicKeys = desktop;
"desktop/users/root.pass".publicKeys = desktop; "desktop/users/root.pass".publicKeys = desktop;
"desktop/vm/myndows.pass".publicKeys = desktop;
### SBC ### SBC
"sbc/borgmatic/borgbase.mypi3".publicKeys = sbc; "sbc/borgmatic/borgbase.mypi3".publicKeys = sbc;