From 13b630f31bf2bba22eb81531efae78cc334b76d3 Mon Sep 17 00:00:00 2001 From: tzlil Date: Thu, 20 Jul 2023 16:16:58 +0300 Subject: uhh a bunch of crap idk terraria --- mixins/cli.nix | 22 ++++++++++------- mixins/multimedia.nix | 19 +++++++++++++-- mixins/sway.nix | 59 +++++++++++++++++++++++----------------------- mixins/youtube-quality.nix | 51 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 40 deletions(-) create mode 100644 mixins/youtube-quality.nix (limited to 'mixins') diff --git a/mixins/cli.nix b/mixins/cli.nix index 5ef2cfe..c9a214f 100644 --- a/mixins/cli.nix +++ b/mixins/cli.nix @@ -51,9 +51,9 @@ '' ) ]; - sessionVariables = { - EDITOR = "nvim"; - }; + #sessionVariables = { + #EDITOR = "nvim"; + #}; }; programs = { git = { @@ -79,18 +79,22 @@ functions = { fish_greeting = ""; ns = '' - set -l p - for a in $argv - set p $p "nixpkgs#$a" - end - nix shell $p - ''; + set -l p + for a in $argv + set p $p "nixpkgs#$a" + end + nix shell $p + ''; }; }; neovim = { enable = true; viAlias = true; vimAlias = true; + defaultEditor = true; + extraConfig = '' + set clipboard+=unnamedplus + ''; }; # gpg = { # enable = true; diff --git a/mixins/multimedia.nix b/mixins/multimedia.nix index 8186b87..9b82a4f 100644 --- a/mixins/multimedia.nix +++ b/mixins/multimedia.nix @@ -22,6 +22,8 @@ enable = true; defaultApplications = { "application/pdf" = ["${pkgs.zathura}/share/applications/org.pwmt.zathura.desktop"]; + "image/png" = ["${pkgs.swayimg}/share/applications/swayimg.desktop"]; + "image/jpeg" = ["${pkgs.swayimg}/share/applications/swayimg.desktop"]; }; }; userDirs = { @@ -29,14 +31,27 @@ desktop = "${config.home.homeDirectory}/desktop"; download = "${config.home.homeDirectory}/downloads"; }; + #portal = { + # enable = true; + # extraPortals = with pkgs; [ + # xdg-desktop-portal-wlr + # xdg-desktop-portal-gtk + # ]; + #}; }; programs = { mpv = { enable = true; - scripts = [ - pkgs.mpvScripts.mpris + scripts = with pkgs.mpvScripts; [ + mpris + #youtube-quality + (pkgs.callPackage ./youtube-quality.nix {}) ]; + config = { + sub-auto = "fuzzy"; + ytdl-raw-options = "write-auto-sub=,sub-lang=en"; + }; }; zathura = { enable = true; diff --git a/mixins/sway.nix b/mixins/sway.nix index 84a8cc9..678206d 100644 --- a/mixins/sway.nix +++ b/mixins/sway.nix @@ -16,8 +16,8 @@ trap "rm -f $in_pipe $out_pipe" EXIT app_id=menu - chooser="${pkgs.fzf}/bin/fzf <$in_pipe >$out_pipe" - ${pkgs.foot}/bin/foot -W40x40 --app-id "$app_id" -- sh -c "$chooser" & + chooser="${lib.getExe pkgs.fzf} <$in_pipe >$out_pipe" + ${lib.getExe pkgs.foot} -W40x40 --app-id "$app_id" -- sh -c "$chooser" & cat >"$in_pipe" cat <"$out_pipe" ''; @@ -62,7 +62,7 @@ in { block = "sound" headphones_indicator=true [[block.click]] - cmd = "${pkgs.pavucontrol}/bin/pavucontrol" + cmd = "${lib.getExe pkgs.pavucontrol}" button = "left" [[block]] @@ -102,7 +102,7 @@ in { }; services.swayidle = let - pgrep = "${pkgs.procps}/bin/pgrep"; + pgrep = "${lib.getExe pkgs.procps}"; dpms_check = s: pkgs.writeShellScript "dpms_check_${s}" '' set -x @@ -115,7 +115,7 @@ in { ''; fadelock = pkgs.writeShellScript "fadelock.sh" '' set -x - exec "${pkgs.swaylock}/bin/swaylock" + exec "${lib.getExe pkgs.swaylock}" ''; in { enable = false; @@ -235,12 +235,13 @@ in { "${modifier}+shift+a" = "focus child"; "${modifier}+Shift+minus" = "move scratchpad"; "${modifier}+minus" = "scratchpad show"; - "${modifier}+m" = "mode notifications"; + #"${modifier}+m" = "mode notifications"; + "${modifier}+m" = "exec ${pkgs.wl-clipboard}/bin/wl-paste | xargs mpv"; - "${modifier}+l" = "exec ${pkgs.swaylock}/bin/swaylock -c 070D0D"; - "Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area"; - "Shift+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy active"; - "Ctrl+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy output"; + "${modifier}+l" = "exec ${lib.getExe pkgs.swaylock} -c 070D0D"; + "Print" = "exec ${lib.getExe pkgs.sway-contrib.grimshot} copy area"; + "Shift+Print" = "exec ${lib.getExe pkgs.sway-contrib.grimshot} copy active"; + "Ctrl+Print" = "exec ${lib.getExe pkgs.sway-contrib.grimshot} copy output"; }; input = { "type:keyboard" = { @@ -255,11 +256,11 @@ in { }; extraConfig = '' exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway - # exec ${pkgs.swayidle}/bin/swayidle -w \ - # timeout 300 '${pkgs.swaylock}/bin/swaylock -f -c 000000' \ + # exec ${lib.getExe pkgs.swayidle} -w \ + # timeout 300 '${lib.getExe pkgs.swaylock} -f -c 000000' \ # timeout 600 'swaymsg "output * dpms off"' \ # resume 'swaymsg "output * dpms on"' \ - # before-sleep '${pkgs.swaylock}/bin/swaylock -f -c 000000' + # before-sleep '${lib.getExe pkgs.swaylock} -f -c 000000' # exec ${pkgs.polkit_gnome}/polkit-gnome/polkit-gnome-authentication-agent-1 #set $mod Alt @@ -268,7 +269,7 @@ in { set $down n set $up e set $right i - set $term ${pkgs.foot}/bin/foot + set $term ${lib.getExe pkgs.foot} default_border pixel hide_edge_borders smart @@ -282,24 +283,24 @@ in { floating_modifier $mod normal mode notifications { bindsym Escape mode default - bindsym Return exec ${pkgs.mako}/bin/makoctl invoke; exec ${pkgs.mako}/bin/makoctl dismiss; mode default - bindsym d exec ${pkgs.mako}/bin/makoctl dismiss; mode default - bindsym Shift+d exec ${pkgs.mako}/bin/makoctl dismiss -a; mode default + bindsym Return exec ${lib.getExe pkgs.mako} invoke; exec ${lib.getExe pkgs.mako} dismiss; mode default + bindsym d exec ${lib.getExe pkgs.mako} dismiss; mode default + bindsym Shift+d exec ${lib.getExe pkgs.mako} dismiss -a; mode default } font Iosevka 10 bindsym $mod+p exec passmenu $menu_args - bindsym --locked XF86AudioMute exec ${pkgs.pulseaudio}/bin/playerctl set-sink-mute @DEFAULT_SINK@ toggle - bindsym --locked XF86AudioLowerVolume exec ${pkgs.pulseaudio}/bin/playerctl set-sink-volume @DEFAULT_SINK@ -5% - bindsym --locked XF86AudioRaiseVolume exec ${pkgs.pulseaudio}/bin/playerctl set-sink-volume @DEFAULT_SINK@ +5% - bindsym --locked XF86AudioMicMute exec ${pkgs.pulseaudio}/bin/playerctl set-source-mute @DEFAULT_SOURCE@ toggle + bindsym --locked XF86AudioMute exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle + bindsym --locked XF86AudioLowerVolume exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5% + bindsym --locked XF86AudioRaiseVolume exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5% + bindsym --locked XF86AudioMicMute exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle - bindsym --locked XF86AudioNext exec ${pkgs.playerctl}/bin/playerctl next - bindsym --locked XF86AudioPlay exec ${pkgs.playerctl}/bin/playerctl play-pause - bindsym --locked XF86AudioPrev exec ${pkgs.playerctl}/bin/playerctl previous - bindsym --locked XF86AudioStop exec ${pkgs.playerctl}/bin/playerctl stop + bindsym --locked XF86AudioNext exec ${lib.getExe pkgs.playerctl} next + bindsym --locked XF86AudioPlay exec ${lib.getExe pkgs.playerctl} play-pause + bindsym --locked XF86AudioPrev exec ${lib.getExe pkgs.playerctl} previous + bindsym --locked XF86AudioStop exec ${lib.getExe pkgs.playerctl} stop for_window [app_id="^menu$"] floating enable, border none #for_window [app_id="mpv"] sticky enable @@ -309,11 +310,11 @@ in { #for_window [app_id="imv"] floating enable #for_window [class="PacketTracer"] floating enable - bindsym XF86MonBrightnessUp exec ${pkgs.brightnessctl}/bin/brightnessctl s +5% - bindsym XF86MonBrightnessDown exec ${pkgs.brightnessctl}/bin/brightnessctl s 5%- + bindsym XF86MonBrightnessUp exec ${lib.getExe pkgs.brightnessctl} s +5% + bindsym XF86MonBrightnessDown exec ${lib.getExe pkgs.brightnessctl} s 5%- - exec ${pkgs.mako}/bin/mako >/tmp/mako.log 2>&1 - exec_always ${pkgs.kanshi}/bin/kanshi >/tmp/kanshi.log 2>&1 + exec ${lib.getExe pkgs.mako} >/tmp/mako.log 2>&1 + exec_always ${lib.getExe pkgs.kanshi} >/tmp/kanshi.log 2>&1 default_border pixel 2 diff --git a/mixins/youtube-quality.nix b/mixins/youtube-quality.nix new file mode 100644 index 0000000..e6143ac --- /dev/null +++ b/mixins/youtube-quality.nix @@ -0,0 +1,51 @@ +{ + lib, + stdenvNoCC, + fetchFromGitHub, + oscSupport ? false, + fetchpatch, +}: +stdenvNoCC.mkDerivation rec { + pname = "mpv-youtube-quality"; + version = "unstable-2020-02-11"; + + src = fetchFromGitHub { + owner = "jgreco"; + repo = "mpv-youtube-quality"; + rev = "1f8c31457459ffc28cd1c3f3c2235a53efad7148"; + sha256 = "voNP8tCwCv8QnAZOPC9gqHRV/7jgCAE63VKBd/1s5ic="; + }; + + patches = [ + (fetchpatch { + # Add support for using yt-dlp. + url = "https://github.com/jgreco/mpv-youtube-quality/commit/80a8540c449c8ba63a8e0361e6f17ffe7ef7aaf2.patch"; + hash = "sha256-wbjGF007jUa2rFsbdlRE3JerQkKBy70LKbjp+IwHzKg="; + }) + ]; + + dontBuild = true; + + installPhase = + '' + runHook preInstall + mkdir -p $out/share/mpv/scripts + cp youtube-quality.lua $out/share/mpv/scripts + '' + + lib.optionalString oscSupport '' + cp youtube-quality-osc.lua $out/share/mpv/scripts + '' + + '' + runHook postInstall + ''; + + passthru.scriptName = "youtube-quality.lua"; + + meta = with lib; { + description = "A userscript for MPV that allows you to change youtube video quality (ytdl-format) on the fly"; + homepage = "https://github.com/jgreco/mpv-youtube-quality"; + license = licenses.unfree; + platforms = platforms.all; + maintainers = with maintainers; [lunik1]; + }; +} -- cgit 1.4.1