reorg and switc hto grim+slurp for screenshots
Some checks are pending
flakehub / flakehub-publish (push) Waiting to run
git-mirror / gitlab-sync (push) Waiting to run
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run

This commit is contained in:
Aly Raffauf 2024-07-21 20:59:03 -04:00
parent 2700c8af53
commit 1e1a02a5b3
5 changed files with 67 additions and 50 deletions

View file

@ -8,7 +8,7 @@
./gnome ./gnome
./hyprland ./hyprland
./sway ./sway
./waylandComp.nix ./wayland
]; ];
config = config =

View file

@ -6,36 +6,7 @@
}: let }: let
cfg = config.ar.home; cfg = config.ar.home;
scripts = import ./scripts.nix {inherit config lib pkgs;}; scripts = import ./scripts.nix {inherit config lib pkgs;};
helpers = import ../wayland/helpers.nix {inherit config lib pkgs;};
# Media/hardware commands
brightness = rec {
bin = lib.getExe' pkgs.swayosd "swayosd-client";
up = "${bin} --brightness=raise";
down = "${bin} --brightness=lower";
};
media = rec {
bin = lib.getExe pkgs.playerctl;
play = "${bin} play-pause";
paus = "${bin} pause";
next = "${bin} next";
prev = "${bin} previous";
};
screenshot = rec {
bin = lib.getExe pkgs.hyprshot;
folder = "${config.xdg.userDirs.pictures}/screenshots";
screen = "${bin} -m output -o ${folder}";
region = "${bin} -m region -o ${folder}";
};
volume = rec {
bin = lib.getExe' pkgs.swayosd "swayosd-client";
up = "${bin} --output-volume=raise";
down = "${bin} --output-volume=lower";
mute = "${bin} --output-volume=mute-toggle";
micMute = "${bin} --input-volume=mute-toggle";
};
in { in {
"$mod" = "SUPER"; "$mod" = "SUPER";
@ -56,7 +27,7 @@ in {
bind = bind =
[ [
"$mod CONTROL,F12,exec,${screenshot.region}" "$mod CONTROL,F12,exec,${helpers.screenshot.region}"
"$mod CONTROL,L,exec,${lib.getExe pkgs.swaylock}" "$mod CONTROL,L,exec,${lib.getExe pkgs.swaylock}"
"$mod SHIFT,S,movetoworkspace,special:magic" "$mod SHIFT,S,movetoworkspace,special:magic"
"$mod SHIFT,V,togglefloating" "$mod SHIFT,V,togglefloating"
@ -70,7 +41,7 @@ in {
"$mod,F,exec,${lib.getExe cfg.defaultApps.fileManager}" "$mod,F,exec,${lib.getExe cfg.defaultApps.fileManager}"
"$mod,F11,exec,pkill -SIGUSR1 waybar" "$mod,F11,exec,pkill -SIGUSR1 waybar"
"$mod,M,exec,${lib.getExe pkgs.wlogout}" "$mod,M,exec,${lib.getExe pkgs.wlogout}"
"$mod,PRINT,exec,${screenshot.region}" "$mod,PRINT,exec,${helpers.screenshot.region}"
"$mod,R,exec,${lib.getExe pkgs.fuzzel}" "$mod,R,exec,${lib.getExe pkgs.fuzzel}"
"$mod,S,togglespecialworkspace,magic" "$mod,S,togglespecialworkspace,magic"
"$mod,T,exec,${lib.getExe cfg.defaultApps.terminal}" "$mod,T,exec,${lib.getExe cfg.defaultApps.terminal}"
@ -78,8 +49,8 @@ in {
"$mod,mouse_down,workspace,+1" "$mod,mouse_down,workspace,+1"
"$mod,mouse_up,workspace,-1" "$mod,mouse_up,workspace,-1"
"$mod,period,exec,${lib.getExe pkgs.hyprnome}" "$mod,period,exec,${lib.getExe pkgs.hyprnome}"
",PRINT,exec,${screenshot.screen}" ",PRINT,exec,${helpers.screenshot.screen}"
"CONTROL,F12,exec,${screenshot.screen}" "CONTROL,F12,exec,${helpers.screenshot.screen}"
"CTRL ALT,M,submap,move" "CTRL ALT,M,submap,move"
"CTRL ALT,R,submap,resize" "CTRL ALT,R,submap,resize"
] ]
@ -98,11 +69,11 @@ in {
bindl = bindl =
[ [
# Volume, microphone, and media keys. # Volume, microphone, and media keys.
",xf86audiomute,exec,${volume.mute}" ",xf86audiomute,exec,${helpers.volume.mute}"
",xf86audiomicmute,exec,${volume.micMute}" ",xf86audiomicmute,exec,${helpers.volume.micMute}"
",xf86audioplay,exec,${media.play}" ",xf86audioplay,exec,${helpers.media.play}"
",xf86audioprev,exec,${media.prev}" ",xf86audioprev,exec,${helpers.media.prev}"
",xf86audionext,exec,${media.next}" ",xf86audionext,exec,${helpers.media.next}"
] ]
++ builtins.map (switch: ",switch:${switch},exec,${scripts.tablet}") cfg.desktop.hyprland.tabletMode.tabletSwitches ++ builtins.map (switch: ",switch:${switch},exec,${scripts.tablet}") cfg.desktop.hyprland.tabletMode.tabletSwitches
++ lib.lists.optionals (cfg.desktop.hyprland.laptopMonitors != []) ++ lib.lists.optionals (cfg.desktop.hyprland.laptopMonitors != [])
@ -113,10 +84,10 @@ in {
bindle = [ bindle = [
# Display, volume, microphone, and media keys. # Display, volume, microphone, and media keys.
",xf86monbrightnessup,exec,${brightness.up}" ",xf86monbrightnessup,exec,${helpers.brightness.up}"
",xf86monbrightnessdown,exec,${brightness.down}" ",xf86monbrightnessdown,exec,${helpers.brightness.down}"
",xf86audioraisevolume,exec,${volume.up}" ",xf86audioraisevolume,exec,${helpers.volume.up}"
",xf86audiolowervolume,exec,${volume.down}" ",xf86audiolowervolume,exec,${helpers.volume.down}"
]; ];
decoration = { decoration = {

View file

@ -11,12 +11,13 @@
if config.wayland.windowManager.sway.package == pkgs.sway if config.wayland.windowManager.sway.package == pkgs.sway
then true then true
else false; else false;
wayland = {
windowManager.sway.enable = true;
windowManager.sway.wrapperFeatures.gtk = true;
windowManager.sway.checkConfig = false;
windowManager.sway.config = let wayland.windowManager.sway = {
enable = true;
wrapperFeatures.gtk = true;
checkConfig = false;
config = let
modifier = "Mod4"; modifier = "Mod4";
swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg"; swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg";
@ -369,7 +370,7 @@
workspaceAutoBackAndForth = true; workspaceAutoBackAndForth = true;
}; };
windowManager.sway.extraConfig = let extraConfig = let
brightness = lib.getExe' pkgs.swayosd "swayosd-client"; brightness = lib.getExe' pkgs.swayosd "swayosd-client";
brightness_up = "${brightness} --brightness=raise"; brightness_up = "${brightness} --brightness=raise";
brightness_down = "${brightness} --brightness=lower"; brightness_down = "${brightness} --brightness=lower";

View file

@ -0,0 +1,45 @@
{
lib,
pkgs,
...
}: {
brightness = rec {
bin = lib.getExe' pkgs.swayosd "swayosd-client";
up = "${bin} --brightness=raise";
down = "${bin} --brightness=lower";
};
media = rec {
bin = lib.getExe pkgs.playerctl;
play = "${bin} play-pause";
paus = "${bin} pause";
next = "${bin} next";
prev = "${bin} previous";
};
screenshot = {
region = pkgs.writeShellScript "screenshot-region" ''
FILENAME=$HOME/pics/screenshots/$(date +'%Y-%m-%d-%H:%M_grim.png')
${lib.getExe pkgs.grim} -g "$(${lib.getExe pkgs.slurp})" "$FILENAME"
${lib.getExe' pkgs.wl-clipboard-rs "wl-copy"} $FILENAME
${lib.getExe' pkgs.libnotify "notify-send"} "Screenshot saved" "$FILENAME" -i "$FILENAME"
'';
screen = pkgs.writeShellScript "screenshot-screen" ''
FILENAME=$HOME/pics/screenshots/$(date +'%Y-%m-%d-%H:%M_grim.png')
${lib.getExe pkgs.grim} -g "$(${lib.getExe pkgs.slurp} -o)" "$FILENAME"
${lib.getExe' pkgs.wl-clipboard-rs "wl-copy"} $FILENAME
${lib.getExe' pkgs.libnotify "notify-send"} "Screenshot saved" "$FILENAME" -i "$FILENAME"
'';
};
volume = rec {
bin = lib.getExe' pkgs.swayosd "swayosd-client";
up = "${bin} --output-volume=raise";
down = "${bin} --output-volume=lower";
mute = "${bin} --output-volume=mute-toggle";
micMute = "${bin} --input-volume=mute-toggle";
};
}