From 770b7d23e99340cc9a7f8534081c4b0015859737 Mon Sep 17 00:00:00 2001 From: vorboyvo Date: Mon, 15 Jan 2024 14:11:14 -0500 Subject: [PATCH] Changed a bunch of packages installed through home manager Added brightness and volume scripts to bind to media keys. Still imperfect Refactored to put neovim in its own file, will do the same for others --- configuration.nix | 7 ++++--- home.nix | 28 +++++++++++++--------------- programs/neovim.nix | 6 ++++++ todo | 5 ++--- wayland/changebrightness.sh | 16 ++++++++++++++++ wayland/dynscreenshot.sh | 1 + wayland/sway.nix | 19 ++++++++++++++++++- 7 files changed, 60 insertions(+), 22 deletions(-) create mode 100644 programs/neovim.nix create mode 100644 wayland/changebrightness.sh create mode 100644 wayland/dynscreenshot.sh diff --git a/configuration.nix b/configuration.nix index 51d3605..685106a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -113,9 +113,10 @@ ''; # Allow steam to run nonfree - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "steam" "steam-original" "steam-run" - ]; + # nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + # "steam" "steam-original" "steam-run" "zoom-5.16.10.668" + # ]; + nixpkgs.config.allowUnfreePredicate = _: true; # List packages installed in system profile. To search, run: # $ nix search wget diff --git a/home.nix b/home.nix index 13b0d89..42572ce 100644 --- a/home.nix +++ b/home.nix @@ -7,22 +7,25 @@ home.stateVersion = "23.11"; # Configure cursor - # home.pointerCursor = { - # package = pkgs.vanilla-dmz; - # name = "Vanilla-DMZ"; - # size = 64; - # }; + home.pointerCursor = { + package = pkgs.vanilla-dmz; + name = "Vanilla-DMZ"; + size = 256; + }; # Install packages home.packages = with pkgs; [ texliveFull ] ++ # TeX distribution + [ ocaml ] ++ # OCaml + [ grim slurp wl-clipboard jq ] ++ # Basic utilities [ bitwarden-cli ] ++ # Personalized selection of command-line (CLI/TUI) apps [ kitty ] ++ # Terminal emulator - [ firefox cinnamon.nemo gnome.file-roller cinnamon.nemo-fileroller vlc pavucontrol ] ++ # Basic graphical apps - [ libreoffice signal-desktop prismlauncher apostrophe ] ++ # Personalized selection of graphical apps + [ firefox cinnamon.nemo gnome.file-roller cinnamon.nemo-fileroller imv vlc pavucontrol grim slurp wl-clipboard ] ++ # Basic graphical apps + [ libreoffice signal-desktop element-desktop prismlauncher mumble ] ++ # Personalized selection of graphical apps [ bemenu j4-dmenu-desktop ] ++ # Sway-related packages - [ noto-fonts redhat-official-fonts overpass ]; # Fonts - # [ vanilla-dmz ]; # Cursor + [ noto-fonts redhat-official-fonts overpass ] ++ # Fonts + # [ vanilla-dmz ] ++ # Cursor + [ ]; programs.home-manager.enable = true; @@ -72,12 +75,7 @@ shellIntegration.enableZshIntegration = true; }; - programs.neovim = { - enable = true; - defaultEditor = true; - viAlias = true; - vimAlias = true; - }; + programs.neovim = import ./programs/neovim.nix; programs.zathura = { enable = true; diff --git a/programs/neovim.nix b/programs/neovim.nix new file mode 100644 index 0000000..c1d3c43 --- /dev/null +++ b/programs/neovim.nix @@ -0,0 +1,6 @@ +{ + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; +} diff --git a/todo b/todo index b9d8446..4c7a279 100644 --- a/todo +++ b/todo @@ -1,8 +1,7 @@ -enable NUR and firefox extensions +# enable NUR and firefox extensions split app configs off into separate files switch to zsh -fix brightness switching as non root set up a keyring and store networkmanager wifi passwords in there instead of plain text fnott: notifications neovim and vimtex config -set up screenshots +mute button diff --git a/wayland/changebrightness.sh b/wayland/changebrightness.sh new file mode 100644 index 0000000..3e747d5 --- /dev/null +++ b/wayland/changebrightness.sh @@ -0,0 +1,16 @@ +bright=`cat /sys/class/backlight/amdgpu_bl0/brightness` +state=-1 +thresh=(1 2 3 4 5 6 8 10 13 16 21 27 34 44 57 73 94 120 155 199 255) + +for i in ${!thresh[@]}; do + if [ $bright -ge ${thresh[$i]} ] + then + state=$i + fi +done + +new=$(($1 + $state)) +if [ $new -ge 0 ] && [ $new -le 20 ] +then + echo ${thresh[$new]} | tee /sys/class/backlight/amdgpu_bl0/brightness +fi diff --git a/wayland/dynscreenshot.sh b/wayland/dynscreenshot.sh new file mode 100644 index 0000000..69fe526 --- /dev/null +++ b/wayland/dynscreenshot.sh @@ -0,0 +1 @@ +shotpath="Pictures/Screenshots/screenshot`date +%Y%m%d%H%M%S`.png"; slurp | grim -g - $shotpath && wl-copy < $shotpath diff --git a/wayland/sway.nix b/wayland/sway.nix index 2b08d93..4bb1fd6 100644 --- a/wayland/sway.nix +++ b/wayland/sway.nix @@ -1,6 +1,11 @@ { config, lib, pkgs, ... }: -{ + +let + dynscreenshot = pkgs.writeShellScript "dynscreenshot" (builtins.readFile ./dynscreenshot.sh); + changebrightness = pkgs.writeShellScript "changebrightness" (builtins.readFile ./changebrightness.sh); + mod = config.wayland.windowManager.sway.config.modifier; +in { enable = true; config = rec { terminal = "kitty"; @@ -20,6 +25,18 @@ border = 2; titlebar = true; }; + keybindings = let screenshotPath = "Pictures/Screenshots/screenshot`date +%Y%m%d%H%M%S`.png"; in lib.mkOptionDefault ({ # Screenshot keybinds + "Print" = "exec grim ${screenshotPath} && wl-copy < ${screenshotPath}"; # Take screenshot of whole screen, save it, and copy it to clipboard + "Shift+Print" = "exec swaymsg -t get_tree | jq -r '.. | select(.focused?) | .rect | \"\\(.x),\\(.y) \\(.width)x\\(.height)\"' | grim -g - ${screenshotPath} && wl-copy < ${screenshotPath}"; # Take screenshot of current window, save it, and copy it to clipboard + "Ctrl+Print" = "exec bash ${dynscreenshot}"; # Take screenshot of selection, save it, and copy it to clipboard + } // { # Function Media Keys + XF86MonBrightnessUp = "exec bash ${changebrightness} 1"; + XF86MonBrightnessDown = "exec bash ${changebrightness} -1"; + XF86AudioRaiseVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+"; + XF86AudioLowerVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-"; + "${mod}+XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05+"; + "${mod}+XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05-"; + }); menu = "j4-dmenu-desktop --no-generic --term=kitty --dmenu='bemenu -i --fn Red Hat Display 12 -H 24 -p \"\" -B 2 --hp 5'"; # I don't like hardcoding kitty here, TODO think of better way to do it focus.followMouse = false; };