Compare commits

..

313 Commits
0.1 ... 1.0

Author SHA1 Message Date
Dylan
a5951cedb2 Update Readme 2016-01-27 15:02:15 +11:00
Dylan
039c9f60b1 Rename shuffledir to shuffle_dir 2016-01-27 15:01:48 +11:00
Dylan
548b54e633 Un-hardcode getgtk formatting and cleanup the function. Added choclatey support for Windows 2016-01-27 11:53:12 +11:00
Dylan
7d8f10d528 Add vim comment to set fold method 2016-01-26 23:09:38 +11:00
Dylan
a3446428e8 Added folds for function so that it's easier to navigate the script inside vim 2016-01-26 23:06:53 +11:00
Dylan
5145f40125 Remove check for 'df' as all OS we support will have it installed 2016-01-26 22:52:49 +11:00
Dylan
5048dda2aa Add comments with the optional info lines 2016-01-26 22:44:20 +11:00
Dylan
21a878de5a getdisk: Add Windows support and fix BSD detection 2016-01-26 22:31:00 +11:00
Dylan
07b2c83f9a Add fallback to getdisk 2016-01-26 22:25:08 +11:00
Dylan
7c0863db3d getdisk swap '/total/' for 'END' 2016-01-26 22:18:40 +11:00
Dylan
8b606395d1 Change printf to print in getdisk function 2016-01-26 21:43:01 +11:00
Dylan
21edcc0eb9 Added experimental disk usage 2016-01-26 21:25:28 +11:00
Dylan
2b04747804 Variable substitution, remove useless forward slashes and quotes 2016-01-26 17:44:31 +11:00
Dylan
92cda8174c Quote things that should be wrapped in quotes 2016-01-26 14:48:39 +11:00
Dylan
d20e7b3523 GPU: Added support for virtualbox gpu 2016-01-26 12:58:46 +11:00
Dylan
3c3e2cc571 Use cpufreq if available instead of hardcoding it to specific distros 2016-01-26 12:55:31 +11:00
Dylan
0e83e2099d Fixed gtk3 always printing theme instead of icons/font etc. Added new function 'gtkfont' to get the gtk theme's font, it's disabled by default and can be enabled like any other info line. Also sped up memory function on Linux. 2016-01-26 12:48:40 +11:00
Dylan
04280a688e Added new uptime_shorthand option called 'tiny'. It makes the output of uptime as small as possible eg: '1d 2h 35m' 2016-01-26 12:16:39 +11:00
Dylan
43416ebad5 Fix GPU fallback on OpenBSD 2016-01-26 10:54:07 +11:00
Dylan
a0c93da74d Readme 2016-01-26 09:35:12 +11:00
Dylan
a70db16a74 Readme changes 2016-01-25 21:43:33 +11:00
Dylan
f46aaf8672 Swap out tput stuff for ansi escape codes 2016-01-25 17:26:15 +11:00
Dylan
78dd4b6991 Add issue/workaround for images not appearing 2016-01-25 11:09:55 +11:00
Dylan
792030d00b GPU: Show 'Unknown' on unsupported OS 2016-01-25 10:51:06 +11:00
Dylan
8bb056fa02 Turns out that prompt_height disappeared a few days ago 2016-01-25 10:44:11 +11:00
Dylan
63bc62bf80 GPU support is now enabled by default, see issue #21 for more info 2016-01-25 10:37:29 +11:00
Dylan
96c35229f0 Added options to enable/disable GTK2/3 output for GTK theme. 2016-01-25 10:36:42 +11:00
Dylan
e5e0b4ccce Added commas 2016-01-25 09:07:53 +11:00
Dylan
20d99da018 Added more cpu speed types 2016-01-25 08:58:56 +11:00
Dylan
58b0cf9a90 Fix duplicated icon output on elementary OS 2016-01-25 01:22:45 +11:00
Dylan
ef626b2c36 Add trailing space to gtk3 output 2016-01-25 01:18:31 +11:00
Dylan
2359a3ce2e Added comma to gtk theme output 2016-01-25 01:14:35 +11:00
Dylan
ca0d661fc8 Fixed incorrect GTK3 theme 2016-01-25 01:10:05 +11:00
Dylan
5885c3033e Reformat gpu_shorthand 2016-01-24 23:38:50 +11:00
Dylan
7e42f0c5c3 Fix trailing whitespace in cpu name 2016-01-24 23:36:54 +11:00
Dylan
b80b09376a Spaced out some if statements to make them more readable 2016-01-24 22:59:35 +11:00
Dylan
4cd78d3148 Fix issue where w3m couldn't display an image without a file extension 2016-01-24 11:17:48 +11:00
Dylan
10843ffabb ... 2016-01-24 11:09:44 +11:00
Dylan
fcf7a3fca4 ... 2016-01-24 11:06:06 +11:00
Dylan
b9b3f05fab getwallpaper: Also check that .fehbg exists 2016-01-24 11:05:08 +11:00
Dylan
5996edbc9d getwallpaper: Added gsettings support 2016-01-24 11:03:29 +11:00
Dylan
45b72832bb ... 2016-01-24 10:50:39 +11:00
Dylan
dcadf98d3d ... 2016-01-24 10:46:12 +11:00
Dylan
76fc53bb14 ... 2016-01-24 10:45:43 +11:00
Dylan
6a59d33581 Fixed leading whitespace issue 2016-01-24 10:44:29 +11:00
Dylan
b5deb6b255 Really really fix whitespace issue 2016-01-24 10:40:45 +11:00
Dylan
f1e1915a08 Really fix whitespace issue 2016-01-24 10:38:46 +11:00
Dylan
d480966172 Fix whitespace issue with gtk3 theme fallback 2016-01-24 10:35:32 +11:00
Dylan
936aeab35a Fix whitespace issue if gtk2 theme wasn't found 2016-01-24 10:33:02 +11:00
Dylan
aa4395279d getgtk: Better theme detection 2016-01-24 10:30:33 +11:00
Dylan
b30e6e6d18 Fix typo in gtk icon fallback 2016-01-24 10:17:03 +11:00
Dylan
771ead2701 Fixed missing forward slash 2016-01-24 10:15:43 +11:00
Dylan
2daaa57f3a getgtk fallback to gsettings detection for gtk3 theme/icons 2016-01-24 10:14:32 +11:00
Dylan
f33124b583 Remove flags that broke in the printinfo function changes 2016-01-24 08:46:21 +11:00
Dylan
7b524080d4 Make notes about '--gap' supporting a negative value 2016-01-24 08:40:01 +11:00
Dylan
0b75228f60 Fixed cpu speed on elementary, Added more rules to getgpu for AMD cards 2016-01-24 08:16:06 +11:00
Dylan
bd230f31f7 Add elementary support to getpackage 2016-01-24 08:09:22 +11:00
Dylan
ab92616da8 wmctrl is now used by default if found 2016-01-23 10:31:24 +11:00
Dylan
a81ef5c0f9 --scrot now takes a path/file 2016-01-23 10:28:16 +11:00
Dylan
b01c7b2202 Turns out that the screenshot stuff was still broken 2016-01-23 10:16:34 +11:00
Dylan
88db64361a Merge branch 'master' of github.com:dylanaraps/fetch 2016-01-22 21:29:34 +11:00
Dylan
3bedbcf7f5 Readme 2016-01-22 21:29:00 +11:00
Dylan
0171d3e343 Turns out that the screenshot launch flags didn't actually work 2016-01-22 21:28:06 +11:00
Dylan
721ebe00f6 Changed from '0' to 'off' 2016-01-22 21:18:16 +11:00
Dylan
f13ea88dde Update docs 2016-01-22 18:04:53 +11:00
Dylan
7577752047 Changed all 'print' to 'printf' 2016-01-22 15:12:43 +11:00
Dylan
2301000a72 Cleanup Post Install 2016-01-21 22:33:05 +11:00
Dylan
61661095a0 Suppress lsb_release errors 2016-01-21 22:22:29 +11:00
Dylan
31b1ce0bf1 Remove blank XP case 2016-01-21 20:45:08 +11:00
Dylan
33b5b2ef60 Remove gpu support for NetBSD 2016-01-21 20:42:25 +11:00
Dylan
30f7146786 Add gpu support for NetBSD 2016-01-21 20:41:03 +11:00
Dylan
3f4f8170b9 New scrot 2016-01-21 17:32:31 +11:00
Dylan
2082fd19d1 Readme 2016-01-21 17:23:29 +11:00
Dylan
e95d09a26a Remove 'clear' option as it's now useless 2016-01-21 13:34:16 +11:00
Dylan
2cd4879fb3 Fixed images disappearing in vte based terminals. Closes #18 2016-01-21 13:23:16 +11:00
Dylan
8fb27be14f Remove exclude option as it no longer works 2016-01-21 12:29:45 +11:00
Dylan
fe4c581b2c Readme 2016-01-21 12:25:36 +11:00
Dylan
91526082fb Readme 2016-01-21 12:24:52 +11:00
Dylan
ab55150101 GTK Theme Detection: Exclude commented lines from output 2016-01-21 11:29:24 +11:00
Dylan
3459833a62 Restore cursor and clear screen on ctrl+c 2016-01-21 10:56:55 +11:00
Dylan
4044fb6b92 Readme 2016-01-21 09:52:23 +11:00
Dylan
f7c37dd934 Add color function 2016-01-21 09:49:50 +11:00
Dylan
515e2621a2 Readme 2016-01-21 09:03:11 +11:00
Dylan
9daacddda1 You can now use ANY bash syntax when customizing what gets displayed, for example you could use an if statment to only show info when condition is true! 2016-01-21 08:58:50 +11:00
Dylan
c5c34637b8 Hopefully fixed blank gpu with nvidia cards 2016-01-21 07:20:42 +11:00
Dylan
19b4861e83 Fix cpu speed on CentOS 2016-01-21 00:41:15 +11:00
Dylan
db26756ea7 Turns out we only supported bash 4.3, this commit swaps typeset for eval 2016-01-21 00:37:31 +11:00
Dylan
928bbf0760 Fix hang when wallpaper is empty 2016-01-20 21:48:38 +11:00
Dylan
868344c1a4 Fix hang when wallpaper isn't found 2016-01-20 21:46:20 +11:00
Dylan
153f804626 getwallpaper: Add nitrogen support 2016-01-20 21:35:32 +11:00
Dylan
a9e3db5d8f Add cmus support to getsong 2016-01-20 21:24:29 +11:00
Dylan
9729361a3e Add cmus support to getsong 2016-01-20 21:24:04 +11:00
Dylan
a6eb4ccf91 Cleanup Reamde 2016-01-20 20:40:17 +11:00
Dylan
f1d52bd240 Fetch is now MIT licensed 2016-01-20 20:18:09 +11:00
Dylan
0e49201dbb Add note about outdated pci.ids 2016-01-20 09:29:08 +11:00
Dylan
d05020404f getgpu: Made the function more reliable and added support for nvidia-smi (untested) 2016-01-20 09:17:54 +11:00
Dylan
b36385d53d Fixed *buntu cpu speed on multicore cpus 2016-01-19 22:33:25 +11:00
Dylan
ba88942bcd Fixed missing * 2016-01-19 22:31:33 +11:00
Dylan
515e2fb886 Fix cpuspeed on *buntu based systems 2016-01-19 22:30:17 +11:00
Dylan
4096d3c988 gpu_shorthand: remove more stuff 2016-01-19 19:33:52 +11:00
Dylan
20e48eceac Readme 2016-01-19 17:38:19 +11:00
Dylan
d521f5168e Remove duplicate lines in BSD cpu detection 2016-01-19 17:36:10 +11:00
Dylan
f4982c76f5 Added cpu speed for FreeBSD 2016-01-19 17:33:41 +11:00
Dylan
ec5b826d27 Added note to readme about iTerm2 support 2016-01-19 17:15:29 +11:00
Dylan
0ae45fb404 Display the image before the text and reset cursor position before printing text 2016-01-19 17:08:00 +11:00
Dylan
f26d2870cb Iterm2 rendering should work take 2 2016-01-19 16:56:43 +11:00
Dylan
b40b0b1d4f iterm2 image rendring should work now. 2016-01-19 16:42:52 +11:00
Dylan
7e042c4b5a Added untested support for iterm2 image rendering 2016-01-19 14:21:38 +11:00
Dylan
c2612b8d8c Fix gpu spacing in FreeBSD 2016-01-19 13:57:29 +11:00
Dylan
10c3ff2d3e Move gpu shorthand 2016-01-19 13:52:33 +11:00
Dylan
76c3e949fe Add GPU support for Linux. Needs testing so bad. 2016-01-19 13:49:30 +11:00
Dylan
f3b3383781 GPU: Now fully works on Windows 2016-01-19 12:22:32 +11:00
Dylan
b86f014099 GPU: Now fully works on Windows 2016-01-19 12:21:20 +11:00
Dylan
f9f32ef28b GPU: Added support for OS X and Windows 2016-01-19 12:12:41 +11:00
Dylan
96c62b0774 GPU: Now works on FreeBSD 2016-01-19 12:02:04 +11:00
Dylan
460f798d13 Added gpu support base 2016-01-19 11:55:45 +11:00
Dylan
b7bb03b6ab Wildcard linux distros in getpackages 2016-01-19 11:42:31 +11:00
Dylan
eb8f115df4 Arch package count: Disable colored output and hide versions 2016-01-19 11:24:56 +11:00
Dylan
ae46d6f895 NetBSD: Actually fix whitespace issue 2016-01-19 11:17:45 +11:00
Dylan
7e073ef573 Fix whitespace issue with NetBSD cpu speed 2016-01-19 11:15:37 +11:00
Dylan
0b8587cc24 NetBSD: cpu speed 2016-01-19 11:12:38 +11:00
Dylan
45f0204d7b NetBSD: Fix CPU name and Memory usage 2016-01-19 11:05:43 +11:00
Dylan
4e275bf66d revert whitespace changes 2016-01-19 10:45:56 +11:00
Dylan
3ff01a0154 Fix package whitespace 2016-01-19 10:44:25 +11:00
Dylan
aa8e64c1be Added lsb_release to distro detection 2016-01-19 10:42:41 +11:00
Dylan
44517d2cd4 Remove zsh form readme 2016-01-19 10:15:30 +11:00
Dylan
c53235dc90 Fix cursor move issue on *BSD and remove ';;&' from printinfo 2016-01-19 09:54:03 +11:00
Dylan
f3bc7145e4 Readme 2016-01-18 18:21:57 +11:00
Dylan
27ee879d25 Fix memory detection on OpenBSD 2016-01-18 17:48:27 +11:00
Dylan
f2be7906ec Fix memory detection on OpenBSD 2016-01-18 17:47:31 +11:00
Dylan
04ba1d2c3b Fix memory usage on BSD 2016-01-18 17:45:32 +11:00
Dylan
b6b4e09287 Fix FreeBSD mem free 2016-01-18 17:39:23 +11:00
Dylan
6f1ed5c0b7 Turns out other *BSD distros don't have hw.cpuspeed 2016-01-18 17:37:00 +11:00
Dylan
432eb89e2d Added cpu speed for *BSD 2016-01-18 17:30:00 +11:00
Dylan
08ea6945fa Added empty text for getresolution 2016-01-18 17:24:08 +11:00
Dylan
10be9f4759 Fix free memory on OpenBSD 2016-01-18 17:21:32 +11:00
Dylan
148742e1fe Fix free memory on OpenBSD 2016-01-18 17:19:15 +11:00
Dylan
b01f0eb22f Fixed memory usage on OpenBSD 2016-01-18 17:17:32 +11:00
Dylan
ed9cbac233 Fix used memory on FreeBSD 2016-01-18 16:44:55 +11:00
Dylan
7f0ff292d2 Fix stray bracket on FreeBSD 2016-01-18 16:33:27 +11:00
Dylan
48787b3684 Fix memused on FreeBSD 2016-01-18 16:30:37 +11:00
Dylan
6107b29f50 Fix memory on FreeBSD 2016-01-18 16:26:18 +11:00
Dylan
dfd4289831 Fixed package count on FreeBSD 2016-01-18 16:22:21 +11:00
Dylan
bf86605250 Readme 2016-01-18 13:02:35 +11:00
Dylan
7b3db5d9e5 Readme 2016-01-18 12:56:06 +11:00
Dylan
6b09927962 Readme 2016-01-18 12:55:38 +11:00
Dylan
01d1f19d1d Readme 2016-01-18 12:43:06 +11:00
Dylan
69e4ae5cfc Added experimental and untested *BSD support 2016-01-18 12:09:37 +11:00
Dylan
e8e3376c26 Readme 2016-01-18 11:20:22 +11:00
Dylan
52fc2b82de Readme 2016-01-18 11:19:29 +11:00
Dylan
8b82840ffd Readme 2016-01-18 11:02:28 +11:00
Dylan
61ba88b41b Added quotes 2016-01-18 09:10:59 +11:00
Dylan
2cce750243 Remove quotes from OS X wallpaper detection 2016-01-18 09:07:05 +11:00
Dylan
6b9d7ac78b Added OS X wallpaper detection 2016-01-18 08:37:37 +11:00
Dylan
895698fe40 Fix syntax errors in readme and add issue/workarounds section 2016-01-18 08:26:39 +11:00
Dylan
7fb2a53243 Added missing exit, it's late 2016-01-18 00:56:20 +11:00
Dylan
c7742fca0a Added OS error detection 2016-01-18 00:43:44 +11:00
Dylan
b25d52a41e Mac OS X: Added support for other package managers 2016-01-18 00:30:58 +11:00
Dylan
c970c48f94 Add note to the readme about bash versions pre 4.0 2016-01-17 23:25:53 +11:00
Dylan
9b15f1492c Add note to the readme about bash versions pre 4.0 2016-01-17 23:23:55 +11:00
Dylan
b375c116e0 Update readme 2016-01-17 18:01:52 +11:00
Dylan
0cf1405ae8 Update readme 2016-01-17 18:01:14 +11:00
Dylan
48b8b08016 Update readme 2016-01-17 17:59:11 +11:00
Dylan
ab5810969c Update readme 2016-01-17 17:57:39 +11:00
Dylan
9266678368 Clearing the terminal is now a config option and launch flag instead of being hardcoded. '--clear on/off' or '' 2016-01-17 17:45:34 +11:00
Dylan
f8ef1b93c7 If images are disabled don't clear terminal output or mess around with cursor location 2016-01-17 17:17:13 +11:00
Dylan
822ed78efc Readme anchor Links 2016-01-16 10:21:28 +11:00
Dylan
29868195e3 Readme anchor Links 2016-01-16 10:20:25 +11:00
Dylan
7aa1920c61 Readme anchor Links 2016-01-16 10:18:50 +11:00
Dylan
141e34a1bd Moved getgtktheme and getgtkicons to a single function. This way we don't have two identical functions 2016-01-13 16:36:07 +11:00
Dylan
d7f5c575d3 Added launch flag to disable info lines at launch 2016-01-13 16:15:01 +11:00
Dylan
afbc03605b You can now color the '@' sign in the title 2016-01-13 15:19:49 +11:00
Dylan
b933a3d055 New screenshot 2016-01-13 12:47:46 +11:00
Dylan
209216a516 Update Readme 2016-01-13 12:35:38 +11:00
Dylan
7125998141 Added gtk theme and icons support, the script also has screenfetch like defaults now 2016-01-13 12:26:40 +11:00
Dylan
939127235f Quoted unquoted path 2016-01-10 09:13:59 +11:00
Dylan
7f32a90ddf Make note about bash version 2016-01-10 09:02:13 +11:00
Dylan
99b2946c70 Added install isntructions 2016-01-09 13:27:37 +11:00
Dylan
ea3508f7a0 Readme 2016-01-09 12:53:20 +11:00
Dylan
6d85553bdb Removed crop comparison in favor of wiki page 2016-01-09 11:13:59 +11:00
Dylan
0ddd2a109f Fixed link in readme 2016-01-09 11:08:45 +11:00
Dylan
99f48035bd Add Features to Readme 2016-01-09 10:47:55 +11:00
Dylan
d47861a7e6 Add Features to Readme 2016-01-09 10:46:16 +11:00
Dylan
941842d4ba Add Features to Readme 2016-01-09 10:45:20 +11:00
Dylan
56a04990f2 readme 2016-01-08 21:00:29 +11:00
Dylan
6cb08e60a1 Remove windows resolution detection 2016-01-08 20:59:58 +11:00
Dylan
196dfc009a Windows get resolution take two 2016-01-08 20:58:28 +11:00
Dylan
cb0dae0a20 Added resolution support for Windows 2016-01-08 20:45:08 +11:00
Dylan
69747da81a Added option to select custom screenshot tool 2016-01-08 17:04:23 +11:00
Dylan
9e31b7bf93 Readme 2016-01-08 16:11:03 +11:00
Dylan
2246a39632 Readme 2016-01-08 16:09:07 +11:00
Dylan
329265f284 Added the ability to take a screenshot. Fixed doubled cpu speed on linux 2016-01-08 16:08:00 +11:00
Dylan
972d677da5 Set wall as default image source 2016-01-08 13:31:23 +11:00
Dylan
039604f806 Added the option to pick a directory and shuffle the images, Image settings are now unified. 2016-01-08 13:29:24 +11:00
Dylan
d392373102 Fixed wallpapers with spaces in name not working, Fixed Fedora distro detection 2016-01-08 12:59:33 +11:00
Dylan
3593445279 Windows visual style, uppercase first letter 2016-01-07 15:08:08 +11:00
Dylan
a01042f2ad getvisualstyle works now. 2016-01-07 14:56:50 +11:00
Dylan
4dd363f586 Update 2016-01-07 14:53:11 +11:00
Dylan
f1e61174d8 Update 2016-01-07 14:47:57 +11:00
Dylan
e5f67e8874 Update 2016-01-07 14:45:43 +11:00
Dylan
08fa10fb06 Fixed typo 2016-01-07 14:40:46 +11:00
Dylan
48492b87ef Oops 2016-01-07 14:38:54 +11:00
Dylan
2770a31ad7 Added getvisualstyle function. (Untested) 2016-01-07 14:37:24 +11:00
dylan araps
5953035e38 Add missing newlines 2016-01-06 18:34:34 +11:00
dylan araps
d55b9f6693 Dropped support for mksh. 2016-01-06 18:28:56 +11:00
dylan araps
53496dbd92 Remove the unfinished OpenBSD support as no one wanted to test... 2016-01-06 18:17:43 +11:00
dylan araps
43a22793dd Fixed whitespace on windows uptime cmd 2016-01-06 17:10:46 +11:00
dylan araps
2d1a5ddd45 Fixed whitespace on windows uptime cmd 2016-01-06 17:10:16 +11:00
dylan araps
81ea929146 Added note about procps 2016-01-06 17:07:56 +11:00
dylan araps
2413839ec1 Dropping .sh everywhere. 2016-01-06 13:16:52 +11:00
dylan araps
ac5a2ef8e2 Dropped the .sh from the filename. 2016-01-06 13:07:57 +11:00
dylan araps
86c5645fca Added filesize to thumbnail filename, this lets us remove the slow image size check and speeds up the script even more! 2016-01-06 12:51:46 +11:00
dylan araps
b5be49e545 Left out a space 2016-01-06 12:04:43 +11:00
dylan araps
cf1d22aead Split long lines, script is now under 80 chars wide 2016-01-06 12:03:29 +11:00
dylan araps
e82c898ae1 Add -F to grep when we look for fixed strings 2016-01-06 11:36:57 +11:00
dylan araps
25809bf721 Remove double negative tests 2016-01-06 11:18:02 +11:00
dylan araps
20ce5253a7 More cleanup 2016-01-06 11:00:20 +11:00
dylan araps
4edbbd349f Combine if statements and remove uneeded line from fill crop 2016-01-06 10:50:37 +11:00
dylan araps
fe86db3b74 Removed uneeded $ symbols, fixed printf format issues and quoted some strings 2016-01-06 10:41:02 +11:00
dylan araps
0a882fd483 Fixed whitespace issue 2016-01-06 10:06:22 +11:00
dylan araps
afbf12bba7 Readme 2016-01-06 09:59:56 +11:00
dylan araps
87c50d46dc Added option to set w3m-img path, Moved usage to a single cat call instead of countless printfs 2016-01-06 09:40:54 +11:00
dylan araps
4dba6f2e09 Windows: Fixed cpu whitespace issue 2016-01-06 09:01:21 +11:00
dylan araps
18d838233f Fixed images being cut off at the top. 2016-01-05 19:45:19 +11:00
dylan araps
5182deeec1 Please work. 2016-01-05 19:24:57 +11:00
dylan araps
53cc0067b4 Revert. 2016-01-05 19:21:46 +11:00
dylan araps
534c1514d5 I give up. 2016-01-05 19:20:42 +11:00
dylan araps
0f398662b5 I give up. 2016-01-05 19:13:57 +11:00
dylan araps
2ea0a60685 Windows XP path fix 2016-01-05 19:12:09 +11:00
dylan araps
e75aa64203 Windows XP path fix 2016-01-05 19:09:48 +11:00
dylan araps
88a6c10d28 Windows XP path fix 2016-01-05 19:08:10 +11:00
dylan araps
2fef67694d Hopefully fixed Windows XP path 2016-01-05 19:03:01 +11:00
dylan araps
26495ccab5 getdistro now runs at the start of the script with getos so we can use it in detection 2016-01-05 18:56:05 +11:00
dylan araps
528296626c Fix wallpaper on Windows 2016-01-05 18:50:06 +11:00
dylan araps
cd928cae22 Update wallpaper support for windows 2016-01-05 18:42:27 +11:00
dylan araps
eeb53b0de2 Added support for Windows XP wallpapers 2016-01-05 18:30:52 +11:00
dylan araps
f6a30f827c Fixed doubled speed for real this time 2016-01-05 18:27:51 +11:00
dylan araps
8ce6cee20e Cpu speed is still bugged. 2016-01-05 18:27:02 +11:00
dylan araps
2bcfdab6d1 Fixed doubled cpu speed in Windows 2016-01-05 18:25:19 +11:00
dylan araps
6d77ae4123 Added support for Windows wallpapers 2016-01-05 18:19:38 +11:00
dylan araps
c09d2aecb0 Added windows version detection 2016-01-05 18:14:04 +11:00
dylan araps
14a6b486ad Revert windows resolution detection 2016-01-05 17:19:48 +11:00
dylan araps
a79e74df1a Windows: Screen res support 2016-01-05 17:17:06 +11:00
dylan araps
9f1c18e90d Windows memory usage (untested) 2016-01-05 17:10:34 +11:00
dylan araps
18d465a6d2 Fixed cpu whitespace for real this time 2016-01-05 17:04:41 +11:00
dylan araps
b9bb282c8d fixed whitespace issue with windows cpu info 2016-01-05 16:59:45 +11:00
dylan araps
cb8444c41a Windows: cpu support 2016-01-05 16:57:30 +11:00
dylan araps
736b06ea3c Added option to set prompt height which will fix the title going off screen on multi line prompts 2016-01-05 16:46:53 +11:00
dylan araps
264de7564a Windows: Added windowmanager fallback 2016-01-05 16:34:49 +11:00
dylan araps
f3bd444b32 Fix hang on Windows 2016-01-05 16:33:31 +11:00
dylan araps
1059ccd566 Start of Windows support 2016-01-05 16:32:34 +11:00
dylan araps
c3c8c23d1d Script is now even faster. 2016-01-05 16:20:06 +11:00
dylan araps
b6dc6ed22b Oops. 2016-01-05 15:02:52 +11:00
dylan araps
76ea574cf9 The script is now even faster 2016-01-05 15:02:24 +11:00
dylan araps
24fd54c7bf Reduce tput to a single call 2016-01-05 12:27:27 +11:00
dylan araps
4e3322448d revert Windows support, needs more testing 2016-01-05 12:16:19 +11:00
dylan araps
f289ccd85d Clear the terminal using printf instead of clear 2016-01-05 12:01:51 +11:00
dylan araps
0d18832f71 Start of Windows support (experimental, needs testing) 2016-01-05 11:46:08 +11:00
dylan araps
0145b678ac Added note about w3m-img 2016-01-05 10:24:41 +11:00
dylan araps
07eb2417e9 Script is now twice as fast. 2016-01-05 10:11:25 +11:00
dylan araps
e733824ab7 Removed left over echos 2016-01-04 22:39:19 +11:00
dylan araps
dd3987fa48 Removed uneeded backslashes 2016-01-04 22:38:36 +11:00
dylan araps
2ea7a484fb Readme 2016-01-04 18:27:49 +11:00
dylan araps
4d0b01be45 Readme 2016-01-04 18:26:34 +11:00
dylan araps
39b2ceef96 Update Readme 2016-01-04 16:26:09 +11:00
dylan araps
7afcf2f2ec Added wmctrl as a fallback for window manager detection. 2016-01-04 16:24:41 +11:00
dylan araps
25941af61b Readme 2016-01-04 16:00:19 +11:00
dylan araps
b0e9cc4782 Fixed whitespace issue and name issue with OS X uptime 2016-01-04 15:50:52 +11:00
dylan araps
62db9ad83a Uptime support for OS X 2016-01-04 15:30:14 +11:00
dylan araps
ebfe0dbc8c OS X: Uptime, take two 2016-01-04 15:09:47 +11:00
dylan araps
596952e0a2 Mac OS X: Added uptime (Needs to be tested) 2016-01-04 15:04:25 +11:00
dylan araps
4fc82847db Mac OS X: getmemory fix. 2016-01-04 14:59:47 +11:00
dylan araps
94cac0676f Fix package issue on Mac OS X 2016-01-04 14:38:38 +11:00
dylan araps
cfa089e801 Moved song to optional info, added getresolution to get screen res using xorg-xdpyinfo (disabled by default) and added uptime shorthand option to shorten the output of uptime 2016-01-04 14:31:21 +11:00
dylan araps
0e3fed419e Revert shebang to /usr/bin/env bash 2016-01-04 13:09:23 +11:00
dylan araps
4d0c127b9b Readme 2016-01-04 10:36:32 +11:00
dylan araps
656680b324 Update Readme 2016-01-04 10:34:12 +11:00
dylan araps
60e8f2a016 Fixed colon bug and fixed underline length 2016-01-04 10:33:45 +11:00
dylan araps
7d9ce8923e Added option --image_position to display the image on the left or right of the terminal 2016-01-04 10:20:36 +11:00
dylan araps
c034067573 The get* functions now fallback to 'Unknown' instead of printing nothing 2016-01-04 09:25:30 +11:00
dylan araps
cd4848e27c getos now gets os type (Linux, Mac OS X, OpenBSD) and the new function getdistro gets (Arch Linux, Ubuntu, etc). This way the case statements can always end in an Unknown instead of falling back to linux. 2016-01-04 09:21:13 +11:00
dylan araps
70af2fc12d Added more support for OpenBSD. I'm installing OpenBSD to test. 2016-01-04 08:48:50 +11:00
dylan araps
b645fd71c5 Added the start of OpenBSD support 2016-01-04 00:01:44 +11:00
dylan araps
572062d98b Fixes #8 2016-01-03 23:45:08 +11:00
dylan araps
ac3d1f6c6b Readme 2016-01-03 20:02:39 +11:00
dylan araps
5104e448e5 Update Readme 2016-01-03 19:59:15 +11:00
dylan araps
2120fbad0f Renamed blockwidth to block_width 2016-01-03 19:55:09 +11:00
dylan araps
5c2cee5b3b Finished rewrite and added OS X support (experimental), it's now way faster! 2016-01-03 17:54:16 +11:00
dylan araps
ef2ed6257a Update Readme 2016-01-01 16:49:11 +11:00
dylan araps
2c19725d41 Readme 2016-01-01 11:56:19 +11:00
dylan araps
d7277adfdb Remove stray sleep from test branch 2016-01-01 11:02:48 +11:00
dylan araps
ab7bffdfa4 Merge branch 'master' of https://github.com/dylanaraps/fetch.sh 2016-01-01 11:01:49 +11:00
dylan araps
3e375dd04e Left stray comment 2016-01-01 11:01:17 +11:00
dylan araps
b91a583ed1 Update readme 2016-01-01 11:00:43 +11:00
dylan araps
a8ebdf544d Update readme 2016-01-01 10:43:06 +11:00
dylan araps
6ad6283895 Fix linewrap option now working in screen/tmux 2016-01-01 10:41:31 +11:00
dylan araps
b7eff48b27 update Readme 2016-01-01 10:01:30 +11:00
dylan araps
9ace25a78c Save smart_crop_mode in the image filename, this way we can save one image for each mode 2016-01-01 09:45:39 +11:00
dylan araps
cfba9efae4 Fixed Readme images 2016-01-01 09:38:31 +11:00
dylan araps
1eede4fece Fixed Readme images 2016-01-01 09:37:50 +11:00
dylan araps
bc5478fa9f Fixed readme folds 2016-01-01 09:36:26 +11:00
dylan araps
8479a60c5b Oops 2016-01-01 09:34:43 +11:00
dylan araps
496a254db1 Merge branch 'master' of https://github.com/dylanaraps/fetch.sh 2016-01-01 09:33:16 +11:00
dylan araps
567ba97539 Added experimental smart crop feature 2016-01-01 09:33:08 +11:00
Dylan Araps
cb9a0b659b Merge pull request #4 from sapake/master
Add support for Void Linux
2016-01-01 09:01:35 +11:00
Sami Pitkänen
f45d3d6955 Add support for Void Linux 2015-12-31 19:35:49 +02:00
dylan araps
07538e0bf1 Cleanup Readme 2015-12-31 16:24:02 +11:00
dylan araps
1f58408293 Detect 'free' version, Add flags to customize underline, Change all negative flags to neutral ones 2015-12-31 15:43:13 +11:00
dylan araps
054504a8ab Detect 'free' version, Add flags to customize underline, Change all negative flags to neutral ones 2015-12-31 15:42:58 +11:00
dylan araps
5fbdfa35d6 cleanup 2015-12-31 13:19:30 +11:00
dylan araps
431644d61d Saner default for padding 2015-12-31 12:39:46 +11:00
dylan araps
e3780099f4 Add changes from #2, thanks @ix 2015-12-31 12:08:35 +11:00
dylan araps
f808a9c076 Readme 2015-12-31 11:37:31 +11:00
5 changed files with 2042 additions and 658 deletions

21
LICENSE.md Normal file
View 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
View 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
![1](http://i.imgur.com/oTxq5fA.png)
<!-- 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
View File

@@ -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.
![1](https://sr.ht/5aNV.png)
## 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.
![2](https://sr.ht/Z9hZ.png)
#### You can now customize the color of everything.
![3](https://sr.ht/hy7m.png)
#### You can now disable all images with a flag.
![4](https://sr.ht/zujR.png)

1634
fetch Executable file

File diff suppressed because it is too large Load Diff

502
fetch.sh
View File

@@ -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)
# }}}