1
1
Fork 0

Compare commits

..

5 commits

Author SHA1 Message Date
7665a9a4cc
ssh: fix fhs permissions
Signed-off-by: Myned <dev@bjork.tech>
2024-09-25 15:14:23 -05:00
cfe0a8b886
1password: modify config
Signed-off-by: Myned <dev@bjork.tech>
2024-09-25 15:05:04 -05:00
bdb72136a6
hyprland: fix terminal binds
Signed-off-by: Myned <dev@bjork.tech>
2024-09-25 15:04:05 -05:00
f2e4cb2a3c
launch: initial script to work around static rules
Signed-off-by: Myned <dev@bjork.tech>
2024-09-25 15:03:44 -05:00
9a764b27d5
nix: use hyprland package from program
Signed-off-by: Myned <dev@bjork.tech>
2024-09-25 15:02:50 -05:00
12 changed files with 163 additions and 21 deletions

View file

@ -11,7 +11,7 @@ with lib; let
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";
gnome-text-editor = "${pkgs.gnome-text-editor}/bin/gnome-text-editor"; gnome-text-editor = "${pkgs.gnome-text-editor}/bin/gnome-text-editor";
hyprctl = "${pkgs.hyprland}/bin/hyprctl"; hyprctl = "${config.programs.hyprland.package}/bin/hyprctl";
hyprlock = "${config.home-manager.users.${config.custom.username}.programs.hyprlock.package}/bin/hyprlock"; hyprlock = "${config.home-manager.users.${config.custom.username}.programs.hyprlock.package}/bin/hyprlock";
hyprpicker = "${pkgs.hyprpicker}/bin/hyprpicker"; hyprpicker = "${pkgs.hyprpicker}/bin/hyprpicker";
inhibit = "~/.local/bin/inhibit"; inhibit = "~/.local/bin/inhibit";
@ -153,6 +153,8 @@ in {
(key "Return" "Super+Shift" "fullscreen" "0") # Fullscreen (key "Return" "Super+Shift" "fullscreen" "0") # Fullscreen
(key "Right" "Super" "movewindow" "r") (key "Right" "Super" "movewindow" "r")
(key "Right" "Super+Shift" "movewindoworgroup" "r") (key "Right" "Super+Shift" "movewindoworgroup" "r")
(key "Semicolon" "Super" "exec" "${hyprpicker} --autocopy")
(key "Semicolon" "Super+Shift" "exec" "${hyprpicker} --autocopy --format rgb")
(key "Slash" "Super" "exec" vrr) (key "Slash" "Super" "exec" vrr)
(key "Space" "Ctrl" "exec" (concatStringsSep " " [ (key "Space" "Ctrl" "exec" (concatStringsSep " " [
"${toggle}" "${toggle}"
@ -225,8 +227,9 @@ in {
(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" "Super" "exec" "${hyprpicker} --autocopy") (key "P" "Ctrl+Alt" "exec" "${pkill} 1password")
(key "P" "Super+Shift" "exec" "${hyprpicker} --autocopy --format rgb") (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" "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)
@ -236,8 +239,8 @@ in {
(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+Shift" "movetoworkspacesilent" "special:terminal") (key "T" "Super+Shift" "movetoworkspacesilent" "special:terminal")
(key "T" "Super+Shift" "exec" kitty)
(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")

View file

@ -5,7 +5,7 @@
... ...
}: }:
with lib; let with lib; let
hyprctl = "${pkgs.hyprland}/bin/hyprctl"; hyprctl = "${config.programs.hyprland.package}/bin/hyprctl";
cfg = config.custom.desktops.hyprland.plugins; cfg = config.custom.desktops.hyprland.plugins;
in { in {

View file

@ -5,8 +5,11 @@
... ...
}: }:
with lib; let with lib; let
_1password = "${config.programs._1password-gui.package}/bin/1password";
gamescope = "${config.programs.gamescope.package}/bin/gamescope"; gamescope = "${config.programs.gamescope.package}/bin/gamescope";
hyprctl = "${config.programs.hyprland.package}/bin/hyprctl";
kitty = "${config.home-manager.users.${config.custom.username}.programs.kitty.package}/bin/kitty"; kitty = "${config.home-manager.users.${config.custom.username}.programs.kitty.package}/bin/kitty";
launch = "~/.local/bin/launch";
loupe = "${pkgs.loupe}/bin/loupe"; loupe = "${pkgs.loupe}/bin/loupe";
onlyoffice = "${pkgs.onlyoffice-bin}/bin/onlyoffice-desktopeditors"; onlyoffice = "${pkgs.onlyoffice-bin}/bin/onlyoffice-desktopeditors";
pgrep = "${pkgs.procps}/bin/pgrep"; pgrep = "${pkgs.procps}/bin/pgrep";
@ -29,6 +32,7 @@ in {
"special:android, on-created-empty:${waydroid} app launch com.YoStarEN.Arknights" "special:android, on-created-empty:${waydroid} app launch com.YoStarEN.Arknights"
"special:music, on-created-empty:${youtube-music}" "special:music, on-created-empty:${youtube-music}"
"special:office, on-created-empty:[tile] ${onlyoffice}" "special:office, on-created-empty:[tile] ${onlyoffice}"
"special:password, on-created-empty:${launch} --tile ${_1password}"
"special:steam, on-created-empty:${steam}" "special:steam, on-created-empty:${steam}"
"special:terminal, on-created-empty:${kitty}" "special:terminal, on-created-empty:${kitty}"
"special:vm, on-created-empty:${pgrep} -x vm || ${virt-manager}" "special:vm, on-created-empty:${pgrep} -x vm || ${virt-manager}"
@ -168,6 +172,10 @@ in {
(class "libreoffice.+" rules) (class "libreoffice.+" rules)
(class "ONLYOFFICE Desktop Editors" rules) (class "ONLYOFFICE Desktop Editors" rules)
]; ];
password = rules: [
(class "1Password" rules)
(class "Bitwarden" rules)
];
pip = rules: [ pip = rules: [
(title "Picture.in.[Pp]icture" rules) (title "Picture.in.[Pp]icture" rules)
]; ];
@ -211,6 +219,7 @@ in {
(tag.game ["fullscreen" "group barred" "idleinhibit always" "noborder" "noshadow" "renderunfocused" "workspace name:game"]) (tag.game ["fullscreen" "group barred" "idleinhibit always" "noborder" "noshadow" "renderunfocused" "workspace name:game"])
(tag.music ["tile" "workspace special:music"]) (tag.music ["tile" "workspace special:music"])
(tag.office ["workspace special:office"]) (tag.office ["workspace special:office"])
(tag.password ["center" "workspace special:password"])
(tag.pip ["keepaspectratio" "move ${pip.x} ${pip.y}" "pin" "size ${pip.w} ${pip.h}"]) (tag.pip ["keepaspectratio" "move ${pip.x} ${pip.y}" "pin" "size ${pip.w} ${pip.h}"])
(tag.social ["group" "tile"]) (tag.social ["group" "tile"])
(tag.steam ["workspace special:steam"]) (tag.steam ["workspace special:steam"])
@ -223,10 +232,6 @@ in {
(class "Tap Wizard 2.x86_64" ["workspace 0"]) (class "Tap Wizard 2.x86_64" ["workspace 0"])
#!! Expressions are not wrapped in ^$ #!! Expressions are not wrapped in ^$
(fields {
class = "^1Password$";
title = "^1Password$";
} ["center"])
(fields { (fields {
class = "^com\\.github\\.wwmm\\.easyeffects$"; class = "^com\\.github\\.wwmm\\.easyeffects$";
title = "^Easy Effects$"; # Main window title = "^Easy Effects$"; # Main window

View file

@ -5,6 +5,7 @@
... ...
}: }:
with lib; let with lib; let
_1password = "${config.programs._1password-gui.package}/bin/1password";
clipse = "${pkgs.clipse}/bin/clipse"; clipse = "${pkgs.clipse}/bin/clipse";
firefox-esr = "${ firefox-esr = "${
config.home-manager.users.${config.custom.username}.programs.firefox.finalPackage config.home-manager.users.${config.custom.username}.programs.firefox.finalPackage
@ -73,6 +74,7 @@ in {
sway-audio-idle-inhibit # Inhibit idle while audio is playing sway-audio-idle-inhibit # Inhibit idle while audio is playing
"${clipse} --clear" # Clear clipboard history "${clipse} --clear" # Clear clipboard history
"${clipse} --listen" # Monitor clipboard "${clipse} --listen" # Monitor clipboard
"${_1password} --silent" # Launch password manager in background
"[group new lock; tile] ${firefox-esr}" "[group new lock; tile] ${firefox-esr}"
]; ];

View file

@ -5,9 +5,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.custom.programs."1password"; cfg = config.custom.programs._1password;
in { in {
options.custom.programs."1password".enable = mkOption {default = false;}; options.custom.programs._1password.enable = mkOption {default = false;};
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs = { programs = {

View file

@ -37,7 +37,7 @@ with lib; {
}) })
(mkIf config.custom.full { (mkIf config.custom.full {
"1password".enable = true; _1password.enable = true;
adb.enable = true; adb.enable = true;
ags.enable = true; ags.enable = true;
#// anyrun.enable = true; #// anyrun.enable = true;

View file

@ -14,5 +14,23 @@ in {
programs.ssh.extraConfig = '' programs.ssh.extraConfig = ''
StrictHostKeyChecking no StrictHostKeyChecking no
''; '';
home-manager.users.${config.custom.username} = {
programs.ssh = {
enable = true;
extraConfig = ''
Host *
IdentityAgent ~/.1password/agent.sock
'';
};
# Work around FHS permissions
# https://github.com/nix-community/home-manager/issues/322#issuecomment-1856128020
home.file.".ssh/config" = {
target = ".ssh/config_source";
onChange = "cat ~/.ssh/config_source > ~/.ssh/config && chmod 400 ~/.ssh/config";
};
};
}; };
} }

View file

@ -10,9 +10,7 @@ with lib; let
bluetoothctl = "${pkgs.bluez}/bin/bluetoothctl"; bluetoothctl = "${pkgs.bluez}/bin/bluetoothctl";
easyeffects = "${pkgs.easyeffects}/bin/easyeffects"; easyeffects = "${pkgs.easyeffects}/bin/easyeffects";
echo = "${pkgs.coreutils}/bin/echo"; echo = "${pkgs.coreutils}/bin/echo";
hyprctl = "${ hyprctl = "${config.programs.hyprland.package}/bin/hyprctl";
config.home-manager.users.${config.custom.username}.wayland.windowManager.hyprland.finalPackage
}/bin/hyprctl";
inhibit = config.home-manager.users.${config.custom.username}.home.file.".local/bin/inhibit".source; inhibit = config.home-manager.users.${config.custom.username}.home.file.".local/bin/inhibit".source;
jq = "${pkgs.jq}/bin/jq"; jq = "${pkgs.jq}/bin/jq";
loginctl = "${pkgs.systemd}/bin/loginctl"; loginctl = "${pkgs.systemd}/bin/loginctl";
@ -172,6 +170,7 @@ in {
game = "󰊴"; game = "󰊴";
music = "󰝚"; music = "󰝚";
office = "󰈙"; office = "󰈙";
password = "󰌾";
pip = "󰹙"; pip = "󰹙";
scratchpad = ""; scratchpad = "";
steam = "󰓓"; steam = "󰓓";

View file

@ -91,6 +91,12 @@ in {
libnotify libnotify
systemd systemd
]) ])
(bash "launch" [
argc
coreutils
hyprland
jq
])
(bash "left" [ (bash "left" [
argc argc
hyprland hyprland

View file

@ -0,0 +1,113 @@
#! /usr/bin/env bash
# @describe Wrapper for launching applications with window rules
# Relies on polling for the next open window, not the process id
# Race conditions are possible with active usage during application start
#
# https://github.com/sigoden/argc
# @meta combine-shorts
# @option -M --move Move next window to absolute position (X[%] Y[%]) (requires floating)
# @option -R --resize Resize next window to absolute dimensions (W[%] H[%]) (requires floating)
# @option -W --workspace Move next window to workspace
# @flag -a --active Focus and raise next window (raise requires floating)
# @flag -c --center Center next window (requires floating)
# @flag -f --float Float next window
# @flag -g --group Add next window to the active group
# @flag -l --lock Lock next window's group
# @flag -m --maximize Maximize next window
# @flag -n --new Add next window to a new group
# @flag -p --pin Pin next window (requires floating)
# @flag -s --fullscreen Fullscreen next window
# @flag -t --tile Tile next window
# @arg commands+ Commands to execute in an exec dispatcher
eval "$(argc --argc-eval "$0" "$@")"
# Get initial count of open windows
count="$(hyprctl -j clients | jq length)"
# Launch application
hyprctl dispatch exec "${argc_commands[@]:-}"
# Poll for next window
c=0
while (("$(hyprctl -j clients | jq length)" <= "$count")); do
# Increment timeout counter
((c += 1))
# Time out after 60 seconds
if (("$c" >= 60 * 10)); then
notify-send "> launch" "Polling timed out" --urgency critical
break
fi
sleep 0.1
done
# Get address of last window
window="address:$(hyprctl -j clients | jq -r ".[-1].address")"
# Set batch rules on window
batch=
### Floating rules
if [[ "${argc_float:-}" ]]; then
batch+="dispatch setfloating $window;"
fi
if [[ "${argc_center:-}" ]]; then
batch+="dispatch focuswindow $window; dispatch centerwindow;"
fi
if [[ "${argc_move:-}" ]]; then
batch+="dispatch movewindowpixel exact ${argc_move:-},$window;"
fi
if [[ "${argc_pin:-}" ]]; then
batch+="dispatch pin $window;"
fi
if [[ "${argc_resize:-}" ]]; then
batch+="dispatch resizewindowpixel exact ${argc_resize:-},$window;"
fi
### Group rules
if [[ "${argc_new:-}" ]]; then
batch+="dispatch focuswindow $window; dispatch togglegroup;" # Requires no initial group
fi
if [[ "${argc_lock:-}" ]]; then
batch+="dispatch focuswindow $window; dispatch lockactivegroup lock;"
fi
### Global rules
if [[ "${argc_active:-}" ]]; then
batch+="dispatch alterzorder top,$window; dispatch focuswindow $window;" # Handles floating
fi
if [[ "${argc_fullscreen:-}" ]]; then
batch+="dispatch focuswindow $window; dispatch fullscreen 0;"
fi
if [[ "${argc_group:-}" ]]; then
batch+="dispatch focuswindow $window; dispatch moveintogroup up;" # Assumes up direction
fi
if [[ "${argc_maximize:-}" ]]; then
batch+="dispatch focuswindow $window; dispatch fullscreen 1;"
fi
if [[ "${argc_tile:-}" ]]; then
batch+="dispatch settiled $window;"
fi
if [[ "${argc_workspace:-}" ]]; then
batch+="dispatch movetoworkspacesilent ${argc_workspace:-},$window;"
fi
# Dispatch batch commands
if [[ "${batch:-}" ]]; then
hyprctl --batch "$batch"
fi

View file

@ -6,9 +6,7 @@
}: }:
with lib; let with lib; let
grep = "${pkgs.gnugrep}/bin/grep"; grep = "${pkgs.gnugrep}/bin/grep";
hyprctl = "${ hyprctl = "${config.programs.hyprland.package}/bin/hyprctl";
config.home-manager.users.${config.custom.username}.wayland.windowManager.hyprland.finalPackage
}/bin/hyprctl";
hyprlock = "${ hyprlock = "${
config.home-manager.users.${config.custom.username}.programs.hyprlock.package config.home-manager.users.${config.custom.username}.programs.hyprlock.package
}/bin/hyprlock"; }/bin/hyprlock";

View file

@ -6,9 +6,7 @@
}: }:
with lib; let with lib; let
chayang = "${pkgs.chayang}/bin/chayang"; chayang = "${pkgs.chayang}/bin/chayang";
hyprctl = "${ hyprctl = "${config.programs.hyprland.package}/bin/hyprctl";
config.home-manager.users.${config.custom.username}.wayland.windowManager.hyprland.package
}/bin/hyprctl";
loginctl = "${pkgs.systemd}/bin/loginctl"; loginctl = "${pkgs.systemd}/bin/loginctl";
pgrep = "${pkgs.procps}/bin/pgrep"; pgrep = "${pkgs.procps}/bin/pgrep";
swaylock = "${ swaylock = "${