deskwhich and some proper hotkeys

This commit is contained in:
Grimmauld 2024-04-30 22:04:17 +02:00
parent 624fd23f8b
commit 159c70216e
Signed by: Grimmauld
GPG Key ID: C2946668769F91FB
13 changed files with 120 additions and 60 deletions

View File

@ -16,6 +16,6 @@ with lib;
./gaming.nix
./firefox.nix
./cloudsync.nix
./laptop_hardware.nix
./hardware
];
}

View File

@ -16,6 +16,8 @@ in
libsForQt5.qtgraphicaleffects
catppuccin-kvantum
kdePackages.audiocd-kio
kdePackages.kio-extras
kdePackages.kio
xcb-util-cursor
qt6ct
kdePackages.dolphin

View File

@ -0,0 +1,6 @@
{
imports = [
./laptop.nix
./tlp.nix
];
}

View File

@ -5,25 +5,20 @@ in
{
config = with cfg; lib.mkIf (enable && laptop_hardware.enable) {
environment.systemPackages = with pkgs; [
acpi
lm_sensors
lshw
pciutils
usbutils
powertop
opentabletdriver
ddcutil
] ++ lib.optionals graphical [
ddcui
tlpui
];
# services.ddccontrol.enable = true;
powerManagement.scsiLinkPolicy = lib.mkIf (!config.services.tlp.enable) "min_power";
hardware.i2c.enable = true;
services.libinput.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "normal";
hardware.opentabletdriver.enable = true;
services.udisks2.enable = true;
services.udev.extraRules = ''
SUBSYSTEM=="i2c-dev", ACTION=="add",\
@ -87,36 +82,10 @@ in
];
# blacklistedKernelModules = [ "i2c_nvidia_gpu" ];
};
services.power-profiles-daemon.enable = false;
# powerManagement.powertop.enable = true;
services.upower.enable = true;
services.tlp = {
enable = true;
settings = {
USB_AUTOSUSPEND = 1;
USB_EXCLUDE_BTUSB = 1;
USB_EXCLUDE_PHONE = 1;
SOUND_POWER_SAVE_ON_AC = 0;
SOUND_POWER_SAVE_ON_BAT = 1;
SATA_LINKPWR_ON_AC = "max_performance";
SATA_LINKPWR_ON_BAT = "min_power";
MAX_LOST_WORK_SECS_ON_BAT = 15;
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
RUNTIME_PM_ON_AC = "on";
RUNTIME_PM_ON_BAT = "auto";
};
};
};
options.grimmShared.laptop_hardware = {
enable = lib.mkEnableOption "grimm-laptop";
};
}

43
common/hardware/tlp.nix Normal file
View File

@ -0,0 +1,43 @@
{ pkgs, config, lib, system, ... }:
let
cfg = config.grimmShared;
perf_policy = lib.optional (lib.systems.elaborate system).isx86 config.boot.kernelPackages.x86_energy_perf_policy;
in
{
config = with cfg; lib.mkIf (enable && laptop_hardware.enable) {
environment.systemPackages = with pkgs; [
acpi
powertop
] ++ lib.optionals graphical [
tlpui
] ++ perf_policy;
powerManagement.scsiLinkPolicy = lib.mkIf (!config.services.tlp.enable) "min_power";
powerManagement.cpuFreqGovernor = lib.mkDefault "normal";
services.power-profiles-daemon.enable = false;
services.upower.enable = true;
boot.extraModulePackages = perf_policy;
services.tlp = {
enable = true;
settings = {
USB_AUTOSUSPEND = 1;
USB_EXCLUDE_BTUSB = 1;
USB_EXCLUDE_PHONE = 1;
SOUND_POWER_SAVE_ON_AC = 0;
SOUND_POWER_SAVE_ON_BAT = 1;
SATA_LINKPWR_ON_AC = "max_performance";
SATA_LINKPWR_ON_BAT = "min_power";
MAX_LOST_WORK_SECS_ON_BAT = 15;
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
RUNTIME_PM_ON_AC = "on";
RUNTIME_PM_ON_BAT = "auto";
};
};
};
}

View File

@ -15,13 +15,15 @@ in
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
(writeShellScriptBin "lsiommu" ./lsiommu)
(writeShellScriptBin "tree" "${lib.getExe pkgs.eza} -T --git -lh --no-permissions --no-user --no-filesize --no-time")
urlencode
pstree
dos2unix
gcc
jdk17
pkg-config
unzip
p7zip
dos2unix
tea
eza

View File

@ -36,6 +36,8 @@ in
{
config = with cfg; lib.mkIf (enable && portals && graphical) {
environment.systemPackages = with pkgs; [
(callPackage ../../custom/deskwhich/package.nix {})
zathura
imhex
libreoffice-qt

View File

@ -43,7 +43,7 @@
};
};
cloudSync = {
# enable = true;
enable = true;
username = "Grimmauld";
server = "cloud.grimmauld.de";
passwordFile = config.age.secrets.nextcloud_pass.path;

View File

@ -0,0 +1,27 @@
{ fetchFromGitea
, lib
, rustPlatform
}:
rustPlatform.buildRustPackage rec {
pname = "deskwhich";
version = "unstable-2024-04-30";
src = fetchFromGitea {
domain = "codeberg.org";
owner = "axtlos";
repo = "deskwhich";
rev = "cbe8a0cdf4bdbb26faecb028e79ad6c409376051";
hash = "sha256-c0Q0oYIB/1eutV7tkqYXvDMw8A7YsT+5+CmmwbGvcNk=";
};
cargoHash = "sha256-fBC3UBf9oLswlR6Kgw3nSwjqAtn7VQGzvbUJaYnOid4=";
meta = {
description = "tool to find the path of desktop entries";
homepage = "https://codeberg.org/axtlos/deskwhich";
license = lib.licenses.gpl3Only;
mainProgram = "deskwhich";
maintainers = with lib.maintainers; [ grimmauld ];
platforms = lib.platforms.linux;
};
}

View File

@ -63,7 +63,6 @@
nixosConfigurations = {
grimmauld-nixos = customNixosSystem "x86_64-linux" {
modules = [
(import ./overlays)
agenix.nixosModules.default
chaotic.nixosModules.default
nix-gaming.nixosModules.pipewireLowLatency

View File

@ -1,6 +0,0 @@
{ lib, config, ... }: {
nixpkgs.overlays = map (f: (final: prev: (import f { inherit final prev lib config; })))
[
./wlr_flicker.nix
];
}

View File

@ -1,8 +0,0 @@
{ final, prev, ... }: {
wlroots = prev.wlroots.overrideAttrs (o: {
patches = (o.patches or [ ]) ++ [
# ./patches/lessflicker.patch
# ./patches/screenshare.patch
];
});
}

View File

@ -1,4 +1,12 @@
{ inputs, system, pkgs, config, lib, ... }: {
{ inputs, system, pkgs, config, lib, ... }:
let
searchclip = pkgs.writeShellScriptBin "searchclip" ''
xdg-open https://www.google.com/search?q=$(wl-paste -p | urlencode)
browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//")
swaymsg [app_id="$browser" urgent="newest"] focus
'';
in
{
environment.systemPackages = with pkgs; [
alacritty
rmenu
@ -9,6 +17,7 @@
swaymux
qt6ct
swaynotificationcenter
searchclip
];
grimmShared.sway = {
@ -20,7 +29,9 @@
style = ./bar/style.css;
};
config = with lib; {
config = with pkgs; let
inherit (lib) getExe;
in {
definitions = {
mod = "Mod4";
left = "h";
@ -28,8 +39,8 @@
up = "k";
right = "l";
term = getExe pkgs.alacritty;
menu = "${getExe pkgs.rmenu} -r drun | xargs swaymsg exec --";
menu_run = "${getExe pkgs.rmenu} -r run | xargs swaymsg exec --";
menu = "${getExe rmenu} -r drun | xargs swaymsg exec --";
menu_run = "${getExe rmenu} -r run | xargs swaymsg exec --";
primecol = "#8800FF";
accentcol = "#5700a0";
@ -42,8 +53,8 @@
keybinds = {
"$mod+d" = "exec $menu";
"$mod+Shift+d" = "exec $menu_run";
"$mod+Shift+s" = ''exec ${getExe pkgs.grim} -g "$(${getExe pkgs.slurp} -d)" - | wl-copy'';
"$mod+Return" = "exec $term -e xonsh";
"$mod+Shift+s" = ''exec ${getExe grim} -g "$(${getExe slurp} -d)" - | wl-copy'';
"$mod+Return" = "exec $term --command xonsh";
"$mod+Shift+Return" = "exec $term";
"$mod+Shift+q" = "kill";
"$mod+Shift+c" = "reload";
@ -136,9 +147,22 @@
XF86AudioPlay = "exec playerctl play-pause";
XF86AudioNext = "exec playerctl next";
XF86AudioPrev = "exec playerctl previous";
"$mod+c" = "exec ${getExe pkgs.swaymux}";
XF86MonBrightnessUp = "exec ${getExe pkgs.brightnessctl} s 10+%";
XF86MonBrightnessDown = "exec ${getExe pkgs.brightnessctl} s 10-%";
"$mod+c" = "exec ${getExe swaymux}";
XF86MonBrightnessUp = "exec ${getExe brightnessctl} s 10+%";
XF86MonBrightnessDown = "exec ${getExe brightnessctl} s 10-%";
XF86Explorer = "exec $term --command ${getExe ranger}";
XF86Search = "exec ${getExe searchclip}";
XF86HomePage = let open = pkgs.writeShellScriptBin "open_or_switch_browser" ''
browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//")
swaymsg [app_id="$browser"] focus || deskwhich $browser | xargs gio launch
''; in "exec ${getExe open}";
XF86Tools = let open = pkgs.writeShellScriptBin "open_or_switch_spotify" ''
# FIXME: spotify is being weird
while IFS= read -r pid; do
swaymsg [pid=$pid] focus && exit 0
done <<< $(pgrep spotify -u "$(whoami)")
deskwhich spotify | xargs gio launch
''; in "exec ${getExe open}"; # for some reason tools = audio media on my keyboard??
};
autolaunch = with pkgs; [
# fixme: absolute paths