Commit 54d02a42ad
Unsigned
Layout: unified · split
.gitignore +1
| @@ -1,2 +1,3 @@ | |||
| 1 | /target | 1 | /target |
| 2 | /docs/book | 2 | /docs/book |
| 3 | /mpv-dev | ||
Cargo.lock +136 −11
| @@ -682,6 +682,27 @@ dependencies = [ | |||
| 682 | "crypto-common", | 682 | "crypto-common", |
| 683 | ] | 683 | ] |
| 684 | 684 | ||
| 685 | [[package]] | ||
| 686 | name = "dirs" | ||
| 687 | version = "5.0.1" | ||
| 688 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 689 | checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" | ||
| 690 | dependencies = [ | ||
| 691 | "dirs-sys", | ||
| 692 | ] | ||
| 693 | |||
| 694 | [[package]] | ||
| 695 | name = "dirs-sys" | ||
| 696 | version = "0.4.1" | ||
| 697 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 698 | checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" | ||
| 699 | dependencies = [ | ||
| 700 | "libc", | ||
| 701 | "option-ext", | ||
| 702 | "redox_users", | ||
| 703 | "windows-sys 0.48.0", | ||
| 704 | ] | ||
| 705 | |||
| 685 | [[package]] | 706 | [[package]] |
| 686 | name = "displaydoc" | 707 | name = "displaydoc" |
| 687 | version = "0.2.5" | 708 | version = "0.2.5" |
| @@ -1014,6 +1035,17 @@ dependencies = [ | |||
| 1014 | "version_check", | 1035 | "version_check", |
| 1015 | ] | 1036 | ] |
| 1016 | 1037 | ||
| 1038 | [[package]] | ||
| 1039 | name = "getrandom" | ||
| 1040 | version = "0.2.17" | ||
| 1041 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1042 | checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" | ||
| 1043 | dependencies = [ | ||
| 1044 | "cfg-if", | ||
| 1045 | "libc", | ||
| 1046 | "wasi", | ||
| 1047 | ] | ||
| 1048 | |||
| 1017 | [[package]] | 1049 | [[package]] |
| 1018 | name = "getrandom" | 1050 | name = "getrandom" |
| 1019 | version = "0.3.4" | 1051 | version = "0.3.4" |
| @@ -1578,6 +1610,15 @@ version = "2.0.0-fork.1" | |||
| 1578 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1610 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1579 | checksum = "88adfe3a9f3ef1d69c87ce86930246cd80c86be098d5bfd2a7b05962ff1d3a50" | 1611 | checksum = "88adfe3a9f3ef1d69c87ce86930246cd80c86be098d5bfd2a7b05962ff1d3a50" |
| 1580 | 1612 | ||
| 1613 | [[package]] | ||
| 1614 | name = "libredox" | ||
| 1615 | version = "0.1.16" | ||
| 1616 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1617 | checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" | ||
| 1618 | dependencies = [ | ||
| 1619 | "libc", | ||
| 1620 | ] | ||
| 1621 | |||
| 1581 | [[package]] | 1622 | [[package]] |
| 1582 | name = "line-clipping" | 1623 | name = "line-clipping" |
| 1583 | version = "0.3.5" | 1624 | version = "0.3.5" |
| @@ -1958,6 +1999,12 @@ dependencies = [ | |||
| 1958 | "vcpkg", | 1999 | "vcpkg", |
| 1959 | ] | 2000 | ] |
| 1960 | 2001 | ||
| 2002 | [[package]] | ||
| 2003 | name = "option-ext" | ||
| 2004 | version = "0.2.0" | ||
| 2005 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2006 | checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" | ||
| 2007 | |||
| 1961 | [[package]] | 2008 | [[package]] |
| 1962 | name = "ordered-float" | 2009 | name = "ordered-float" |
| 1963 | version = "4.6.0" | 2010 | version = "4.6.0" |
| @@ -2467,6 +2514,17 @@ dependencies = [ | |||
| 2467 | "bitflags 2.11.0", | 2514 | "bitflags 2.11.0", |
| 2468 | ] | 2515 | ] |
| 2469 | 2516 | ||
| 2517 | [[package]] | ||
| 2518 | name = "redox_users" | ||
| 2519 | version = "0.4.6" | ||
| 2520 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2521 | checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" | ||
| 2522 | dependencies = [ | ||
| 2523 | "getrandom 0.2.17", | ||
| 2524 | "libredox", | ||
| 2525 | "thiserror 1.0.69", | ||
| 2526 | ] | ||
| 2527 | |||
| 2470 | [[package]] | 2528 | [[package]] |
| 2471 | name = "regex" | 2529 | name = "regex" |
| 2472 | version = "1.12.3" | 2530 | version = "1.12.3" |
| @@ -3787,7 +3845,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 3787 | checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" | 3845 | checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" |
| 3788 | dependencies = [ | 3846 | dependencies = [ |
| 3789 | "windows-core 0.54.0", | 3847 | "windows-core 0.54.0", |
| 3790 | "windows-targets", | 3848 | "windows-targets 0.52.6", |
| 3791 | ] | 3849 | ] |
| 3792 | 3850 | ||
| 3793 | [[package]] | 3851 | [[package]] |
| @@ -3797,7 +3855,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 3797 | checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" | 3855 | checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" |
| 3798 | dependencies = [ | 3856 | dependencies = [ |
| 3799 | "windows-result 0.1.2", | 3857 | "windows-result 0.1.2", |
| 3800 | "windows-targets", | 3858 | "windows-targets 0.52.6", |
| 3801 | ] | 3859 | ] |
| 3802 | 3860 | ||
| 3803 | [[package]] | 3861 | [[package]] |
| @@ -3847,7 +3905,7 @@ version = "0.1.2" | |||
| 3847 | source = "registry+https://github.com/rust-lang/crates.io-index" | 3905 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3848 | checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" | 3906 | checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" |
| 3849 | dependencies = [ | 3907 | dependencies = [ |
| 3850 | "windows-targets", | 3908 | "windows-targets 0.52.6", |
| 3851 | ] | 3909 | ] |
| 3852 | 3910 | ||
| 3853 | [[package]] | 3911 | [[package]] |
| @@ -3868,13 +3926,22 @@ dependencies = [ | |||
| 3868 | "windows-link", | 3926 | "windows-link", |
| 3869 | ] | 3927 | ] |
| 3870 | 3928 | ||
| 3929 | [[package]] | ||
| 3930 | name = "windows-sys" | ||
| 3931 | version = "0.48.0" | ||
| 3932 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 3933 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" | ||
| 3934 | dependencies = [ | ||
| 3935 | "windows-targets 0.48.5", | ||
| 3936 | ] | ||
| 3937 | |||
| 3871 | [[package]] | 3938 | [[package]] |
| 3872 | name = "windows-sys" | 3939 | name = "windows-sys" |
| 3873 | version = "0.59.0" | 3940 | version = "0.59.0" |
| 3874 | source = "registry+https://github.com/rust-lang/crates.io-index" | 3941 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3875 | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" | 3942 | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" |
| 3876 | dependencies = [ | 3943 | dependencies = [ |
| 3877 | "windows-targets", | 3944 | "windows-targets 0.52.6", |
| 3878 | ] | 3945 | ] |
| 3879 | 3946 | ||
| 3880 | [[package]] | 3947 | [[package]] |
| @@ -3886,34 +3953,67 @@ dependencies = [ | |||
| 3886 | "windows-link", | 3953 | "windows-link", |
| 3887 | ] | 3954 | ] |
| 3888 | 3955 | ||
| 3956 | [[package]] | ||
| 3957 | name = "windows-targets" | ||
| 3958 | version = "0.48.5" | ||
| 3959 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 3960 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" | ||
| 3961 | dependencies = [ | ||
| 3962 | "windows_aarch64_gnullvm 0.48.5", | ||
| 3963 | "windows_aarch64_msvc 0.48.5", | ||
| 3964 | "windows_i686_gnu 0.48.5", | ||
| 3965 | "windows_i686_msvc 0.48.5", | ||
| 3966 | "windows_x86_64_gnu 0.48.5", | ||
| 3967 | "windows_x86_64_gnullvm 0.48.5", | ||
| 3968 | "windows_x86_64_msvc 0.48.5", | ||
| 3969 | ] | ||
| 3970 | |||
| 3889 | [[package]] | 3971 | [[package]] |
| 3890 | name = "windows-targets" | 3972 | name = "windows-targets" |
| 3891 | version = "0.52.6" | 3973 | version = "0.52.6" |
| 3892 | source = "registry+https://github.com/rust-lang/crates.io-index" | 3974 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3893 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" | 3975 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" |
| 3894 | dependencies = [ | 3976 | dependencies = [ |
| 3895 | "windows_aarch64_gnullvm", | 3977 | "windows_aarch64_gnullvm 0.52.6", |
| 3896 | "windows_aarch64_msvc", | 3978 | "windows_aarch64_msvc 0.52.6", |
| 3897 | "windows_i686_gnu", | 3979 | "windows_i686_gnu 0.52.6", |
| 3898 | "windows_i686_gnullvm", | 3980 | "windows_i686_gnullvm", |
| 3899 | "windows_i686_msvc", | 3981 | "windows_i686_msvc 0.52.6", |
| 3900 | "windows_x86_64_gnu", | 3982 | "windows_x86_64_gnu 0.52.6", |
| 3901 | "windows_x86_64_gnullvm", | 3983 | "windows_x86_64_gnullvm 0.52.6", |
| 3902 | "windows_x86_64_msvc", | 3984 | "windows_x86_64_msvc 0.52.6", |
| 3903 | ] | 3985 | ] |
| 3904 | 3986 | ||
| 3987 | [[package]] | ||
| 3988 | name = "windows_aarch64_gnullvm" | ||
| 3989 | version = "0.48.5" | ||
| 3990 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 3991 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" | ||
| 3992 | |||
| 3905 | [[package]] | 3993 | [[package]] |
| 3906 | name = "windows_aarch64_gnullvm" | 3994 | name = "windows_aarch64_gnullvm" |
| 3907 | version = "0.52.6" | 3995 | version = "0.52.6" |
| 3908 | source = "registry+https://github.com/rust-lang/crates.io-index" | 3996 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3909 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" | 3997 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" |
| 3910 | 3998 | ||
| 3999 | [[package]] | ||
| 4000 | name = "windows_aarch64_msvc" | ||
| 4001 | version = "0.48.5" | ||
| 4002 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 4003 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" | ||
| 4004 | |||
| 3911 | [[package]] | 4005 | [[package]] |
| 3912 | name = "windows_aarch64_msvc" | 4006 | name = "windows_aarch64_msvc" |
| 3913 | version = "0.52.6" | 4007 | version = "0.52.6" |
| 3914 | source = "registry+https://github.com/rust-lang/crates.io-index" | 4008 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3915 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" | 4009 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" |
| 3916 | 4010 | ||
| 4011 | [[package]] | ||
| 4012 | name = "windows_i686_gnu" | ||
| 4013 | version = "0.48.5" | ||
| 4014 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 4015 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" | ||
| 4016 | |||
| 3917 | [[package]] | 4017 | [[package]] |
| 3918 | name = "windows_i686_gnu" | 4018 | name = "windows_i686_gnu" |
| 3919 | version = "0.52.6" | 4019 | version = "0.52.6" |
| @@ -3926,24 +4026,48 @@ version = "0.52.6" | |||
| 3926 | source = "registry+https://github.com/rust-lang/crates.io-index" | 4026 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3927 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" | 4027 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" |
| 3928 | 4028 | ||
| 4029 | [[package]] | ||
| 4030 | name = "windows_i686_msvc" | ||
| 4031 | version = "0.48.5" | ||
| 4032 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 4033 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" | ||
| 4034 | |||
| 3929 | [[package]] | 4035 | [[package]] |
| 3930 | name = "windows_i686_msvc" | 4036 | name = "windows_i686_msvc" |
| 3931 | version = "0.52.6" | 4037 | version = "0.52.6" |
| 3932 | source = "registry+https://github.com/rust-lang/crates.io-index" | 4038 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3933 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" | 4039 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" |
| 3934 | 4040 | ||
| 4041 | [[package]] | ||
| 4042 | name = "windows_x86_64_gnu" | ||
| 4043 | version = "0.48.5" | ||
| 4044 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 4045 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" | ||
| 4046 | |||
| 3935 | [[package]] | 4047 | [[package]] |
| 3936 | name = "windows_x86_64_gnu" | 4048 | name = "windows_x86_64_gnu" |
| 3937 | version = "0.52.6" | 4049 | version = "0.52.6" |
| 3938 | source = "registry+https://github.com/rust-lang/crates.io-index" | 4050 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3939 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" | 4051 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" |
| 3940 | 4052 | ||
| 4053 | [[package]] | ||
| 4054 | name = "windows_x86_64_gnullvm" | ||
| 4055 | version = "0.48.5" | ||
| 4056 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 4057 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" | ||
| 4058 | |||
| 3941 | [[package]] | 4059 | [[package]] |
| 3942 | name = "windows_x86_64_gnullvm" | 4060 | name = "windows_x86_64_gnullvm" |
| 3943 | version = "0.52.6" | 4061 | version = "0.52.6" |
| 3944 | source = "registry+https://github.com/rust-lang/crates.io-index" | 4062 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3945 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" | 4063 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" |
| 3946 | 4064 | ||
| 4065 | [[package]] | ||
| 4066 | name = "windows_x86_64_msvc" | ||
| 4067 | version = "0.48.5" | ||
| 4068 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 4069 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" | ||
| 4070 | |||
| 3947 | [[package]] | 4071 | [[package]] |
| 3948 | name = "windows_x86_64_msvc" | 4072 | name = "windows_x86_64_msvc" |
| 3949 | version = "0.52.6" | 4073 | version = "0.52.6" |
| @@ -4099,6 +4223,7 @@ dependencies = [ | |||
| 4099 | "chrono", | 4223 | "chrono", |
| 4100 | "clipboard", | 4224 | "clipboard", |
| 4101 | "crossterm 0.29.0", | 4225 | "crossterm 0.29.0", |
| 4226 | "dirs", | ||
| 4102 | "dyn-clone", | 4227 | "dyn-clone", |
| 4103 | "futures", | 4228 | "futures", |
| 4104 | "home", | 4229 | "home", |
Cargo.toml +1
| @@ -29,6 +29,7 @@ serde = {version = "1.0", default-features = false, features = ["derive"]} | |||
| 29 | crossterm = {version = "0.29", default-features = false, features = ["serde"]} | 29 | crossterm = {version = "0.29", default-features = false, features = ["serde"]} |
| 30 | viuer = {version = "0.11", default-features = false, optional = true, features = ["print-file"]} | 30 | viuer = {version = "0.11", default-features = false, optional = true, features = ["print-file"]} |
| 31 | home = "0.5" | 31 | home = "0.5" |
| 32 | dirs = "5" | ||
| 32 | chrono = {version = "0.4", default-features = false, features = ["clock"]} | 33 | chrono = {version = "0.4", default-features = false, features = ["clock"]} |
| 33 | typemap = {version = "0.3", default-features = false} | 34 | typemap = {version = "0.3", default-features = false} |
| 34 | tui-additions = {version = "0.4.3", default-features = false, features = ["framework", "widgets"]} | 35 | tui-additions = {version = "0.4.3", default-features = false, features = ["framework", "widgets"]} |
README.md +2 −2
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | # Overview | 12 | # Overview |
| 13 | 13 | ||
| 14 | Written in Rust, the **YouTube TUI** is a lightweight and user friendly TUI for browsing YouTube content from the terminal. Works out of the box and easily configurable. | 14 | Written in Rust, the **YouTube TUI** is a lightweight and user friendly TUI for browsing YouTube content from the terminal. Works out of the box and easily configurable. Supports Linux and Windows. |
| 15 | 15 | ||
| 16 |  | 16 |  |
| 17 | 17 | ||
| @@ -23,7 +23,7 @@ It is like an _app launcher_, it launches other programs to do the heavy lifting | |||
| 23 | 23 | ||
| 24 | ## Customisable | 24 | ## Customisable |
| 25 | 25 | ||
| 26 | The YouTube TUI can be customised through config files, they are located in `~/.config/youtube-tui` and are in the YAML format. | 26 | The YouTube TUI can be customised through config files, located in `~/.config/youtube-tui` on Linux or `%APPDATA%\youtube-tui` on Windows, in the YAML format. |
| 27 | 27 | ||
| 28 | Here's an example of the config file: | 28 | Here's an example of the config file: |
| 29 | 29 | ||
build.rs added +20
| @@ -0,0 +1,20 @@ | |||
| 1 | fn main() { | ||
| 2 | // On Windows, help the linker find mpv.lib when building with the mpv feature. | ||
| 3 | // Check MPV_LIB_DIR env var, then fall back to a local mpv-dev directory. | ||
| 4 | #[cfg(all(target_os = "windows", feature = "mpv"))] | ||
| 5 | { | ||
| 6 | if let Ok(dir) = std::env::var("MPV_LIB_DIR") { | ||
| 7 | println!("cargo:rustc-link-search=native={}", dir); | ||
| 8 | } else { | ||
| 9 | // Check for a local mpv-dev directory (created by setup-mpv-dev.ps1) | ||
| 10 | let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); | ||
| 11 | let local_mpv = std::path::Path::new(&manifest_dir).join("mpv-dev"); | ||
| 12 | if local_mpv.exists() { | ||
| 13 | println!( | ||
| 14 | "cargo:rustc-link-search=native={}", | ||
| 15 | local_mpv.display() | ||
| 16 | ); | ||
| 17 | } | ||
| 18 | } | ||
| 19 | } | ||
| 20 | } | ||
docs/src/installation.md +32 −7
| @@ -1,6 +1,6 @@ | |||
| 1 | # Installation | 1 | # Installation |
| 2 | 2 | ||
| 3 | The YouTube TUI is *not* intended for Windows, pull requests to make it work are welcome. | 3 | The YouTube TUI supports both Linux and Windows. |
| 4 | 4 | ||
| 5 | ## Install from Crates.io (recommended) | 5 | ## Install from Crates.io (recommended) |
| 6 | 6 | ||
| @@ -66,6 +66,33 @@ youtube-tui | |||
| 66 | 66 | ||
| 67 | If installed correctly, a TUI should be launched. Press `q` to close the TUI. | 67 | If installed correctly, a TUI should be launched. Press `q` to close the TUI. |
| 68 | 68 | ||
| 69 | ## Installation on Windows | ||
| 70 | |||
| 71 | Install using `cargo`: | ||
| 72 | |||
| 73 | ```sh | ||
| 74 | cargo install youtube-tui | ||
| 75 | ``` | ||
| 76 | |||
| 77 | All default features work on Windows. The `sixel` feature uses a pure Rust encoder on Windows (no native dependencies). The `clipboard` feature uses native Windows clipboard APIs. | ||
| 78 | |||
| 79 | If you do not have `mpv` installed, you can disable the `mpv` feature: | ||
| 80 | |||
| 81 | ```sh | ||
| 82 | cargo install youtube-tui --no-default-features -F sixel -F halfblock -F clipboard -F rustypipe | ||
| 83 | ``` | ||
| 84 | |||
| 85 | ### Windows configuration | ||
| 86 | |||
| 87 | The default config directory on Windows is `%APPDATA%\youtube-tui\`. Data files (history, thumbnails, etc.) are stored in `%LOCALAPPDATA%\youtube-tui\`. | ||
| 88 | |||
| 89 | Default tools on Windows: | ||
| 90 | - **Browser**: `explorer` (opens URLs in default browser) | ||
| 91 | - **Terminal emulator**: `cmd /c start cmd /k` | ||
| 92 | - **Shell**: `cmd` | ||
| 93 | |||
| 94 | These can be changed in `main.yml`. | ||
| 95 | |||
| 69 | ## Features | 96 | ## Features |
| 70 | 97 | ||
| 71 | The TUI has features that can be enabled/disabled when compiling. | 98 | The TUI has features that can be enabled/disabled when compiling. |
| @@ -82,23 +109,21 @@ Display images through HalfBlocks, work best in terminals with TrueColour suppor | |||
| 82 | 109 | ||
| 83 | ### `sixel` (default) | 110 | ### `sixel` (default) |
| 84 | 111 | ||
| 85 | Display images with Sixels, allows the display of images at full definition. Not present on windows. | 112 | Display images with Sixels, allows the display of images at full definition. |
| 86 | |||
| 87 | Enabling this will also enable `halfblock`. | ||
| 88 | 113 | ||
| 89 | Requires <a href="https://github.com/saitoha/libsixel" target=_blank>`libsixel`</a>. | 114 | On Linux, this uses the C `libsixel` library for best performance (requires <a href="https://github.com/saitoha/libsixel" target=_blank>`libsixel`</a>). On Windows, a pure Rust encoder is used automatically (no native dependencies). |
| 90 | 115 | ||
| 91 | ### `clipboard` (default) | 116 | ### `clipboard` (default) |
| 92 | 117 | ||
| 93 | Allows clipboard pasting in commands and search bar. | 118 | Allows clipboard pasting in commands and search bar. |
| 94 | 119 | ||
| 95 | Requires <a href="https://xcb.freedesktop.org/" target=_blank>`libxcb`</a>. | 120 | On Linux, requires <a href="https://xcb.freedesktop.org/" target=_blank>`libxcb`</a>. On Windows, uses native clipboard APIs (no extra dependencies). |
| 96 | 121 | ||
| 97 | ### `mpv` (default) | 122 | ### `mpv` (default) |
| 98 | 123 | ||
| 99 | Embedded audio player | 124 | Embedded audio player |
| 100 | 125 | ||
| 101 | Requires <a href="https://mpv.io/" target=_blank>`mpv`</a> (libmpv) to be installed in your system. | 126 | Requires <a href="https://mpv.io/" target=_blank>`mpv`</a> (libmpv) to be installed in your system. On Windows, `mpv.dll` must be available in your PATH or next to the executable. |
| 102 | 127 | ||
| 103 | ### rustypipe (default) | 128 | ### rustypipe (default) |
| 104 | 129 | ||
setup-mpv-dev.ps1 added +139
| @@ -0,0 +1,139 @@ | |||
| 1 | # Downloads mpv dev library for Windows (required to build with the `mpv` feature) | ||
| 2 | # Usage: .\setup-mpv-dev.ps1 | ||
| 3 | # This downloads ~30MB and extracts mpv.lib + libmpv-2.dll into a local 'mpv-dev' folder. | ||
| 4 | # Then sets MPV_LIB_DIR for the current session. | ||
| 5 | |||
| 6 | $ErrorActionPreference = "Stop" | ||
| 7 | |||
| 8 | $mpvDevDir = Join-Path $PSScriptRoot "mpv-dev" | ||
| 9 | $mpvLib = Join-Path $mpvDevDir "mpv.lib" | ||
| 10 | |||
| 11 | if (Test-Path $mpvLib) { | ||
| 12 | Write-Host "mpv.lib already exists at $mpvDevDir, skipping download." | ||
| 13 | $env:MPV_LIB_DIR = $mpvDevDir | ||
| 14 | Write-Host "MPV_LIB_DIR set to $mpvDevDir" | ||
| 15 | return | ||
| 16 | } | ||
| 17 | |||
| 18 | # Detect architecture | ||
| 19 | $arch = if ([Environment]::Is64BitOperatingSystem) { "x86_64" } else { "i686" } | ||
| 20 | $url = "https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/20260412/mpv-dev-${arch}-20260412-git-062f4bf.7z" | ||
| 21 | |||
| 22 | Write-Host "Downloading mpv-dev for $arch..." | ||
| 23 | $tempFile = Join-Path $env:TEMP "mpv-dev.7z" | ||
| 24 | Invoke-WebRequest -Uri $url -OutFile $tempFile -UserAgent "Mozilla/5.0" | ||
| 25 | |||
| 26 | # Create output directory | ||
| 27 | New-Item -ItemType Directory -Force -Path $mpvDevDir | Out-Null | ||
| 28 | |||
| 29 | # Extract using 7z (ships with scoop, git, or can be installed via scoop install 7zip) | ||
| 30 | $7zPaths = @( | ||
| 31 | "7z", | ||
| 32 | "$env:ProgramFiles\7-Zip\7z.exe", | ||
| 33 | "$env:LOCALAPPDATA\Programs\7-Zip\7z.exe", | ||
| 34 | "$env:USERPROFILE\scoop\apps\7zip\current\7z.exe" | ||
| 35 | ) | ||
| 36 | |||
| 37 | $7zExe = $null | ||
| 38 | foreach ($p in $7zPaths) { | ||
| 39 | if (Get-Command $p -ErrorAction SilentlyContinue) { | ||
| 40 | $7zExe = $p | ||
| 41 | break | ||
| 42 | } | ||
| 43 | if (Test-Path $p) { | ||
| 44 | $7zExe = $p | ||
| 45 | break | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | if (-not $7zExe) { | ||
| 50 | Write-Host "7z not found. Attempting to install via scoop..." | ||
| 51 | scoop install 7zip | ||
| 52 | $7zExe = "$env:USERPROFILE\scoop\apps\7zip\current\7z.exe" | ||
| 53 | } | ||
| 54 | |||
| 55 | Write-Host "Extracting mpv-dev..." | ||
| 56 | $tempExtract = Join-Path $env:TEMP "mpv-dev-extract" | ||
| 57 | if (Test-Path $tempExtract) { Remove-Item -Recurse -Force $tempExtract } | ||
| 58 | & $7zExe x $tempFile -o"$tempExtract" -y | Out-Null | ||
| 59 | |||
| 60 | # Copy the files we need | ||
| 61 | $libFile = Get-ChildItem -Path $tempExtract -Filter "mpv.lib" -Recurse | Select-Object -First 1 | ||
| 62 | $dllFile = Get-ChildItem -Path $tempExtract -Filter "libmpv-2.dll" -Recurse | Select-Object -First 1 | ||
| 63 | |||
| 64 | if (-not $libFile) { | ||
| 65 | # The shinchiro builds ship libmpv.dll.a (GCC format), not mpv.lib (MSVC format). | ||
| 66 | # Generate mpv.lib from the DLL using dumpbin + lib (MSVC tools). | ||
| 67 | Write-Host "mpv.lib not found in archive. Generating from libmpv-2.dll..." | ||
| 68 | |||
| 69 | $dllForLib = Get-ChildItem -Path $tempExtract -Filter "libmpv-2.dll" -Recurse | Select-Object -First 1 | ||
| 70 | if (-not $dllForLib) { | ||
| 71 | Write-Error "Could not find libmpv-2.dll in the archive!" | ||
| 72 | } | ||
| 73 | |||
| 74 | # Find MSVC tools (dumpbin, lib) - they're installed but not in PATH | ||
| 75 | $vsBase = "${env:ProgramFiles(x86)}\Microsoft Visual Studio" | ||
| 76 | if (-not (Test-Path $vsBase)) { $vsBase = "$env:ProgramFiles\Microsoft Visual Studio" } | ||
| 77 | $dumpbin = Get-ChildItem -Path $vsBase -Recurse -Filter "dumpbin.exe" -ErrorAction SilentlyContinue | | ||
| 78 | Where-Object { $_.FullName -like "*Hostx64\x64*" -or $_.FullName -like "*HostX64\x64*" } | | ||
| 79 | Select-Object -First 1 -ExpandProperty FullName | ||
| 80 | $libExe = Get-ChildItem -Path $vsBase -Recurse -Filter "lib.exe" -ErrorAction SilentlyContinue | | ||
| 81 | Where-Object { $_.FullName -like "*Hostx64\x64*" -or $_.FullName -like "*HostX64\x64*" } | | ||
| 82 | Select-Object -First 1 -ExpandProperty FullName | ||
| 83 | |||
| 84 | if (-not $dumpbin -or -not $libExe) { | ||
| 85 | Write-Error "Could not find MSVC build tools (dumpbin.exe, lib.exe). Install 'Desktop development with C++' workload." | ||
| 86 | } | ||
| 87 | |||
| 88 | # Export function names from DLL | ||
| 89 | $defPath = Join-Path $mpvDevDir "mpv.def" | ||
| 90 | $exports = & $dumpbin /exports "$($dllForLib.FullName)" 2>&1 | | ||
| 91 | Select-String "^\s+\d+\s+[0-9A-Fa-f]+\s+[0-9A-Fa-f]+\s+(\S+)" | | ||
| 92 | ForEach-Object { $_.Matches[0].Groups[1].Value } | ||
| 93 | |||
| 94 | # Write .def file | ||
| 95 | $defContent = "LIBRARY libmpv-2`nEXPORTS`n" | ||
| 96 | $defContent += ($exports | ForEach-Object { " $_" }) -join "`n" | ||
| 97 | Set-Content -Path $defPath -Value $defContent -Encoding ASCII | ||
| 98 | |||
| 99 | # Generate .lib from .def | ||
| 100 | $machine = if ($arch -eq "x86_64") { "x64" } else { "x86" } | ||
| 101 | & $libExe /def:"$defPath" /machine:$machine /out:"$mpvDevDir\mpv.lib" 2>&1 | Out-Null | ||
| 102 | |||
| 103 | if (-not (Test-Path "$mpvDevDir\mpv.lib")) { | ||
| 104 | Write-Error "Failed to generate mpv.lib!" | ||
| 105 | } else { | ||
| 106 | Write-Host "Generated mpv.lib successfully." | ||
| 107 | } | ||
| 108 | } else { | ||
| 109 | Copy-Item $libFile.FullName $mpvDevDir | ||
| 110 | } | ||
| 111 | |||
| 112 | if ($dllFile) { | ||
| 113 | Copy-Item $dllFile.FullName $mpvDevDir | ||
| 114 | # Also copy DLL next to the built binary location | ||
| 115 | $targetRelease = Join-Path $PSScriptRoot "target\release" | ||
| 116 | if (Test-Path $targetRelease) { | ||
| 117 | Copy-Item $dllFile.FullName $targetRelease | ||
| 118 | } | ||
| 119 | } | ||
| 120 | |||
| 121 | # Also grab any other DLLs we might need | ||
| 122 | Get-ChildItem -Path $tempExtract -Filter "*.dll" -Recurse | ForEach-Object { | ||
| 123 | Copy-Item $_.FullName $mpvDevDir -Force | ||
| 124 | } | ||
| 125 | |||
| 126 | # Cleanup | ||
| 127 | Remove-Item -Force $tempFile -ErrorAction SilentlyContinue | ||
| 128 | Remove-Item -Recurse -Force $tempExtract -ErrorAction SilentlyContinue | ||
| 129 | |||
| 130 | $env:MPV_LIB_DIR = $mpvDevDir | ||
| 131 | Write-Host "" | ||
| 132 | Write-Host "Done! mpv dev files extracted to: $mpvDevDir" | ||
| 133 | Write-Host "MPV_LIB_DIR set to: $mpvDevDir" | ||
| 134 | Write-Host "" | ||
| 135 | Write-Host "You can now build with:" | ||
| 136 | Write-Host " cargo build --release" | ||
| 137 | Write-Host "" | ||
| 138 | Write-Host "To make this permanent, add to your PowerShell profile:" | ||
| 139 | Write-Host " `$env:MPV_LIB_DIR = '$mpvDevDir'" | ||
src/config/appearance.rs +3 −4
| @@ -1,5 +1,4 @@ | |||
| 1 | use crate::{config::serde::*, global::traits::*}; | 1 | use crate::{config::serde::*, global::functions::paths, global::traits::*}; |
| 2 | use home::home_dir; | ||
| 3 | use ratatui::{style::Color, widgets::BorderType}; | 2 | use ratatui::{style::Color, widgets::BorderType}; |
| 4 | use serde::{Deserialize, Serialize}; | 3 | use serde::{Deserialize, Serialize}; |
| 5 | use std::{ | 4 | use std::{ |
| @@ -38,8 +37,8 @@ impl AppearanceConfig { | |||
| 38 | return Ok(appearance); | 37 | return Ok(appearance); |
| 39 | } | 38 | } |
| 40 | 39 | ||
| 41 | let config_path = home_dir().unwrap().join(format!( | 40 | let config_path = paths::config_dir().join(format!( |
| 42 | ".config/youtube-tui/{}.{}", | 41 | "{}.{}", |
| 43 | AppearanceConfigSerde::LABEL, | 42 | AppearanceConfigSerde::LABEL, |
| 44 | EXTENSION | 43 | EXTENSION |
| 45 | )); | 44 | )); |
src/config/commandbindings.rs +35 −29
| @@ -161,11 +161,17 @@ fn get_command<'a>( | |||
| 161 | 161 | ||
| 162 | // default functions | 162 | // default functions |
| 163 | 163 | ||
| 164 | /// Returns the appropriate quote character for shell commands on the current platform. | ||
| 165 | #[cfg(target_os = "windows")] | ||
| 166 | const Q: &str = "\""; | ||
| 167 | #[cfg(not(target_os = "windows"))] | ||
| 168 | const Q: &str = "'"; | ||
| 169 | |||
| 164 | fn global_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 170 | fn global_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 165 | HashMap::from([ | 171 | HashMap::from([ |
| 166 | ( | 172 | ( |
| 167 | KeyCodeSerde::Char('f'), | 173 | KeyCodeSerde::Char('f'), |
| 168 | HashMap::from([(2, String::from("run ${browser} '${url}'"))]), | 174 | HashMap::from([(2, format!("run ${{browser}} {Q}${{url}}{Q}"))]), |
| 169 | ), | 175 | ), |
| 170 | ( | 176 | ( |
| 171 | KeyCodeSerde::Char('c'), | 177 | KeyCodeSerde::Char('c'), |
| @@ -204,9 +210,9 @@ fn global_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | |||
| 204 | 210 | ||
| 205 | fn search_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 211 | fn search_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 206 | HashMap::from([ | 212 | HashMap::from([ |
| 207 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | 213 | (KeyCodeSerde::Char('a'), HashMap::from([(2, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video"))])), |
| 208 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | 214 | (KeyCodeSerde::Char('A'), HashMap::from([(1, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video --loop-playlist=inf --shuffle"))])), |
| 209 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("parrun mpv '${hover-url}'"))])), | 215 | (KeyCodeSerde::Char('p'), HashMap::from([(2, format!("parrun mpv {Q}${{hover-url}}{Q}"))])), |
| 210 | ]) | 216 | ]) |
| 211 | } | 217 | } |
| 212 | 218 | ||
| @@ -216,41 +222,41 @@ fn channel_main_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | |||
| 216 | 222 | ||
| 217 | fn channel_playlists_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 223 | fn channel_playlists_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 218 | HashMap::from([ | 224 | HashMap::from([ |
| 219 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | 225 | (KeyCodeSerde::Char('a'), HashMap::from([(2, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video"))])), |
| 220 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | 226 | (KeyCodeSerde::Char('A'), HashMap::from([(1, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video --loop-playlist=inf --shuffle"))])), |
| 221 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("parrun mpv '${hover-url}'"))])), | 227 | (KeyCodeSerde::Char('p'), HashMap::from([(2, format!("parrun mpv {Q}${{hover-url}}{Q}"))])), |
| 222 | ]) | 228 | ]) |
| 223 | } | 229 | } |
| 224 | 230 | ||
| 225 | fn channel_videos_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 231 | fn channel_videos_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 226 | HashMap::from([ | 232 | HashMap::from([ |
| 227 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | 233 | (KeyCodeSerde::Char('a'), HashMap::from([(2, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video"))])), |
| 228 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | 234 | (KeyCodeSerde::Char('A'), HashMap::from([(1, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video --loop-playlist=inf --shuffle"))])), |
| 229 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("parrun mpv '${hover-url}'"))])), | 235 | (KeyCodeSerde::Char('p'), HashMap::from([(2, format!("parrun mpv {Q}${{hover-url}}{Q}"))])), |
| 230 | ]) | 236 | ]) |
| 231 | } | 237 | } |
| 232 | 238 | ||
| 233 | fn playlist_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 239 | fn playlist_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 234 | HashMap::from([ | 240 | HashMap::from([ |
| 235 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | 241 | (KeyCodeSerde::Char('a'), HashMap::from([(2, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video"))])), |
| 236 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | 242 | (KeyCodeSerde::Char('A'), HashMap::from([(1, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video --loop-playlist=inf --shuffle"))])), |
| 237 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("parrun mpv '${hover-url}'"))])), | 243 | (KeyCodeSerde::Char('p'), HashMap::from([(2, format!("parrun mpv {Q}${{hover-url}}{Q}"))])), |
| 238 | ]) | 244 | ]) |
| 239 | } | 245 | } |
| 240 | 246 | ||
| 241 | fn popular_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 247 | fn popular_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 242 | HashMap::from([ | 248 | HashMap::from([ |
| 243 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | 249 | (KeyCodeSerde::Char('a'), HashMap::from([(2, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video"))])), |
| 244 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | 250 | (KeyCodeSerde::Char('A'), HashMap::from([(1, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video --loop-playlist=inf --shuffle"))])), |
| 245 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("parrun mpv '${hover-url}'"))])), | 251 | (KeyCodeSerde::Char('p'), HashMap::from([(2, format!("parrun mpv {Q}${{hover-url}}{Q}"))])), |
| 246 | ]) | 252 | ]) |
| 247 | } | 253 | } |
| 248 | 254 | ||
| 249 | fn trending_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 255 | fn trending_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 250 | HashMap::from([ | 256 | HashMap::from([ |
| 251 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | 257 | (KeyCodeSerde::Char('a'), HashMap::from([(2, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video"))])), |
| 252 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | 258 | (KeyCodeSerde::Char('A'), HashMap::from([(1, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video --loop-playlist=inf --shuffle"))])), |
| 253 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("parrun mpv '${hover-url}'"))])), | 259 | (KeyCodeSerde::Char('p'), HashMap::from([(2, format!("parrun mpv {Q}${{hover-url}}{Q}"))])), |
| 254 | ]) | 260 | ]) |
| 255 | } | 261 | } |
| 256 | 262 | ||
| @@ -260,9 +266,9 @@ fn video_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | |||
| 260 | 266 | ||
| 261 | fn watchhistory_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 267 | fn watchhistory_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 262 | HashMap::from([ | 268 | HashMap::from([ |
| 263 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | 269 | (KeyCodeSerde::Char('a'), HashMap::from([(2, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video"))])), |
| 264 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | 270 | (KeyCodeSerde::Char('A'), HashMap::from([(1, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video --loop-playlist=inf --shuffle"))])), |
| 265 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("parrun mpv '${hover-url}'"))])), | 271 | (KeyCodeSerde::Char('p'), HashMap::from([(2, format!("parrun mpv {Q}${{hover-url}}{Q}"))])), |
| 266 | ]) | 272 | ]) |
| 267 | } | 273 | } |
| 268 | 274 | ||
| @@ -272,22 +278,22 @@ fn feed_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | |||
| 272 | KeyCodeSerde::Char('a'), | 278 | KeyCodeSerde::Char('a'), |
| 273 | HashMap::from([( | 279 | HashMap::from([( |
| 274 | 2, | 280 | 2, |
| 275 | String::from("parrun ${terminal-emulator} mpv '${hover-video-url}' --no-video"), | 281 | format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-video-url}}{Q} --no-video"), |
| 276 | )]), | 282 | )]), |
| 277 | ), | 283 | ), |
| 278 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("parrun ${terminal-emulator} mpv '${hover-channel-url}/videos' --no-video --loop-playlist=inf --shuffle"))])), | 284 | (KeyCodeSerde::Char('A'), HashMap::from([(1, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-channel-url}}/videos{Q} --no-video --loop-playlist=inf --shuffle"))])), |
| 279 | (KeyCodeSerde::Char('P'), HashMap::from([(1, String::from("parrun ${terminal-emulator} mpv '${hover-channel-url}/videos' --no-video --loop-playlist=inf --shuffle"))])), | 285 | (KeyCodeSerde::Char('P'), HashMap::from([(1, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-channel-url}}/videos{Q} --no-video --loop-playlist=inf --shuffle"))])), |
| 280 | ( | 286 | ( |
| 281 | KeyCodeSerde::Char('p'), | 287 | KeyCodeSerde::Char('p'), |
| 282 | HashMap::from([(2, String::from("parrun mpv '${hover-video-url}'"))]), | 288 | HashMap::from([(2, format!("parrun mpv {Q}${{hover-video-url}}{Q}"))]), |
| 283 | ), | 289 | ), |
| 284 | ]) | 290 | ]) |
| 285 | } | 291 | } |
| 286 | 292 | ||
| 287 | fn library_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { | 293 | fn library_default() -> HashMap<KeyCodeSerde, HashMap<u8, String>> { |
| 288 | HashMap::from([ | 294 | HashMap::from([ |
| 289 | (KeyCodeSerde::Char('a'), HashMap::from([(2, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video"))])), | 295 | (KeyCodeSerde::Char('a'), HashMap::from([(2, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video"))])), |
| 290 | (KeyCodeSerde::Char('A'), HashMap::from([(1, String::from("parrun ${terminal-emulator} mpv '${hover-url}' --no-video --loop-playlist=inf --shuffle"))])), | 296 | (KeyCodeSerde::Char('A'), HashMap::from([(1, format!("parrun ${{terminal-emulator}} mpv {Q}${{hover-url}}{Q} --no-video --loop-playlist=inf --shuffle"))])), |
| 291 | (KeyCodeSerde::Char('p'), HashMap::from([(2, String::from("parrun mpv '${hover-url}'"))])), | 297 | (KeyCodeSerde::Char('p'), HashMap::from([(2, format!("parrun mpv {Q}${{hover-url}}{Q}"))])), |
| 292 | ]) | 298 | ]) |
| 293 | } | 299 | } |
src/config/commands.rs +75 −36
| @@ -98,6 +98,16 @@ fn launch_command_default() -> String { | |||
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | fn video_default() -> Vec<HashMap<String, String>> { | 100 | fn video_default() -> Vec<HashMap<String, String>> { |
| 101 | #[cfg(target_os = "windows")] | ||
| 102 | let q = "\""; | ||
| 103 | #[cfg(not(target_os = "windows"))] | ||
| 104 | let q = "'"; | ||
| 105 | |||
| 106 | #[cfg(target_os = "windows")] | ||
| 107 | let rm_cmd = |pattern: &str| format!("run cmd /c del /q /s \"{pattern}\""); | ||
| 108 | #[cfg(not(target_os = "windows"))] | ||
| 109 | let rm_cmd = |pattern: &str| format!("run rm -rf '{pattern}'"); | ||
| 110 | |||
| 101 | vec![ | 111 | vec![ |
| 102 | HashMap::from([( | 112 | HashMap::from([( |
| 103 | String::from("Reload updated video"), | 113 | String::from("Reload updated video"), |
| @@ -105,20 +115,16 @@ fn video_default() -> Vec<HashMap<String, String>> { | |||
| 105 | )]), | 115 | )]), |
| 106 | HashMap::from([( | 116 | HashMap::from([( |
| 107 | String::from("Play video"), | 117 | String::from("Play video"), |
| 108 | String::from("parrun ${video-player} '${embed-url}'"), | 118 | format!("parrun ${{video-player}} {q}${{embed-url}}{q}"), |
| 109 | )]), | 119 | )]), |
| 110 | HashMap::from([( | 120 | HashMap::from([( |
| 111 | String::from("Play audio"), | 121 | String::from("Play audio"), |
| 112 | String::from("mpv stop ;; resume ;; mpv sprop loop-file no ;; mpv loadfile '${embed-url}' ;; echo mpv Player started"), | 122 | format!("mpv stop ;; resume ;; mpv sprop loop-file no ;; mpv loadfile {q}${{embed-url}}{q} ;; echo mpv Player started"), |
| 113 | )]), | 123 | )]), |
| 114 | HashMap::from([( | 124 | HashMap::from([( |
| 115 | String::from("Play audio (loop)"), | 125 | String::from("Play audio (loop)"), |
| 116 | String::from("mpv stop ;; resume ;; mpv sprop loop-file inf ;; mpv loadfile '${embed-url}' ;; echo mpv Player started"), | 126 | format!("mpv stop ;; resume ;; mpv sprop loop-file inf ;; mpv loadfile {q}${{embed-url}}{q} ;; echo mpv Player started"), |
| 117 | )]), | 127 | )]), |
| 118 | // HashMap::from([( | ||
| 119 | // String::from("Add to queue"), | ||
| 120 | // String::from("mpv loadfile '${embed-url}' appendplay;; echo mpv Added to queue"), | ||
| 121 | // )]), | ||
| 122 | HashMap::from([( | 128 | HashMap::from([( |
| 123 | String::from("View channel"), | 129 | String::from("View channel"), |
| 124 | String::from("channel ${channel-id}"), | 130 | String::from("channel ${channel-id}"), |
| @@ -129,7 +135,7 @@ fn video_default() -> Vec<HashMap<String, String>> { | |||
| 129 | )]), | 135 | )]), |
| 130 | HashMap::from([( | 136 | HashMap::from([( |
| 131 | String::from("Open in browser"), | 137 | String::from("Open in browser"), |
| 132 | String::from("parrun ${browser} '${url}'"), | 138 | format!("parrun ${{browser}} {q}${{url}}{q}"), |
| 133 | )]), | 139 | )]), |
| 134 | HashMap::from([( | 140 | HashMap::from([( |
| 135 | String::from("Toggle bookmark"), | 141 | String::from("Toggle bookmark"), |
| @@ -137,11 +143,11 @@ fn video_default() -> Vec<HashMap<String, String>> { | |||
| 137 | )]), | 143 | )]), |
| 138 | HashMap::from([( | 144 | HashMap::from([( |
| 139 | String::from("Save video to library"), | 145 | String::from("Save video to library"), |
| 140 | String::from("bookmark ${id} ;; run rm -rf '${save-path}${id}.*' ;; parrun ${terminal-emulator} ${youtube-downloader} '${embed-url}' -o '${save-path}%(title)s[%(id)s].%(ext)s'") | 146 | format!("bookmark ${{id}} ;; {} ;; parrun ${{terminal-emulator}} ${{youtube-downloader}} {q}${{embed-url}}{q} -o {q}${{save-path}}%(title)s[${{id}}].%(ext)s{q}", rm_cmd("${save-path}${id}.*")) |
| 141 | )]), | 147 | )]), |
| 142 | HashMap::from([( | 148 | HashMap::from([( |
| 143 | String::from("Save audio to library"), | 149 | String::from("Save audio to library"), |
| 144 | String::from("bookmark ${id} ;; parrun rm -rf '${save-path}${id}.*' ;; parrun ${terminal-emulator} ${youtube-downloader} '${embed-url}' -x -o '${save-path}%(title)s[%(id)s].%(ext)s'") | 150 | format!("bookmark ${{id}} ;; {} ;; parrun ${{terminal-emulator}} ${{youtube-downloader}} {q}${{embed-url}}{q} -x -o {q}${{save-path}}%(title)s[${{id}}].%(ext)s{q}", rm_cmd("${save-path}${id}.*")) |
| 145 | )]), | 151 | )]), |
| 146 | HashMap::from([( | 152 | HashMap::from([( |
| 147 | String::from("Mode: ${provider}"), | 153 | String::from("Mode: ${provider}"), |
| @@ -151,6 +157,16 @@ fn video_default() -> Vec<HashMap<String, String>> { | |||
| 151 | } | 157 | } |
| 152 | 158 | ||
| 153 | fn saved_video_default() -> Vec<HashMap<String, String>> { | 159 | fn saved_video_default() -> Vec<HashMap<String, String>> { |
| 160 | #[cfg(target_os = "windows")] | ||
| 161 | let q = "\""; | ||
| 162 | #[cfg(not(target_os = "windows"))] | ||
| 163 | let q = "'"; | ||
| 164 | |||
| 165 | #[cfg(target_os = "windows")] | ||
| 166 | let rm_cmd = |pattern: &str| format!("run cmd /c del /q /s \"{pattern}\""); | ||
| 167 | #[cfg(not(target_os = "windows"))] | ||
| 168 | let rm_cmd = |pattern: &str| format!("run rm {pattern}"); | ||
| 169 | |||
| 154 | vec![ | 170 | vec![ |
| 155 | HashMap::from([( | 171 | HashMap::from([( |
| 156 | String::from("Reload updated video"), | 172 | String::from("Reload updated video"), |
| @@ -158,20 +174,16 @@ fn saved_video_default() -> Vec<HashMap<String, String>> { | |||
| 158 | )]), | 174 | )]), |
| 159 | HashMap::from([( | 175 | HashMap::from([( |
| 160 | String::from("[Offline] Play saved file"), | 176 | String::from("[Offline] Play saved file"), |
| 161 | String::from("parrun ${video-player} '${offline-path}' --force-window"), | 177 | format!("parrun ${{video-player}} {q}${{offline-path}}{q} --force-window"), |
| 162 | )]), | 178 | )]), |
| 163 | HashMap::from([( | 179 | HashMap::from([( |
| 164 | String::from("[Offline] Play saved file (audio)"), | 180 | String::from("[Offline] Play saved file (audio)"), |
| 165 | String::from("mpv stop ;; resume ;; mpv sprop loop-file no ;; mpv loadfile '${offline-path}' ;; echo mpv Player started"), | 181 | format!("mpv stop ;; resume ;; mpv sprop loop-file no ;; mpv loadfile {q}${{offline-path}}{q} ;; echo mpv Player started"), |
| 166 | )]), | 182 | )]), |
| 167 | HashMap::from([( | 183 | HashMap::from([( |
| 168 | String::from("[Offline] Play saved file (audio loop)"), | 184 | String::from("[Offline] Play saved file (audio loop)"), |
| 169 | String::from("mpv stop ;; resume ;; mpv sprop loop-file inf ;; mpv loadfile '${offline-path}' ;; echo mpv Player started"), | 185 | format!("mpv stop ;; resume ;; mpv sprop loop-file inf ;; mpv loadfile {q}${{offline-path}}{q} ;; echo mpv Player started"), |
| 170 | )]), | 186 | )]), |
| 171 | // HashMap::from([( | ||
| 172 | // String::from("[Offline] Add to queue"), | ||
| 173 | // String::from("mpv loadfile '${offline-path}' appendplay ;; echo mpv Added to queue"), | ||
| 174 | // )]), | ||
| 175 | HashMap::from([( | 187 | HashMap::from([( |
| 176 | String::from("View channel"), | 188 | String::from("View channel"), |
| 177 | String::from("channel ${channel-id}"), | 189 | String::from("channel ${channel-id}"), |
| @@ -182,7 +194,7 @@ fn saved_video_default() -> Vec<HashMap<String, String>> { | |||
| 182 | )]), | 194 | )]), |
| 183 | HashMap::from([( | 195 | HashMap::from([( |
| 184 | String::from("Open in browser"), | 196 | String::from("Open in browser"), |
| 185 | String::from("parrun ${browser} '${url}'"), | 197 | format!("parrun ${{browser}} {q}${{url}}{q}"), |
| 186 | )]), | 198 | )]), |
| 187 | HashMap::from([( | 199 | HashMap::from([( |
| 188 | String::from("Toggle bookmark"), | 200 | String::from("Toggle bookmark"), |
| @@ -190,20 +202,25 @@ fn saved_video_default() -> Vec<HashMap<String, String>> { | |||
| 190 | )]), | 202 | )]), |
| 191 | HashMap::from([( | 203 | HashMap::from([( |
| 192 | String::from("Redownload video to library"), | 204 | String::from("Redownload video to library"), |
| 193 | String::from("bookmark ${id} ;; run rm ${save-path}*${id}*.* ;; parrun ${terminal-emulator} ${youtube-downloader} ${embed-url} -o '${save-path}%(title)s[%(id)s].%(ext)s'"), | 205 | format!("bookmark ${{id}} ;; {} ;; parrun ${{terminal-emulator}} ${{youtube-downloader}} ${{embed-url}} -o {q}${{save-path}}%(title)s[${{id}}].%(ext)s{q}", rm_cmd("${save-path}*${id}*.*")), |
| 194 | )]), | 206 | )]), |
| 195 | HashMap::from([( | 207 | HashMap::from([( |
| 196 | String::from("Redownload audio to library"), | 208 | String::from("Redownload audio to library"), |
| 197 | String::from("bookmark ${id} ;; run rm ${save-path}*${id}*.* ;; parrun ${terminal-emulator} ${youtube-downloader} ${embed-url} -x -o '${save-path}%(title)s[%(id)s].%(ext)s'") | 209 | format!("bookmark ${{id}} ;; {} ;; parrun ${{terminal-emulator}} ${{youtube-downloader}} ${{embed-url}} -x -o {q}${{save-path}}%(title)s[${{id}}].%(ext)s{q}", rm_cmd("${save-path}*${id}*.*")) |
| 198 | )]), | 210 | )]), |
| 199 | HashMap::from([( | 211 | HashMap::from([( |
| 200 | String::from("Delete saved file"), | 212 | String::from("Delete saved file"), |
| 201 | String::from("run rm ${save-path}*${id}*.*") | 213 | rm_cmd("${save-path}*${id}*.*") |
| 202 | )]), | 214 | )]), |
| 203 | ] | 215 | ] |
| 204 | } | 216 | } |
| 205 | 217 | ||
| 206 | fn playlist_default() -> Vec<HashMap<String, String>> { | 218 | fn playlist_default() -> Vec<HashMap<String, String>> { |
| 219 | #[cfg(target_os = "windows")] | ||
| 220 | let q = "\""; | ||
| 221 | #[cfg(not(target_os = "windows"))] | ||
| 222 | let q = "'"; | ||
| 223 | |||
| 207 | vec![ | 224 | vec![ |
| 208 | HashMap::from([(String::from("Switch view"), String::from("%switch-view%"))]), | 225 | HashMap::from([(String::from("Switch view"), String::from("%switch-view%"))]), |
| 209 | HashMap::from([( | 226 | HashMap::from([( |
| @@ -222,10 +239,6 @@ fn playlist_default() -> Vec<HashMap<String, String>> { | |||
| 222 | String::from("Shuffle play all (audio loop)"), | 239 | String::from("Shuffle play all (audio loop)"), |
| 223 | String::from("mpv stop ;; resume ;; ${mpv-queuelist} ;; mpv sprop loop-playlist yes ;; mpv playlist-shuffle ;; mpv playlist-play-index 0 ;; echo mpv Player started"), | 240 | String::from("mpv stop ;; resume ;; ${mpv-queuelist} ;; mpv sprop loop-playlist yes ;; mpv playlist-shuffle ;; mpv playlist-play-index 0 ;; echo mpv Player started"), |
| 224 | )]), | 241 | )]), |
| 225 | // HashMap::from([( | ||
| 226 | // String::from("Add all to queue"), | ||
| 227 | // String::from("${mpv-queuelist} ;; echo mpv Queued playlist"), | ||
| 228 | // )]), | ||
| 229 | HashMap::from([( | 242 | HashMap::from([( |
| 230 | String::from("View channel"), | 243 | String::from("View channel"), |
| 231 | String::from("channel ${channel-id}"), | 244 | String::from("channel ${channel-id}"), |
| @@ -236,7 +249,7 @@ fn playlist_default() -> Vec<HashMap<String, String>> { | |||
| 236 | )]), | 249 | )]), |
| 237 | HashMap::from([( | 250 | HashMap::from([( |
| 238 | String::from("Open in browser"), | 251 | String::from("Open in browser"), |
| 239 | String::from("parrun ${browser} '${url}'"), | 252 | format!("parrun ${{browser}} {q}${{url}}{q}"), |
| 240 | )]), | 253 | )]), |
| 241 | HashMap::from([( | 254 | HashMap::from([( |
| 242 | String::from("Toggle bookmark"), | 255 | String::from("Toggle bookmark"), |
| @@ -244,11 +257,21 @@ fn playlist_default() -> Vec<HashMap<String, String>> { | |||
| 244 | )]), | 257 | )]), |
| 245 | HashMap::from([( | 258 | HashMap::from([( |
| 246 | String::from("Save playlist videos to library"), | 259 | String::from("Save playlist videos to library"), |
| 247 | String::from("bookmark ${id} ;; run rm -rf '${save-path}*${id}*' ;; parrun ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"") | 260 | { |
| 261 | #[cfg(target_os = "windows")] | ||
| 262 | { String::from("bookmark ${id} ;; run cmd /c rd /s /q \"${save-path}*${id}*\" ;; parrun ${terminal-emulator} ${youtube-downloader} ${all-videos} -o \"${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s\"") } | ||
| 263 | #[cfg(not(target_os = "windows"))] | ||
| 264 | { String::from("bookmark ${id} ;; run rm -rf '${save-path}*${id}*' ;; parrun ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"") } | ||
| 265 | } | ||
| 248 | )]), | 266 | )]), |
| 249 | HashMap::from([( | 267 | HashMap::from([( |
| 250 | String::from("Save playlist audio to library"), | 268 | String::from("Save playlist audio to library"), |
| 251 | String::from("bookmark ${id} ;; run rm -rf '${save-path}*${id}*' ;; parrun ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -x -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"") | 269 | { |
| 270 | #[cfg(target_os = "windows")] | ||
| 271 | { String::from("bookmark ${id} ;; run cmd /c rd /s /q \"${save-path}*${id}*\" ;; parrun ${terminal-emulator} ${youtube-downloader} ${all-videos} -x -o \"${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s\"") } | ||
| 272 | #[cfg(not(target_os = "windows"))] | ||
| 273 | { String::from("bookmark ${id} ;; run rm -rf '${save-path}*${id}*' ;; parrun ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -x -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"") } | ||
| 274 | } | ||
| 252 | )]), | 275 | )]), |
| 253 | HashMap::from([( | 276 | HashMap::from([( |
| 254 | String::from("Mode: ${provider}"), | 277 | String::from("Mode: ${provider}"), |
| @@ -258,6 +281,11 @@ fn playlist_default() -> Vec<HashMap<String, String>> { | |||
| 258 | } | 281 | } |
| 259 | 282 | ||
| 260 | fn saved_playlist_default() -> Vec<HashMap<String, String>> { | 283 | fn saved_playlist_default() -> Vec<HashMap<String, String>> { |
| 284 | #[cfg(target_os = "windows")] | ||
| 285 | let q = "\""; | ||
| 286 | #[cfg(not(target_os = "windows"))] | ||
| 287 | let q = "'"; | ||
| 288 | |||
| 261 | vec![ | 289 | vec![ |
| 262 | HashMap::from([(String::from("Switch view"), String::from("%switch-view%"))]), | 290 | HashMap::from([(String::from("Switch view"), String::from("%switch-view%"))]), |
| 263 | HashMap::from([( | 291 | HashMap::from([( |
| @@ -276,10 +304,6 @@ fn saved_playlist_default() -> Vec<HashMap<String, String>> { | |||
| 276 | String::from("[Offline] Shuffle play all (audio loop)"), | 304 | String::from("[Offline] Shuffle play all (audio loop)"), |
| 277 | String::from("mpv stop ;; resume ;; ${offline-queuelist} ;; mpv sprop loop-playlist yes ;; mpv playlist-shuffle ;; mpv playlist-play-index 0 ;; echo mpv Player started"), | 305 | String::from("mpv stop ;; resume ;; ${offline-queuelist} ;; mpv sprop loop-playlist yes ;; mpv playlist-shuffle ;; mpv playlist-play-index 0 ;; echo mpv Player started"), |
| 278 | )]), | 306 | )]), |
| 279 | // HashMap::from([( | ||
| 280 | // String::from("[Offline] Add all to queue"), | ||
| 281 | // String::from("${offline-queuelist} ;; echo mpv Queued playlist"), | ||
| 282 | // )]), | ||
| 283 | HashMap::from([( | 307 | HashMap::from([( |
| 284 | String::from("View channel"), | 308 | String::from("View channel"), |
| 285 | String::from("channel ${channel-id}"), | 309 | String::from("channel ${channel-id}"), |
| @@ -290,7 +314,7 @@ fn saved_playlist_default() -> Vec<HashMap<String, String>> { | |||
| 290 | )]), | 314 | )]), |
| 291 | HashMap::from([( | 315 | HashMap::from([( |
| 292 | String::from("Open in browser"), | 316 | String::from("Open in browser"), |
| 293 | String::from("parrun ${browser} '${url}'"), | 317 | format!("parrun ${{browser}} {q}${{url}}{q}"), |
| 294 | )]), | 318 | )]), |
| 295 | HashMap::from([( | 319 | HashMap::from([( |
| 296 | String::from("Toggle bookmark"), | 320 | String::from("Toggle bookmark"), |
| @@ -298,15 +322,30 @@ fn saved_playlist_default() -> Vec<HashMap<String, String>> { | |||
| 298 | )]), | 322 | )]), |
| 299 | HashMap::from([( | 323 | HashMap::from([( |
| 300 | String::from("Redownload playlist videos to library"), | 324 | String::from("Redownload playlist videos to library"), |
| 301 | String::from("bookmark ${id} ;; run rm -rf ${save-path}*${id}* ;; parrun ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"") | 325 | { |
| 326 | #[cfg(target_os = "windows")] | ||
| 327 | { String::from("bookmark ${id} ;; run cmd /c rd /s /q \"${save-path}*${id}*\" ;; parrun ${terminal-emulator} ${youtube-downloader} ${all-videos} -o \"${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s\"") } | ||
| 328 | #[cfg(not(target_os = "windows"))] | ||
| 329 | { String::from("bookmark ${id} ;; run rm -rf ${save-path}*${id}* ;; parrun ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"") } | ||
| 330 | } | ||
| 302 | )]), | 331 | )]), |
| 303 | HashMap::from([( | 332 | HashMap::from([( |
| 304 | String::from("Redownload playlist audio to library"), | 333 | String::from("Redownload playlist audio to library"), |
| 305 | String::from("bookmark ${id} ;; run rm -rf ${save-path}*${id}* ;; parrun ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -x -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"") | 334 | { |
| 335 | #[cfg(target_os = "windows")] | ||
| 336 | { String::from("bookmark ${id} ;; run cmd /c rd /s /q \"${save-path}*${id}*\" ;; parrun ${terminal-emulator} ${youtube-downloader} ${all-videos} -x -o \"${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s\"") } | ||
| 337 | #[cfg(not(target_os = "windows"))] | ||
| 338 | { String::from("bookmark ${id} ;; run rm -rf ${save-path}*${id}* ;; parrun ${terminal-emulator} bash -c \"${youtube-downloader} ${all-videos} -x -o '\"'${save-path}${title}[${id}]/%(title)s[%(id)s].%(ext)s'\"'\"") } | ||
| 339 | } | ||
| 306 | )]), | 340 | )]), |
| 307 | HashMap::from([( | 341 | HashMap::from([( |
| 308 | String::from("Delete saved files"), | 342 | String::from("Delete saved files"), |
| 309 | String::from("run rm -rf ${save-path}*${id}*") | 343 | { |
| 344 | #[cfg(target_os = "windows")] | ||
| 345 | { String::from("run cmd /c rd /s /q \"${save-path}*${id}*\"") } | ||
| 346 | #[cfg(not(target_os = "windows"))] | ||
| 347 | { String::from("run rm -rf ${save-path}*${id}*") } | ||
| 348 | } | ||
| 310 | )]), | 349 | )]), |
| 311 | ] | 350 | ] |
| 312 | } | 351 | } |
src/config/keybindings.rs +3 −3
| @@ -3,11 +3,11 @@ use super::{ | |||
| 3 | WriteConfig, | 3 | WriteConfig, |
| 4 | }; | 4 | }; |
| 5 | use crate::global::{ | 5 | use crate::global::{ |
| 6 | functions::paths, | ||
| 6 | structs::KeyAction, | 7 | structs::KeyAction, |
| 7 | traits::{ConfigTrait, EXTENSION}, | 8 | traits::{ConfigTrait, EXTENSION}, |
| 8 | }; | 9 | }; |
| 9 | use crossterm::event::{KeyCode, KeyEvent}; | 10 | use crossterm::event::{KeyCode, KeyEvent}; |
| 10 | use home::home_dir; | ||
| 11 | use serde::{Deserialize, Serialize}; | 11 | use serde::{Deserialize, Serialize}; |
| 12 | use std::{ | 12 | use std::{ |
| 13 | collections::HashMap, | 13 | collections::HashMap, |
| @@ -174,8 +174,8 @@ impl KeyBindingsConfig { | |||
| 174 | return Ok(keybindings); | 174 | return Ok(keybindings); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | let config_path = home_dir().unwrap().join(format!( | 177 | let config_path = paths::config_dir().join(format!( |
| 178 | ".config/youtube-tui/{}.{}", | 178 | "{}.{}", |
| 179 | KeyBindingsConfigSerde::LABEL, | 179 | KeyBindingsConfigSerde::LABEL, |
| 180 | EXTENSION | 180 | EXTENSION |
| 181 | )); | 181 | )); |
src/config/main.rs +50 −18
| @@ -287,27 +287,59 @@ const fn write_to_config_default() -> WriteConfig { | |||
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | fn default_env() -> HashMap<String, String> { | 289 | fn default_env() -> HashMap<String, String> { |
| 290 | HashMap::from([ | 290 | use crate::global::functions::paths; |
| 291 | (String::from("video-player"), String::from("mpv")), | 291 | |
| 292 | (String::from("browser"), String::from("xdg-open")), | 292 | #[cfg(target_os = "windows")] |
| 293 | ( | 293 | { |
| 294 | String::from("terminal-emulator"), | 294 | HashMap::from([ |
| 295 | String::from("konsole -e"), | 295 | (String::from("video-player"), String::from("mpv")), |
| 296 | ), | 296 | (String::from("browser"), String::from("explorer")), |
| 297 | (String::from("youtube-downloader"), String::from("yt-dlp")), | 297 | ( |
| 298 | ( | 298 | String::from("terminal-emulator"), |
| 299 | String::from("download-path"), | 299 | String::from("cmd /c start cmd /k"), |
| 300 | String::from("~/Downloads/%(title)s-%(id)s.%(ext)s"), | 300 | ), |
| 301 | ), | 301 | (String::from("youtube-downloader"), String::from("yt-dlp")), |
| 302 | ( | 302 | ( |
| 303 | String::from("save-path"), | 303 | String::from("download-path"), |
| 304 | String::from("~/.local/share/youtube-tui/saved/"), | 304 | paths::default_download_path(), |
| 305 | ), | 305 | ), |
| 306 | ]) | 306 | ( |
| 307 | String::from("save-path"), | ||
| 308 | paths::default_save_path(), | ||
| 309 | ), | ||
| 310 | ]) | ||
| 311 | } | ||
| 312 | #[cfg(not(target_os = "windows"))] | ||
| 313 | { | ||
| 314 | HashMap::from([ | ||
| 315 | (String::from("video-player"), String::from("mpv")), | ||
| 316 | (String::from("browser"), String::from("xdg-open")), | ||
| 317 | ( | ||
| 318 | String::from("terminal-emulator"), | ||
| 319 | String::from("konsole -e"), | ||
| 320 | ), | ||
| 321 | (String::from("youtube-downloader"), String::from("yt-dlp")), | ||
| 322 | ( | ||
| 323 | String::from("download-path"), | ||
| 324 | String::from("~/Downloads/%(title)s-%(id)s.%(ext)s"), | ||
| 325 | ), | ||
| 326 | ( | ||
| 327 | String::from("save-path"), | ||
| 328 | String::from("~/.local/share/youtube-tui/saved/"), | ||
| 329 | ), | ||
| 330 | ]) | ||
| 331 | } | ||
| 307 | } | 332 | } |
| 308 | 333 | ||
| 309 | fn shell_default() -> String { | 334 | fn shell_default() -> String { |
| 310 | String::from("sh") | 335 | #[cfg(target_os = "windows")] |
| 336 | { | ||
| 337 | String::from("cmd") | ||
| 338 | } | ||
| 339 | #[cfg(not(target_os = "windows"))] | ||
| 340 | { | ||
| 341 | String::from("sh") | ||
| 342 | } | ||
| 311 | } | 343 | } |
| 312 | 344 | ||
| 313 | fn api_key_default() -> String { | 345 | fn api_key_default() -> String { |
src/config/remap.rs +6 −4
| @@ -6,11 +6,13 @@ use std::{ | |||
| 6 | }; | 6 | }; |
| 7 | 7 | ||
| 8 | use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; | 8 | use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; |
| 9 | use home::home_dir; | ||
| 10 | use serde::{Deserialize, Serialize}; | 9 | use serde::{Deserialize, Serialize}; |
| 11 | use typemap::Key; | 10 | use typemap::Key; |
| 12 | 11 | ||
| 13 | use crate::global::traits::{ConfigTrait, EXTENSION}; | 12 | use crate::global::{ |
| 13 | functions::paths, | ||
| 14 | traits::{ConfigTrait, EXTENSION}, | ||
| 15 | }; | ||
| 14 | 16 | ||
| 15 | use super::{serde::KeyCodeSerde, WriteConfig}; | 17 | use super::{serde::KeyCodeSerde, WriteConfig}; |
| 16 | 18 | ||
| @@ -86,8 +88,8 @@ impl RemapConfig { | |||
| 86 | return Ok(keybindings); | 88 | return Ok(keybindings); |
| 87 | } | 89 | } |
| 88 | 90 | ||
| 89 | let config_path = home_dir().unwrap().join(format!( | 91 | let config_path = paths::config_dir().join(format!( |
| 90 | ".config/youtube-tui/{}.{}", | 92 | "{}.{}", |
| 91 | RemapConfigSerde::LABEL, | 93 | RemapConfigSerde::LABEL, |
| 92 | EXTENSION | 94 | EXTENSION |
| 93 | )); | 95 | )); |
src/exit.rs +4 −5
| @@ -1,10 +1,10 @@ | |||
| 1 | use home::home_dir; | ||
| 2 | use std::{collections::HashSet, error::Error, fs}; | 1 | use std::{collections::HashSet, error::Error, fs}; |
| 3 | use tui_additions::framework::Framework; | 2 | use tui_additions::framework::Framework; |
| 4 | 3 | ||
| 5 | use crate::{ | 4 | use crate::{ |
| 6 | config::MainConfig, | 5 | config::MainConfig, |
| 7 | global::{ | 6 | global::{ |
| 7 | functions::paths, | ||
| 8 | structs::*, | 8 | structs::*, |
| 9 | traits::{Collection, CollectionNoId}, | 9 | traits::{Collection, CollectionNoId}, |
| 10 | }, | 10 | }, |
| @@ -51,10 +51,9 @@ pub fn exit(framework: &mut Framework) -> Result<(), Box<dyn Error>> { | |||
| 51 | 51 | ||
| 52 | let cached_before = CACHED_BEFORE.get().unwrap(); | 52 | let cached_before = CACHED_BEFORE.get().unwrap(); |
| 53 | 53 | ||
| 54 | let info_path = home_dir().unwrap().join(".local/share/youtube-tui/info/"); | 54 | let data = paths::data_dir(); |
| 55 | let thumbnail_path = home_dir() | 55 | let info_path = data.join("info"); |
| 56 | .unwrap() | 56 | let thumbnail_path = data.join("thumbnails"); |
| 57 | .join(".local/share/youtube-tui/thumbnails/"); | ||
| 58 | 57 | ||
| 59 | // remove cache that no longer exists | 58 | // remove cache that no longer exists |
| 60 | for deleted in cached_before | 59 | for deleted in cached_before |
src/global/functions/download_all_images.rs +1 −3
| @@ -46,9 +46,7 @@ pub fn download_all_images(downloads: Vec<Option<DownloadRequest>>) { | |||
| 46 | return; | 46 | return; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | let path = home::home_dir() | 49 | let path = super::paths::data_dir().join("thumbnails"); |
| 50 | .expect("Cannot get your home directory") | ||
| 51 | .join(".local/share/youtube-tui/thumbnails/"); | ||
| 52 | 50 | ||
| 53 | downloads.into_iter().flatten().for_each(|req| { | 51 | downloads.into_iter().flatten().for_each(|req| { |
| 54 | LocalStore::add_image(req.id.clone()); | 52 | LocalStore::add_image(req.id.clone()); |
src/global/functions/find_library.rs +23 −9
| @@ -1,16 +1,30 @@ | |||
| 1 | use std::{fs, path::PathBuf}; | 1 | use std::{fs, path::PathBuf}; |
| 2 | 2 | ||
| 3 | use home::home_dir; | ||
| 4 | |||
| 5 | use crate::config::MainConfig; | 3 | use crate::config::MainConfig; |
| 6 | 4 | ||
| 5 | use super::paths; | ||
| 6 | |||
| 7 | pub fn find_library_item(id: &str, mainconfig: &MainConfig) -> Option<PathBuf> { | 7 | pub fn find_library_item(id: &str, mainconfig: &MainConfig) -> Option<PathBuf> { |
| 8 | fs::read_dir( | 8 | let save_path_str = mainconfig.env.get("save-path")?; |
| 9 | home_dir() | 9 | |
| 10 | // Resolve save-path: handle tilde expansion for backward compatibility | ||
| 11 | let save_path = if save_path_str.starts_with("~/") || save_path_str.starts_with("~\\") { | ||
| 12 | home::home_dir() | ||
| 10 | .unwrap() | 13 | .unwrap() |
| 11 | .join(mainconfig.env.get("save-path")?.replacen("~/", "", 1)), | 14 | .join(&save_path_str[2..]) |
| 12 | ) | 15 | } else { |
| 13 | .ok()? | 16 | // If it's an absolute path (e.g., from paths::default_save_path()), use directly |
| 14 | .filter_map(|entry| Some(entry.ok()?.path())) | 17 | let p = PathBuf::from(save_path_str); |
| 15 | .find(|stem| stem.as_os_str().to_str().unwrap_or_default().contains(id)) | 18 | if p.is_absolute() { |
| 19 | p | ||
| 20 | } else { | ||
| 21 | // Relative path: treat as relative to data_dir for safety | ||
| 22 | paths::data_dir().join(save_path_str) | ||
| 23 | } | ||
| 24 | }; | ||
| 25 | |||
| 26 | fs::read_dir(save_path) | ||
| 27 | .ok()? | ||
| 28 | .filter_map(|entry| Some(entry.ok()?.path())) | ||
| 29 | .find(|stem| stem.as_os_str().to_str().unwrap_or_default().contains(id)) | ||
| 16 | } | 30 | } |
src/global/functions/init_move.rs +3 −4
| @@ -1,11 +1,10 @@ | |||
| 1 | use std::fs; | 1 | use std::fs; |
| 2 | 2 | ||
| 3 | use home::home_dir; | 3 | use super::paths; |
| 4 | 4 | ||
| 5 | pub fn init_move() { | 5 | pub fn init_move() { |
| 6 | let home_dir = home_dir().unwrap(); | 6 | let store_dir = paths::data_dir(); |
| 7 | let store_dir = home_dir.join(".local/share/youtube-tui/"); | 7 | let cache_dir = paths::cache_dir(); |
| 8 | let cache_dir = home_dir.join(".cache/youtube-tui"); | ||
| 9 | 8 | ||
| 10 | let store_info_dir = store_dir.join("info/"); | 9 | let store_info_dir = store_dir.join("info/"); |
| 11 | let cache_info_dir = cache_dir.join("info/"); | 10 | let cache_info_dir = cache_dir.join("info/"); |
src/global/functions/mod.rs +1
| @@ -35,3 +35,4 @@ mod key_input; | |||
| 35 | pub use key_input::*; | 35 | pub use key_input::*; |
| 36 | mod find_library; | 36 | mod find_library; |
| 37 | pub use find_library::*; | 37 | pub use find_library::*; |
| 38 | pub mod paths; | ||
src/global/functions/paths.rs added +68
| @@ -0,0 +1,68 @@ | |||
| 1 | use std::path::PathBuf; | ||
| 2 | |||
| 3 | /// Returns the configuration directory for youtube-tui. | ||
| 4 | /// | ||
| 5 | /// - Linux: `~/.config/youtube-tui/` | ||
| 6 | /// - Windows: `%APPDATA%\youtube-tui\` | ||
| 7 | /// - macOS: `~/Library/Application Support/youtube-tui/` | ||
| 8 | pub fn config_dir() -> PathBuf { | ||
| 9 | dirs::config_dir() | ||
| 10 | .unwrap_or_else(|| home::home_dir().unwrap().join(".config")) | ||
| 11 | .join("youtube-tui") | ||
| 12 | } | ||
| 13 | |||
| 14 | /// Returns the data directory for youtube-tui. | ||
| 15 | /// | ||
| 16 | /// - Linux: `~/.local/share/youtube-tui/` | ||
| 17 | /// - Windows: `%LOCALAPPDATA%\youtube-tui\` | ||
| 18 | /// - macOS: `~/Library/Application Support/youtube-tui/` | ||
| 19 | pub fn data_dir() -> PathBuf { | ||
| 20 | dirs::data_local_dir() | ||
| 21 | .unwrap_or_else(|| home::home_dir().unwrap().join(".local").join("share")) | ||
| 22 | .join("youtube-tui") | ||
| 23 | } | ||
| 24 | |||
| 25 | /// Returns the cache directory for youtube-tui. | ||
| 26 | /// | ||
| 27 | /// - Linux: `~/.cache/youtube-tui/` | ||
| 28 | /// - Windows: `%LOCALAPPDATA%\youtube-tui\cache\` | ||
| 29 | /// - macOS: `~/Library/Caches/youtube-tui/` | ||
| 30 | pub fn cache_dir() -> PathBuf { | ||
| 31 | dirs::cache_dir() | ||
| 32 | .unwrap_or_else(|| home::home_dir().unwrap().join(".cache")) | ||
| 33 | .join("youtube-tui") | ||
| 34 | } | ||
| 35 | |||
| 36 | /// Returns the storage directory for rustypipe. | ||
| 37 | /// | ||
| 38 | /// - Linux: `~/.local/share/rustypipe/` | ||
| 39 | /// - Windows: `%LOCALAPPDATA%\rustypipe\` | ||
| 40 | /// - macOS: `~/Library/Application Support/rustypipe/` | ||
| 41 | pub fn rustypipe_dir() -> PathBuf { | ||
| 42 | dirs::data_local_dir() | ||
| 43 | .unwrap_or_else(|| home::home_dir().unwrap().join(".local").join("share")) | ||
| 44 | .join("rustypipe") | ||
| 45 | } | ||
| 46 | |||
| 47 | /// Returns the default save path string for the `save-path` env variable. | ||
| 48 | /// This is used in command strings, so it returns a String with trailing separator. | ||
| 49 | pub fn default_save_path() -> String { | ||
| 50 | let p = data_dir().join("saved"); | ||
| 51 | let mut s = p.to_string_lossy().to_string(); | ||
| 52 | // Ensure trailing path separator for command substitution | ||
| 53 | if !s.ends_with(std::path::MAIN_SEPARATOR) { | ||
| 54 | s.push(std::path::MAIN_SEPARATOR); | ||
| 55 | } | ||
| 56 | s | ||
| 57 | } | ||
| 58 | |||
| 59 | /// Returns the default download path string for the `download-path` env variable. | ||
| 60 | pub fn default_download_path() -> String { | ||
| 61 | let downloads = dirs::download_dir() | ||
| 62 | .unwrap_or_else(|| home::home_dir().unwrap().join("Downloads")); | ||
| 63 | let mut s = downloads.to_string_lossy().to_string(); | ||
| 64 | if !s.ends_with(std::path::MAIN_SEPARATOR) { | ||
| 65 | s.push(std::path::MAIN_SEPARATOR); | ||
| 66 | } | ||
| 67 | format!("{s}%(title)s-%(id)s.%(ext)s") | ||
| 68 | } | ||
src/global/functions/run_command.rs +35 −11
| @@ -4,7 +4,6 @@ use crate::{ | |||
| 4 | load_configs, | 4 | load_configs, |
| 5 | }; | 5 | }; |
| 6 | use crossterm::event::{KeyEvent, KeyModifiers}; | 6 | use crossterm::event::{KeyEvent, KeyModifiers}; |
| 7 | use home::home_dir; | ||
| 8 | use ratatui::{backend::CrosstermBackend, Terminal}; | 7 | use ratatui::{backend::CrosstermBackend, Terminal}; |
| 9 | use std::{ | 8 | use std::{ |
| 10 | env, | 9 | env, |
| @@ -156,17 +155,14 @@ pub fn run_single_command( | |||
| 156 | } | 155 | } |
| 157 | ["rmcache", id] => { | 156 | ["rmcache", id] => { |
| 158 | let res = LocalStore::rm_cache(id); | 157 | let res = LocalStore::rm_cache(id); |
| 158 | let data = paths::data_dir(); | ||
| 159 | let _ = fs::remove_file( | 159 | let _ = fs::remove_file( |
| 160 | home_dir() | 160 | data.join("info") |
| 161 | .unwrap() | ||
| 162 | .join(".local/share/youtube-tui/info/") | ||
| 163 | .join(id) | 161 | .join(id) |
| 164 | .with_extension("json"), | 162 | .with_extension("json"), |
| 165 | ); | 163 | ); |
| 166 | let _ = fs::remove_file( | 164 | let _ = fs::remove_file( |
| 167 | home_dir() | 165 | data.join("thumbnails") |
| 168 | .unwrap() | ||
| 169 | .join(".local/share/youtube-tui/thumbnails/") | ||
| 170 | .join(id), | 166 | .join(id), |
| 171 | ); | 167 | ); |
| 172 | if res { | 168 | if res { |
| @@ -351,9 +347,11 @@ pub fn run_single_command( | |||
| 351 | let command = command[1..].join(" "); | 347 | let command = command[1..].join(" "); |
| 352 | *framework.data.global.get_mut::<Message>().unwrap() = | 348 | *framework.data.global.get_mut::<Message>().unwrap() = |
| 353 | Message::Success(command.clone()); | 349 | Message::Success(command.clone()); |
| 350 | let shell = &framework.data.global.get::<MainConfig>().unwrap().shell; | ||
| 351 | let shell_flag = shell_flag(shell); | ||
| 354 | if let Ok(mut child) = | 352 | if let Ok(mut child) = |
| 355 | Command::new(&framework.data.global.get::<MainConfig>().unwrap().shell) | 353 | Command::new(shell) |
| 356 | .args(["-c", &command]) | 354 | .args([shell_flag, &command]) |
| 357 | .stdout(Stdio::null()) | 355 | .stdout(Stdio::null()) |
| 358 | .stderr(Stdio::null()) | 356 | .stderr(Stdio::null()) |
| 359 | .spawn() | 357 | .spawn() |
| @@ -365,8 +363,10 @@ pub fn run_single_command( | |||
| 365 | let command = command[1..].join(" "); | 363 | let command = command[1..].join(" "); |
| 366 | *framework.data.global.get_mut::<Message>().unwrap() = | 364 | *framework.data.global.get_mut::<Message>().unwrap() = |
| 367 | Message::Success(command.clone()); | 365 | Message::Success(command.clone()); |
| 368 | let _ = Command::new(&framework.data.global.get::<MainConfig>().unwrap().shell) | 366 | let shell = &framework.data.global.get::<MainConfig>().unwrap().shell; |
| 369 | .args(["-c", &command]) | 367 | let shell_flag = shell_flag(shell); |
| 368 | let _ = Command::new(shell) | ||
| 369 | .args([shell_flag, &command]) | ||
| 370 | .stdout(Stdio::null()) | 370 | .stdout(Stdio::null()) |
| 371 | .stderr(Stdio::null()) | 371 | .stderr(Stdio::null()) |
| 372 | .spawn(); | 372 | .spawn(); |
| @@ -655,6 +655,30 @@ pub fn run_single_command( | |||
| 655 | } | 655 | } |
| 656 | } | 656 | } |
| 657 | 657 | ||
| 658 | /// Returns the appropriate shell flag for the given shell command. | ||
| 659 | /// | ||
| 660 | /// On Windows, `cmd` and `cmd.exe` use `/C`, `powershell`/`pwsh` use `-Command`, | ||
| 661 | /// and everything else (e.g., bash from Git for Windows) uses `-c`. | ||
| 662 | /// On non-Windows platforms, always uses `-c`. | ||
| 663 | fn shell_flag(shell: &str) -> &'static str { | ||
| 664 | #[cfg(target_os = "windows")] | ||
| 665 | { | ||
| 666 | let shell_lower = shell.to_lowercase(); | ||
| 667 | if shell_lower == "cmd" || shell_lower == "cmd.exe" { | ||
| 668 | "/C" | ||
| 669 | } else if shell_lower.contains("powershell") || shell_lower.contains("pwsh") { | ||
| 670 | "-Command" | ||
| 671 | } else { | ||
| 672 | "-c" | ||
| 673 | } | ||
| 674 | } | ||
| 675 | #[cfg(not(target_os = "windows"))] | ||
| 676 | { | ||
| 677 | let _ = shell; | ||
| 678 | "-c" | ||
| 679 | } | ||
| 680 | } | ||
| 681 | |||
| 658 | const HELLO_WORLDS: &[&str] = &[ | 682 | const HELLO_WORLDS: &[&str] = &[ |
| 659 | "printf(\"Hello World\")", | 683 | "printf(\"Hello World\")", |
| 660 | "std::cout << \"Hello World\"", | 684 | "std::cout << \"Hello World\"", |
src/global/structs/history.rs +4 −4
| @@ -13,7 +13,7 @@ impl Key for WatchHistory { | |||
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | impl Collection<Item> for WatchHistory { | 15 | impl Collection<Item> for WatchHistory { |
| 16 | const INDEX_PATH: &'static str = ".local/share/youtube-tui/watch_history.json"; | 16 | const INDEX_PATH: &'static str = "watch_history.json"; |
| 17 | 17 | ||
| 18 | fn items(&self) -> &Vec<Item> { | 18 | fn items(&self) -> &Vec<Item> { |
| 19 | &self.0 | 19 | &self.0 |
| @@ -36,7 +36,7 @@ impl Key for SearchHistory { | |||
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | impl CollectionNoId<String> for SearchHistory { | 38 | impl CollectionNoId<String> for SearchHistory { |
| 39 | const INDEX_PATH: &'static str = ".local/share/youtube-tui/search_history.json"; | 39 | const INDEX_PATH: &'static str = "search_history.json"; |
| 40 | 40 | ||
| 41 | fn items(&self) -> &Vec<String> { | 41 | fn items(&self) -> &Vec<String> { |
| 42 | &self.0 | 42 | &self.0 |
| @@ -59,7 +59,7 @@ impl Key for CommandHistory { | |||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | impl CollectionNoId<String> for CommandHistory { | 61 | impl CollectionNoId<String> for CommandHistory { |
| 62 | const INDEX_PATH: &'static str = ".local/share/youtube-tui/command_history.json"; | 62 | const INDEX_PATH: &'static str = "command_history.json"; |
| 63 | 63 | ||
| 64 | fn items(&self) -> &Vec<String> { | 64 | fn items(&self) -> &Vec<String> { |
| 65 | &self.0 | 65 | &self.0 |
| @@ -83,7 +83,7 @@ impl Key for ChannelHistory { | |||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | impl CollectionNoId<String> for ChannelHistory { | 85 | impl CollectionNoId<String> for ChannelHistory { |
| 86 | const INDEX_PATH: &'static str = ".local/share/youtube-tui/channel_history.json"; | 86 | const INDEX_PATH: &'static str = "channel_history.json"; |
| 87 | 87 | ||
| 88 | fn items(&self) -> &Vec<String> { | 88 | fn items(&self) -> &Vec<String> { |
| 89 | &self.0 | 89 | &self.0 |
src/global/structs/library.rs +1 −1
| @@ -12,7 +12,7 @@ impl Key for Library { | |||
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | impl Collection<Item> for Library { | 14 | impl Collection<Item> for Library { |
| 15 | const INDEX_PATH: &'static str = ".local/share/youtube-tui/library.json"; | 15 | const INDEX_PATH: &'static str = "library.json"; |
| 16 | 16 | ||
| 17 | fn items(&self) -> &Vec<Item> { | 17 | fn items(&self) -> &Vec<Item> { |
| 18 | &self.0 | 18 | &self.0 |
src/global/structs/localstore.rs +7 −10
| @@ -6,13 +6,12 @@ | |||
| 6 | // this needs to change | 6 | // this needs to change |
| 7 | use std::{ | 7 | use std::{ |
| 8 | collections::{HashMap, HashSet}, | 8 | collections::{HashMap, HashSet}, |
| 9 | env::home_dir, | ||
| 10 | fs::{self, OpenOptions}, | 9 | fs::{self, OpenOptions}, |
| 11 | io::Write, | 10 | io::Write, |
| 12 | sync::OnceLock, | 11 | sync::OnceLock, |
| 13 | }; | 12 | }; |
| 14 | 13 | ||
| 15 | use crate::global::structs::Item; | 14 | use crate::global::{functions::paths, structs::Item}; |
| 16 | 15 | ||
| 17 | static mut LOCALSTORE: OnceLock<LocalStore> = OnceLock::new(); | 16 | static mut LOCALSTORE: OnceLock<LocalStore> = OnceLock::new(); |
| 18 | 17 | ||
| @@ -48,10 +47,9 @@ impl LocalStore { | |||
| 48 | .unwrap() | 47 | .unwrap() |
| 49 | .downloaded_images | 48 | .downloaded_images |
| 50 | .remove(id); | 49 | .remove(id); |
| 51 | let info_path = home_dir().unwrap().join(".local/share/youtube-tui/info/"); | 50 | let data = paths::data_dir(); |
| 52 | let thumbnail_path = home_dir() | 51 | let info_path = data.join("info"); |
| 53 | .unwrap() | 52 | let thumbnail_path = data.join("thumbnails"); |
| 54 | .join(".local/share/youtube-tui/thumbnails/"); | ||
| 55 | let _ = fs::remove_file(info_path.join(id).with_extension("json")); | 53 | let _ = fs::remove_file(info_path.join(id).with_extension("json")); |
| 56 | let _ = fs::remove_file(thumbnail_path.join(id)); | 54 | let _ = fs::remove_file(thumbnail_path.join(id)); |
| 57 | 55 | ||
| @@ -64,9 +62,8 @@ impl LocalStore { | |||
| 64 | match localstore.info.get(id) { | 62 | match localstore.info.get(id) { |
| 65 | Some(LocalRecord { item, .. }) => Some(item.clone()), | 63 | Some(LocalRecord { item, .. }) => Some(item.clone()), |
| 66 | None => { | 64 | None => { |
| 67 | let path = home_dir() | 65 | let path = paths::data_dir() |
| 68 | .unwrap() | 66 | .join(format!("info/{id}.json")); |
| 69 | .join(format!(".local/share/youtube-tui/info/{id}.json")); | ||
| 70 | 67 | ||
| 71 | if path.exists() { | 68 | if path.exists() { |
| 72 | serde_json::from_str(&fs::read_to_string(path).ok()?).ok()? | 69 | serde_json::from_str(&fs::read_to_string(path).ok()?).ok()? |
| @@ -83,7 +80,7 @@ impl LocalStore { | |||
| 83 | } | 80 | } |
| 84 | 81 | ||
| 85 | pub fn save_only(ids: &HashSet<String>) { | 82 | pub fn save_only(ids: &HashSet<String>) { |
| 86 | let info_path = home_dir().unwrap().join(".local/share/youtube-tui/info/"); | 83 | let info_path = paths::data_dir().join("info"); |
| 87 | 84 | ||
| 88 | for (id, LocalRecord { item, is_new }) in unsafe { LOCALSTORE.get() }.unwrap().info.iter() { | 85 | for (id, LocalRecord { item, is_new }) in unsafe { LOCALSTORE.get() }.unwrap().info.iter() { |
| 89 | let info = info_path.join(id).with_extension("json"); | 86 | let info = info_path.join(id).with_extension("json"); |
src/global/structs/providers/rustypipe.rs +1 −1
| @@ -24,7 +24,7 @@ impl Default for RustyPipeWrapper { | |||
| 24 | fn default() -> Self { | 24 | fn default() -> Self { |
| 25 | Self( | 25 | Self( |
| 26 | RustyPipe::builder() | 26 | RustyPipe::builder() |
| 27 | .storage_dir(home::home_dir().unwrap().join(".local/share/rustypipe")) | 27 | .storage_dir(crate::global::functions::paths::rustypipe_dir()) |
| 28 | .build() | 28 | .build() |
| 29 | .unwrap(), | 29 | .unwrap(), |
| 30 | ) | 30 | ) |
src/global/structs/subscriptions.rs +5 −7
| @@ -7,7 +7,6 @@ use crate::{ | |||
| 7 | }, | 7 | }, |
| 8 | }; | 8 | }; |
| 9 | use chrono::Utc; | 9 | use chrono::Utc; |
| 10 | use home::home_dir; | ||
| 11 | use serde::*; | 10 | use serde::*; |
| 12 | use std::{ | 11 | use std::{ |
| 13 | error::Error, | 12 | error::Error, |
| @@ -247,9 +246,8 @@ fn update_channel_cache( | |||
| 247 | channel: &FullChannelItem, | 246 | channel: &FullChannelItem, |
| 248 | image_index: usize, | 247 | image_index: usize, |
| 249 | ) -> Result<(), Box<dyn Error>> { | 248 | ) -> Result<(), Box<dyn Error>> { |
| 250 | let home_dir = home_dir().unwrap(); | 249 | let cache_path = crate::global::functions::paths::data_dir().join(format!( |
| 251 | let cache_path = home_dir.join(format!( | 250 | "channels/{}.json", |
| 252 | ".local/share/youtube-tui/channels/{}.json", | ||
| 253 | channel.id | 251 | channel.id |
| 254 | )); | 252 | )); |
| 255 | 253 | ||
| @@ -318,7 +316,7 @@ impl CollectionItem for SubItem { | |||
| 318 | } | 316 | } |
| 319 | 317 | ||
| 320 | impl Collection<SubItem> for Subscriptions { | 318 | impl Collection<SubItem> for Subscriptions { |
| 321 | const INDEX_PATH: &'static str = ".local/share/youtube-tui/subscriptions.json"; | 319 | const INDEX_PATH: &'static str = "subscriptions.json"; |
| 322 | 320 | ||
| 323 | fn items(&self) -> &Vec<SubItem> { | 321 | fn items(&self) -> &Vec<SubItem> { |
| 324 | &self.0 | 322 | &self.0 |
| @@ -337,7 +335,7 @@ impl Collection<SubItem> for Subscriptions { | |||
| 337 | .truncate(true) | 335 | .truncate(true) |
| 338 | .write(true) | 336 | .write(true) |
| 339 | .create(true) | 337 | .create(true) |
| 340 | .open(home_dir().unwrap().join(Self::INDEX_PATH))?; | 338 | .open(crate::global::functions::paths::data_dir().join(Self::INDEX_PATH))?; |
| 341 | 339 | ||
| 342 | let save_string = serde_json::to_string_pretty(self)?; | 340 | let save_string = serde_json::to_string_pretty(self)?; |
| 343 | file.write_all(save_string.as_bytes())?; | 341 | file.write_all(save_string.as_bytes())?; |
| @@ -349,7 +347,7 @@ impl Collection<SubItem> for Subscriptions { | |||
| 349 | } | 347 | } |
| 350 | 348 | ||
| 351 | fn load() -> Self { | 349 | fn load() -> Self { |
| 352 | let path = home_dir().unwrap().join(Self::INDEX_PATH); | 350 | let path = crate::global::functions::paths::data_dir().join(Self::INDEX_PATH); |
| 353 | let res = (|| -> Result<Self, Box<dyn Error>> { | 351 | let res = (|| -> Result<Self, Box<dyn Error>> { |
| 354 | let file_string = fs::read_to_string(&path)?; | 352 | let file_string = fs::read_to_string(&path)?; |
| 355 | let deserialized = serde_json::from_str(&file_string)?; | 353 | let deserialized = serde_json::from_str(&file_string)?; |
src/global/traits/collection.rs +13 −11
| @@ -1,4 +1,3 @@ | |||
| 1 | use home::home_dir; | ||
| 2 | use serde::{de::DeserializeOwned, Serialize}; | 1 | use serde::{de::DeserializeOwned, Serialize}; |
| 3 | use std::{ | 2 | use std::{ |
| 4 | error::Error, | 3 | error::Error, |
| @@ -6,6 +5,8 @@ use std::{ | |||
| 6 | io::Write, | 5 | io::Write, |
| 7 | }; | 6 | }; |
| 8 | 7 | ||
| 8 | use crate::global::functions::paths; | ||
| 9 | |||
| 9 | pub trait CollectionItem { | 10 | pub trait CollectionItem { |
| 10 | fn id(&self) -> Option<&str>; | 11 | fn id(&self) -> Option<&str>; |
| 11 | fn children_ids(&self) -> Vec<&str>; | 12 | fn children_ids(&self) -> Vec<&str>; |
| @@ -40,7 +41,7 @@ where | |||
| 40 | .filter(|id| !id.is_empty()) | 41 | .filter(|id| !id.is_empty()) |
| 41 | .collect::<Vec<&str>>(), | 42 | .collect::<Vec<&str>>(), |
| 42 | )?; | 43 | )?; |
| 43 | let path = home_dir().unwrap().join(Self::INDEX_PATH); | 44 | let path = paths::data_dir().join(Self::INDEX_PATH); |
| 44 | 45 | ||
| 45 | let mut file = OpenOptions::new() | 46 | let mut file = OpenOptions::new() |
| 46 | .write(true) | 47 | .write(true) |
| @@ -88,7 +89,7 @@ where | |||
| 88 | 89 | ||
| 89 | /// loads watch history from file | 90 | /// loads watch history from file |
| 90 | fn load() -> Self { | 91 | fn load() -> Self { |
| 91 | let path = home_dir().unwrap().join(Self::INDEX_PATH); | 92 | let path = paths::data_dir().join(Self::INDEX_PATH); |
| 92 | let res = (|| -> Result<Vec<String>, Box<dyn Error>> { | 93 | let res = (|| -> Result<Vec<String>, Box<dyn Error>> { |
| 93 | let file_string = fs::read_to_string(&path)?; | 94 | let file_string = fs::read_to_string(&path)?; |
| 94 | let deserialized = serde_json::from_str(&file_string)?; | 95 | let deserialized = serde_json::from_str(&file_string)?; |
| @@ -98,7 +99,7 @@ where | |||
| 98 | // if res is err, then the file either doesn't exist of has be altered incorrectly, in | 99 | // if res is err, then the file either doesn't exist of has be altered incorrectly, in |
| 99 | // which case returns Self::default() | 100 | // which case returns Self::default() |
| 100 | let items = if let Ok(deserialized) = res { | 101 | let items = if let Ok(deserialized) = res { |
| 101 | let info = home_dir().unwrap().join(".local/share/youtube-tui/info/"); | 102 | let info = paths::data_dir().join("info"); |
| 102 | deserialized | 103 | deserialized |
| 103 | .into_iter() | 104 | .into_iter() |
| 104 | .filter_map(|id| fs::read_to_string(info.join(format!("{id}.json"))).ok()) | 105 | .filter_map(|id| fs::read_to_string(info.join(format!("{id}.json"))).ok()) |
| @@ -124,11 +125,12 @@ where | |||
| 124 | 125 | ||
| 125 | /// moves thumbnails of videos in watch history from cache back to storage when exiting, so that thumbnails can be viewed offline | 126 | /// moves thumbnails of videos in watch history from cache back to storage when exiting, so that thumbnails can be viewed offline |
| 126 | fn exit_move(&self) { | 127 | fn exit_move(&self) { |
| 127 | let home_dir = home_dir().unwrap(); | 128 | let data = paths::data_dir(); |
| 128 | let store_thumbnails_path = home_dir.join(".local/share/youtube-tui/thumbnails/"); | 129 | let cache = paths::cache_dir(); |
| 129 | let store_info_path = home_dir.join(".local/share/youtube-tui/info/"); | 130 | let store_thumbnails_path = data.join("thumbnails"); |
| 130 | let cache_thumbnails_path = home_dir.join(".cache/youtube-tui/thumbnails/"); | 131 | let store_info_path = data.join("info"); |
| 131 | let cache_info_path = home_dir.join(".cache/youtube-tui/info"); | 132 | let cache_thumbnails_path = cache.join("thumbnails"); |
| 133 | let cache_info_path = cache.join("info"); | ||
| 132 | 134 | ||
| 133 | self.items().iter().for_each(|item| { | 135 | self.items().iter().for_each(|item| { |
| 134 | let id = item.id().unwrap_or("invalid-dump"); | 136 | let id = item.id().unwrap_or("invalid-dump"); |
| @@ -189,7 +191,7 @@ where | |||
| 189 | /// saves the current state of watch history into a file | 191 | /// saves the current state of watch history into a file |
| 190 | fn save(&self) -> Result<(), Box<dyn Error>> { | 192 | fn save(&self) -> Result<(), Box<dyn Error>> { |
| 191 | let save_string = serde_json::to_string_pretty(&self)?; | 193 | let save_string = serde_json::to_string_pretty(&self)?; |
| 192 | let path = home_dir().unwrap().join(Self::INDEX_PATH); | 194 | let path = paths::data_dir().join(Self::INDEX_PATH); |
| 193 | 195 | ||
| 194 | let mut file = OpenOptions::new() | 196 | let mut file = OpenOptions::new() |
| 195 | .write(true) | 197 | .write(true) |
| @@ -218,7 +220,7 @@ where | |||
| 218 | 220 | ||
| 219 | /// loads watch history from file | 221 | /// loads watch history from file |
| 220 | fn load() -> Self { | 222 | fn load() -> Self { |
| 221 | let path = home_dir().unwrap().join(Self::INDEX_PATH); | 223 | let path = paths::data_dir().join(Self::INDEX_PATH); |
| 222 | let res = (|| -> Result<Vec<T>, Box<dyn Error>> { | 224 | let res = (|| -> Result<Vec<T>, Box<dyn Error>> { |
| 223 | let file_string = fs::read_to_string(&path)?; | 225 | let file_string = fs::read_to_string(&path)?; |
| 224 | let deserialized = serde_json::from_str(&file_string)?; | 226 | let deserialized = serde_json::from_str(&file_string)?; |
src/global/traits/configtrait.rs +2 −4
| @@ -1,4 +1,3 @@ | |||
| 1 | use home::home_dir; | ||
| 2 | use serde::{de::DeserializeOwned, Serialize}; | 1 | use serde::{de::DeserializeOwned, Serialize}; |
| 3 | use std::{ | 2 | use std::{ |
| 4 | error::Error, | 3 | error::Error, |
| @@ -6,7 +5,7 @@ use std::{ | |||
| 6 | io::Write, | 5 | io::Write, |
| 7 | }; | 6 | }; |
| 8 | 7 | ||
| 9 | use crate::config::WriteConfig; | 8 | use crate::{config::WriteConfig, global::functions::paths}; |
| 10 | 9 | ||
| 11 | pub const EXTENSION: &str = "yml"; | 10 | pub const EXTENSION: &str = "yml"; |
| 12 | 11 | ||
| @@ -18,9 +17,8 @@ pub trait ConfigTrait { | |||
| 18 | where | 17 | where |
| 19 | Self: Serialize + DeserializeOwned + Default + Clone, | 18 | Self: Serialize + DeserializeOwned + Default + Clone, |
| 20 | { | 19 | { |
| 21 | let home_dir = home_dir().unwrap(); | ||
| 22 | let config_path = | 20 | let config_path = |
| 23 | home_dir.join(format!(".config/youtube-tui/{}.{}", Self::LABEL, EXTENSION)); | 21 | paths::config_dir().join(format!("{}.{}", Self::LABEL, EXTENSION)); |
| 24 | 22 | ||
| 25 | // The config struct | 23 | // The config struct |
| 26 | let config: Self = { | 24 | let config: Self = { |
src/init.rs +6 −12
| @@ -2,7 +2,6 @@ use crate::{ | |||
| 2 | config::*, | 2 | config::*, |
| 3 | global::{functions::*, structs::*, traits::*}, | 3 | global::{functions::*, structs::*, traits::*}, |
| 4 | }; | 4 | }; |
| 5 | use home::home_dir; | ||
| 6 | use ratatui::{backend::CrosstermBackend, Terminal}; | 5 | use ratatui::{backend::CrosstermBackend, Terminal}; |
| 7 | use std::{ | 6 | use std::{ |
| 8 | collections::HashSet, | 7 | collections::HashSet, |
| @@ -29,23 +28,19 @@ pub fn init( | |||
| 29 | command: Option<&str>, | 28 | command: Option<&str>, |
| 30 | ) -> Result<(), Box<dyn Error>> { | 29 | ) -> Result<(), Box<dyn Error>> { |
| 31 | LocalStore::init(); | 30 | LocalStore::init(); |
| 32 | let home_dir = home_dir().unwrap(); | ||
| 33 | RUNTIME | 31 | RUNTIME |
| 34 | .set(Builder::new_current_thread().enable_all().build().unwrap()) | 32 | .set(Builder::new_current_thread().enable_all().build().unwrap()) |
| 35 | .unwrap(); | 33 | .unwrap(); |
| 36 | 34 | ||
| 37 | // creating files | 35 | // creating files |
| 36 | let data = paths::data_dir(); | ||
| 38 | [ | 37 | [ |
| 39 | // ".cache/youtube-tui/thumbnails/", | 38 | data.join("thumbnails"), |
| 40 | // ".cache/youtube-tui/info/", | 39 | data.join("info"), |
| 41 | // ".cache/youtube-tui/channels/", | 40 | data.join("saved"), |
| 42 | ".local/share/youtube-tui/thumbnails/", | ||
| 43 | ".local/share/youtube-tui/info/", | ||
| 44 | ".local/share/youtube-tui/saved/", | ||
| 45 | ] | 41 | ] |
| 46 | .into_iter() | 42 | .into_iter() |
| 47 | .for_each(|s| { | 43 | .for_each(|dir| { |
| 48 | let dir = home_dir.join(s); | ||
| 49 | if !dir.exists() { | 44 | if !dir.exists() { |
| 50 | fs::create_dir_all(dir).unwrap(); | 45 | fs::create_dir_all(dir).unwrap(); |
| 51 | } | 46 | } |
| @@ -136,8 +131,7 @@ pub fn init( | |||
| 136 | 131 | ||
| 137 | /// reload all config files | 132 | /// reload all config files |
| 138 | pub fn load_configs(framework: &mut FrameworkClean) -> Result<(), Box<dyn Error>> { | 133 | pub fn load_configs(framework: &mut FrameworkClean) -> Result<(), Box<dyn Error>> { |
| 139 | let home_dir = home_dir().unwrap(); | 134 | let config_path = paths::config_dir(); |
| 140 | let config_path = home_dir.join(".config/youtube-tui/"); | ||
| 141 | 135 | ||
| 142 | if !&config_path.exists() { | 136 | if !&config_path.exists() { |
| 143 | fs::create_dir_all(&config_path).unwrap(); | 137 | fs::create_dir_all(&config_path).unwrap(); |
src/items/iteminfo.rs +2 −3
| @@ -53,9 +53,8 @@ impl FrameworkItem for ItemInfo { | |||
| 53 | 53 | ||
| 54 | #[cfg(any(feature = "sixel", feature = "halfblock"))] | 54 | #[cfg(any(feature = "sixel", feature = "halfblock"))] |
| 55 | { | 55 | { |
| 56 | let thumbnail_path = home::home_dir() | 56 | let thumbnail_path = crate::global::functions::paths::data_dir() |
| 57 | .unwrap() | 57 | .join("thumbnails") |
| 58 | .join(".local/share/youtube-tui/thumbnails/") | ||
| 59 | .join(item.thumbnail_id()); | 58 | .join(item.thumbnail_id()); |
| 60 | if thumbnail_path.exists() { | 59 | if thumbnail_path.exists() { |
| 61 | #[cfg(any(feature = "sixel", feature = "halfblock"))] | 60 | #[cfg(any(feature = "sixel", feature = "halfblock"))] |
src/run.rs +6 −2
| @@ -1,4 +1,4 @@ | |||
| 1 | use crossterm::event::{self, Event, MouseButton, MouseEventKind}; | 1 | use crossterm::event::{self, Event, KeyEventKind, MouseButton, MouseEventKind}; |
| 2 | use ratatui::{backend::CrosstermBackend, Terminal}; | 2 | use ratatui::{backend::CrosstermBackend, Terminal}; |
| 3 | #[cfg(feature = "mpv")] | 3 | #[cfg(feature = "mpv")] |
| 4 | use std::time::{Duration, Instant}; | 4 | use std::time::{Duration, Instant}; |
| @@ -272,7 +272,11 @@ pub fn run( | |||
| 272 | .push(Task::RenderAll); | 272 | .push(Task::RenderAll); |
| 273 | } | 273 | } |
| 274 | } | 274 | } |
| 275 | Event::Key(key) => key_input(key, framework, terminal), | 275 | // Only handle Press events; ignore Release/Repeat to avoid |
| 276 | // duplicate key actions on Windows terminals that send enhanced key events. | ||
| 277 | Event::Key(key) if key.kind == KeyEventKind::Press => { | ||
| 278 | key_input(key, framework, terminal) | ||
| 279 | } | ||
| 276 | // always render if there is a screen resize event | 280 | // always render if there is a screen resize event |
| 277 | Event::Resize(_, _) => { | 281 | Event::Resize(_, _) => { |
| 278 | framework | 282 | framework |