Add Hyprland, attempt generalization

This commit is contained in:
Jimbo 2024-12-08 06:41:06 -05:00
parent 590430f296
commit a0cc623c4b
57 changed files with 634 additions and 385 deletions

View file

@ -9,21 +9,20 @@
{ command = "foot -a music -T Music ncmpcpp"; }
{ command = "foot -a sound -T Sound pulsemixer"; }
# Daemons and tray apps
# Daemons and tray
{ command = "hyprpaper"; }
{ command = "wl-paste -t text --watch clipman store -P"; }
{ command = "wl-copy"; }
{ command = "mako"; }
{ command = "sunshine"; }
{ command = "xwayland-satellite"; }
{ command = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1"; }
# Foreground apps
# Foreground
{ command = "librewolf -P Misc --name=MiscBrowser"; }
{ command = "thunderbird"; }
{ command = "vesktop"; }
{ command = "fractal"; }
{ command = "telegram-desktop"; }
{ command = "thunderbird"; }
];
};
}

View file

@ -21,12 +21,6 @@
titlebar_padding 10 1
primary_selection disabled
mouse_warping container
# Include extra window icons
include ${pkgs.fetchurl {
url = "https://raw.githubusercontent.com/iguanajuice/sway-font-awesome/6b7a9d08974eea1b9cddb8d444e1c89d6837083a/icons";
sha256 = "09ki5qw1h91kd33k3fwzq7cb6ck8sq4haswgizrsy387sfr2a75x";
}}
'';
};
}

View file

@ -20,23 +20,22 @@
"${primeMod}+F4" = ''exec virt-manager | notify-send "Virtual Machines"'';
"${primeMod}+F5" = ''exec looking-glass-client input:rawMouse=yes | notify-send "Looking Glass"'';
# Mod + key
# Prime + key
"${primeMod}+s" = ''exec rofi -show run -p Command'';
"${primeMod}+c" = ''exec clipman pick -t rofi'';
"${primeMod}+x" = ''exec rofiscripts --power'';
"${primeMod}+b" = ''exec pkill -USR1 waybar'';
"${primeMod}+Return" = ''exec foot'';
"${primeMod}+Escape" = ''exec tools-sway --kill'';
# Mod + shift + key
# Prime + shift + key
"${primeMod}+Shift+s" = ''exec rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history'';
"${primeMod}+Shift+t" = ''exec pcmanfm'';
"${primeMod}+Shift+e" = ''exec bemoji -n -P 0'';
"${primeMod}+Shift+b" = ''exec rofi-bluetooth'';
"${primeMod}+Shift+Return" = ''exec foot ranger'';
# Mod + ctrl + key
"${primeMod}+Ctrl+x" = ''exec tools-sway --prop'';
# Prime + ctrl + key
"${primeMod}+Ctrl+x" = ''exec prop-sway'';
"${primeMod}+Ctrl+s" = ''exec rofiscripts --scratchpads'';
"${primeMod}+Ctrl+c" = ''exec wlpicker && notify-send "Color copied to clipboard"'';
@ -61,8 +60,8 @@
"${primeMod}+Ctrl+n" = ''exec makoctl dismiss -a'';
# Screenshots
"${secMod}+f" = ''exec screen-sway --swappy'';
"${secMod}+Shift+f" = ''exec screen-sway --screen'';
"${secMod}+f" = ''exec shot-sway --swappy'';
"${secMod}+Shift+f" = ''exec shot-sway --screen'';
# Display and keyboard brightness
"${primeMod}+equal" = ''exec light -A 5'';
@ -140,20 +139,15 @@
"${primeMod}+${secMod}+k" = ''resize grow height ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+l" = ''resize grow width ${resizeAmount} px or 5 ppt'';
# Change focus between floating/tiled, toggle floating
# Floating
"${primeMod}+space" = ''focus mode_toggle'';
"${primeMod}+Shift+space" = ''floating toggle'';
# Toggle fullscreen
# Change layout
"${primeMod}+f" = ''fullscreen toggle'';
"${primeMod}+${secMod}+Ctrl+f" = ''fullscreen toggle global'';
# Change container layout
"${primeMod}+w" = ''layout toggle split'';
"${primeMod}+e" = ''layout toggle tabbed stacking'';
# Change split direction
"${primeMod}+v" = ''split v'';
"${primeMod}+e" = ''layout toggle tabbed stacking'';
# Focus parent / child
"${primeMod}+a" = ''focus parent'';

View file

@ -1,8 +1,7 @@
{ pkgs, ... }:
{
imports = [
./screen-sway
./prop-sway
./sleep-sway
./tools-sway
];
}

View file

@ -0,0 +1,13 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "prop-sway" ''
selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | ${pkgs.slurp}/bin/slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000)
if [ -n "$selected_window" ]; then
app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id')
system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell'))
notify-send "$(echo -e "Window's app_id: $app_id\nWindow System: $system")"
fi
'')
];
}

View file

@ -1,44 +0,0 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "screen-sway" ''
swappy() {
# Create an imv window to act as a static screen
grim -t jpeg -q 90 - | imv -w "GlobalShot" - & imv_pid=$!
# Capture the screenshot of the selected area and save to a temporary file
selected_area=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"'\
| XCURSOR_SIZE=40 slurp -w ${config.look.border.string} -c ${config.look.colors.prime} -B 00000066 -b 00000099)
temp_file=$(mktemp -u).png
grim -g "$selected_area" "$temp_file"
kill $imv_pid
# Copy the screenshot to the clipboard and clear the temp
${pkgs.swappy}/bin/swappy -f - < "$temp_file"
rm "$temp_file"
}
screen() {
temp_file=$(mktemp -u).png
grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$temp_file"
# Check if the screenshot was successfully taken
if [ $? -eq 0 ]; then
wl-copy < "$temp_file"
notify-send -i "$temp_file" "Current screen copied."
rm "$temp_file"
else
notify-send "Error: Unable to capture screenshot."
fi
}
if [ "$1" == "--swappy" ]; then
swappy
elif [ "$1" == "--screen" ]; then
screen
else
echo "Please use the arguments --swappy or --screen."
fi
'')
];
}

View file

@ -1,33 +0,0 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
(pkgs.writeScriptBin "tools-sway" ''
# List the app name and whether or not it uses wayland
prop() {
selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000)
if [ -n "$selected_window" ]; then
app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id')
system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell'))
notify-send "$(echo -e "Window's app_id: $app_id\nWindow System: $system")"
fi
}
# Kill a selected window
kill() {
selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000)
if [ -n "$selected_window" ]; then
pid=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .pid')
kill -9 "$pid"
fi
}
if [ "$1" == "--prop" ]; then
prop
elif [ "$1" == "--kill" ]; then
kill
else
echo "Please use the arguments --prop or --kill."
fi
'')
];
}

View file

@ -67,7 +67,6 @@
"7:${config.ws.w7}" = [
{ app_id = "MiscBrowser"; }
{ app_id = "vesktop"; }
{ class = "vesktop"; }
];
"8:${config.ws.w8}" = [
{ app_id = "org.gnome.Fractal"; }

View file

@ -32,7 +32,7 @@
};
};
fonts = {
names = ["${config.look.fonts.main}"];
names = [ config.look.fonts.main ];
size = 10.5;
};
gaps = {