mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-10-04 17:09:21 +00:00
Compare commits
313 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a5951cedb2 | ||
|
039c9f60b1 | ||
|
548b54e633 | ||
|
7d8f10d528 | ||
|
a3446428e8 | ||
|
5145f40125 | ||
|
5048dda2aa | ||
|
21a878de5a | ||
|
07b2c83f9a | ||
|
7c0863db3d | ||
|
8b606395d1 | ||
|
21edcc0eb9 | ||
|
2b04747804 | ||
|
92cda8174c | ||
|
d20e7b3523 | ||
|
3c3e2cc571 | ||
|
0e83e2099d | ||
|
04280a688e | ||
|
43416ebad5 | ||
|
a0c93da74d | ||
|
a70db16a74 | ||
|
f46aaf8672 | ||
|
78dd4b6991 | ||
|
792030d00b | ||
|
8bb056fa02 | ||
|
63bc62bf80 | ||
|
96c35229f0 | ||
|
e5e0b4ccce | ||
|
20d99da018 | ||
|
58b0cf9a90 | ||
|
ef626b2c36 | ||
|
2359a3ce2e | ||
|
ca0d661fc8 | ||
|
5885c3033e | ||
|
7e42f0c5c3 | ||
|
b80b09376a | ||
|
4cd78d3148 | ||
|
10843ffabb | ||
|
fcf7a3fca4 | ||
|
b9b3f05fab | ||
|
5996edbc9d | ||
|
45b72832bb | ||
|
dcadf98d3d | ||
|
76fc53bb14 | ||
|
6a59d33581 | ||
|
b5deb6b255 | ||
|
f1e1915a08 | ||
|
d480966172 | ||
|
936aeab35a | ||
|
aa4395279d | ||
|
b30e6e6d18 | ||
|
771ead2701 | ||
|
2daaa57f3a | ||
|
f33124b583 | ||
|
7b524080d4 | ||
|
0b75228f60 | ||
|
bd230f31f7 | ||
|
ab92616da8 | ||
|
a81ef5c0f9 | ||
|
b01c7b2202 | ||
|
88db64361a | ||
|
3bedbcf7f5 | ||
|
0171d3e343 | ||
|
721ebe00f6 | ||
|
f13ea88dde | ||
|
7577752047 | ||
|
2301000a72 | ||
|
61661095a0 | ||
|
31b1ce0bf1 | ||
|
33b5b2ef60 | ||
|
30f7146786 | ||
|
3f4f8170b9 | ||
|
2082fd19d1 | ||
|
e95d09a26a | ||
|
2cd4879fb3 | ||
|
8fb27be14f | ||
|
fe4c581b2c | ||
|
91526082fb | ||
|
ab55150101 | ||
|
3459833a62 | ||
|
4044fb6b92 | ||
|
f7c37dd934 | ||
|
515e2621a2 | ||
|
9daacddda1 | ||
|
c5c34637b8 | ||
|
19b4861e83 | ||
|
db26756ea7 | ||
|
928bbf0760 | ||
|
868344c1a4 | ||
|
153f804626 | ||
|
a9e3db5d8f | ||
|
9729361a3e | ||
|
a6eb4ccf91 | ||
|
f1d52bd240 | ||
|
0e49201dbb | ||
|
d05020404f | ||
|
b36385d53d | ||
|
ba88942bcd | ||
|
515e2fb886 | ||
|
4096d3c988 | ||
|
20e48eceac | ||
|
d521f5168e | ||
|
f4982c76f5 | ||
|
ec5b826d27 | ||
|
0ae45fb404 | ||
|
f26d2870cb | ||
|
b40b0b1d4f | ||
|
7e042c4b5a | ||
|
c2612b8d8c | ||
|
10c3ff2d3e | ||
|
76c3e949fe | ||
|
f3b3383781 | ||
|
b86f014099 | ||
|
f9f32ef28b | ||
|
96c62b0774 | ||
|
460f798d13 | ||
|
b7bb03b6ab | ||
|
eb8f115df4 | ||
|
ae46d6f895 | ||
|
7e073ef573 | ||
|
0b8587cc24 | ||
|
45f0204d7b | ||
|
4e275bf66d | ||
|
3ff01a0154 | ||
|
aa8e64c1be | ||
|
44517d2cd4 | ||
|
c53235dc90 | ||
|
f3bc7145e4 | ||
|
27ee879d25 | ||
|
f2be7906ec | ||
|
04ba1d2c3b | ||
|
b6b4e09287 | ||
|
6f1ed5c0b7 | ||
|
432eb89e2d | ||
|
08ea6945fa | ||
|
10be9f4759 | ||
|
148742e1fe | ||
|
b01f0eb22f | ||
|
ed9cbac233 | ||
|
7f0ff292d2 | ||
|
48787b3684 | ||
|
6107b29f50 | ||
|
dfd4289831 | ||
|
bf86605250 | ||
|
7b3db5d9e5 | ||
|
6b09927962 | ||
|
01d1f19d1d | ||
|
69e4ae5cfc | ||
|
e8e3376c26 | ||
|
52fc2b82de | ||
|
8b82840ffd | ||
|
61ba88b41b | ||
|
2cce750243 | ||
|
6b9d7ac78b | ||
|
895698fe40 | ||
|
7fb2a53243 | ||
|
c7742fca0a | ||
|
b25d52a41e | ||
|
c970c48f94 | ||
|
9b15f1492c | ||
|
b375c116e0 | ||
|
0cf1405ae8 | ||
|
48b8b08016 | ||
|
ab5810969c | ||
|
9266678368 | ||
|
f8ef1b93c7 | ||
|
822ed78efc | ||
|
29868195e3 | ||
|
7aa1920c61 | ||
|
141e34a1bd | ||
|
d7f5c575d3 | ||
|
afbc03605b | ||
|
b933a3d055 | ||
|
209216a516 | ||
|
7125998141 | ||
|
939127235f | ||
|
7f32a90ddf | ||
|
99b2946c70 | ||
|
ea3508f7a0 | ||
|
6d85553bdb | ||
|
0ddd2a109f | ||
|
99f48035bd | ||
|
d47861a7e6 | ||
|
941842d4ba | ||
|
56a04990f2 | ||
|
6cb08e60a1 | ||
|
196dfc009a | ||
|
cb0dae0a20 | ||
|
69747da81a | ||
|
9e31b7bf93 | ||
|
2246a39632 | ||
|
329265f284 | ||
|
972d677da5 | ||
|
039604f806 | ||
|
d392373102 | ||
|
3593445279 | ||
|
a01042f2ad | ||
|
4dd363f586 | ||
|
f1e61174d8 | ||
|
e5f67e8874 | ||
|
08fa10fb06 | ||
|
48492b87ef | ||
|
2770a31ad7 | ||
|
5953035e38 | ||
|
d55b9f6693 | ||
|
53496dbd92 | ||
|
43a22793dd | ||
|
2d1a5ddd45 | ||
|
81ea929146 | ||
|
2413839ec1 | ||
|
ac5a2ef8e2 | ||
|
86c5645fca | ||
|
b5be49e545 | ||
|
cf1d22aead | ||
|
e82c898ae1 | ||
|
25809bf721 | ||
|
20ce5253a7 | ||
|
4edbbd349f | ||
|
fe86db3b74 | ||
|
0a882fd483 | ||
|
afbf12bba7 | ||
|
87c50d46dc | ||
|
4dba6f2e09 | ||
|
18d838233f | ||
|
5182deeec1 | ||
|
53cc0067b4 | ||
|
534c1514d5 | ||
|
0f398662b5 | ||
|
2ea0a60685 | ||
|
e75aa64203 | ||
|
88a6c10d28 | ||
|
2fef67694d | ||
|
26495ccab5 | ||
|
528296626c | ||
|
cd928cae22 | ||
|
eeb53b0de2 | ||
|
f6a30f827c | ||
|
8ce6cee20e | ||
|
2bcfdab6d1 | ||
|
6d77ae4123 | ||
|
c09d2aecb0 | ||
|
14a6b486ad | ||
|
a79e74df1a | ||
|
9f1c18e90d | ||
|
18d465a6d2 | ||
|
b9bb282c8d | ||
|
cb8444c41a | ||
|
736b06ea3c | ||
|
264de7564a | ||
|
f3bd444b32 | ||
|
1059ccd566 | ||
|
c3c8c23d1d | ||
|
b6dc6ed22b | ||
|
76ea574cf9 | ||
|
24fd54c7bf | ||
|
4e3322448d | ||
|
f289ccd85d | ||
|
0d18832f71 | ||
|
0145b678ac | ||
|
07eb2417e9 | ||
|
e733824ab7 | ||
|
dd3987fa48 | ||
|
2ea7a484fb | ||
|
4d0b01be45 | ||
|
39b2ceef96 | ||
|
7afcf2f2ec | ||
|
25941af61b | ||
|
b0e9cc4782 | ||
|
62db9ad83a | ||
|
ebfe0dbc8c | ||
|
596952e0a2 | ||
|
4fc82847db | ||
|
94cac0676f | ||
|
cfa089e801 | ||
|
0e3fed419e | ||
|
4d0c127b9b | ||
|
656680b324 | ||
|
60e8f2a016 | ||
|
7d9ce8923e | ||
|
c034067573 | ||
|
cd4848e27c | ||
|
70af2fc12d | ||
|
b645fd71c5 | ||
|
572062d98b | ||
|
ac3d1f6c6b | ||
|
5104e448e5 | ||
|
2120fbad0f | ||
|
5c2cee5b3b | ||
|
ef2ed6257a | ||
|
2c19725d41 | ||
|
d7277adfdb | ||
|
ab7bffdfa4 | ||
|
3e375dd04e | ||
|
b91a583ed1 | ||
|
a8ebdf544d | ||
|
6ad6283895 | ||
|
b7eff48b27 | ||
|
9ace25a78c | ||
|
cfba9efae4 | ||
|
1eede4fece | ||
|
bc5478fa9f | ||
|
8479a60c5b | ||
|
496a254db1 | ||
|
567ba97539 | ||
|
cb9a0b659b | ||
|
f45d3d6955 | ||
|
07538e0bf1 | ||
|
1f58408293 | ||
|
054504a8ab | ||
|
5fbdfa35d6 | ||
|
431644d61d | ||
|
e3780099f4 | ||
|
f808a9c076 |
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) [2016] [Dylan Araps]
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
387
README.md
Normal file
387
README.md
Normal file
@@ -0,0 +1,387 @@
|
||||
# fetch
|
||||
|
||||
This is the home of my fetch script! This script gathers info <br />
|
||||
about your system and prints it to the terminal next to an image of your choice!
|
||||
|
||||
**NOTE: See this wiki page for info on the new info function and it's usage**
|
||||
|
||||
https://github.com/dylanaraps/fetch/wiki/Customizing-Info
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
<!-- Table of Contents {{{ -->
|
||||
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Features](#features)
|
||||
- [Dependencies](#dependencies)
|
||||
- [Installation](#installation)
|
||||
- [Post Install](#post-install)
|
||||
- [Usage](#usage)
|
||||
- [Frequently Asked Questions](#frequently-asked-questions)
|
||||
- [Issues and Workarounds](#issues-and-workarounds)
|
||||
- [Todo](#todo)
|
||||
- [Thanks](#thanks)
|
||||
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<!-- Features {{{ -->
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
- **Supports Linux, Mac OS X, BSD and Windows (Cygwin)!**
|
||||
- If the script doesn't work on your system, open an issue.
|
||||
- **It's Fast**
|
||||
- The script makes heavy use of bash builtins and <br \>string manipulation.
|
||||
- **Display an image next to the info. (or don't!)**
|
||||
- Use your current wallpaper, shuffle through a directory or just <br \>display an image of your choice.
|
||||
- Supports using w3m or iTerm2 to display the images.
|
||||
- **Highly Customizable**
|
||||
- You can customize almost everything.
|
||||
- See Usage below or lines 23-233 in script
|
||||
- **Take a screenshot at the end.**
|
||||
- It's disabled by default and you can specify the cmd <br \>to use with `--scrotcmd cmd` at launch or by <br \>changing the value of `$scrotcmd` in the script.
|
||||
- **Smart crop (or Waifu crop)**
|
||||
- See https://github.com/dylanaraps/fetch/wiki/What-is-Smart-Crop%3F
|
||||
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<!-- Dependences {{{ -->
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
||||
### Required dependencies:
|
||||
|
||||
**All OS:**
|
||||
|
||||
- `Bash 4.0+`
|
||||
|
||||
**Linux / BSD / Windows:**
|
||||
|
||||
- Uptime detection: `procps` or `procps-ng`
|
||||
|
||||
### Optional dependencies:
|
||||
|
||||
**All OS:**
|
||||
|
||||
- Displaying Images: `w3m`
|
||||
- You may also need `w3m-img`
|
||||
- **Note:** The script can now also use iTerm2's builtin image rendering instead of w3m!
|
||||
- Enable it by changing `$image_backend` to `iterm2` or by using the launch flag `--image_backend`.
|
||||
- Image Cropping, Resizing etc: `ImageMagick`
|
||||
- More accurate window manager detection: `wmctrl`
|
||||
|
||||
**Linux / BSD:**
|
||||
|
||||
- Display Wallpaper: `feh`, `nitrogen` or `gsettings`
|
||||
- Current Song: `mpc` or `cmus`
|
||||
- Resolution Detection: `xorg-xdpyinfo`
|
||||
- Take a screenshot on script finish: `scrot`
|
||||
- You can change this to another program with a `--scrot_cmd` and an in script option.
|
||||
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<!-- Installation {{{ -->
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
### Arch
|
||||
|
||||
1. Install **[fetch-git](https://aur.archlinux.org/packages/fetch-git/)** from the aur.
|
||||
|
||||
|
||||
### Others
|
||||
|
||||
1. Download the latest source at https://github.com/dylanaraps/fetch
|
||||
2. Make the file executable using chmod. `chmod +x /path/to/fetch`
|
||||
3. Move the script to somewhere in your $PATH or just run it from where it is.
|
||||
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<!-- Post Install {{{ -->
|
||||
|
||||
## Post Install
|
||||
|
||||
|
||||
#### Sizing the image correctly
|
||||
|
||||
**NOTE:** For the images to be sized correctly you need to set the `$font_width` variable.
|
||||
If you don't know your font width in pixels keep trying values until the image is sized correctly.
|
||||
|
||||
You can also use the launch flag `--font_width` to set it on the fly.
|
||||
|
||||
|
||||
#### Customizing what info gets displayed
|
||||
|
||||
At the top of the script there's a function that allows you to customize all of the info that gets displayed.
|
||||
|
||||
Here's what you can do:
|
||||
|
||||
- Add new info lines
|
||||
- Change the ordering of the info
|
||||
- Remove unwanted info lines
|
||||
- Use bash syntax to control when info gets displayed
|
||||
|
||||
See this wiki page that goes more in-depth about it:
|
||||
|
||||
https://github.com/dylanaraps/fetch/wiki/Customizing-Info
|
||||
|
||||
|
||||
#### Customizing the script using a custom alias
|
||||
|
||||
If you don't want to edit the script you can customize almost everything using launch flags!
|
||||
|
||||
Here's what my fetch alias looks like:
|
||||
|
||||
```sh
|
||||
alias fetch2="fetch \
|
||||
--block_range 1 8 \
|
||||
--line_wrap off \
|
||||
--bold off \
|
||||
--uptime_shorthand on \
|
||||
--gtk_shorthand on \
|
||||
--colors 4 1 8 8 8 7 \
|
||||
"
|
||||
```
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<!-- Usage {{{ -->
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
usage: ${0##*/} [--colors 1 2 3 4 5] [--kernel "\$\(uname -rs\)"]
|
||||
|
||||
Info:
|
||||
--speed_type Change the type of cpu speed to display.
|
||||
Possible values: current, min, max, bios,
|
||||
scaling_current, scaling_min, scaling_max
|
||||
NOTE: This only support Linux with cpufreq.
|
||||
--uptime_shorthand Shorten the output of uptime (tiny, on, off)
|
||||
--gpu_shorthand on/off Shorten the output of GPU
|
||||
--gtk_shorthand on/off Shorten output of gtk theme/icons
|
||||
--gtk2 on/off Enable/Disable gtk2 theme/icons output
|
||||
--gtk3 on/off Enable/Disable gtk3 theme/icons output
|
||||
|
||||
Text Colors:
|
||||
--colors 1 2 3 4 5 6 Change the color of text
|
||||
(title, @, subtitle, colon, underline, info)
|
||||
--title_color num Change the color of the title
|
||||
--at_color num Change the color of "@" in title
|
||||
--subtitle_color num Change the color of the subtitle
|
||||
--colon_color num Change the color of the colons
|
||||
--underline_color num Change the color of the underlines
|
||||
--info_color num Change the color of the info
|
||||
|
||||
Text Formatting:
|
||||
--underline on/off Enable/Disable title underline
|
||||
--underline_char char Character to use when underlineing title
|
||||
--line_wrap on/off Enable/Disable line wrapping
|
||||
--bold on/off Enable/Disable bold text
|
||||
--prompt_height num Set this to your prompt height to fix
|
||||
issues with the text going off screen at the top
|
||||
|
||||
Color Blocks:
|
||||
--color_blocks on/off Enable/Disable the color blocks
|
||||
--block_width num Width of color blocks
|
||||
--block_range start end --v
|
||||
Range of colors to print as blocks
|
||||
|
||||
Image:
|
||||
--image Image source. Where and what image we display.
|
||||
Possible values: wall, shuffle, /path/to/img, off
|
||||
--image_backend Which program to use to draw images.
|
||||
--shuffle_dir Which directory to shuffle for an image.
|
||||
--font_width px Used to automatically size the image
|
||||
--image_position Where to display the image: (Left/Right)
|
||||
--split_size num Width of img/text splits
|
||||
A value of 2 makes each split half the terminal
|
||||
width and etc
|
||||
--crop_mode Which crop mode to use
|
||||
Takes the values: normal, fit, fill
|
||||
--crop_offset value Change the crop offset for normal mode.
|
||||
Possible values: northwest, north, northeast,
|
||||
west, center, east, southwest, south, southeast
|
||||
|
||||
--xoffset px How close the image will be
|
||||
to the left edge of the window
|
||||
NOTE: This only works with w3m
|
||||
--yoffset px How close the image will be
|
||||
to the top edge of the window
|
||||
NOTE: This only works with w3m
|
||||
--gap num Gap between image and text right side
|
||||
to the top edge of the window
|
||||
NOTE: --gap can take a negative value which will
|
||||
move the text closer to the left side.
|
||||
--clean Remove all cropped images
|
||||
|
||||
Screenshot:
|
||||
--scrot /path/to/img Take a screenshot, if path is left empty
|
||||
the screenshot function will use
|
||||
\$scrot_dir and \$scrot_name.
|
||||
--scrot_cmd Screenshot program to launch
|
||||
|
||||
Other:
|
||||
--help Print this text and exit
|
||||
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<!-- Frequently Asked Questions {{{ -->
|
||||
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
|
||||
#### Why doesn't fetch support my wallpaper setter?
|
||||
|
||||
It's hard to add support for other wallpaper setters as<br \>
|
||||
they don't provide a way of getting the current wallpaper from the cli.
|
||||
|
||||
If your wallpaper setter **does** provide a way of getting the current wallpaper<br \>
|
||||
or you know where it's stored then adding support won't be a problem!<br \>
|
||||
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<!-- Issues and Workarounds {{{ -->
|
||||
|
||||
|
||||
## Issues and Workarounds
|
||||
|
||||
|
||||
#### The image is blank and won't show up.
|
||||
|
||||
|
||||
If the images display in `ranger` and `w3m` then it's an issue with my script and not<br \>
|
||||
your terminal emulator.
|
||||
|
||||
Some terminal emulators don't support viewing images with w3m. You can either disable<br \>
|
||||
images with `--image off` at launch or `image=off` inside the script.
|
||||
|
||||
|
||||
#### The image is rendering with black lines in Urxvt while using an xft font.
|
||||
|
||||
This is an issue with w3mimgdisplay and not the script. You can find a possible workaround here:
|
||||
|
||||
https://github.com/hut/ranger/issues/86#issuecomment-17346249
|
||||
|
||||
|
||||
#### The text is too long for my terminal window and wraps to the next line causing the image to not render correctly.
|
||||
|
||||
There are a few ways to fix this.
|
||||
|
||||
* Disable line wrapping with `line_wrap=off` in the script or with the launch flag `--line_wrap off`
|
||||
|
||||
* The uptime and gtk info lines each have a shorthand option that makes their output smaller. You can <br \>
|
||||
enable them by changing these variables or using these flags.
|
||||
|
||||
```sh
|
||||
# In script options
|
||||
uptime_shorthand="on"
|
||||
gtk_shorthand="on"
|
||||
gpu_shorthand="on"
|
||||
|
||||
# Launch flags
|
||||
--uptime_shorthand on
|
||||
--gtk_shorthand on
|
||||
--gpu_shorthand on
|
||||
```
|
||||
|
||||
* Edit the info array to make the subtitles shorter
|
||||
|
||||
* Resizing the terminal so that the lines don't wrap.
|
||||
|
||||
|
||||
#### The text is pushed over too far to the right
|
||||
|
||||
The easiest way to fix this is to change the value of `--gap` or `$gap`<br \>
|
||||
to a negative value. For example `--gap -10` will move the text 10 spaces to the left.
|
||||
|
||||
|
||||
#### getgpu doesn't show my exact video card name
|
||||
|
||||
If your `lspci | grep "VGA"` output looks like this:
|
||||
|
||||
```
|
||||
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1401 (rev a1)
|
||||
```
|
||||
|
||||
Instead of this:
|
||||
|
||||
```
|
||||
01:00.0 VGA compatible controller: NVIDIA Corporation GM206 [GeForce GTX 960] (rev a1)
|
||||
```
|
||||
|
||||
Then you're affected by the issue.
|
||||
|
||||
This is caused by your `/usr/share/misc/pci.ids\*` files being outdated and you can fix it<br \>
|
||||
by running this command as root.
|
||||
|
||||
```
|
||||
sudo update-pciids
|
||||
```
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<!-- Todo {{{ -->
|
||||
|
||||
|
||||
## Todo
|
||||
|
||||
Here's what's on my todo list
|
||||
|
||||
- More info outputs. Now that it's easy to customize what's printed and<br \>
|
||||
everything is a function we can add optional support for pretty much anything.
|
||||
|
||||
- Resolution (Just missing Windows support)
|
||||
- ~~GTK themes~~
|
||||
- Terminal Font
|
||||
- This will be difficult to add as there's no standard way of getting this info. We can't check<br \>
|
||||
for terminal config files because the user may have multiple terminals installed.<br \>
|
||||
Using `$PPID` isn't an option because it won't work in tmux/screen, subshells or neovim terminal splits.
|
||||
- GPU (In master but experimental) See **[issue #21](https://github.com/dylanaraps/fetch/issues/21)**.
|
||||
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<!-- Thanks {{{ -->
|
||||
|
||||
|
||||
## Thanks
|
||||
|
||||
Thanks to:
|
||||
|
||||
- metakirby5: Providing great feedback as well as ideas for the script.
|
||||
|
||||
- Screenfetch: I've used some snippets as a base for a few functions in this script.
|
||||
|
||||
- @jrgz: Helping me test the Mac OS X version.
|
||||
|
||||
- @xDemonessx: Helping me test the Windows version.
|
||||
|
||||
|
||||
<!-- }}} -->
|
156
Readme.md
156
Readme.md
@@ -1,156 +0,0 @@
|
||||
# fetch.sh
|
||||
### Check the releases page
|
||||
|
||||
https://github.com/dylanaraps/fetch.sh
|
||||
|
||||
|
||||
This is the home of my fetch script! This script gathers info <br\>
|
||||
about your system and prints it to the terminal.
|
||||
|
||||
I've spent the past few days rewriting this and it now supports <br\>
|
||||
other distros as well as a ton of new features and bug fixes.
|
||||
|
||||
If you're having any issues or have any ideas, please open an issue! <br\>
|
||||
I can't test on many other distros and I want this to work <br\>
|
||||
for as many people as possible.
|
||||
|
||||

|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
These are the script's required dependencies
|
||||
|
||||
- Text formatting, dynamic image size and padding: tput
|
||||
|
||||
These are the script's optional dependencies:
|
||||
|
||||
- Displaying Images: w3m
|
||||
- Image Cropping: ImageMagick
|
||||
- Display Wallpaper: feh
|
||||
- Current Song: mpc
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
The script now supports dynamic image sizing and padding,
|
||||
<br\> they're enabled by default and there's a variable you
|
||||
<br\> need to set for it to work correctly.
|
||||
|
||||
You can either change the variable $fontwidth inside of the
|
||||
<br\> script or launch it with "--fontwidth num".
|
||||
|
||||
Once you set the var the script will scale the image and padding
|
||||
<br\> to fit your terminal window.
|
||||
|
||||
You can disable this by changing the var "$img_auto" or by launching
|
||||
<br\> the script with "--size px".
|
||||
|
||||
Please report any bugs or issues you're having with this as I can't
|
||||
<br\> test with many configurations.
|
||||
|
||||
|
||||
```
|
||||
usage: scrot.sh [--colors 1 2 4 5] [--kernel "$(uname -rs)"]
|
||||
|
||||
Info:
|
||||
--title string Change the title at the top
|
||||
--distro string/cmd Manually set the distro
|
||||
--kernel string/cmd Manually set the kernel
|
||||
--uptime string/cmd Manually set the uptime
|
||||
--packages string/cmd Manually set the package count
|
||||
--shell string/cmd Manually set the shell
|
||||
--winman string/cmd Manually set the window manager
|
||||
--cpu string/cmd Manually set the cpu name
|
||||
--memory string/cmd Manually set the memory
|
||||
--speed string/cmd Manually set the cpu speed
|
||||
--speed_type Change the type of cpu speed to get
|
||||
Possible values: current, min, max
|
||||
--song string/cmd Manually set the current song
|
||||
|
||||
Text Colors:
|
||||
--colors 1 2 3 4 Change the color of text
|
||||
(title, subtitle, colon, info)
|
||||
--titlecol num Change the color of the title
|
||||
--subtitlecol num Change the color of the subtitle
|
||||
--coloncol num Change the color of the colons
|
||||
--infocol num Change the color of the info
|
||||
|
||||
Text Formatting:
|
||||
--nowrap Disable line wrapping
|
||||
--nobold Disable bold text
|
||||
|
||||
Color Blocks:
|
||||
--printcols start end Range of colors to print as blocks
|
||||
--blockwidth num Width of color blocks"
|
||||
--nopal Disable the color blocks
|
||||
|
||||
Image:
|
||||
--image Image to display with the script
|
||||
The image gets priority over other
|
||||
images: (wallpaper, \$img)
|
||||
|
||||
--fontwidth Used to automatically size the image
|
||||
--size px Change the size of the image
|
||||
--cropoffset value Change the crop offset. Possible values:
|
||||
northwest, north, northeast, west, center
|
||||
east, southwest, south, southeast
|
||||
--padding num How many spaces to pad the text
|
||||
to the right
|
||||
--xoffset px How close the image will be
|
||||
to the left edge of the window
|
||||
--yoffset px How close the image will be
|
||||
to the top edge of the window
|
||||
|
||||
--gap num Gap between image and text right side
|
||||
--noimg Disable all images
|
||||
--nowall Disable the wallpaper function
|
||||
and fallback to \$img
|
||||
--clean Remove all cropped images
|
||||
|
||||
Other:
|
||||
--help Print this text and exit
|
||||
```
|
||||
|
||||
|
||||
## TODO
|
||||
|
||||
Here's what's on my todo list
|
||||
|
||||
- Add an easy way to define info prefixes at launch.
|
||||
- Finish adding an option to smart crop images with plain color backgrounds.
|
||||
<br/>What this means is that your solid bg waifu wallpaper will be cropped around
|
||||
<br/>your waifu no matter where she is in the image.
|
||||
|
||||
|
||||
## Customization
|
||||
|
||||
I launch fetch using a shell function and a ton of flags. Here's how it looks:
|
||||
|
||||
```sh
|
||||
fetch () {
|
||||
fetch.sh \
|
||||
--printcols 1 7 \
|
||||
--cpu "AMD FX-6300" \
|
||||
--uptime "$(uptime -p | sed -e 's/minutes/mins/')" \
|
||||
--title "dylan's pc" \
|
||||
--nowrap \
|
||||
--nobold \
|
||||
$@
|
||||
}
|
||||
```
|
||||
|
||||
Notice how you can even pass commands? This allows you to easily use custom
|
||||
<br/> commands or even just bare strings to change the info.
|
||||
|
||||
|
||||
## Screenshots
|
||||
|
||||
#### The color script is now builtin.
|
||||

|
||||
|
||||
#### You can now customize the color of everything.
|
||||

|
||||
|
||||
#### You can now disable all images with a flag.
|
||||

|
502
fetch.sh
502
fetch.sh
@@ -1,502 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Fetch info about your system
|
||||
#
|
||||
# Optional Dependencies: (You'll lose these features without them)
|
||||
# Displaying Images: w3m
|
||||
# Image Cropping: ImageMagick
|
||||
# Wallpaper Display: feh Window Manager Detection: wmctrl
|
||||
# Current Song: mpc
|
||||
# Text formatting, dynamic image size and padding: tput
|
||||
#
|
||||
# Created by Dylan Araps
|
||||
# https://github.com/dylanaraps/dotfiles
|
||||
|
||||
|
||||
# Info Prefixes {{{
|
||||
# The titles that come before the info (Ram:, Cpu:, Uptime:)
|
||||
# TODO: Add an easy way to specify these at launch.
|
||||
|
||||
|
||||
title_os="OS"
|
||||
title_kernel="Kernel"
|
||||
title_uptime="Uptime"
|
||||
title_packages="Packages"
|
||||
title_shell="Shell"
|
||||
title_windowmanager="Window Manager"
|
||||
title_cpu="CPU"
|
||||
title_memory="Memory"
|
||||
title_song="Song"
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
# Text Formatting {{{
|
||||
|
||||
|
||||
# Line wrap
|
||||
# Set this to 0 or use the flag "--nowrap" to disable
|
||||
# line wrapping. Really useful for small terminal windows
|
||||
# and long lines.
|
||||
linewrap=1
|
||||
|
||||
# Set to "", comment this line or use the flaf "--nobold"
|
||||
# to disable bold text.
|
||||
bold=$(tput bold)
|
||||
|
||||
# Default colors
|
||||
# Colors can be defined at launch with:
|
||||
# "--titlecol 1, --subtitlecol 2, --coloncol 3, --infocol 4"
|
||||
# Or the shorthand "-c/--color 1 2 3 4"
|
||||
# Or by editing them below.
|
||||
title_color=$(tput setaf 7)
|
||||
subtitle_color=$(tput setaf 1)
|
||||
colon_color=$(tput setaf 7) # Also changes underline color
|
||||
info_color=$(tput setaf 7)
|
||||
|
||||
# Reset formatting
|
||||
# Removing this line will fuck up the text formatting
|
||||
clear=$(tput sgr0)
|
||||
|
||||
# Amount of left padding to use when images are disabled.
|
||||
# The variable takes a count of spaces. So a value of 10
|
||||
# will pad the text to the right 10 spaces.
|
||||
padding=10
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
# Custom Image {{{
|
||||
|
||||
|
||||
# Enable or disable the use of images (Disable images at launch with "--noimg")
|
||||
enableimages=1
|
||||
|
||||
# If 1, fetch will use a cropped version of your wallpaper as the image
|
||||
# (Disable this at launch with "--nowall")
|
||||
# NOTE: This is only compatible with feh, I can add support for more
|
||||
# wallpaper setters but you'll need to show me a way to get the current
|
||||
# wallpaper from the commandline.
|
||||
usewall=1
|
||||
|
||||
# The image to use if usewall=0. There's also the launch flags "-i" + "--image"
|
||||
# to set a custom image at launch.
|
||||
img="$HOME/Pictures/avatars/gon.png"
|
||||
|
||||
# Image size is based on terminal size
|
||||
# Using the flag "--size" sets this to 0.
|
||||
img_auto=1
|
||||
|
||||
# Image size to use if img_auto=0
|
||||
# Also configureable at launch with "--size"
|
||||
size=128
|
||||
|
||||
# Font width is needed to properly calulate the image size
|
||||
# If there's a gap on the right try increasing the value by 1
|
||||
# If there's an overlap try decreasing the value by 1
|
||||
fontwidth=5
|
||||
|
||||
# Gap is the amount of space between the image and the text on the right
|
||||
gap=4
|
||||
|
||||
# Image size/offset
|
||||
# (Customizable at launch with these flags: --xoffset 0 --yoffset 0")
|
||||
yoffset=0
|
||||
xoffset=0
|
||||
|
||||
# Default crop offset (Customizable at launch with --cropoffset)
|
||||
# Possible values:
|
||||
# northwest, north, northeast, west, center, east, southwest, south, southeast
|
||||
crop_offset="center"
|
||||
|
||||
# Directory to store cropped images
|
||||
imgtempdir="$HOME/.fetchimages"
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
# Get Info {{{
|
||||
# Commands to use when gathering info
|
||||
|
||||
|
||||
# Title (Configurable with "-t" and "--title" at launch)
|
||||
# To use the usual "user@hostname" change the line below to:
|
||||
title="$(whoami)@$(hostname)"
|
||||
|
||||
# Operating System (Configurable with "-O" and "--distro" at launch)
|
||||
# You can manually set this if the command below doesn't work for you.
|
||||
os=$(awk '/^NAME=/' /etc/*ease | sed -n 's/^NAME=//p' | tr -d '"')
|
||||
|
||||
# Linux kernel name/version (Configurable with "-K" and "--kernel" at launch)
|
||||
kernel=$(uname -r)
|
||||
|
||||
# System Uptime (Configurable with "-U" and "--uptime" at launch)
|
||||
uptime=$(uptime -p)
|
||||
|
||||
# Total number of packages (Configurable with "-P" and "--packages" at launch)
|
||||
# If your package manager can't be found open an issue on my github repo.
|
||||
# (Link is at the top)
|
||||
getpackages () {
|
||||
case $os in
|
||||
'Arch Linux'|'Parabola GNU/Linux-libre'|'Manjaro'|'Antergos') \
|
||||
packages=$(pacman -Q | wc -l) ;;
|
||||
'Ubuntu'|'Mint'|'Debian'|'Kali Linux') \
|
||||
packages=$(dpkg --get-selections | grep -v deinstall$ | wc -l) ;;
|
||||
'Slackware') \
|
||||
packages=$(ls -1 /var/log/packages | wc -l) ;;
|
||||
'Gentoo'|'Funtoo') \
|
||||
packages=$(ls -d /var/db/pkg/*/* | wc -l) ;;
|
||||
'Fedora'|'openSUSE'|'Red Hat Enterprise Linux'|'CentOS') \
|
||||
packages=$(rpm -qa | wc -l) ;;
|
||||
'CRUX') \
|
||||
packages=$(pkginfo -i | wc -l) ;;
|
||||
*) packages="unknown" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# Shell (Configurable with "-s" and "--shell" at launch)
|
||||
shell="$SHELL"
|
||||
|
||||
# Window manager (Configurable with "-W" and "--windowmanager" at launch)
|
||||
# (depends on wmctrl)
|
||||
# This can be detected without wmctrl by using an array of window manager
|
||||
# process names and pgrep but it's really slow.
|
||||
# (Doubles script startup time in some cases).
|
||||
# If you don't want to install wmctrl you can either edit the var below,
|
||||
# export the "windowmanager" variable in your shell's configuration file,
|
||||
# or run the script with: --windowmanager wmname
|
||||
# windowmanager="openbox"
|
||||
getwindowmanager () {
|
||||
if type -p wmctrl >/dev/null 2>&1; then
|
||||
windowmanager=$(wmctrl -m | awk '/Name:/ {printf $2}')
|
||||
elif [ -e ~/.xinitrc ]; then
|
||||
windowmanager=$(grep -v "^#" "${HOME}/.xinitrc" | tail -n 1 | cut -d " " -f2)
|
||||
else
|
||||
windowmanager="Unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Processor (Configurable with "-C", "-S" and "--cpu", "--speed" at launch)
|
||||
cpu="$(awk 'BEGIN{FS=":"} /model name/ {print $2; exit}' /proc/cpuinfo |\
|
||||
awk 'BEGIN{FS="@"; OFS="\n"} { print $1; exit }' |\
|
||||
sed -e 's/\((tm)\|(TM)\)//' -e 's/\((R)\|(r)\)//' -e 's/^\ //')"
|
||||
|
||||
# Get current/min/max cpu speed
|
||||
speed_type="max"
|
||||
cpuspeed () {
|
||||
case $speed_type in
|
||||
current) speed="$(lscpu | awk '/CPU MHz:/ {printf "scale=1; " $3 " / 1000 \n"}' | bc -l)" ;;
|
||||
min) speed="$(lscpu | awk '/CPU min MHz:/ {printf "scale=1; " $4 " / 1000 \n"}' | bc -l)" ;;
|
||||
max) speed="$(lscpu | awk '/CPU max MHz:/ {printf "scale=1; " $4 " / 1000 \n"}' | bc -l)" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Memory (Configurable with "-M" and "--memory" at launch)
|
||||
# Print the total amount of ram and amount of ram in use
|
||||
memory=$(free -m | awk '/Mem:/ {printf $3 "MB / " $2 "MB"}')
|
||||
|
||||
# Currently playing song/artist (Configurable with "-m" and "--song" at launch)
|
||||
song=$(mpc current)
|
||||
|
||||
# Print terminal colors in a line
|
||||
# (Configurable with "--printcols start end" at launch)
|
||||
# Start/End are vars for the range of colors to print
|
||||
# The default values below print 8 colors in total.
|
||||
start=0
|
||||
end=7
|
||||
|
||||
# Print the color blocks by default.
|
||||
printcols=1
|
||||
|
||||
# Widh of the color blocks
|
||||
blockwidth=3
|
||||
|
||||
printcols () {
|
||||
while [ "$start" -le "$end" ]; do
|
||||
printf "%s%${blockwidth}s" "$(tput setab $start)"
|
||||
start=$((start + 1))
|
||||
|
||||
# Split the blocks at 8 colors
|
||||
[ $end -ge 9 ] && [ $start -eq 8 ] && printf "\n%${pad}s" "$clear$pad"
|
||||
done
|
||||
|
||||
# Clear formatting
|
||||
printf "$clear"
|
||||
}
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
# Usage {{{
|
||||
|
||||
|
||||
usage () {
|
||||
printf '%s\n'
|
||||
printf '%s\n' "usage: ${0##*/} [--colors 1 2 4 5] [--kernel \"\$(uname -rs)\"]"
|
||||
printf '%s\n'
|
||||
printf '%s\n' " Info:"
|
||||
printf '%s\n' " --title string Change the title at the top"
|
||||
printf '%s\n' " --distro string/cmd Manually set the distro"
|
||||
printf '%s\n' " --kernel string/cmd Manually set the kernel"
|
||||
printf '%s\n' " --uptime string/cmd Manually set the uptime"
|
||||
printf '%s\n' " --packages string/cmd Manually set the package count"
|
||||
printf '%s\n' " --shell string/cmd Manually set the shell"
|
||||
printf '%s\n' " --winman string/cmd Manually set the window manager"
|
||||
printf '%s\n' " --cpu string/cmd Manually set the cpu name"
|
||||
printf '%s\n' " --memory string/cmd Manually set the memory"
|
||||
printf '%s\n' " --speed string/cmd Manually set the cpu speed"
|
||||
printf '%s\n' " --speed_type Change the type of cpu speed to get"
|
||||
printf '%s\n' " Possible values: current, min, max"
|
||||
printf '%s\n' " --song string/cmd Manually set the current song"
|
||||
printf '%s\n'
|
||||
printf '%s\n' " Text Colors:"
|
||||
printf '%s\n' " --colors 1 2 3 4 Change the color of text"
|
||||
printf '%s\n' " (title, subtitle, colon, info)"
|
||||
printf '%s\n' " --titlecol num Change the color of the title"
|
||||
printf '%s\n' " --subtitlecol num Change the color of the subtitle"
|
||||
printf '%s\n' " --coloncol num Change the color of the colons"
|
||||
printf '%s\n' " --infocol num Change the color of the info"
|
||||
printf '%s\n'
|
||||
printf '%s\n' " Text Formatting:"
|
||||
printf '%s\n' " --nowrap Disable line wrapping"
|
||||
printf '%s\n' " --nobold Disable bold text"
|
||||
printf '%s\n'
|
||||
printf '%s\n' " Color Blocks:"
|
||||
printf '%s\n' " --printcols start end Range of colors to print as blocks"
|
||||
printf '%s\n' " --blockwidth num Width of color blocks"
|
||||
printf '%s\n' " --nopal Disable the color blocks"
|
||||
printf '%s\n'
|
||||
printf '%s\n' " Image:"
|
||||
printf '%s\n' " --image Image to display with the script"
|
||||
printf '%s\n' " The image gets priority over other"
|
||||
printf '%s\n' " images: (wallpaper, \$img)"
|
||||
printf '%s\n' " --fontwidth px Used to automatically size the image"
|
||||
printf '%s\n' " --size px Change the size of the image"
|
||||
printf '%s\n' " --cropoffset value Change the crop offset. Possible values:"
|
||||
printf '%s\n' " northwest, north, northeast, west, center"
|
||||
printf '%s\n' " east, southwest, south, southeast"
|
||||
printf '%s\n'
|
||||
printf '%s\n' " --padding num How many spaces to pad the text"
|
||||
printf '%s\n' " to the right"
|
||||
printf '%s\n' " --xoffset px How close the image will be "
|
||||
printf '%s\n' " to the left edge of the window"
|
||||
printf '%s\n' " --yoffset px How close the image will be "
|
||||
printf '%s\n' " --gap num Gap between image and text right side"
|
||||
printf '%s\n' " to the top edge of the window"
|
||||
printf '%s\n' " --noimg Disable all images"
|
||||
printf '%s\n' " --nowall Disable the wallpaper function"
|
||||
printf '%s\n' " and fallback to \$img"
|
||||
printf '%s\n' " --clean Remove all cropped images"
|
||||
printf '%s\n'
|
||||
printf '%s\n' " Other:"
|
||||
printf '%s\n' " --help Print this text and exit"
|
||||
printf '%s\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
# Args {{{
|
||||
|
||||
|
||||
# Args
|
||||
args="$@"
|
||||
|
||||
for argument in $args; do
|
||||
case $1 in
|
||||
# Info
|
||||
--title) title="$2" ;;
|
||||
--distro) os="$2" ;;
|
||||
--kernel) kernel="$2" ;;
|
||||
--uptime) uptime="$2" ;;
|
||||
--packages) packages="$2" ;;
|
||||
--shell) shell="$2" ;;
|
||||
--winman) windowmanager="$2" ;;
|
||||
--cpu) cpu="$2" ;;
|
||||
--speed) speed="$2" ;;
|
||||
--speed_type) speed_type="$2" ;;
|
||||
--memory) memory="$2" ;;
|
||||
--song) song="$2" ;;
|
||||
|
||||
# Text Colors
|
||||
--colors) title_color="$(tput setaf $2)"; \
|
||||
[ ! -z $3 ] && subtitle_color="$(tput setaf $3)"; \
|
||||
[ ! -z $4 ] && colon_color="$(tput setaf $4)"; \
|
||||
[ ! -z $5 ] && info_color="$(tput setaf $5)" ;;
|
||||
--titlecol) title_color="$(tput setaf $2)" ;;
|
||||
--subtitlecol) subtitle_color="$(tput setaf $2)" ;;
|
||||
--coloncol) colon_color="$(tput setaf $2)" ;;
|
||||
--infocol) info_color="$(tput setaf $2)" ;;
|
||||
|
||||
# Text Formatting
|
||||
--nowrap) linewrap=0 ;;
|
||||
--nobold) bold="" ;;
|
||||
|
||||
# Color Blocks
|
||||
--printcols) start=$2; end=$3 ;;
|
||||
--nopal) printcols=0 ;;
|
||||
|
||||
# Image
|
||||
--image) usewall=0; img="$2" ;;
|
||||
--fontwidth) fontwidth="$2" ;;
|
||||
--size) img_auto=0 imgsize="$2" ;;
|
||||
--cropoffset) crop_offset="$2" ;;
|
||||
--padding) padding="$2" ;;
|
||||
--xoffset) xoffset="$2" ;;
|
||||
--yoffset) yoffset="$2" ;;
|
||||
--gap) gap="$2" ;;
|
||||
--noimg) enableimages=0 ;;
|
||||
--nowall) usewall=0 ;;
|
||||
--clean) rm -rf "$imgtempdir" || exit ;;
|
||||
|
||||
# Other
|
||||
--help) usage ;;
|
||||
esac
|
||||
|
||||
# The check here fixes shift in sh/mksh
|
||||
[ ! -z "$1" ] && shift
|
||||
done
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
# Image {{{
|
||||
|
||||
|
||||
# If the script was called with --noimg, disable images and padding
|
||||
if [ $enableimages -eq 1 ]; then
|
||||
# Check to see if auto=1
|
||||
if [ $img_auto -eq 1 ]; then
|
||||
# Image size is half of the terminal
|
||||
imgsize=$(($(tput cols) * fontwidth / 2))
|
||||
|
||||
# Padding is half the terminal width + gap
|
||||
padding=$(($(tput cols) / 2 + gap))
|
||||
fi
|
||||
|
||||
# If usewall=1, Get image to display from current wallpaper.
|
||||
# (only works with feh)
|
||||
[ $usewall -eq 1 ] && \
|
||||
img=$(awk '/feh/ {printf $3}' "$HOME/.fehbg" | sed -e "s/'//g")
|
||||
|
||||
# Get name of image and prefix it with it's crop offset
|
||||
imgname="$crop_offset-${img##*/}"
|
||||
|
||||
# This check allows you to resize the image at launch
|
||||
if [ -f "$imgtempdir/$imgname" ]; then
|
||||
imgheight=$(identify -format "%h" "$imgtempdir/$imgname")
|
||||
[ $imgheight != $imgsize ] && rm "$imgtempdir/$imgname"
|
||||
fi
|
||||
|
||||
# Check to see if the tempfile exists before we do any cropping.
|
||||
if [ ! -f "$imgtempdir/$imgname" ]; then
|
||||
# Check if the directory exists and create it if it doesn't
|
||||
[ ! -d "$imgtempdir" ] && (mkdir "$imgtempdir" || exit)
|
||||
|
||||
# Get wallpaper size so that we can do a better crop
|
||||
size=($(identify -format "%w %h" $img))
|
||||
|
||||
# This checks to see if height is geater than width
|
||||
# so we can do a better crop of portrait images.
|
||||
if [ ${size[1]} -gt ${size[0]} ]; then
|
||||
size=${size[0]}
|
||||
else
|
||||
size=${size[1]}
|
||||
fi
|
||||
|
||||
# Crop the image and save it to the $imgtempdir
|
||||
# By default we crop a square in the center of the image which is
|
||||
# "image height x image height".
|
||||
# We then resize it to the image size specified above.
|
||||
# (default 128x128 px, uses var $height)
|
||||
# This way we get a full image crop with the speed benefit
|
||||
# of a tiny image.
|
||||
convert \
|
||||
-crop "$size"x"$size"+0+0 \
|
||||
-gravity $crop_offset "$img" \
|
||||
-resize "$imgsize"x"$imgsize" "$imgtempdir/$imgname"
|
||||
fi
|
||||
|
||||
# The final image
|
||||
img="$imgtempdir/$imgname"
|
||||
else
|
||||
img=""
|
||||
fi
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
# Print Info {{{
|
||||
|
||||
|
||||
# Get cpu speed
|
||||
cpuspeed
|
||||
|
||||
# Get packages
|
||||
[ -z $packages ] && getpackages
|
||||
|
||||
# Get window manager
|
||||
[ -z $windowmanager ] && getwindowmanager
|
||||
|
||||
# Padding
|
||||
pad=$(printf "%${padding}s")
|
||||
|
||||
clear
|
||||
|
||||
# Underline title with length of title
|
||||
underline=$(printf %"${#title}"s |tr " " "-")
|
||||
|
||||
# Hide the terminal cursor while we print the info
|
||||
tput civis
|
||||
|
||||
# Print the title and underline
|
||||
printf "$pad$bold$title_color$title$clear \n"
|
||||
printf "$pad$colon_color$underline$clear \n"
|
||||
|
||||
# Custom printf function to make it easier to edit the info lines.
|
||||
printinfo () {
|
||||
printf "$pad$bold$subtitle_color$1$clear"
|
||||
printf "$colon_color:$clear "
|
||||
printf "$info_color$2$clear \n"
|
||||
}
|
||||
|
||||
# Disable line wrap
|
||||
[ $linewrap -eq 0 ] && tput rmam
|
||||
|
||||
printinfo "$title_os" "$os"
|
||||
printinfo "$title_kernel" "$kernel"
|
||||
printinfo "$title_uptime" "$uptime"
|
||||
printinfo "$title_packages" "$packages"
|
||||
printinfo "$title_shell" "$shell"
|
||||
printinfo "$title_windowmanager" "$windowmanager"
|
||||
printinfo "$title_cpu" "$cpu @ ${speed}GHz"
|
||||
printinfo "$title_memory" "$memory"
|
||||
printinfo "$title_song" "$song"
|
||||
|
||||
# Display the color blocks
|
||||
printf "\n"
|
||||
[ $printcols -eq 1 ] && printf "$pad$(printcols)"
|
||||
|
||||
# Enable line wrap again
|
||||
[ $linewrap -eq 0 ] && tput smam
|
||||
|
||||
# Display the image
|
||||
printf "0;1;$xoffset;$yoffset;$imgsize;$imgsize;;;;;$img\n4;\n3;" |\
|
||||
/usr/lib/w3m/w3mimgdisplay
|
||||
|
||||
# Show the cursor again
|
||||
tput cnorm
|
||||
|
||||
# Move the cursor to the bottom of the terminal
|
||||
tput cup $(tput lines)
|
||||
|
||||
|
||||
# }}}
|
Reference in New Issue
Block a user