refactor: expose all scripts as modules

This commit is contained in:
Swarsel 2024-07-29 17:01:19 +02:00
parent db231d4b83
commit 8f4fe686a5
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
29 changed files with 785 additions and 330 deletions

View file

@ -37,7 +37,6 @@
"flakes"
"ca-derivations"
];
warn-dirty = false;
};
};

View file

@ -1,6 +1,6 @@
_:
{
home.sessionVariables = {
EDITOR = "bash ~/.dotfiles/scripts/editor.sh";
EDITOR = "e -w";
};
}

View file

@ -2,7 +2,7 @@
{
programs.nix-index =
let
command-not-found = pkgs.runCommandLocal "command-not-found.sh" { } ''
commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } ''
mkdir -p $out/etc/profile.d
substitute ${../../../scripts/command-not-found.sh} \
$out/etc/profile.d/command-not-found.sh \
@ -10,11 +10,12 @@
--replace @tput@ ${pkgs.ncurses}/bin/tput
'';
in
{
enable = true;
package = pkgs.symlinkJoin {
name = "nix-index";
paths = [ command-not-found ];
paths = [ commandNotFound ];
};
};
}

View file

@ -147,17 +147,15 @@
noto-fonts-cjk-sans
pass-fuzzel
pass-fuzzel-otp
cura5
cdw
cdb
bak
timer
#E: hides scratchpad depending on state, calls emacsclient for edit and then restores the scratchpad state
(pkgs.writeShellScriptBin "e" ''
bash ~/.dotfiles/scripts/editor_nowait.sh "$@"
'')
e
swarselcheck
waybarupdate
opacitytoggle
(pkgs.writeScriptBin "project" ''
#! ${pkgs.bash}/bin/bash

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }: with lib;
{ config, pkgs, lib, ... }:
let
inherit (config.swarselsystems) monitors;
eachMonitor = _name: monitor: {
@ -9,8 +9,8 @@ let
inherit (monitor) name;
value = builtins.removeAttrs monitor [ "mode" "name" "scale" "position" ];
};
workplaceSets = mapAttrs' eachOutput monitors;
workplaceOutputs = map (key: getAttr key workplaceSets) (attrNames workplaceSets);
workplaceSets = lib.mapAttrs' eachOutput monitors;
workplaceOutputs = map (key: lib.getAttr key workplaceSets) (lib.attrNames workplaceSets);
in
{
wayland.windowManager.sway = {
@ -31,7 +31,7 @@ in
let
inherit (config.wayland.windowManager.sway.config) modifier;
in
recursiveUpdate
lib.recursiveUpdate
{
"${modifier}+q" = "kill";
"${modifier}+f" = "exec firefox";
@ -40,24 +40,21 @@ in
"${modifier}+e" = "exec emacsclient -nquc -a emacs -e \"(dashboard-open)\"";
"${modifier}+Shift+m" = "exec emacsclient -nquc -a emacs -e \"(mu4e)\"";
"${modifier}+Shift+c" = "exec emacsclient -nquc -a emacs -e \"(swarsel/open-calendar)\"";
"${modifier}+Shift+s" = "exec \"bash ~/.dotfiles/scripts/checkspotify.sh\"";
"${modifier}+m" = "exec \"bash ~/.dotfiles/scripts/checkspotifytui.sh\"";
"${modifier}+x" = "exec \"bash ~/.dotfiles/scripts/checkkitty.sh\"";
"${modifier}+d" = "exec \"bash ~/.dotfiles/scripts/checkdiscord.sh\"";
"${modifier}+Shift+r" = "exec \"bash ~/.dotfiles/scripts/restart.sh\"";
"${modifier}+Shift+t" = "exec \"bash ~/.dotfiles/scripts/toggle_opacity.sh\"";
"${modifier}+m" = "exec swarselcheck -s";
"${modifier}+x" = "exec swarselcheck -k";
"${modifier}+d" = "exec swarselcheck -d";
"${modifier}+w" = "exec swarselcheck -e";
"${modifier}+Shift+t" = "exec opacitytoggle";
"${modifier}+Shift+F12" = "move scratchpad";
"${modifier}+F12" = "scratchpad show";
"${modifier}+c" = "exec qalculate-gtk";
"${modifier}+p" = "exec pass-fuzzel";
"${modifier}+o" = "exec pass-fuzzel-otp";
"${modifier}+o" = "exec pass-fuzzel --otp";
"${modifier}+Shift+p" = "exec pass-fuzzel --type";
"${modifier}+Shift+o" = "exec pass-fuzzel-otp --type";
"${modifier}+Shift+o" = "exec pass-fuzzel --otp --type";
"${modifier}+Escape" = "mode $exit";
# "${modifier}+Shift+Escape" = "exec com.github.stsdc.monitor";
"${modifier}+Shift+Escape" = "exec kitty -o confirm_os_window_close=0 btm";
"${modifier}+s" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png";
"${modifier}+i" = "exec \"bash ~/.dotfiles/scripts/startup.sh\"";
"${modifier}+1" = "workspace 1:";
"${modifier}+Shift+1" = "move container to workspace 1:";
"${modifier}+2" = "workspace 2:";
@ -78,8 +75,6 @@ in
"${modifier}+Shift+9" = "move container to workspace 9:";
"${modifier}+0" = "workspace 10:";
"${modifier}+Shift+0" = "move container to workspace 10:";
"XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%";
"${modifier}+Left" = "focus left";
"${modifier}+Right" = "focus right";
"${modifier}+Down" = "focus down";
@ -100,6 +95,12 @@ in
"${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
"${modifier}+r" = "mode resize";
"${modifier}+Return" = "exec kitty";
"XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86MonBrightnessUp" = "exec brightnessctl set +5%";
"XF86MonBrightnessDown" = "exec brightnessctl set 5%-";
"XF86Display" = "exec wl-mirror eDP-1";
}
config.swarselsystems.keybindings;
modes = {
@ -113,7 +114,7 @@ in
};
};
defaultWorkspace = "workspace 1:";
output = mapAttrs' eachMonitor monitors;
output = lib.mapAttrs' eachMonitor monitors;
input = config.swarselsystems.standardinputs;
workspaceOutputAssign = workplaceOutputs;
startup = config.swarselsystems.startup ++ [

View file

@ -22,7 +22,7 @@
};
"custom/configwarn" = {
exec = "bash ~/.dotfiles/scripts/checkconfigstatus.sh";
exec = "waybarupdate";
interval = 60;
};
@ -141,6 +141,7 @@
on-click = "pamixer -t";
on-click-right = "pavucontrol";
};
memory = {
interval = 5;
format = " {}%";

View file

@ -6,7 +6,7 @@
hg = "history | grep";
hmswitch = "cd ~/.dotfiles; home-manager --flake .#$(whoami)@$(hostname) switch; cd -;";
nswitch = "cd ~/.dotfiles; sudo nixos-rebuild --flake .#$(hostname) switch; cd -;";
edithome = "bash ~/.dotfiles/scripts/editor.sh ~/.dotfiles/Nix.org";
edithome = "e -w ~/.dotfiles/SwarselSystems.org";
magit = "emacsclient -nc -e \"(magit-status)\"";
config = "git --git-dir=$HOME/.cfg/ --work-tree=$HOME";
g = "git";

View file

@ -97,10 +97,6 @@
};
};
keybindings = {
"Mod4+w" = "exec \"bash ~/.dotfiles/scripts/checkelement.sh\"";
"XF86MonBrightnessUp" = "exec brightnessctl set +5%";
"XF86MonBrightnessDown" = "exec brightnessctl set 5%-";
"XF86Display" = "exec wl-mirror eDP-1";
# these are left open to use
# "XF86WLAN" = "exec wl-mirror eDP-1";
# "XF86Messenger" = "exec wl-mirror eDP-1";
@ -109,8 +105,6 @@
# "XF86HomePage" = "exec wtype -P Escape -p Escape";
# "XF86AudioLowerVolume" = "pactl set-sink-volume alsa_output.pci-0000_08_00.6.HiFi__hw_Generic_1__sink -5%";
# "XF86AudioRaiseVolume" = "pactl set-sink-volume alsa_output.pci-0000_08_00.6.HiFi__hw_Generic_1__sink +5% ";
"XF86AudioMute" = "exec pactl set-sink-mute alsa_output.pci-0000_08_00.6.HiFi__Speaker__sink toggle && exec pactl set-sink-mute alsa_output.usb-Lenovo_ThinkPad_Thunderbolt_4_Dock_USB_Audio_000000000000-00.analog-stereo toggle";
};
};
}