initial
This commit is contained in:
parent
090766cab0
commit
a33f99e765
1725 changed files with 129819 additions and 0 deletions
45
dot_tmux/plugins/tmux-continuum/CHANGELOG.md
Normal file
45
dot_tmux/plugins/tmux-continuum/CHANGELOG.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Changelog
|
||||
|
||||
### master
|
||||
- bugfix: "auto restore" feature stopped working
|
||||
- bugfix: prevent race condition when auto-saving with locks (@v9v)
|
||||
- Multiple users on a system can now each run continuum on their own.
|
||||
|
||||
### v3.1.0, 2015-03-14
|
||||
- properly quote scripts
|
||||
- bugfix: "auto restore" feature does not work on tmux `1.9a`
|
||||
- bugfix: do not count `tmux source-file .tmux.conf` as a tmux process (when
|
||||
checking if other tmux server is running). Previously, this caused
|
||||
interpolation command not to be inserted into `status-right` because `tmux
|
||||
source-file` was falsely detected as another tmux server.
|
||||
- add `#{continuum_status}` status line interpolation
|
||||
|
||||
### v3.0.0, 2015-02-20
|
||||
- rename the plugin from `tmux-resurrect-auto` to `tmux-continuum`
|
||||
|
||||
### v2.2.0, 2015-02-20
|
||||
- document tmux multi-server behavior in the readme
|
||||
- do not auto-restore tmux environment if another tmux server is already running
|
||||
(we don't want to duplicate stuff)
|
||||
- bugfixes for 'tmux auto start' OS X Terminal.app and iTerm scripts
|
||||
- prevent saving for the first 15 minutes only when plugin is sourced the first
|
||||
time (not on subsequent sources or tmux.conf reloads)
|
||||
- do not start auto-saving if there's another tmux server running (we don't want
|
||||
for save files from various tmux environments to override each other)
|
||||
|
||||
### v2.1.0, 2015-02-18
|
||||
- enable "tmux auto start" for OS X
|
||||
- enable customizing "tmux auto start" for OS X
|
||||
- fix errors when creating a launchd plist file for auto-start on OS X
|
||||
|
||||
### v2.0.0, 2015-02-15
|
||||
- enable automatic environment restore when tmux is started
|
||||
|
||||
### v1.0.0, 2015-02-12
|
||||
- first working version
|
||||
- run the save script in the background
|
||||
- do not start saving right after tmux is started
|
||||
- add a check for tmux version to the initializer script
|
||||
- when interval is set to '0' autosave is disabled
|
||||
- bugfix: helper files not loaded
|
||||
- update readme with the instructions how to disable auto saving
|
||||
15
dot_tmux/plugins/tmux-continuum/CONTRIBUTING.md
Normal file
15
dot_tmux/plugins/tmux-continuum/CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
### Contributing
|
||||
|
||||
Code contributions are welcome!
|
||||
|
||||
If you wanna contribute a bigger feature, please open a github issue so we can
|
||||
discuss it together first.
|
||||
|
||||
### Reporting a bug
|
||||
|
||||
If you find a bug please report it in the issues. When reporting a bug please
|
||||
attach:
|
||||
- a file symlinked to `~/.tmux/resurrect/last`.
|
||||
- your `.tmux.conf`
|
||||
- if you're getting an error paste it to a [gist](https://gist.github.com/) and
|
||||
link it in the issue
|
||||
19
dot_tmux/plugins/tmux-continuum/LICENSE.md
Normal file
19
dot_tmux/plugins/tmux-continuum/LICENSE.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (C) Bruno Sutic
|
||||
|
||||
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.
|
||||
103
dot_tmux/plugins/tmux-continuum/README.md
Normal file
103
dot_tmux/plugins/tmux-continuum/README.md
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
# tmux-continuum
|
||||
|
||||
Features:
|
||||
|
||||
- continuous saving of tmux environment
|
||||
- automatic tmux start when computer/server is turned on
|
||||
- automatic restore when tmux is started
|
||||
|
||||
Together, these features enable uninterrupted tmux usage. No matter the computer
|
||||
or server restarts, if the machine is on, tmux will be there how you left it off
|
||||
the last time it was used.
|
||||
|
||||
Tested and working on Linux, OSX and Cygwin.
|
||||
|
||||
#### Continuous saving
|
||||
|
||||
Tmux environment will be saved at an interval of 15 minutes. All the saving
|
||||
happens in the background without impact to your workflow.
|
||||
|
||||
This action starts automatically when the plugin is installed. Note it requires
|
||||
the status line to be `on` to run (since it uses a hook in status-right to run).
|
||||
|
||||
#### Automatic tmux start
|
||||
|
||||
Tmux is automatically started after the computer/server is turned on.
|
||||
|
||||
See the [instructions](docs/automatic_start.md) on how to enable this for your
|
||||
system.
|
||||
|
||||
#### Automatic restore
|
||||
|
||||
Last saved environment is automatically restored when tmux is started.
|
||||
|
||||
Put `set -g @continuum-restore 'on'` in `.tmux.conf` to enable this.
|
||||
|
||||
Note: automatic restore happens **exclusively** on tmux server start. No other
|
||||
action (e.g. sourcing `.tmux.conf`) triggers this.
|
||||
|
||||
#### Dependencies
|
||||
|
||||
`tmux 1.9` or higher, `bash`,
|
||||
[tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect) plugin.
|
||||
|
||||
### Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) (recommended)
|
||||
|
||||
Please make sure you have
|
||||
[tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect) installed.
|
||||
|
||||
Add plugin to the list of TPM plugins in `.tmux.conf`:
|
||||
|
||||
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
||||
set -g @plugin 'tmux-plugins/tmux-continuum'
|
||||
|
||||
Hit `prefix + I` to fetch the plugin and source it. The plugin will
|
||||
automatically start "working" in the background, no action required.
|
||||
|
||||
### Manual Installation
|
||||
|
||||
Please make sure you have
|
||||
[tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect) installed.
|
||||
|
||||
Clone the repo:
|
||||
|
||||
$ git clone https://github.com/tmux-plugins/tmux-continuum ~/clone/path
|
||||
|
||||
Add this line to the bottom of `.tmux.conf`:
|
||||
|
||||
run-shell ~/clone/path/continuum.tmux
|
||||
|
||||
Reload TMUX environment with: `$ tmux source-file ~/.tmux.conf`
|
||||
|
||||
The plugin will automatically start "working" in the background, no action
|
||||
required.
|
||||
|
||||
### Docs
|
||||
|
||||
- [frequently asked questions](docs/faq.md)
|
||||
- [behavior when running multiple tmux servers](docs/multiple_tmux_servers.md) -
|
||||
this doc is safe to skip, but you might want to read it if you're using tmux
|
||||
with `-L` or `-S` flags
|
||||
- [automatically start tmux after the computer is turned on](docs/automatic_start.md)
|
||||
- [continuum status in tmux status line](docs/continuum_status.md)
|
||||
|
||||
### Other goodies
|
||||
|
||||
- [tmux-copycat](https://github.com/tmux-plugins/tmux-copycat) - a plugin for
|
||||
regex searches in tmux and fast match selection
|
||||
- [tmux-yank](https://github.com/tmux-plugins/tmux-yank) - enables copying
|
||||
highlighted text to system clipboard
|
||||
- [tmux-open](https://github.com/tmux-plugins/tmux-open) - a plugin for quickly
|
||||
opening highlighted file or a url
|
||||
|
||||
### Known Issues
|
||||
|
||||
- In order to be executed periodically, the plugin updates the `status-right` tmux variable. In case some plugin (usually themes) overwrites the `status-right` variable, the autosave feature stops working. To fix this issue, place the plugin last in the TPM plugins list.
|
||||
|
||||
### Reporting bugs and contributing
|
||||
|
||||
Both contributing and bug reports are welcome. Please check out
|
||||
[contributing guidelines](CONTRIBUTING.md).
|
||||
|
||||
### License
|
||||
[MIT](LICENSE.md)
|
||||
47
dot_tmux/plugins/tmux-continuum/docs/automatic_start.md
Normal file
47
dot_tmux/plugins/tmux-continuum/docs/automatic_start.md
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# Automatic Tmux start
|
||||
|
||||
Tmux is automatically started after the computer/server is turned on.
|
||||
|
||||
### OS X
|
||||
|
||||
To enable this feature:
|
||||
- put `set -g @continuum-boot 'on'` in `.tmux.conf`
|
||||
- reload tmux config with this shell command: `$ tmux source-file ~/.tmux.conf`
|
||||
|
||||
Next time the computer is started:
|
||||
- `Terminal.app` window will open and resize to maximum size
|
||||
- `tmux` command will be executed in the terminal window
|
||||
- if "auto restore" feature is enabled, tmux will start restoring previous env
|
||||
|
||||
Config options:
|
||||
- `set -g @continuum-boot-options 'fullscreen'` - terminal window
|
||||
will go fullscreen
|
||||
- `set -g @continuum-boot-options 'iterm'` - start [iTerm](https://www.iterm2.com) instead
|
||||
of `Terminal.app`
|
||||
- `set -g @continuum-boot-options 'iterm,fullscreen'` - start `iTerm`
|
||||
in fullscreen
|
||||
- `set -g @continuum-boot-options 'kitty'` - start [kitty](https://sw.kovidgoyal.net/kitty) instead
|
||||
of `Terminal.app`
|
||||
- `set -g @continuum-boot-options 'kitty,fullscreen'` - start `kitty`
|
||||
in fullscreen
|
||||
- `set -g @continuum-boot-options 'alacritty'` - start [alacritty](https://github.com/alacritty/alacritty) instead of `Terminal.app`
|
||||
- `set -g @continuum-boot-options 'alacritty,fullscreen'` - start `alacritty`
|
||||
in fullscreen
|
||||
|
||||
Note: The first time you reboot your machine and activate this feature you may be prompted about a script requiring
|
||||
access to a system program (i.e. - System Events). If this happens tmux will not start automatically and you will need
|
||||
to go to `System Preferences -> Security & Privacy -> Accessability` and add the script to the list of apps that are
|
||||
allowed to control your computer.
|
||||
|
||||
### Linux
|
||||
|
||||
Help with this would be greatly appreciated. Please get in touch.
|
||||
|
||||
#### Systemd
|
||||
|
||||
##### this will only start the tmux server, it will *not* start any terminal emulator
|
||||
|
||||
To enable automatic start with systemd:
|
||||
- Put `set -g @continuum-boot 'on'` in `.tmux.conf`
|
||||
- reload tmux config with this shell command: `$ tmux source-file ~/.tmux.conf`
|
||||
- see [systemd](/docs/systemd_details.md) for more details about how this is implemented
|
||||
17
dot_tmux/plugins/tmux-continuum/docs/continuum_status.md
Normal file
17
dot_tmux/plugins/tmux-continuum/docs/continuum_status.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
## Continuum status in tmux status line
|
||||
|
||||
There is an option to display current status of tmux continuum in tmux status
|
||||
line. This is done via `#{continuum_status}` interpolation and it works with
|
||||
both `status-right` and `status-left` tmux native options.
|
||||
|
||||
Example usage:
|
||||
|
||||
set -g status-right 'Continuum status: #{continuum_status}'
|
||||
|
||||
When running, `#{continuum_status}` will show continuum save interval:
|
||||
|
||||
Continuum status: 15
|
||||
|
||||
or if continuous saving is disabled:
|
||||
|
||||
Continuum status: off
|
||||
45
dot_tmux/plugins/tmux-continuum/docs/faq.md
Normal file
45
dot_tmux/plugins/tmux-continuum/docs/faq.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
### FAQ
|
||||
|
||||
> Will a previous save be overwritten immediately after I start tmux?
|
||||
|
||||
No, first automatic save starts 15 minutes after tmux is started. If automatic
|
||||
restore is not enabled, that gives you enough time to manually restore from a
|
||||
previous save.
|
||||
|
||||
> I want to make a restore to a previous point in time, but it seems that save
|
||||
is now overwritten?
|
||||
|
||||
Read how to [restore a previously saved environment](https://github.com/tmux-plugins/tmux-resurrect/blob/master/docs/restoring_previously_saved_environment.md)
|
||||
|
||||
> Will this plugin fill my hard disk?
|
||||
|
||||
Most likely no. A regular save file is in the range of 5Kb. And `tmux-resurrect` already has a `remove_old_backups()` routine that will ["remove resurrect files older than 30 days, but keep at least 5 copies of backup."](https://github.com/tmux-plugins/tmux-resurrect/blob/da1a7558024b8552f7262b39ed22e3d679304f99/scripts/save.sh#L271-L277)
|
||||
|
||||
> How do I change the save interval to i.e. 1 hour?
|
||||
|
||||
The interval is always measured in minutes. So setting the interval to `60`
|
||||
(minutes) will do the trick. Put this in `.tmux.conf`:
|
||||
|
||||
set -g @continuum-save-interval '60'
|
||||
|
||||
and then source `tmux.conf` by executing this command in the shell
|
||||
`$ tmux source-file ~/.tmux.conf`.
|
||||
|
||||
> How do I stop automatic saving?
|
||||
|
||||
Just set the save interval to `0`. Put this in `.tmux.conf`
|
||||
|
||||
set -g @continuum-save-interval '0'
|
||||
|
||||
and then source `tmux.conf` by executing this command in the shell
|
||||
`$ tmux source-file ~/.tmux.conf`.
|
||||
|
||||
> I had automatic restore turned on, how do I disable it now?
|
||||
|
||||
Just remove `set -g @continuum-restore 'on'` from `tmux.conf`.
|
||||
|
||||
To be absolutely sure automatic restore doesn't happen, create a
|
||||
`tmux_no_auto_restore` file in your home directory (command:
|
||||
`$ touch ~/tmux_no_auto_restore`). Automatic restore won't happen if this file
|
||||
exists.
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
### Behavior when running multiple tmux servers
|
||||
|
||||
(This is safe to skip if you're always running a single tmux server.)
|
||||
|
||||
If you're an advanced tmux user, you might be running multiple tmux servers at
|
||||
the same time. Maybe you start the first tmux server with `$ tmux` and then
|
||||
later another one with e.g. `$ tmux -S/tmp/foo`.
|
||||
|
||||
You probably don't want to "auto restore" the same environment in the second
|
||||
tmux that uses `/tmp/foo` socket. You also probably don't want two tmux
|
||||
environments both having "auto save" feature on (think about overwrites).
|
||||
|
||||
This plugin handles multi-server scenario by giving precedence to the tmux
|
||||
server that was first started.
|
||||
|
||||
In the above example, the server started with `$ tmux` will do "auto
|
||||
restore" (if enabled) and will start "auto saving".
|
||||
"Auto restore" or "auto saving" **will not** happen for the second server that
|
||||
was started later with the `$ tmux -S/tmp/foo` command. The plugin will
|
||||
detect the presence of another server (`$ tmux`) and give it precedence.
|
||||
13
dot_tmux/plugins/tmux-continuum/docs/systemd_details.md
Normal file
13
dot_tmux/plugins/tmux-continuum/docs/systemd_details.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Systemd automatic start for tmux
|
||||
|
||||
The first time tmux starts when `@continuum-boot` is set to 'on' tmux-continuum will generate a user level systemd unit file which it will save to `${HOME}/.config/systemd/user/tmux.service` and enable it. From then on when that user logs in, either through a GUI session or on the console or via ssh, Systemd will start the tmux server.
|
||||
|
||||
The command used to start the tmux server is determined via the `@continuum-systemd-start-cmd` option that can be set in .tmux.conf. (Remember to reload your configuration with `tmux source ~/.tmux.conf` afterwards.
|
||||
|
||||
The default command to use is `new-session -d`. If you want more control over what sessions get started then you should set up your sessions in tmux.conf and set `@continuum-systemd-start-cmd = 'start-server'`. As this will be executed as part of systemd's ExecStart statement there will be no shell parsing. See [Systemd manual](http://www.freedesktop.org/software/systemd/man/systemd.service.html#Command%20lines) for more details.
|
||||
|
||||
To control the tmux service you can use all the standard `systemctl` commands using the `--user` argument. eg to see if the tmux server has started:
|
||||
|
||||
systemctl --user status tmux.service
|
||||
|
||||
|
||||
1
dot_tmux/plugins/tmux-continuum/dot_git/FETCH_HEAD
Normal file
1
dot_tmux/plugins/tmux-continuum/dot_git/FETCH_HEAD
Normal file
|
|
@ -0,0 +1 @@
|
|||
0698e8f4b17d6454c71bf5212895ec055c578da0 branch 'master' of https://github.com/tmux-plugins/tmux-continuum
|
||||
1
dot_tmux/plugins/tmux-continuum/dot_git/HEAD
Normal file
1
dot_tmux/plugins/tmux-continuum/dot_git/HEAD
Normal file
|
|
@ -0,0 +1 @@
|
|||
ref: refs/heads/master
|
||||
1
dot_tmux/plugins/tmux-continuum/dot_git/ORIG_HEAD
Normal file
1
dot_tmux/plugins/tmux-continuum/dot_git/ORIG_HEAD
Normal file
|
|
@ -0,0 +1 @@
|
|||
0698e8f4b17d6454c71bf5212895ec055c578da0
|
||||
0
dot_tmux/plugins/tmux-continuum/dot_git/branches/.keep
Normal file
0
dot_tmux/plugins/tmux-continuum/dot_git/branches/.keep
Normal file
13
dot_tmux/plugins/tmux-continuum/dot_git/config
Normal file
13
dot_tmux/plugins/tmux-continuum/dot_git/config
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
[submodule]
|
||||
active = .
|
||||
[remote "origin"]
|
||||
url = https://git::@github.com/tmux-plugins/tmux-continuum
|
||||
fetch = +refs/heads/master:refs/remotes/origin/master
|
||||
[branch "master"]
|
||||
remote = origin
|
||||
merge = refs/heads/master
|
||||
1
dot_tmux/plugins/tmux-continuum/dot_git/description
Normal file
1
dot_tmux/plugins/tmux-continuum/dot_git/description
Normal file
|
|
@ -0,0 +1 @@
|
|||
Unnamed repository; edit this file 'description' to name the repository.
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to check the commit log message taken by
|
||||
# applypatch from an e-mail message.
|
||||
#
|
||||
# The hook should exit with non-zero status after issuing an
|
||||
# appropriate message if it wants to stop the commit. The hook is
|
||||
# allowed to edit the commit message file.
|
||||
#
|
||||
# To enable this hook, rename this file to "applypatch-msg".
|
||||
|
||||
. git-sh-setup
|
||||
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
|
||||
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
|
||||
:
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to check the commit log message.
|
||||
# Called by "git commit" with one argument, the name of the file
|
||||
# that has the commit message. The hook should exit with non-zero
|
||||
# status after issuing an appropriate message if it wants to stop the
|
||||
# commit. The hook is allowed to edit the commit message file.
|
||||
#
|
||||
# To enable this hook, rename this file to "commit-msg".
|
||||
|
||||
# Uncomment the below to add a Signed-off-by line to the message.
|
||||
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
||||
# hook is more suited to it.
|
||||
#
|
||||
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
||||
|
||||
# This example catches duplicate Signed-off-by lines.
|
||||
|
||||
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
||||
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
||||
echo >&2 Duplicate Signed-off-by lines.
|
||||
exit 1
|
||||
}
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use IPC::Open2;
|
||||
|
||||
# An example hook script to integrate Watchman
|
||||
# (https://facebook.github.io/watchman/) with git to speed up detecting
|
||||
# new and modified files.
|
||||
#
|
||||
# The hook is passed a version (currently 2) and last update token
|
||||
# formatted as a string and outputs to stdout a new update token and
|
||||
# all files that have been modified since the update token. Paths must
|
||||
# be relative to the root of the working tree and separated by a single NUL.
|
||||
#
|
||||
# To enable this hook, rename this file to "query-watchman" and set
|
||||
# 'git config core.fsmonitor .git/hooks/query-watchman'
|
||||
#
|
||||
my ($version, $last_update_token) = @ARGV;
|
||||
|
||||
# Uncomment for debugging
|
||||
# print STDERR "$0 $version $last_update_token\n";
|
||||
|
||||
# Check the hook interface version
|
||||
if ($version ne 2) {
|
||||
die "Unsupported query-fsmonitor hook version '$version'.\n" .
|
||||
"Falling back to scanning...\n";
|
||||
}
|
||||
|
||||
my $git_work_tree = get_working_dir();
|
||||
|
||||
my $retry = 1;
|
||||
|
||||
my $json_pkg;
|
||||
eval {
|
||||
require JSON::XS;
|
||||
$json_pkg = "JSON::XS";
|
||||
1;
|
||||
} or do {
|
||||
require JSON::PP;
|
||||
$json_pkg = "JSON::PP";
|
||||
};
|
||||
|
||||
launch_watchman();
|
||||
|
||||
sub launch_watchman {
|
||||
my $o = watchman_query();
|
||||
if (is_work_tree_watched($o)) {
|
||||
output_result($o->{clock}, @{$o->{files}});
|
||||
}
|
||||
}
|
||||
|
||||
sub output_result {
|
||||
my ($clockid, @files) = @_;
|
||||
|
||||
# Uncomment for debugging watchman output
|
||||
# open (my $fh, ">", ".git/watchman-output.out");
|
||||
# binmode $fh, ":utf8";
|
||||
# print $fh "$clockid\n@files\n";
|
||||
# close $fh;
|
||||
|
||||
binmode STDOUT, ":utf8";
|
||||
print $clockid;
|
||||
print "\0";
|
||||
local $, = "\0";
|
||||
print @files;
|
||||
}
|
||||
|
||||
sub watchman_clock {
|
||||
my $response = qx/watchman clock "$git_work_tree"/;
|
||||
die "Failed to get clock id on '$git_work_tree'.\n" .
|
||||
"Falling back to scanning...\n" if $? != 0;
|
||||
|
||||
return $json_pkg->new->utf8->decode($response);
|
||||
}
|
||||
|
||||
sub watchman_query {
|
||||
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
|
||||
or die "open2() failed: $!\n" .
|
||||
"Falling back to scanning...\n";
|
||||
|
||||
# In the query expression below we're asking for names of files that
|
||||
# changed since $last_update_token but not from the .git folder.
|
||||
#
|
||||
# To accomplish this, we're using the "since" generator to use the
|
||||
# recency index to select candidate nodes and "fields" to limit the
|
||||
# output to file names only. Then we're using the "expression" term to
|
||||
# further constrain the results.
|
||||
if (substr($last_update_token, 0, 1) eq "c") {
|
||||
$last_update_token = "\"$last_update_token\"";
|
||||
}
|
||||
my $query = <<" END";
|
||||
["query", "$git_work_tree", {
|
||||
"since": $last_update_token,
|
||||
"fields": ["name"],
|
||||
"expression": ["not", ["dirname", ".git"]]
|
||||
}]
|
||||
END
|
||||
|
||||
# Uncomment for debugging the watchman query
|
||||
# open (my $fh, ">", ".git/watchman-query.json");
|
||||
# print $fh $query;
|
||||
# close $fh;
|
||||
|
||||
print CHLD_IN $query;
|
||||
close CHLD_IN;
|
||||
my $response = do {local $/; <CHLD_OUT>};
|
||||
|
||||
# Uncomment for debugging the watch response
|
||||
# open ($fh, ">", ".git/watchman-response.json");
|
||||
# print $fh $response;
|
||||
# close $fh;
|
||||
|
||||
die "Watchman: command returned no output.\n" .
|
||||
"Falling back to scanning...\n" if $response eq "";
|
||||
die "Watchman: command returned invalid output: $response\n" .
|
||||
"Falling back to scanning...\n" unless $response =~ /^\{/;
|
||||
|
||||
return $json_pkg->new->utf8->decode($response);
|
||||
}
|
||||
|
||||
sub is_work_tree_watched {
|
||||
my ($output) = @_;
|
||||
my $error = $output->{error};
|
||||
if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
|
||||
$retry--;
|
||||
my $response = qx/watchman watch "$git_work_tree"/;
|
||||
die "Failed to make watchman watch '$git_work_tree'.\n" .
|
||||
"Falling back to scanning...\n" if $? != 0;
|
||||
$output = $json_pkg->new->utf8->decode($response);
|
||||
$error = $output->{error};
|
||||
die "Watchman: $error.\n" .
|
||||
"Falling back to scanning...\n" if $error;
|
||||
|
||||
# Uncomment for debugging watchman output
|
||||
# open (my $fh, ">", ".git/watchman-output.out");
|
||||
# close $fh;
|
||||
|
||||
# Watchman will always return all files on the first query so
|
||||
# return the fast "everything is dirty" flag to git and do the
|
||||
# Watchman query just to get it over with now so we won't pay
|
||||
# the cost in git to look up each individual file.
|
||||
my $o = watchman_clock();
|
||||
$error = $output->{error};
|
||||
|
||||
die "Watchman: $error.\n" .
|
||||
"Falling back to scanning...\n" if $error;
|
||||
|
||||
output_result($o->{clock}, ("/"));
|
||||
$last_update_token = $o->{clock};
|
||||
|
||||
eval { launch_watchman() };
|
||||
return 0;
|
||||
}
|
||||
|
||||
die "Watchman: $error.\n" .
|
||||
"Falling back to scanning...\n" if $error;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub get_working_dir {
|
||||
my $working_dir;
|
||||
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
|
||||
$working_dir = Win32::GetCwd();
|
||||
$working_dir =~ tr/\\/\//;
|
||||
} else {
|
||||
require Cwd;
|
||||
$working_dir = Cwd::cwd();
|
||||
}
|
||||
|
||||
return $working_dir;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to prepare a packed repository for use over
|
||||
# dumb transports.
|
||||
#
|
||||
# To enable this hook, rename this file to "post-update".
|
||||
|
||||
exec git update-server-info
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to verify what is about to be committed
|
||||
# by applypatch from an e-mail message.
|
||||
#
|
||||
# The hook should exit with non-zero status after issuing an
|
||||
# appropriate message if it wants to stop the commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-applypatch".
|
||||
|
||||
. git-sh-setup
|
||||
precommit="$(git rev-parse --git-path hooks/pre-commit)"
|
||||
test -x "$precommit" && exec "$precommit" ${1+"$@"}
|
||||
:
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to verify what is about to be committed.
|
||||
# Called by "git commit" with no arguments. The hook should
|
||||
# exit with non-zero status after issuing an appropriate message if
|
||||
# it wants to stop the commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-commit".
|
||||
|
||||
if git rev-parse --verify HEAD >/dev/null 2>&1
|
||||
then
|
||||
against=HEAD
|
||||
else
|
||||
# Initial commit: diff against an empty tree object
|
||||
against=$(git hash-object -t tree /dev/null)
|
||||
fi
|
||||
|
||||
# If you want to allow non-ASCII filenames set this variable to true.
|
||||
allownonascii=$(git config --type=bool hooks.allownonascii)
|
||||
|
||||
# Redirect output to stderr.
|
||||
exec 1>&2
|
||||
|
||||
# Cross platform projects tend to avoid non-ASCII filenames; prevent
|
||||
# them from being added to the repository. We exploit the fact that the
|
||||
# printable range starts at the space character and ends with tilde.
|
||||
if [ "$allownonascii" != "true" ] &&
|
||||
# Note that the use of brackets around a tr range is ok here, (it's
|
||||
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
||||
# the square bracket bytes happen to fall in the designated range.
|
||||
test $(git diff --cached --name-only --diff-filter=A -z $against |
|
||||
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
|
||||
then
|
||||
cat <<\EOF
|
||||
Error: Attempt to add a non-ASCII file name.
|
||||
|
||||
This can cause problems if you want to work with people on other platforms.
|
||||
|
||||
To be portable it is advisable to rename the file.
|
||||
|
||||
If you know what you are doing you can disable this check using:
|
||||
|
||||
git config hooks.allownonascii true
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If there are whitespace errors, print the offending file names and fail.
|
||||
exec git diff-index --check --cached $against --
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to verify what is about to be committed.
|
||||
# Called by "git merge" with no arguments. The hook should
|
||||
# exit with non-zero status after issuing an appropriate message to
|
||||
# stderr if it wants to stop the merge commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-merge-commit".
|
||||
|
||||
. git-sh-setup
|
||||
test -x "$GIT_DIR/hooks/pre-commit" &&
|
||||
exec "$GIT_DIR/hooks/pre-commit"
|
||||
:
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
#!/bin/sh
|
||||
|
||||
# An example hook script to verify what is about to be pushed. Called by "git
|
||||
# push" after it has checked the remote status, but before anything has been
|
||||
# pushed. If this script exits with a non-zero status nothing will be pushed.
|
||||
#
|
||||
# This hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- Name of the remote to which the push is being done
|
||||
# $2 -- URL to which the push is being done
|
||||
#
|
||||
# If pushing without using a named remote those arguments will be equal.
|
||||
#
|
||||
# Information about the commits which are being pushed is supplied as lines to
|
||||
# the standard input in the form:
|
||||
#
|
||||
# <local ref> <local oid> <remote ref> <remote oid>
|
||||
#
|
||||
# This sample shows how to prevent push of commits where the log message starts
|
||||
# with "WIP" (work in progress).
|
||||
|
||||
remote="$1"
|
||||
url="$2"
|
||||
|
||||
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
|
||||
|
||||
while read local_ref local_oid remote_ref remote_oid
|
||||
do
|
||||
if test "$local_oid" = "$zero"
|
||||
then
|
||||
# Handle delete
|
||||
:
|
||||
else
|
||||
if test "$remote_oid" = "$zero"
|
||||
then
|
||||
# New branch, examine all commits
|
||||
range="$local_oid"
|
||||
else
|
||||
# Update to existing branch, examine new commits
|
||||
range="$remote_oid..$local_oid"
|
||||
fi
|
||||
|
||||
# Check for WIP commit
|
||||
commit=$(git rev-list -n 1 --grep '^WIP' "$range")
|
||||
if test -n "$commit"
|
||||
then
|
||||
echo >&2 "Found WIP commit in $local_ref, not pushing"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2006, 2008 Junio C Hamano
|
||||
#
|
||||
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
||||
# its job, and can prevent the command from running by exiting with
|
||||
# non-zero status.
|
||||
#
|
||||
# The hook is called with the following parameters:
|
||||
#
|
||||
# $1 -- the upstream the series was forked from.
|
||||
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
||||
#
|
||||
# This sample shows how to prevent topic branches that are already
|
||||
# merged to 'next' branch from getting rebased, because allowing it
|
||||
# would result in rebasing already published history.
|
||||
|
||||
publish=next
|
||||
basebranch="$1"
|
||||
if test "$#" = 2
|
||||
then
|
||||
topic="refs/heads/$2"
|
||||
else
|
||||
topic=`git symbolic-ref HEAD` ||
|
||||
exit 0 ;# we do not interrupt rebasing detached HEAD
|
||||
fi
|
||||
|
||||
case "$topic" in
|
||||
refs/heads/??/*)
|
||||
;;
|
||||
*)
|
||||
exit 0 ;# we do not interrupt others.
|
||||
;;
|
||||
esac
|
||||
|
||||
# Now we are dealing with a topic branch being rebased
|
||||
# on top of master. Is it OK to rebase it?
|
||||
|
||||
# Does the topic really exist?
|
||||
git show-ref -q "$topic" || {
|
||||
echo >&2 "No such branch $topic"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Is topic fully merged to master?
|
||||
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
||||
if test -z "$not_in_master"
|
||||
then
|
||||
echo >&2 "$topic is fully merged to master; better remove it."
|
||||
exit 1 ;# we could allow it, but there is no point.
|
||||
fi
|
||||
|
||||
# Is topic ever merged to next? If so you should not be rebasing it.
|
||||
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
||||
only_next_2=`git rev-list ^master ${publish} | sort`
|
||||
if test "$only_next_1" = "$only_next_2"
|
||||
then
|
||||
not_in_topic=`git rev-list "^$topic" master`
|
||||
if test -z "$not_in_topic"
|
||||
then
|
||||
echo >&2 "$topic is already up to date with master"
|
||||
exit 1 ;# we could allow it, but there is no point.
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
||||
/usr/bin/perl -e '
|
||||
my $topic = $ARGV[0];
|
||||
my $msg = "* $topic has commits already merged to public branch:\n";
|
||||
my (%not_in_next) = map {
|
||||
/^([0-9a-f]+) /;
|
||||
($1 => 1);
|
||||
} split(/\n/, $ARGV[1]);
|
||||
for my $elem (map {
|
||||
/^([0-9a-f]+) (.*)$/;
|
||||
[$1 => $2];
|
||||
} split(/\n/, $ARGV[2])) {
|
||||
if (!exists $not_in_next{$elem->[0]}) {
|
||||
if ($msg) {
|
||||
print STDERR $msg;
|
||||
undef $msg;
|
||||
}
|
||||
print STDERR " $elem->[1]\n";
|
||||
}
|
||||
}
|
||||
' "$topic" "$not_in_next" "$not_in_master"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
<<\DOC_END
|
||||
|
||||
This sample hook safeguards topic branches that have been
|
||||
published from being rewound.
|
||||
|
||||
The workflow assumed here is:
|
||||
|
||||
* Once a topic branch forks from "master", "master" is never
|
||||
merged into it again (either directly or indirectly).
|
||||
|
||||
* Once a topic branch is fully cooked and merged into "master",
|
||||
it is deleted. If you need to build on top of it to correct
|
||||
earlier mistakes, a new topic branch is created by forking at
|
||||
the tip of the "master". This is not strictly necessary, but
|
||||
it makes it easier to keep your history simple.
|
||||
|
||||
* Whenever you need to test or publish your changes to topic
|
||||
branches, merge them into "next" branch.
|
||||
|
||||
The script, being an example, hardcodes the publish branch name
|
||||
to be "next", but it is trivial to make it configurable via
|
||||
$GIT_DIR/config mechanism.
|
||||
|
||||
With this workflow, you would want to know:
|
||||
|
||||
(1) ... if a topic branch has ever been merged to "next". Young
|
||||
topic branches can have stupid mistakes you would rather
|
||||
clean up before publishing, and things that have not been
|
||||
merged into other branches can be easily rebased without
|
||||
affecting other people. But once it is published, you would
|
||||
not want to rewind it.
|
||||
|
||||
(2) ... if a topic branch has been fully merged to "master".
|
||||
Then you can delete it. More importantly, you should not
|
||||
build on top of it -- other people may already want to
|
||||
change things related to the topic as patches against your
|
||||
"master", so if you need further changes, it is better to
|
||||
fork the topic (perhaps with the same name) afresh from the
|
||||
tip of "master".
|
||||
|
||||
Let's look at this example:
|
||||
|
||||
o---o---o---o---o---o---o---o---o---o "next"
|
||||
/ / / /
|
||||
/ a---a---b A / /
|
||||
/ / / /
|
||||
/ / c---c---c---c B /
|
||||
/ / / \ /
|
||||
/ / / b---b C \ /
|
||||
/ / / / \ /
|
||||
---o---o---o---o---o---o---o---o---o---o---o "master"
|
||||
|
||||
|
||||
A, B and C are topic branches.
|
||||
|
||||
* A has one fix since it was merged up to "next".
|
||||
|
||||
* B has finished. It has been fully merged up to "master" and "next",
|
||||
and is ready to be deleted.
|
||||
|
||||
* C has not merged to "next" at all.
|
||||
|
||||
We would want to allow C to be rebased, refuse A, and encourage
|
||||
B to be deleted.
|
||||
|
||||
To compute (1):
|
||||
|
||||
git rev-list ^master ^topic next
|
||||
git rev-list ^master next
|
||||
|
||||
if these match, topic has not merged in next at all.
|
||||
|
||||
To compute (2):
|
||||
|
||||
git rev-list master..topic
|
||||
|
||||
if this is empty, it is fully merged to "master".
|
||||
|
||||
DOC_END
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to make use of push options.
|
||||
# The example simply echoes all push options that start with 'echoback='
|
||||
# and rejects all pushes when the "reject" push option is used.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-receive".
|
||||
|
||||
if test -n "$GIT_PUSH_OPTION_COUNT"
|
||||
then
|
||||
i=0
|
||||
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
|
||||
do
|
||||
eval "value=\$GIT_PUSH_OPTION_$i"
|
||||
case "$value" in
|
||||
echoback=*)
|
||||
echo "echo from the pre-receive-hook: ${value#*=}" >&2
|
||||
;;
|
||||
reject)
|
||||
exit 1
|
||||
esac
|
||||
i=$((i + 1))
|
||||
done
|
||||
fi
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to prepare the commit log message.
|
||||
# Called by "git commit" with the name of the file that has the
|
||||
# commit message, followed by the description of the commit
|
||||
# message's source. The hook's purpose is to edit the commit
|
||||
# message file. If the hook fails with a non-zero status,
|
||||
# the commit is aborted.
|
||||
#
|
||||
# To enable this hook, rename this file to "prepare-commit-msg".
|
||||
|
||||
# This hook includes three examples. The first one removes the
|
||||
# "# Please enter the commit message..." help message.
|
||||
#
|
||||
# The second includes the output of "git diff --name-status -r"
|
||||
# into the message, just before the "git status" output. It is
|
||||
# commented because it doesn't cope with --amend or with squashed
|
||||
# commits.
|
||||
#
|
||||
# The third example adds a Signed-off-by line to the message, that can
|
||||
# still be edited. This is rarely a good idea.
|
||||
|
||||
COMMIT_MSG_FILE=$1
|
||||
COMMIT_SOURCE=$2
|
||||
SHA1=$3
|
||||
|
||||
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
|
||||
|
||||
# case "$COMMIT_SOURCE,$SHA1" in
|
||||
# ,|template,)
|
||||
# /usr/bin/perl -i.bak -pe '
|
||||
# print "\n" . `git diff --cached --name-status -r`
|
||||
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
|
||||
# *) ;;
|
||||
# esac
|
||||
|
||||
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
|
||||
# if test -z "$COMMIT_SOURCE"
|
||||
# then
|
||||
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
|
||||
# fi
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
#!/bin/sh
|
||||
|
||||
# An example hook script to update a checked-out tree on a git push.
|
||||
#
|
||||
# This hook is invoked by git-receive-pack(1) when it reacts to git
|
||||
# push and updates reference(s) in its repository, and when the push
|
||||
# tries to update the branch that is currently checked out and the
|
||||
# receive.denyCurrentBranch configuration variable is set to
|
||||
# updateInstead.
|
||||
#
|
||||
# By default, such a push is refused if the working tree and the index
|
||||
# of the remote repository has any difference from the currently
|
||||
# checked out commit; when both the working tree and the index match
|
||||
# the current commit, they are updated to match the newly pushed tip
|
||||
# of the branch. This hook is to be used to override the default
|
||||
# behaviour; however the code below reimplements the default behaviour
|
||||
# as a starting point for convenient modification.
|
||||
#
|
||||
# The hook receives the commit with which the tip of the current
|
||||
# branch is going to be updated:
|
||||
commit=$1
|
||||
|
||||
# It can exit with a non-zero status to refuse the push (when it does
|
||||
# so, it must not modify the index or the working tree).
|
||||
die () {
|
||||
echo >&2 "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Or it can make any necessary changes to the working tree and to the
|
||||
# index to bring them to the desired state when the tip of the current
|
||||
# branch is updated to the new commit, and exit with a zero status.
|
||||
#
|
||||
# For example, the hook can simply run git read-tree -u -m HEAD "$1"
|
||||
# in order to emulate git fetch that is run in the reverse direction
|
||||
# with git push, as the two-tree form of git read-tree -u -m is
|
||||
# essentially the same as git switch or git checkout that switches
|
||||
# branches while keeping the local changes in the working tree that do
|
||||
# not interfere with the difference between the branches.
|
||||
|
||||
# The below is a more-or-less exact translation to shell of the C code
|
||||
# for the default behaviour for git's push-to-checkout hook defined in
|
||||
# the push_to_deploy() function in builtin/receive-pack.c.
|
||||
#
|
||||
# Note that the hook will be executed from the repository directory,
|
||||
# not from the working tree, so if you want to perform operations on
|
||||
# the working tree, you will have to adapt your code accordingly, e.g.
|
||||
# by adding "cd .." or using relative paths.
|
||||
|
||||
if ! git update-index -q --ignore-submodules --refresh
|
||||
then
|
||||
die "Up-to-date check failed"
|
||||
fi
|
||||
|
||||
if ! git diff-files --quiet --ignore-submodules --
|
||||
then
|
||||
die "Working directory has unstaged changes"
|
||||
fi
|
||||
|
||||
# This is a rough translation of:
|
||||
#
|
||||
# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
|
||||
if git cat-file -e HEAD 2>/dev/null
|
||||
then
|
||||
head=HEAD
|
||||
else
|
||||
head=$(git hash-object -t tree --stdin </dev/null)
|
||||
fi
|
||||
|
||||
if ! git diff-index --quiet --cached --ignore-submodules $head --
|
||||
then
|
||||
die "Working directory has staged changes"
|
||||
fi
|
||||
|
||||
if ! git read-tree -u -m "$commit"
|
||||
then
|
||||
die "Could not update working tree to new HEAD"
|
||||
fi
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# An example hook script to block unannotated tags from entering.
|
||||
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
||||
#
|
||||
# To enable this hook, rename this file to "update".
|
||||
#
|
||||
# Config
|
||||
# ------
|
||||
# hooks.allowunannotated
|
||||
# This boolean sets whether unannotated tags will be allowed into the
|
||||
# repository. By default they won't be.
|
||||
# hooks.allowdeletetag
|
||||
# This boolean sets whether deleting tags will be allowed in the
|
||||
# repository. By default they won't be.
|
||||
# hooks.allowmodifytag
|
||||
# This boolean sets whether a tag may be modified after creation. By default
|
||||
# it won't be.
|
||||
# hooks.allowdeletebranch
|
||||
# This boolean sets whether deleting branches will be allowed in the
|
||||
# repository. By default they won't be.
|
||||
# hooks.denycreatebranch
|
||||
# This boolean sets whether remotely creating branches will be denied
|
||||
# in the repository. By default this is allowed.
|
||||
#
|
||||
|
||||
# --- Command line
|
||||
refname="$1"
|
||||
oldrev="$2"
|
||||
newrev="$3"
|
||||
|
||||
# --- Safety check
|
||||
if [ -z "$GIT_DIR" ]; then
|
||||
echo "Don't run this script from the command line." >&2
|
||||
echo " (if you want, you could supply GIT_DIR then run" >&2
|
||||
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
||||
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Config
|
||||
allowunannotated=$(git config --type=bool hooks.allowunannotated)
|
||||
allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
|
||||
denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
|
||||
allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
|
||||
allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
|
||||
|
||||
# check for no description
|
||||
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
||||
case "$projectdesc" in
|
||||
"Unnamed repository"* | "")
|
||||
echo "*** Project description file hasn't been set" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# --- Check types
|
||||
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
||||
zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
|
||||
if [ "$newrev" = "$zero" ]; then
|
||||
newrev_type=delete
|
||||
else
|
||||
newrev_type=$(git cat-file -t $newrev)
|
||||
fi
|
||||
|
||||
case "$refname","$newrev_type" in
|
||||
refs/tags/*,commit)
|
||||
# un-annotated tag
|
||||
short_refname=${refname##refs/tags/}
|
||||
if [ "$allowunannotated" != "true" ]; then
|
||||
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
||||
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/tags/*,delete)
|
||||
# delete tag
|
||||
if [ "$allowdeletetag" != "true" ]; then
|
||||
echo "*** Deleting a tag is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/tags/*,tag)
|
||||
# annotated tag
|
||||
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
||||
then
|
||||
echo "*** Tag '$refname' already exists." >&2
|
||||
echo "*** Modifying a tag is not allowed in this repository." >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/heads/*,commit)
|
||||
# branch
|
||||
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
||||
echo "*** Creating a branch is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/heads/*,delete)
|
||||
# delete branch
|
||||
if [ "$allowdeletebranch" != "true" ]; then
|
||||
echo "*** Deleting a branch is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
refs/remotes/*,commit)
|
||||
# tracking branch
|
||||
;;
|
||||
refs/remotes/*,delete)
|
||||
# delete tracking branch
|
||||
if [ "$allowdeletebranch" != "true" ]; then
|
||||
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Anything else (is there anything else?)
|
||||
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# --- Finished
|
||||
exit 0
|
||||
BIN
dot_tmux/plugins/tmux-continuum/dot_git/index
Normal file
BIN
dot_tmux/plugins/tmux-continuum/dot_git/index
Normal file
Binary file not shown.
6
dot_tmux/plugins/tmux-continuum/dot_git/info/exclude
Normal file
6
dot_tmux/plugins/tmux-continuum/dot_git/info/exclude
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# git ls-files --others --exclude-from=.git/info/exclude
|
||||
# Lines that start with '#' are comments.
|
||||
# For a project mostly in C, the following would be a good set of
|
||||
# exclude patterns (uncomment them if you want to use them):
|
||||
# *.[oa]
|
||||
# *~
|
||||
2
dot_tmux/plugins/tmux-continuum/dot_git/logs/HEAD
Normal file
2
dot_tmux/plugins/tmux-continuum/dot_git/logs/HEAD
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
0000000000000000000000000000000000000000 3e4bc35da41f956c873aea716c97555bf1afce5d wizard <wizard@devvm.(none)> 1678899277 +0000 clone: from https://github.com/tmux-plugins/tmux-continuum
|
||||
3e4bc35da41f956c873aea716c97555bf1afce5d 0698e8f4b17d6454c71bf5212895ec055c578da0 Viktor Barzin <vbarzin@gmail.com> 1713616989 +0000 pull: Fast-forward
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0000000000000000000000000000000000000000 3e4bc35da41f956c873aea716c97555bf1afce5d wizard <wizard@devvm.(none)> 1678899277 +0000 clone: from https://github.com/tmux-plugins/tmux-continuum
|
||||
3e4bc35da41f956c873aea716c97555bf1afce5d 0698e8f4b17d6454c71bf5212895ec055c578da0 Viktor Barzin <vbarzin@gmail.com> 1713616989 +0000 pull: Fast-forward
|
||||
|
|
@ -0,0 +1 @@
|
|||
0000000000000000000000000000000000000000 3e4bc35da41f956c873aea716c97555bf1afce5d wizard <wizard@devvm.(none)> 1678899277 +0000 clone: from https://github.com/tmux-plugins/tmux-continuum
|
||||
|
|
@ -0,0 +1 @@
|
|||
3e4bc35da41f956c873aea716c97555bf1afce5d 0698e8f4b17d6454c71bf5212895ec055c578da0 Viktor Barzin <vbarzin@gmail.com> 1713616988 +0000 pull: fast-forward
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
dot_tmux/plugins/tmux-continuum/dot_git/packed-refs
Normal file
2
dot_tmux/plugins/tmux-continuum/dot_git/packed-refs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# pack-refs with: peeled fully-peeled sorted
|
||||
3e4bc35da41f956c873aea716c97555bf1afce5d refs/remotes/origin/master
|
||||
|
|
@ -0,0 +1 @@
|
|||
0698e8f4b17d6454c71bf5212895ec055c578da0
|
||||
|
|
@ -0,0 +1 @@
|
|||
ref: refs/remotes/origin/master
|
||||
|
|
@ -0,0 +1 @@
|
|||
0698e8f4b17d6454c71bf5212895ec055c578da0
|
||||
0
dot_tmux/plugins/tmux-continuum/dot_git/refs/tags/.keep
Normal file
0
dot_tmux/plugins/tmux-continuum/dot_git/refs/tags/.keep
Normal file
1
dot_tmux/plugins/tmux-continuum/dot_git/shallow
Normal file
1
dot_tmux/plugins/tmux-continuum/dot_git/shallow
Normal file
|
|
@ -0,0 +1 @@
|
|||
3e4bc35da41f956c873aea716c97555bf1afce5d
|
||||
2
dot_tmux/plugins/tmux-continuum/dot_gitattributes
Normal file
2
dot_tmux/plugins/tmux-continuum/dot_gitattributes
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Force text files to have unix eols, so Windows/Cygwin does not break them
|
||||
*.* eol=lf
|
||||
89
dot_tmux/plugins/tmux-continuum/executable_continuum.tmux
Normal file
89
dot_tmux/plugins/tmux-continuum/executable_continuum.tmux
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/scripts/helpers.sh"
|
||||
source "$CURRENT_DIR/scripts/variables.sh"
|
||||
source "$CURRENT_DIR/scripts/shared.sh"
|
||||
|
||||
save_command_interpolation="#($CURRENT_DIR/scripts/continuum_save.sh)"
|
||||
|
||||
supported_tmux_version_ok() {
|
||||
"$CURRENT_DIR/scripts/check_tmux_version.sh" "$SUPPORTED_VERSION"
|
||||
}
|
||||
|
||||
handle_tmux_automatic_start() {
|
||||
"$CURRENT_DIR/scripts/handle_tmux_automatic_start.sh"
|
||||
}
|
||||
|
||||
another_tmux_server_running() {
|
||||
if just_started_tmux_server; then
|
||||
another_tmux_server_running_on_startup
|
||||
else
|
||||
# script loaded after tmux server start can have multiple clients attached
|
||||
[ "$(number_tmux_processes_except_current_server)" -gt "$(number_current_server_client_processes)" ]
|
||||
fi
|
||||
}
|
||||
|
||||
delay_saving_environment_on_first_plugin_load() {
|
||||
if [ -z "$(get_tmux_option "$last_auto_save_option" "")" ]; then
|
||||
# last save option not set, this is first time plugin load
|
||||
set_last_save_timestamp
|
||||
fi
|
||||
}
|
||||
|
||||
add_resurrect_save_interpolation() {
|
||||
local status_right_value="$(get_tmux_option "status-right" "")"
|
||||
# check interpolation not already added
|
||||
if ! [[ "$status_right_value" == *"$save_command_interpolation"* ]]; then
|
||||
local new_value="${save_command_interpolation}${status_right_value}"
|
||||
set_tmux_option "status-right" "$new_value"
|
||||
fi
|
||||
}
|
||||
|
||||
just_started_tmux_server() {
|
||||
local tmux_start_time
|
||||
tmux_start_time="$(tmux display-message -p -F '#{start_time}')"
|
||||
local restore_max_delay
|
||||
restore_max_delay="$(get_tmux_option "$auto_restore_max_delay_option" "${auto_restore_max_delay_default}")"
|
||||
[ "$tmux_start_time" == "" ] || [ "$tmux_start_time" -gt "$(($(date +%s)-${restore_max_delay}))" ]
|
||||
}
|
||||
|
||||
start_auto_restore_in_background() {
|
||||
"$CURRENT_DIR/scripts/continuum_restore.sh" &
|
||||
}
|
||||
|
||||
update_tmux_option() {
|
||||
local option="$1"
|
||||
local option_value="$(get_tmux_option "$option")"
|
||||
# replace interpolation string with a script to execute
|
||||
local new_option_value="${option_value/$status_interpolation_string/$status_script}"
|
||||
set_tmux_option "$option" "$new_option_value"
|
||||
}
|
||||
|
||||
main() {
|
||||
if supported_tmux_version_ok; then
|
||||
handle_tmux_automatic_start
|
||||
|
||||
# Advanced edge case handling: start auto-saving only if this is the
|
||||
# only tmux server. We don't want saved files from more environments to
|
||||
# overwrite each other.
|
||||
if ! another_tmux_server_running; then
|
||||
# give user a chance to restore previously saved session
|
||||
delay_saving_environment_on_first_plugin_load
|
||||
add_resurrect_save_interpolation
|
||||
fi
|
||||
|
||||
if just_started_tmux_server; then
|
||||
start_auto_restore_in_background
|
||||
fi
|
||||
|
||||
# Put "#{continuum_status}" interpolation in status-right or
|
||||
# status-left tmux option to get current tmux continuum status.
|
||||
update_tmux_option "status-right"
|
||||
update_tmux_option "status-left"
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
VERSION="$1"
|
||||
UNSUPPORTED_MSG="$2"
|
||||
|
||||
# this is used to get "clean" integer version number. Examples:
|
||||
# `tmux 1.9` => `19`
|
||||
# `1.9a` => `19`
|
||||
get_digits_from_string() {
|
||||
local string="$1"
|
||||
local only_digits="$(echo "$string" | tr -dC '[:digit:]')"
|
||||
echo "$only_digits"
|
||||
}
|
||||
|
||||
tmux_version_int() {
|
||||
local tmux_version_string=$(tmux -V)
|
||||
echo "$(get_digits_from_string "$tmux_version_string")"
|
||||
}
|
||||
|
||||
exit_if_unsupported_version() {
|
||||
local current_version="$1"
|
||||
local supported_version="$2"
|
||||
if [ "$current_version" -lt "$supported_version" ]; then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
local supported_version_int="$(get_digits_from_string "$VERSION")"
|
||||
local current_version_int="$(tmux_version_int)"
|
||||
exit_if_unsupported_version "$current_version_int" "$supported_version_int"
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/helpers.sh"
|
||||
source "$CURRENT_DIR/variables.sh"
|
||||
|
||||
auto_restore_enabled() {
|
||||
local auto_restore_value="$(get_tmux_option "$auto_restore_option" "$auto_restore_default")"
|
||||
[ "$auto_restore_value" == "on" ] && [ ! -f "$auto_restore_halt_file" ]
|
||||
}
|
||||
|
||||
fetch_and_run_tmux_resurrect_restore_script() {
|
||||
# give tmux some time to start and source all the plugins
|
||||
sleep 1
|
||||
local resurrect_restore_script_path="$(get_tmux_option "$resurrect_restore_path_option" "")"
|
||||
if [ -n "$resurrect_restore_script_path" ]; then
|
||||
"$resurrect_restore_script_path"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
# Advanced edge case handling: auto restore only if this is the only tmux
|
||||
# server. If another tmux server exists, it is assumed auto-restore is not wanted.
|
||||
if auto_restore_enabled && ! another_tmux_server_running_on_startup; then
|
||||
fetch_and_run_tmux_resurrect_restore_script
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/helpers.sh"
|
||||
source "$CURRENT_DIR/variables.sh"
|
||||
source "$CURRENT_DIR/shared.sh"
|
||||
|
||||
supported_tmux_version_ok() {
|
||||
"$CURRENT_DIR/check_tmux_version.sh" "$SUPPORTED_VERSION"
|
||||
}
|
||||
|
||||
get_interval() {
|
||||
get_tmux_option "$auto_save_interval_option" "$auto_save_interval_default"
|
||||
}
|
||||
|
||||
auto_save_not_disabled() {
|
||||
[ "$(get_interval)" -gt 0 ]
|
||||
}
|
||||
|
||||
enough_time_since_last_run_passed() {
|
||||
local last_saved_timestamp="$(get_tmux_option "$last_auto_save_option" "0")"
|
||||
local interval_minutes="$(get_interval)"
|
||||
local interval_seconds="$((interval_minutes * 60))"
|
||||
local next_run="$((last_saved_timestamp + $interval_seconds))"
|
||||
[ "$(current_timestamp)" -ge "$next_run" ]
|
||||
}
|
||||
|
||||
fetch_and_run_tmux_resurrect_save_script() {
|
||||
local resurrect_save_script_path="$(get_tmux_option "$resurrect_save_path_option" "")"
|
||||
if [ -n "$resurrect_save_script_path" ]; then
|
||||
"$resurrect_save_script_path" "quiet" >/dev/null 2>&1 &
|
||||
set_last_save_timestamp
|
||||
fi
|
||||
}
|
||||
|
||||
acquire_lock() {
|
||||
# Sometimes tmux starts multiple saves in parallel. We want only one
|
||||
# save to be running, otherwise we can get corrupted saved state.
|
||||
local lockdir_prefix="/tmp/tmux-continuum-$(current_tmux_server_pid)-lock-"
|
||||
# The following implements a lock that auto-expires after 100...200s.
|
||||
local lock_generation=$((`date +%s` / 100))
|
||||
local lockdir1="${lockdir_prefix}${lock_generation}"
|
||||
local lockdir2="${lockdir_prefix}$(($lock_generation + 1))"
|
||||
if mkdir "$lockdir1"; then
|
||||
trap "rmdir "$lockdir1"" EXIT
|
||||
if mkdir "$lockdir2"; then
|
||||
trap "rmdir "$lockdir1" "$lockdir2"" EXIT
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1 # Someone else has the lock.
|
||||
}
|
||||
|
||||
main() {
|
||||
if supported_tmux_version_ok && auto_save_not_disabled && enough_time_since_last_run_passed && acquire_lock; then
|
||||
fetch_and_run_tmux_resurrect_save_script
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/helpers.sh"
|
||||
source "$CURRENT_DIR/variables.sh"
|
||||
|
||||
print_status() {
|
||||
local save_int="$(get_tmux_option "$auto_save_interval_option")"
|
||||
local status=""
|
||||
local style_wrap
|
||||
if [ $save_int -gt 0 ]; then
|
||||
style_wrap="$(get_tmux_option "$status_on_style_wrap_option" "")"
|
||||
status="$save_int"
|
||||
else
|
||||
style_wrap="$(get_tmux_option "$status_off_style_wrap_option" "")"
|
||||
status="off"
|
||||
fi
|
||||
|
||||
if [ -n "$style_wrap" ]; then
|
||||
status="${style_wrap/$status_wrap_string/$status}"
|
||||
fi
|
||||
echo "$status"
|
||||
}
|
||||
print_status
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/helpers.sh"
|
||||
source "$CURRENT_DIR/variables.sh"
|
||||
|
||||
is_tmux_automatic_start_enabled() {
|
||||
local auto_start_value="$(get_tmux_option "$auto_start_option" "$auto_start_default")"
|
||||
[ "$auto_start_value" == "on" ]
|
||||
}
|
||||
|
||||
is_osx() {
|
||||
[ $(uname) == "Darwin" ]
|
||||
}
|
||||
|
||||
is_systemd() {
|
||||
[ $(ps -o comm= -p1) == 'systemd' ]
|
||||
}
|
||||
|
||||
main() {
|
||||
if is_tmux_automatic_start_enabled; then
|
||||
if is_osx; then
|
||||
"$CURRENT_DIR/handle_tmux_automatic_start/osx_enable.sh"
|
||||
elif is_systemd; then
|
||||
"$CURRENT_DIR/handle_tmux_automatic_start/systemd_enable.sh"
|
||||
fi
|
||||
else
|
||||
if is_osx; then
|
||||
"$CURRENT_DIR/handle_tmux_automatic_start/osx_disable.sh"
|
||||
elif is_systemd; then
|
||||
"$CURRENT_DIR/handle_tmux_automatic_start/systemd_disable.sh"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# for "true full screen" call the script with "fullscreen" as the first argument
|
||||
TRUE_FULL_SCREEN="$1"
|
||||
|
||||
start_terminal_and_run_tmux() {
|
||||
osascript <<-EOF
|
||||
tell application "alacritty"
|
||||
activate
|
||||
delay 0.5
|
||||
tell application "System Events" to tell process "alacritty"
|
||||
set frontmost to true
|
||||
keystroke "tmux"
|
||||
key code 36
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
resize_window_to_full_screen() {
|
||||
osascript <<-EOF
|
||||
tell application "alacritty"
|
||||
activate
|
||||
tell application "System Events"
|
||||
if (every window of process "alacritty") is {} then
|
||||
keystroke "n" using command down
|
||||
end if
|
||||
|
||||
tell application "Finder"
|
||||
set desktopSize to bounds of window of desktop
|
||||
end tell
|
||||
|
||||
set position of front window of process "alacritty" to {0, 0}
|
||||
set size of front window of process "alacritty" to {item 3 of desktopSize, item 4 of desktopSize}
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
resize_to_true_full_screen() {
|
||||
osascript <<-EOF
|
||||
tell application "Alacritty"
|
||||
activate
|
||||
delay 0.5
|
||||
tell application "System Events" to tell process "Alacritty"
|
||||
if front window exists then
|
||||
tell front window
|
||||
if value of attribute "AXFullScreen" then
|
||||
set value of attribute "AXFullScreen" to false
|
||||
else
|
||||
set value of attribute "AXFullScreen" to true
|
||||
end if
|
||||
end tell
|
||||
end if
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
start_terminal_and_run_tmux
|
||||
if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then
|
||||
resize_to_true_full_screen
|
||||
else
|
||||
resize_window_to_full_screen
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/../variables.sh"
|
||||
|
||||
main() {
|
||||
rm "$osx_auto_start_file_path" > /dev/null 2>&1
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/../helpers.sh"
|
||||
source "$CURRENT_DIR/../variables.sh"
|
||||
|
||||
template() {
|
||||
local tmux_start_script="$1"
|
||||
local is_fullscreen="$2"
|
||||
|
||||
local fullscreen_tag=""
|
||||
if [ "$is_fullscreen" == "true" ]; then
|
||||
# newline and spacing so tag is aligned with other tags in template
|
||||
fullscreen_tag=$'\n <string>fullscreen</string>'
|
||||
fi
|
||||
|
||||
local content
|
||||
read -r -d '' content <<-EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>${osx_auto_start_file_name}</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>${tmux_start_script}</string>$fullscreen_tag
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
echo "$content"
|
||||
}
|
||||
|
||||
get_strategy() {
|
||||
local options="$1"
|
||||
if [[ "$options" =~ "iterm" ]]; then
|
||||
echo "iterm"
|
||||
elif [[ "$options" =~ "kitty" ]]; then
|
||||
echo "kitty"
|
||||
elif [[ "$options" =~ "alacritty" ]]; then
|
||||
echo "alacritty"
|
||||
else
|
||||
# Terminal.app is the default console app
|
||||
echo "terminal"
|
||||
fi
|
||||
}
|
||||
|
||||
get_fullscreen_option_value() {
|
||||
local options="$1"
|
||||
if [[ "$options" =~ "fullscreen" ]]; then
|
||||
echo "true"
|
||||
else
|
||||
echo "false"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
local options="$(get_tmux_option "$auto_start_config_option" "$auto_start_config_default")"
|
||||
local strategy="$(get_strategy "$options")"
|
||||
local fullscreen_option_value="$(get_fullscreen_option_value "$options")"
|
||||
local tmux_start_script_path="${CURRENT_DIR}/osx_${strategy}_start_tmux.sh"
|
||||
|
||||
local launchd_plist_file_content="$(template "$tmux_start_script_path" "$fullscreen_option_value")"
|
||||
if ! diff "$osx_auto_start_file_path" <(echo "$launchd_plist_file_content") &>/dev/null ; then
|
||||
echo "$launchd_plist_file_content" > "$osx_auto_start_file_path"
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# for "true full screen" call the script with "fullscreen" as the first argument
|
||||
TRUE_FULL_SCREEN="$1"
|
||||
|
||||
start_iterm_and_run_tmux() {
|
||||
osascript <<-EOF
|
||||
tell application "iTerm"
|
||||
activate
|
||||
|
||||
# open iterm window
|
||||
try
|
||||
set _session to current session of current window
|
||||
on error
|
||||
set _term to (make new terminal)
|
||||
tell _term
|
||||
launch session "Tmux"
|
||||
set _session to current session
|
||||
end tell
|
||||
end try
|
||||
|
||||
# start tmux
|
||||
tell _session
|
||||
write text "tmux"
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
resize_window_to_full_screen() {
|
||||
osascript <<-EOF
|
||||
tell application "iTerm"
|
||||
set winID to id of window 1
|
||||
tell application "Finder"
|
||||
set desktopSize to bounds of window of desktop
|
||||
end tell
|
||||
set bounds of window id winID to desktopSize
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
resize_to_true_full_screen() {
|
||||
osascript <<-EOF
|
||||
tell application "iTerm"
|
||||
# wait for iTerm to start
|
||||
delay 1
|
||||
activate
|
||||
# short wait for iTerm to gain focus
|
||||
delay 0.1
|
||||
# Command + Enter for fullscreen
|
||||
tell application "System Events"
|
||||
key code 36 using {command down}
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
start_iterm_and_run_tmux
|
||||
if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then
|
||||
resize_to_true_full_screen
|
||||
else
|
||||
resize_window_to_full_screen
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# for "true full screen" call the script with "fullscreen" as the first argument
|
||||
TRUE_FULL_SCREEN="$1"
|
||||
|
||||
start_terminal_and_run_tmux() {
|
||||
osascript <<-EOF
|
||||
tell application "kitty"
|
||||
activate
|
||||
delay 5
|
||||
tell application "System Events" to tell process "kitty"
|
||||
set frontmost to true
|
||||
keystroke "tmux"
|
||||
key code 36
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
resize_window_to_full_screen() {
|
||||
osascript <<-EOF
|
||||
tell application "kitty"
|
||||
activate
|
||||
tell application "System Events"
|
||||
if (every window of process "kitty") is {} then
|
||||
keystroke "n" using command down
|
||||
end if
|
||||
|
||||
tell application "Finder"
|
||||
set desktopSize to bounds of window of desktop
|
||||
end tell
|
||||
|
||||
set position of front window of process "kitty" to {0, 0}
|
||||
set size of front window of process "kitty" to {item 3 of desktopSize, item 4 of desktopSize}
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
resize_to_true_full_screen() {
|
||||
osascript <<-EOF
|
||||
tell application "kitty"
|
||||
activate
|
||||
delay 1
|
||||
tell application "System Events" to tell process "kitty"
|
||||
keystroke "f" using {control down, command down}
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
start_terminal_and_run_tmux
|
||||
if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then
|
||||
resize_to_true_full_screen
|
||||
else
|
||||
resize_window_to_full_screen
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# for "true full screen" call the script with "fullscreen" as the first argument
|
||||
TRUE_FULL_SCREEN="$1"
|
||||
|
||||
start_terminal_and_run_tmux() {
|
||||
osascript <<-EOF
|
||||
tell application "Terminal"
|
||||
if not (exists window 1) then reopen
|
||||
activate
|
||||
set winID to id of window 1
|
||||
do script "tmux" in window id winID
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
resize_window_to_full_screen() {
|
||||
osascript <<-EOF
|
||||
tell application "Terminal"
|
||||
set winID to id of window 1
|
||||
tell application "Finder"
|
||||
set desktopSize to bounds of window of desktop
|
||||
end tell
|
||||
set bounds of window id winID to desktopSize
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
resize_to_true_full_screen() {
|
||||
osascript <<-EOF
|
||||
tell application "Terminal"
|
||||
# waiting for Terminal.app to start
|
||||
delay 1
|
||||
activate
|
||||
# short wait for Terminal to gain focus
|
||||
delay 0.1
|
||||
tell application "System Events"
|
||||
keystroke "f" using {control down, command down}
|
||||
end tell
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
start_terminal_and_run_tmux
|
||||
if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then
|
||||
resize_to_true_full_screen
|
||||
else
|
||||
resize_window_to_full_screen
|
||||
fi
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Maintainer: Sven Vowe @nuclearglow
|
||||
# Contact maintainer for any change to this file.
|
||||
|
||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_DIR/../variables.sh"
|
||||
|
||||
main() {
|
||||
systemctl --user disable ${systemd_service_name}
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Maintainer: Sven Vowe @nuclearglow
|
||||
# Contact maintainer for any change to this file.
|
||||
|
||||
CURRENT_DIR="$( dirname ${BASH_SOURCE[0]} )"
|
||||
|
||||
source "$CURRENT_DIR/../helpers.sh"
|
||||
source "$CURRENT_DIR/../variables.sh"
|
||||
|
||||
template() {
|
||||
local tmux_start_script="$1"
|
||||
shift
|
||||
local options="$@"
|
||||
local content=""
|
||||
local resurrect_save_script_path="$(get_tmux_option "$resurrect_save_path_option" "$(realpath ${CURRENT_DIR}/../../../tmux-resurrect/scripts/save.sh)")"
|
||||
local tmux_path="$(command -v tmux)"
|
||||
|
||||
read -r -d '' content <<-EOF
|
||||
[Unit]
|
||||
Description=tmux default session (detached)
|
||||
Documentation=man:tmux(1)
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
Environment=DISPLAY=:0
|
||||
ExecStart=${tmux_path} ${systemd_tmux_server_start_cmd}
|
||||
|
||||
ExecStop=${resurrect_save_script_path}
|
||||
ExecStop=${tmux_path} kill-server
|
||||
KillMode=control-group
|
||||
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
|
||||
echo "$content"
|
||||
}
|
||||
|
||||
systemd_tmux_is_enabled() {
|
||||
systemctl --user is-enabled $(basename "${systemd_unit_file_path}") >/dev/null 2>&1
|
||||
}
|
||||
|
||||
enable_tmux_unit_on_boot() {
|
||||
if ! systemd_tmux_is_enabled; then
|
||||
systemctl --user enable ${systemd_service_name}
|
||||
fi
|
||||
}
|
||||
|
||||
systemd_unit_file() {
|
||||
local options="$(get_tmux_option "$auto_start_config_option" "${auto_start_config_default}")"
|
||||
local systemd_tmux_server_start_cmd="$(get_tmux_option "${systemd_tmux_server_start_cmd_option}" "${systemd_tmux_server_start_cmd_default}" )"
|
||||
local tmux_start_script_path="${CURRENT_DIR}/linux_start_tmux.sh"
|
||||
local systemd_unit_file=$(template "${tmux_start_script_path}" "${options}")
|
||||
echo "$systemd_unit_file"
|
||||
}
|
||||
|
||||
write_unit_file() {
|
||||
systemd_unit_file > "${systemd_unit_file_path}"
|
||||
}
|
||||
|
||||
write_unit_file_unless_exists() {
|
||||
local systemd_unit_file_dir=$(dirname ${systemd_unit_file_path})
|
||||
if ! [ -d $systemd_unit_file_dir ]; then
|
||||
mkdir -p $systemd_unit_file_dir
|
||||
write_unit_file
|
||||
elif ! [ -e "${systemd_unit_file_path}" ]; then
|
||||
write_unit_file
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
write_unit_file_unless_exists
|
||||
enable_tmux_unit_on_boot
|
||||
}
|
||||
main
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../docs/automatic_start.md
|
||||
49
dot_tmux/plugins/tmux-continuum/scripts/helpers.sh
Normal file
49
dot_tmux/plugins/tmux-continuum/scripts/helpers.sh
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
get_tmux_option() {
|
||||
local option="$1"
|
||||
local default_value="$2"
|
||||
local option_value=$(tmux show-option -gqv "$option")
|
||||
if [ -z "$option_value" ]; then
|
||||
echo "$default_value"
|
||||
else
|
||||
echo "$option_value"
|
||||
fi
|
||||
}
|
||||
|
||||
set_tmux_option() {
|
||||
local option="$1"
|
||||
local value="$2"
|
||||
tmux set-option -gq "$option" "$value"
|
||||
}
|
||||
|
||||
# multiple tmux server detection helpers
|
||||
|
||||
current_tmux_server_pid() {
|
||||
echo "$TMUX" |
|
||||
cut -f2 -d","
|
||||
}
|
||||
|
||||
all_tmux_processes() {
|
||||
# ignores `tmux source-file .tmux.conf` command used to reload tmux.conf
|
||||
local user_id=$(id -u)
|
||||
ps -u $user_id -o "command pid" |
|
||||
\grep "^tmux" |
|
||||
\grep -v "^tmux source"
|
||||
}
|
||||
|
||||
number_tmux_processes_except_current_server() {
|
||||
all_tmux_processes |
|
||||
\grep -v " $(current_tmux_server_pid)$" |
|
||||
wc -l |
|
||||
sed "s/ //g"
|
||||
}
|
||||
|
||||
number_current_server_client_processes() {
|
||||
tmux list-clients |
|
||||
wc -l |
|
||||
sed "s/ //g"
|
||||
}
|
||||
|
||||
another_tmux_server_running_on_startup() {
|
||||
# there are 2 tmux processes (current tmux server + 1) on tmux startup
|
||||
[ "$(number_tmux_processes_except_current_server)" -gt 1 ]
|
||||
}
|
||||
7
dot_tmux/plugins/tmux-continuum/scripts/shared.sh
Normal file
7
dot_tmux/plugins/tmux-continuum/scripts/shared.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
current_timestamp() {
|
||||
echo "$(date +%s)"
|
||||
}
|
||||
|
||||
set_last_save_timestamp() {
|
||||
set_tmux_option "$last_auto_save_option" "$(current_timestamp)"
|
||||
}
|
||||
43
dot_tmux/plugins/tmux-continuum/scripts/variables.sh
Normal file
43
dot_tmux/plugins/tmux-continuum/scripts/variables.sh
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
SUPPORTED_VERSION="1.9"
|
||||
|
||||
# these tmux options contain paths to tmux resurrect save and restore scripts
|
||||
resurrect_save_path_option="@resurrect-save-script-path"
|
||||
resurrect_restore_path_option="@resurrect-restore-script-path"
|
||||
|
||||
auto_save_interval_option="@continuum-save-interval"
|
||||
auto_save_interval_default="15"
|
||||
|
||||
# time when the tmux environment was last saved (unix timestamp)
|
||||
last_auto_save_option="@continuum-save-last-timestamp"
|
||||
|
||||
auto_restore_option="@continuum-restore"
|
||||
auto_restore_default="off"
|
||||
|
||||
auto_restore_halt_file="${HOME}/tmux_no_auto_restore"
|
||||
|
||||
auto_restore_max_delay_option="@continuum-restore-max-delay"
|
||||
auto_restore_max_delay_default="10"
|
||||
|
||||
# tmux auto start options
|
||||
auto_start_option="@continuum-boot"
|
||||
auto_start_default="off"
|
||||
|
||||
# comma separated list of additional options for tmux auto start
|
||||
auto_start_config_option="@continuum-boot-options"
|
||||
auto_start_config_default=""
|
||||
|
||||
osx_auto_start_file_name="Tmux.Start.plist"
|
||||
osx_auto_start_file_path="${HOME}/Library/LaunchAgents/${osx_auto_start_file_name}"
|
||||
|
||||
status_interpolation_string="\#{continuum_status}"
|
||||
status_script="#($CURRENT_DIR/scripts/continuum_status.sh)"
|
||||
# below options set style/color for #{continuum_status} interpolation
|
||||
status_on_style_wrap_option="@continuum-status-on-wrap-style" # example value: "#[fg=green]#{value}#[fg=white]"
|
||||
status_off_style_wrap_option="@continuum-status-off-wrap-style" # example value: "#[fg=yellow,bold]#{value}#[fg=white,nobold]"
|
||||
status_wrap_string="\#{value}"
|
||||
|
||||
systemd_service_name="tmux.service"
|
||||
systemd_unit_file_path="$HOME/.config/systemd/user/${systemd_service_name}"
|
||||
|
||||
systemd_tmux_server_start_cmd_option="@continuum-systemd-start-cmd"
|
||||
systemd_tmux_server_start_cmd_default="new-session -d"
|
||||
12
dot_tmux/plugins/tmux-mem-cpu-load/AUTHORS
Normal file
12
dot_tmux/plugins/tmux-mem-cpu-load/AUTHORS
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Original author and maintainer:
|
||||
|
||||
Matthew McCormick
|
||||
|
||||
Contributors (in alphabetical order):
|
||||
|
||||
Jasper Lievisse Adriaanse <jasper@humppa.nl>
|
||||
Justin Crawford <justin@pci-online.net>
|
||||
krieiter <krieiter@gmail.com>
|
||||
Mark Palmeri <mlp6@duke.edu>
|
||||
Pawel 'l0ner' Soltys <pwslts@gmail.com>
|
||||
Compilenix <Compilenix@compilenix.org>
|
||||
176
dot_tmux/plugins/tmux-mem-cpu-load/CMakeLists.txt
Normal file
176
dot_tmux/plugins/tmux-mem-cpu-load/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
# vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
#
|
||||
# Copyright 2012 Matthew McCormick
|
||||
# Copyright 2015 Pawel 'l0ner' Soltys
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
### General Package stuff
|
||||
project(tmux-mem-cpu-load)
|
||||
set(tmux-mem-cpu-load_VERSION_MAJOR 3)
|
||||
set(tmux-mem-cpu-load_VERSION_MINOR 8)
|
||||
set(tmux-mem-cpu-load_VERSION_PATCH 2)
|
||||
#Compute full version string
|
||||
set(tmux-mem-cpu-load_VERSION
|
||||
${tmux-mem-cpu-load_VERSION_MAJOR}.${tmux-mem-cpu-load_VERSION_MINOR}.${tmux-mem-cpu-load_VERSION_PATCH})
|
||||
|
||||
# Check whether we have support for c++11 in compiler and fail if we don't
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# generate header file to handle version
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/common/version.h.in" "${PROJECT_BINARY_DIR}/version.h"
|
||||
)
|
||||
|
||||
# set build type
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||
FORCE)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
# detect system type
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
message(STATUS "Linux detected")
|
||||
set(METER_SOURCES "linux/memory.cc" "linux/cpu.cc" "common/load.cc")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
message(STATUS "Darwin detected")
|
||||
set(METER_SOURCES "osx/memory.cc" "osx/cpu.cc" "common/load.cc")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
message(STATUS "FreeBSD detected")
|
||||
set(METER_SOURCES "freebsd/memory.cc" "freebsd/cpu.cc" "common/load.cc")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
||||
message(STATUS "OpenBSD detected")
|
||||
set(METER_SOURCES "openbsd/memory.cc" "openbsd/cpu.cc" "common/load.cc")
|
||||
if(CMAKE_SYSTEM_VERSION VERSION_LESS 5.7)
|
||||
add_definitions(-DOPENBSD_WORKAROUND=1)
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
||||
message(STATUS "NetBSD detected")
|
||||
set(METER_SOURCES "netbsd/memory.cc" "netbsd/cpu.cc" "common/load.cc")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
message(STATUS "Windows detected")
|
||||
set(METER_SOURCES "windows/memory.cc" "windows/cpu.cc" "windows/load.cc")
|
||||
else()
|
||||
message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} Cannot be compiled on this system")
|
||||
message(FATAL_ERROR "Cannot be compiled on this system")
|
||||
endif()
|
||||
|
||||
# set common source files
|
||||
set(COMMON_SOURCES "common/main.cc" "common/memory.cc" "common/graph.cc" "common/powerline.cc")
|
||||
|
||||
add_executable(tmux-mem-cpu-load ${COMMON_SOURCES} ${METER_SOURCES})
|
||||
# add binary tree so we find version.h
|
||||
target_include_directories(tmux-mem-cpu-load PUBLIC "${PROJECT_BINARY_DIR}")
|
||||
target_include_directories(tmux-mem-cpu-load PUBLIC "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/common")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
target_link_libraries(tmux-mem-cpu-load Pdh)
|
||||
endif()
|
||||
install(TARGETS tmux-mem-cpu-load RUNTIME DESTINATION bin)
|
||||
|
||||
include(CTest)
|
||||
if(BUILD_TESTING)
|
||||
add_test(NAME usage
|
||||
COMMAND tmux-mem-cpu-load -h
|
||||
)
|
||||
|
||||
add_test(NAME no_arguments
|
||||
COMMAND tmux-mem-cpu-load
|
||||
)
|
||||
|
||||
add_test(NAME custom_interval
|
||||
COMMAND tmux-mem-cpu-load -i 3
|
||||
)
|
||||
|
||||
add_test(NAME no_cpu_graph
|
||||
COMMAND tmux-mem-cpu-load -g 0
|
||||
)
|
||||
|
||||
add_test(NAME colors
|
||||
COMMAND tmux-mem-cpu-load --colors
|
||||
)
|
||||
|
||||
add_test(NAME colors_short
|
||||
COMMAND tmux-mem-cpu-load -c
|
||||
)
|
||||
|
||||
add_test(NAME powerline-right
|
||||
COMMAND tmux-mem-cpu-load --powerline-right
|
||||
)
|
||||
|
||||
add_test(NAME powerline-left
|
||||
COMMAND tmux-mem-cpu-load --powerline-left
|
||||
)
|
||||
|
||||
add_test(NAME invalid_status_interval
|
||||
COMMAND tmux-mem-cpu-load -i -1
|
||||
)
|
||||
|
||||
add_test(NAME invalid_graph_lines
|
||||
COMMAND tmux-mem-cpu-load --graph_lines -2
|
||||
)
|
||||
|
||||
add_test(NAME old_option_specification
|
||||
COMMAND tmux-mem-cpu-load 2 8
|
||||
)
|
||||
|
||||
add_test(NAME memory_mode_free_memory
|
||||
COMMAND tmux-mem-cpu-load -m 1
|
||||
)
|
||||
|
||||
add_test(NAME memory_mode_used_percentage
|
||||
COMMAND tmux-mem-cpu-load -m 2
|
||||
)
|
||||
|
||||
add_test(NAME averages_count_0
|
||||
COMMAND tmux-mem-cpu-load -a 0
|
||||
)
|
||||
|
||||
add_test(NAME averages_count_1
|
||||
COMMAND tmux-mem-cpu-load -a 1
|
||||
)
|
||||
|
||||
add_test(NAME averages_count_2
|
||||
COMMAND tmux-mem-cpu-load -a 2
|
||||
)
|
||||
|
||||
add_test(NAME averages_count_3
|
||||
COMMAND tmux-mem-cpu-load -a 3
|
||||
)
|
||||
|
||||
add_test(NAME cpu_mode_0
|
||||
COMMAND tmux-mem-cpu-load --cpu-mode 0
|
||||
)
|
||||
|
||||
add_test(NAME cpu_mode_1
|
||||
COMMAND tmux-mem-cpu-load --cpu-mode 1
|
||||
)
|
||||
|
||||
add_test(NAME cpu_mode_short_0
|
||||
COMMAND tmux-mem-cpu-load -t 0
|
||||
)
|
||||
|
||||
add_test(NAME cpu_mode_short_1
|
||||
COMMAND tmux-mem-cpu-load -t 1
|
||||
)
|
||||
|
||||
set_tests_properties(usage
|
||||
invalid_status_interval
|
||||
invalid_graph_lines
|
||||
old_option_specification
|
||||
PROPERTIES WILL_FAIL TRUE)
|
||||
endif()
|
||||
56
dot_tmux/plugins/tmux-mem-cpu-load/CONTRIBUTING.rst
Normal file
56
dot_tmux/plugins/tmux-mem-cpu-load/CONTRIBUTING.rst
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
============
|
||||
Contributing
|
||||
============
|
||||
|
||||
Want to improve the quality of tmux-mem-cpu-load code? Great! Here's a quick
|
||||
guide:
|
||||
|
||||
1. Fork, then clone the repo:
|
||||
|
||||
git clone git@github.com:your-username/tmux-mem-cpu-load
|
||||
|
||||
2. Make your change. Add tests for your change.
|
||||
3. See if it compiles and runs like it should.
|
||||
4. Run tests to check if you didn't break anything:
|
||||
|
||||
make test
|
||||
|
||||
Push to your fork and `submit a pull request`_.
|
||||
|
||||
At this point you're waiting on us. We'll review your changes as soon as we can.
|
||||
Before merging your changes we may request you to make some changes or
|
||||
corrections.
|
||||
|
||||
Style guidelines
|
||||
----------------
|
||||
|
||||
You'll need to follow the subsequent rules in order to get your code merged:
|
||||
|
||||
* Use Allman_ style for block braces.
|
||||
* No space before `(`
|
||||
* Add space after each `(` and before each `)`
|
||||
* Use braces single line statements
|
||||
* Don't use mixed case naming style, use underscores instead.
|
||||
Bad example:
|
||||
|
||||
int myAwesomeVariable = 0;
|
||||
doSomething( myAwesomeVariable );
|
||||
|
||||
Good example:
|
||||
|
||||
int my_awesome_variable = 0;
|
||||
do_something( my_awesome_variable );
|
||||
|
||||
* Don't vertically align tokens on consecutive lines.
|
||||
* If you break up an argument list, align the line to opening brace
|
||||
* Use 2 space indentation (no tabs)
|
||||
* Use spaces around operators, except for unary operators, such as `!`.
|
||||
* Add LICENSE header in new files you create.
|
||||
* Put vim modeline as the first line of file header
|
||||
* Use the lower-case for CMake commands
|
||||
* Do not add trailing whitespace
|
||||
You can use this bash script to strip unnecessary whitespaces:
|
||||
http://git.io/z_GA3A
|
||||
|
||||
.. _`submit a pull request`: https://github.com/thewtex/tmux-mem-cpu-load/compare/
|
||||
.. _Allman: http://en.wikipedia.org/wiki/Indent_style#Allman_style
|
||||
202
dot_tmux/plugins/tmux-mem-cpu-load/LICENSE
Normal file
202
dot_tmux/plugins/tmux-mem-cpu-load/LICENSE
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
226
dot_tmux/plugins/tmux-mem-cpu-load/README.rst
Normal file
226
dot_tmux/plugins/tmux-mem-cpu-load/README.rst
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
=============================================
|
||||
tmux-mem-cpu-load
|
||||
=============================================
|
||||
---------------------------------------------
|
||||
CPU, RAM, and load monitor for use with tmux_
|
||||
---------------------------------------------
|
||||
|
||||
.. image:: https://circleci.com/gh/thewtex/tmux-mem-cpu-load.svg?style=svg
|
||||
:target: https://circleci.com/gh/thewtex/tmux-mem-cpu-load
|
||||
|
||||
.. image:: https://github.com/thewtex/tmux-mem-cpu-load/actions/workflows/main.yml/badge.svg
|
||||
:target: https://github.com/thewtex/tmux-mem-cpu-load/actions/workflows/main.yml
|
||||
|
||||
Description
|
||||
===========
|
||||
|
||||
A simple, lightweight program provided for system monitoring in the *status*
|
||||
line of **tmux**.
|
||||
|
||||
The memory monitor displays the used and available memory.
|
||||
|
||||
The CPU usage monitor outputs a percent CPU usage over all processors. It also
|
||||
displays a textual bar graph of the current percent usage.
|
||||
|
||||
The system load average is also displayed.
|
||||
|
||||
Example output::
|
||||
|
||||
2885/7987MB [||||| ] 51.2% 2.11 2.35 2.44
|
||||
|
||||
^ ^ ^ ^ ^ ^ ^
|
||||
| | | | | | |
|
||||
1 2 3 4 5 6 7
|
||||
|
||||
1. Currently used memory.
|
||||
2. Available memory.
|
||||
3. CPU usage bar graph.
|
||||
4. CPU usage percentage.
|
||||
5. Load average for the past minute.
|
||||
6. Load average for the past 5 minutes.
|
||||
7. Load average for the past 15 minutes.
|
||||
|
||||
For `terminals with 256 color support`_, graded colors can be displayed by
|
||||
passing the **--colors** flag.
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
Currently, Linux, Mac OSX, FreeBSD, OpenBSD, and NetBSD are supported.
|
||||
|
||||
Building
|
||||
~~~~~~~~
|
||||
|
||||
* >= CMake_ -3.5
|
||||
* C++ compiler with C++11 support (e.g. gcc/g++ >= 4.6)
|
||||
|
||||
Download
|
||||
--------
|
||||
|
||||
There are links to the source code at the `project homepage`_.
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
::
|
||||
|
||||
cd <source dir>
|
||||
cmake .
|
||||
make
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
::
|
||||
|
||||
su -
|
||||
make install
|
||||
logout
|
||||
|
||||
Build and Install Using tpm_
|
||||
-----------------------------
|
||||
|
||||
Include the plugin in your ``.tmux.conf``, the same file you'll set the
|
||||
configuration in, below.
|
||||
|
||||
::
|
||||
|
||||
set -g @plugin 'thewtex/tmux-mem-cpu-load'
|
||||
|
||||
Install with Package Managers
|
||||
-----------------------------
|
||||
|
||||
* Gentoo: ``emerge tmux-mem-cpu-load``
|
||||
* Homebrew: ``brew install tmux-mem-cpu-load``
|
||||
|
||||
Build and Install Using Antigen_
|
||||
--------------------------------
|
||||
|
||||
Include the bundle in your ``.zshrc``
|
||||
|
||||
::
|
||||
|
||||
antigen bundle thewtex/tmux-mem-cpu-load
|
||||
|
||||
Configuring tmux_
|
||||
=================
|
||||
|
||||
Edit ``$HOME/.tmux.conf`` to display the program's output in *status-left* or
|
||||
*status-right*. For example::
|
||||
|
||||
set -g status-interval 2
|
||||
set -g status-left "#S #[fg=green,bg=black]#(tmux-mem-cpu-load --colors --interval 2)#[default]"
|
||||
set -g status-left-length 60
|
||||
|
||||
If you installed using tpm, you must specify the full path to the
|
||||
``tmux-mem-cpu-load`` script, like below::
|
||||
|
||||
set -g status-right "#[fg=green]#($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --colors --powerline-right --interval 2)#[default]"
|
||||
|
||||
Note that the *interval* argument to `tmux-mem-cpu-load` should be the same number
|
||||
of seconds that *status-interval* is set at.
|
||||
|
||||
Another optional argument is the number of bars in the bar graph, which
|
||||
defaults to 10. This can, for instance, be set to the number of cores in a
|
||||
multi-core system.
|
||||
|
||||
The *colors* option will add graded colors for each of the measures.
|
||||
|
||||
The full usage::
|
||||
|
||||
Usage: tmux-mem-cpu-load [OPTIONS]
|
||||
|
||||
Available options:
|
||||
-h, --help
|
||||
Prints this help message
|
||||
-c, --colors
|
||||
Use tmux colors in output
|
||||
-p, --powerline-left
|
||||
Use powerline left symbols throughout the output, enables --colors
|
||||
-q, --powerline-right
|
||||
Use powerline right symbols throughout the output, enables --colors
|
||||
-v, --vertical-graph
|
||||
Use vertical bar chart for CPU graph
|
||||
-l <value>, --segments-left <value>
|
||||
Enable blending bg/fg color (depending on -p or -q use) with segment to left
|
||||
Provide color to be used depending on -p or -q option for seamless segment blending
|
||||
Color is an integer value which uses the standard tmux color palette values
|
||||
-r <value>, --segments-right <value>
|
||||
Enable blending bg/fg color (depending on -p or -q use) with segment to right
|
||||
Provide color to be used depending on -p or -q option for seamless segment blending
|
||||
Color is an integer value which uses the standard tmux color palette values
|
||||
-i <value>, --interval <value>
|
||||
Set tmux status refresh interval in seconds. Default: 1 second
|
||||
-g <value>, --graph-lines <value>
|
||||
Set how many lines should be drawn in a graph. Default: 10
|
||||
-m <value>, --mem-mode <value>
|
||||
Set memory display mode. 0: Default, 1: Free memory, 2: Usage percent.
|
||||
-t <value>, --cpu-mode <value>
|
||||
Set cpu % display mode. 0: Default max 100%, 1: Max 100% * number of threads.
|
||||
-a <value>, --averages-count <value>
|
||||
Set how many load-averages should be drawn. Default: 3
|
||||
|
||||
Blending Dynamic Colors Tmux Powerline Segments
|
||||
===============================================
|
||||
|
||||
The -l and -r options when used in conjunction with a recent version of Tmux Powerline
|
||||
that has the ability to selectively disable spacing and separators between segments allow
|
||||
for seamless blending of tmux-mem-cpu-load output with other adjacent segments. The end
|
||||
result is dynamic changing of appropriate foreground and background colors as the start
|
||||
and end of the tmux-mem-cpu-load output string that is aggregated with other Tmux
|
||||
Powerline output to produce a more polished status line in Tmux.
|
||||
|
||||
Segment Adjaceny before this feature:
|
||||
|
||||
.. image:: seg-adj1.png
|
||||
|
||||
Segment Adjaceny after this feature:
|
||||
|
||||
.. image:: seg-adj2.png
|
||||
|
||||
Note that the values for the -l and -r options will be the standard Tmux integer color
|
||||
values. They set the appropriate background and foreground colors used for the separator
|
||||
character when used with the poweline-left or powerline-right options so it is easy to
|
||||
match coloring to adjacent segments. An example from the segment script that calls
|
||||
tmux-mem-cpu-load is as follows::
|
||||
|
||||
tmux-mem-cpu-load -q -v -l 52 -r 33
|
||||
|
||||
This combines with theme options available to tmux-powerline, such as the following::
|
||||
|
||||
"disk_usage_cust 52 123 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD} 52 123 right_disable" \
|
||||
"tmux_mem_cpu_load_cust 52 234 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD} 52 234 both_disable separator_disable" \
|
||||
"batt_cust 33 154 ${TMUX_POWERLINE_SEPARATOR_LEFT_BOLD} 16 33 N separator_disable" \
|
||||
|
||||
Authors
|
||||
=======
|
||||
|
||||
Matt McCormick (thewtex) <matt@mmmccormick.com>
|
||||
|
||||
Contributions from:
|
||||
|
||||
* cousine <iam@cousine.me>
|
||||
* Jasper Lievisse Adriaanse <jasper@humppa.nl>
|
||||
* Justin Crawford <justinc@pci-online.net>
|
||||
* krieiter <krieiter@gmail.com>
|
||||
* Mark Palmeri <mlp6@duke.edu>
|
||||
* `Pawel 'l0ner' Soltys`_ <pwslts@gmail.com>
|
||||
* Travil Heller <trav.heller@gmail.com>
|
||||
* Tony Narlock <tony@git-pull.com>
|
||||
* Compilenix <Compilenix@compilenix.org>
|
||||
* jodavies <jodavies1010@gmail.com>
|
||||
* `@nhdaly`_ (Nathan Daly) <nhdaly@gmail.com>
|
||||
* bensuperpc <bensuperpc@gmail.com>
|
||||
|
||||
.. _tmux: http://tmux.sourceforge.net/
|
||||
.. _CMake: http://www.cmake.org
|
||||
.. _`project homepage`: http://github.com/thewtex/tmux-mem-cpu-load
|
||||
.. _`tpm`: http://github.com/tmux-plugins/tpm
|
||||
.. _`Antigen`: https://github.com/zsh-users/antigen
|
||||
.. _`terminals with 256 color support`: http://misc.flogisoft.com/bash/tip_colors_and_formatting#terminals_compatibility
|
||||
.. _`Pawel 'l0ner' Soltys` : http://l0ner.github.io/
|
||||
.. _`@nhdaly` : http://github.com/nhdaly
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
source $(dirname "$0")/functions/cmake_fn.sh
|
||||
|
||||
cmake_build $@
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
curl https://raw.githubusercontent.com/dockcross/dockcross/master/Makefile -o dockcross-Makefile
|
||||
make -f dockcross-Makefile display_images
|
||||
|
||||
source $(dirname "$0")/functions/cmake_fn.sh
|
||||
|
||||
for image in $(make -f dockcross-Makefile display_images); do
|
||||
cmake_build $image $@
|
||||
done
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
source $(dirname "$0")/functions/makefile_fn.sh
|
||||
|
||||
makefile_build $@
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
curl https://raw.githubusercontent.com/dockcross/dockcross/master/Makefile -o dockcross-Makefile
|
||||
make -f dockcross-Makefile display_images
|
||||
|
||||
source $(dirname "$0")/functions/makefile_fn.sh
|
||||
|
||||
for image in $(make -f dockcross-Makefile display_images); do
|
||||
makefile_build $image $@
|
||||
done
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
cmake_build () {
|
||||
local image=$1
|
||||
local build_file=build-${image%:*}
|
||||
shift 1
|
||||
local cmake_arg=$@
|
||||
echo "cmake arg: $cmake_arg"
|
||||
|
||||
echo "Pulling dockcross/$image"
|
||||
docker pull dockcross/$image
|
||||
echo "Make script dockcross-$image"
|
||||
docker run --rm dockcross/$image > ./dockcross-$image
|
||||
chmod +x ./dockcross-$image
|
||||
echo "Build $build_file"
|
||||
./dockcross-$image cmake -B$build_file -H. -GNinja $cmake_arg
|
||||
./dockcross-$image ninja -C$build_file
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
makefile_build () {
|
||||
local image=$1
|
||||
shift 1
|
||||
|
||||
echo "Pulling dockcross/$image"
|
||||
docker pull dockcross/$image
|
||||
echo "Make script dockcross-$image"
|
||||
docker run --rm dockcross/$image > ./dockcross-$image
|
||||
chmod +x ./dockcross-$image
|
||||
echo "Build..."
|
||||
./dockcross-$image bash -c 'make CXX=$CXX CC=$CC AR=$AR AS=$AS CPP=$CPP FC=$FC'
|
||||
}
|
||||
40
dot_tmux/plugins/tmux-mem-cpu-load/common/conversions.h
Normal file
40
dot_tmux/plugins/tmux-mem-cpu-load/common/conversions.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef CONVERSIONS_H_
|
||||
#define CONVERSIONS_H_
|
||||
|
||||
enum BYTE_UNITS
|
||||
{
|
||||
BYTES = 0,
|
||||
KILOBYTES = 1,
|
||||
MEGABYTES = 2,
|
||||
GIGABYTES = 3
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline T convert_unit( T num, int to, int from = BYTES)
|
||||
{
|
||||
for( ; from < to; from++)
|
||||
{
|
||||
num /= 1024;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
#endif
|
||||
67
dot_tmux/plugins/tmux-mem-cpu-load/common/cpu.h
Normal file
67
dot_tmux/plugins/tmux-mem-cpu-load/common/cpu.h
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef CPU_H_
|
||||
#define CPU_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#define CP_USER 0
|
||||
#define CP_SYS 1
|
||||
#define CP_IDLE 2
|
||||
#define CP_NICE 3
|
||||
#define CP_STATES 4
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <sys/sched.h>
|
||||
#define CP_STATES CPUSTATES
|
||||
#else
|
||||
#define CP_USER 0
|
||||
#define CP_NICE 1
|
||||
#define CP_SYS 2
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
// *BSD or OSX
|
||||
#define CP_INTR 3
|
||||
#define CP_IDLE 4
|
||||
#define CP_STATES 5
|
||||
#else
|
||||
//linux
|
||||
#define CP_IDLE 3
|
||||
#define CP_STATES 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
float cpu_percentage( unsigned );
|
||||
uint32_t get_cpu_count();
|
||||
|
||||
/** CPU percentage output mode.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* CPU_MODE_DEFAULT: 100%
|
||||
* CPU_MODE_THREADS: 800% (8 cores, fully loaded)
|
||||
*/
|
||||
enum CPU_MODE
|
||||
{
|
||||
CPU_MODE_DEFAULT,
|
||||
CPU_MODE_THREADS
|
||||
};
|
||||
|
||||
#endif
|
||||
37
dot_tmux/plugins/tmux-mem-cpu-load/common/error.h
Normal file
37
dot_tmux/plugins/tmux-mem-cpu-load/common/error.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BSD_ERROR_H_
|
||||
#define BSD_ERROR_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/errno.h>
|
||||
#include <cerrno>
|
||||
#include <cstring> // strerror
|
||||
#include <cstdlib> // exit()
|
||||
|
||||
inline void error( const char * error )
|
||||
{
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
|
||||
cerr << error << ": " << strerror( errno ) << endl;
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""Create the color code lookup table header."""
|
||||
|
||||
import matplotlib.cm
|
||||
|
||||
def write_table(fp, colormap_name, stat_name, first_half_foreground, second_half_foreground):
|
||||
fp.write('static const char ')
|
||||
fp.write(stat_name)
|
||||
fp.write('_lut[][32] = {\n')
|
||||
colormap = matplotlib.cm.get_cmap(colormap_name)
|
||||
for ii in range(101):
|
||||
fp.write('"#[fg=')
|
||||
if ii < 50:
|
||||
fp.write(first_half_foreground)
|
||||
else:
|
||||
fp.write(second_half_foreground)
|
||||
fp.write(',bg=colour')
|
||||
rgba = colormap(ii * 0.01)
|
||||
red = int(round(rgba[0] * 5))
|
||||
green = int(round(rgba[1] * 5))
|
||||
blue = int(round(rgba[2] * 5))
|
||||
color = 16 + 36*red + 6*green + blue;
|
||||
fp.write(str(color))
|
||||
fp.write(']"')
|
||||
if ii != 100:
|
||||
fp.write(',')
|
||||
fp.write('\n')
|
||||
fp.write('}; // end ')
|
||||
fp.write(stat_name)
|
||||
fp.write('_lut\n\n')
|
||||
|
||||
with open('luts.h', 'w') as fp:
|
||||
fp.write('#ifndef _luts_h\n')
|
||||
fp.write('#define _luts_h\n\n')
|
||||
|
||||
# hot colormap with white fg for the first half
|
||||
# and black fg for the second half
|
||||
write_table(fp, 'hot', 'cpu_percentage', 'brightwhite', 'black')
|
||||
write_table(fp, 'gist_earth', 'mem', 'brightwhite', 'black')
|
||||
write_table(fp, 'bone', 'load', 'brightwhite', 'black')
|
||||
|
||||
fp.write('#endif\n')
|
||||
53
dot_tmux/plugins/tmux-mem-cpu-load/common/getsysctl.h
Normal file
53
dot_tmux/plugins/tmux-mem-cpu-load/common/getsysctl.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2013 Justin Crawford <Justasic@gmail.com>
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Based on: github.com/freebsd/freebsd/blob/master/usr.bin/top/machine.c
|
||||
// Based on: Apple.cpp for load_string/mem_string and apple's documentation
|
||||
|
||||
#ifndef BSD_METER_COMMON_H_
|
||||
#define BSD_METER_COMMON_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <cerrno>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <cstdlib> //exit()
|
||||
#include <string.h> //strerror()
|
||||
|
||||
#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))
|
||||
static inline void getsysctl( const char *name, void *ptr, size_t len )
|
||||
{
|
||||
size_t nlen = len;
|
||||
|
||||
if( sysctlbyname( name, ptr, &nlen, NULL, 0 ) == -1 )
|
||||
{
|
||||
std::cerr << "sysctl(" << name << "...) failed: " << strerror( errno )
|
||||
<< std::endl;
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
if( nlen != len )
|
||||
{
|
||||
std::cerr << "sysctl(" << name << "...) expected "
|
||||
<< static_cast<unsigned long>( len ) << " bytes, got "
|
||||
<< static_cast<unsigned long>( nlen ) << " bytes\n";
|
||||
//exit( 23 );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
80
dot_tmux/plugins/tmux-mem-cpu-load/common/graph.cc
Normal file
80
dot_tmux/plugins/tmux-mem-cpu-load/common/graph.cc
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
|
||||
#include "graph.h"
|
||||
|
||||
std::string get_graph_by_percentage( unsigned value, unsigned len )
|
||||
{
|
||||
unsigned step = 0;
|
||||
std::string bars;
|
||||
|
||||
unsigned bar_count = ( static_cast<float>(value) / 99.9 * len );
|
||||
|
||||
for( ; step < bar_count; step++ )
|
||||
{
|
||||
bars.append( "|" );
|
||||
}
|
||||
for( ; step < len; step++ )
|
||||
{
|
||||
bars.append( " " );
|
||||
}
|
||||
|
||||
return bars;
|
||||
}
|
||||
|
||||
|
||||
std::string get_graph_by_value( unsigned value, unsigned max, unsigned len )
|
||||
{
|
||||
unsigned step = 0;
|
||||
std::string bars;
|
||||
|
||||
unsigned bar_count = ( static_cast<float>( value / ( max - 0.1 ) ) * len );
|
||||
|
||||
for( ; step < bar_count; step++ )
|
||||
{
|
||||
bars.append( "|" );
|
||||
}
|
||||
for( ; step < len; step++ )
|
||||
{
|
||||
bars.append( " " );
|
||||
}
|
||||
|
||||
return bars;
|
||||
}
|
||||
|
||||
std::string get_graph_vert( unsigned value )
|
||||
{
|
||||
static const std::map<unsigned, std::string> graph_chars = {
|
||||
{ 0, " " }, { 10, "▁" }, { 20, "▂" }, { 30, "▃" }, { 40, "▄" },
|
||||
{ 50, "▅" }, { 60, "▆" }, { 70, "▇" }, { 80, "█" }, { 90, "▲" }
|
||||
};
|
||||
|
||||
for( auto it = graph_chars.rbegin(); it != graph_chars.rend(); ++it )
|
||||
{
|
||||
if( value >= it->first )
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
|
||||
return " "; // default return in case value doesn't match map options
|
||||
}
|
||||
28
dot_tmux/plugins/tmux-mem-cpu-load/common/graph.h
Normal file
28
dot_tmux/plugins/tmux-mem-cpu-load/common/graph.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef GRAPH_H_
|
||||
#define GRAPH_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string get_graph_by_percentage( unsigned, unsigned len = 10 );
|
||||
std::string get_graph_by_value( unsigned, unsigned, unsigned len = 10 );
|
||||
std::string get_graph_vert( unsigned );
|
||||
|
||||
#endif
|
||||
124
dot_tmux/plugins/tmux-mem-cpu-load/common/load.cc
Normal file
124
dot_tmux/plugins/tmux-mem-cpu-load/common/load.cc
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2013 Justin Crawford <Justasic@gmail.com>
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
* Copyright 2016 Compilenix
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Based on: github.com/freebsd/freebsd/blob/master/usr.bin/top/machine.c
|
||||
// Based on: Apple.cpp for load_string/mem_string and apple's documentation
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <stdlib.h> // getloadavg()
|
||||
#include <cmath> // floorf()
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cpu.h"
|
||||
#include "load.h"
|
||||
#include "luts.h"
|
||||
|
||||
#include "powerline.h"
|
||||
|
||||
// Load Averages
|
||||
std::string load_string( bool use_colors,
|
||||
bool use_powerline_left, bool use_powerline_right, short num_averages,
|
||||
bool segments_to_right, short right_color )
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss.setf( std::ios::fixed, std::ios::floatfield );
|
||||
ss.precision( 2 );
|
||||
double averages[num_averages];
|
||||
// based on: opensource.apple.com/source/Libc/Libc-262/gen/getloadavg.c
|
||||
|
||||
if( num_averages <= 0 || num_averages > 3)
|
||||
{
|
||||
ss << (char) 0;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
if( getloadavg( averages, num_averages ) < 0 )
|
||||
{
|
||||
ss << " 0.00 0.00 0.00"; // couldn't get averages.
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned load_percent = static_cast<unsigned int>( averages[0] /
|
||||
get_cpu_count() * 0.5f * 100.0f );
|
||||
|
||||
if( load_percent > 100 )
|
||||
{
|
||||
load_percent = 100;
|
||||
}
|
||||
if( use_colors )
|
||||
{
|
||||
if( use_powerline_right )
|
||||
{
|
||||
powerline( ss, load_lut[load_percent], POWERLINE_RIGHT );
|
||||
}
|
||||
else if( use_powerline_left )
|
||||
{
|
||||
powerline( ss, load_lut[load_percent], POWERLINE_LEFT );
|
||||
}
|
||||
else
|
||||
{
|
||||
powerline( ss, load_lut[load_percent], NONE );
|
||||
}
|
||||
}
|
||||
|
||||
ss << ' ';
|
||||
for( int i = 0; i < num_averages; ++i )
|
||||
{
|
||||
// Round to nearest, make sure this is only a 0.00 value not a 0.0000
|
||||
float avg = floorf( static_cast<float>( averages[i] ) * 100 + 0.5 ) / 100;
|
||||
// Don't print trailing whitespace for last element
|
||||
if ( i == num_averages-1 )
|
||||
{
|
||||
ss << avg;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << avg << " ";
|
||||
}
|
||||
}
|
||||
|
||||
if( use_colors )
|
||||
{
|
||||
if( use_powerline_left && segments_to_right )
|
||||
{
|
||||
powerline( ss, load_lut[load_percent], POWERLINE_LEFT, true );
|
||||
powerline_char( ss, load_lut[load_percent], right_color, POWERLINE_LEFT, true );
|
||||
}
|
||||
else if( use_powerline_left && !segments_to_right )
|
||||
{
|
||||
powerline( ss, load_lut[load_percent], POWERLINE_LEFT, true );
|
||||
powerline( ss, "#[fg=default,bg=default]", POWERLINE_LEFT );
|
||||
}
|
||||
else if( !use_powerline_right )
|
||||
{
|
||||
ss << "#[fg=default,bg=default]";
|
||||
}
|
||||
else if ( segments_to_right && use_powerline_right )
|
||||
{
|
||||
powerline_char( ss, load_lut[load_percent], right_color, POWERLINE_RIGHT, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
30
dot_tmux/plugins/tmux-mem-cpu-load/common/load.h
Normal file
30
dot_tmux/plugins/tmux-mem-cpu-load/common/load.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
* Copyright 2016 Compilenix
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef LOAD_H_
|
||||
#define LOAD_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string load_string( bool use_colors = false,
|
||||
bool use_powerline_left = false, bool use_powerline_right = false,
|
||||
short num_averages = 3, bool segments_to_right = false,
|
||||
short right_color = 0 );
|
||||
|
||||
#endif
|
||||
316
dot_tmux/plugins/tmux-mem-cpu-load/common/luts.h
Normal file
316
dot_tmux/plugins/tmux-mem-cpu-load/common/luts.h
Normal file
|
|
@ -0,0 +1,316 @@
|
|||
#ifndef _luts_h
|
||||
#define _luts_h
|
||||
|
||||
static const char cpu_percentage_lut[][32] = {
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour19]",
|
||||
"#[fg=brightwhite,bg=colour19]",
|
||||
"#[fg=brightwhite,bg=colour19]",
|
||||
"#[fg=brightwhite,bg=colour19]",
|
||||
"#[fg=brightwhite,bg=colour19]",
|
||||
"#[fg=brightwhite,bg=colour19]",
|
||||
"#[fg=brightwhite,bg=colour20]",
|
||||
"#[fg=brightwhite,bg=colour20]",
|
||||
"#[fg=brightwhite,bg=colour20]",
|
||||
"#[fg=brightwhite,bg=colour20]",
|
||||
"#[fg=brightwhite,bg=colour20]",
|
||||
"#[fg=brightwhite,bg=colour20]",
|
||||
"#[fg=brightwhite,bg=colour20]",
|
||||
"#[fg=brightwhite,bg=colour21]",
|
||||
"#[fg=brightwhite,bg=colour21]",
|
||||
"#[fg=brightwhite,bg=colour21]",
|
||||
"#[fg=brightwhite,bg=colour21]",
|
||||
"#[fg=brightwhite,bg=colour21]",
|
||||
"#[fg=brightwhite,bg=colour21]",
|
||||
"#[fg=brightwhite,bg=colour57]",
|
||||
"#[fg=brightwhite,bg=colour57]",
|
||||
"#[fg=brightwhite,bg=colour57]",
|
||||
"#[fg=brightwhite,bg=colour57]",
|
||||
"#[fg=brightwhite,bg=colour57]",
|
||||
"#[fg=brightwhite,bg=colour57]",
|
||||
"#[fg=brightwhite,bg=colour56]",
|
||||
"#[fg=brightwhite,bg=colour56]",
|
||||
"#[fg=brightwhite,bg=colour56]",
|
||||
"#[fg=brightwhite,bg=colour56]",
|
||||
"#[fg=brightwhite,bg=colour56]",
|
||||
"#[fg=brightwhite,bg=colour56]",
|
||||
"#[fg=brightwhite,bg=colour55]",
|
||||
"#[fg=brightwhite,bg=colour55]",
|
||||
"#[fg=brightwhite,bg=colour55]",
|
||||
"#[fg=brightwhite,bg=colour55]",
|
||||
"#[fg=brightwhite,bg=colour55]",
|
||||
"#[fg=brightwhite,bg=colour55]",
|
||||
"#[fg=brightwhite,bg=colour54]",
|
||||
"#[fg=brightwhite,bg=colour54]",
|
||||
"#[fg=brightwhite,bg=colour54]",
|
||||
"#[fg=brightwhite,bg=colour54]",
|
||||
"#[fg=brightwhite,bg=colour54]",
|
||||
"#[fg=brightwhite,bg=colour54]",
|
||||
"#[fg=brightwhite,bg=colour53]",
|
||||
"#[fg=brightwhite,bg=colour53]",
|
||||
"#[fg=brightwhite,bg=colour53]",
|
||||
"#[fg=brightwhite,bg=colour53]",
|
||||
"#[fg=brightwhite,bg=colour53]",
|
||||
"#[fg=brightwhite,bg=colour53]",
|
||||
"#[fg=brightwhite,bg=colour52]",
|
||||
"#[fg=brightwhite,bg=colour52]",
|
||||
"#[fg=brightwhite,bg=colour52]",
|
||||
"#[fg=brightwhite,bg=colour52]",
|
||||
"#[fg=brightwhite,bg=colour52]",
|
||||
"#[fg=brightwhite,bg=colour52]",
|
||||
"#[fg=brightwhite,bg=colour88]",
|
||||
"#[fg=brightwhite,bg=colour88]",
|
||||
"#[fg=brightwhite,bg=colour88]",
|
||||
"#[fg=brightwhite,bg=colour88]",
|
||||
"#[fg=brightwhite,bg=colour88]",
|
||||
"#[fg=brightwhite,bg=colour88]",
|
||||
"#[fg=brightwhite,bg=colour124]",
|
||||
"#[fg=brightwhite,bg=colour124]",
|
||||
"#[fg=brightwhite,bg=colour124]",
|
||||
"#[fg=brightwhite,bg=colour124]",
|
||||
"#[fg=brightwhite,bg=colour124]",
|
||||
"#[fg=brightwhite,bg=colour124]",
|
||||
"#[fg=brightwhite,bg=colour160]",
|
||||
"#[fg=brightwhite,bg=colour160]",
|
||||
"#[fg=brightwhite,bg=colour160]",
|
||||
"#[fg=brightwhite,bg=colour160]",
|
||||
"#[fg=brightwhite,bg=colour160]",
|
||||
"#[fg=brightwhite,bg=colour160]",
|
||||
"#[fg=brightwhite,bg=colour196]",
|
||||
"#[fg=brightwhite,bg=colour196]",
|
||||
"#[fg=brightwhite,bg=colour196]",
|
||||
"#[fg=brightwhite,bg=colour196]",
|
||||
"#[fg=brightwhite,bg=colour196]",
|
||||
"#[fg=brightwhite,bg=colour196]"
|
||||
}; // end cpu_percentage_lut
|
||||
|
||||
static const char mem_lut[][32] = {
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour18]",
|
||||
"#[fg=brightwhite,bg=colour24]",
|
||||
"#[fg=brightwhite,bg=colour24]",
|
||||
"#[fg=brightwhite,bg=colour24]",
|
||||
"#[fg=brightwhite,bg=colour24]",
|
||||
"#[fg=brightwhite,bg=colour24]",
|
||||
"#[fg=brightwhite,bg=colour24]",
|
||||
"#[fg=brightwhite,bg=colour24]",
|
||||
"#[fg=brightwhite,bg=colour24]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour66]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour72]",
|
||||
"#[fg=brightwhite,bg=colour71]",
|
||||
"#[fg=brightwhite,bg=colour71]",
|
||||
"#[fg=brightwhite,bg=colour71]",
|
||||
"#[fg=brightwhite,bg=colour107]",
|
||||
"#[fg=brightwhite,bg=colour107]",
|
||||
"#[fg=black,bg=colour107]",
|
||||
"#[fg=black,bg=colour107]",
|
||||
"#[fg=black,bg=colour108]",
|
||||
"#[fg=black,bg=colour108]",
|
||||
"#[fg=black,bg=colour108]",
|
||||
"#[fg=black,bg=colour108]",
|
||||
"#[fg=black,bg=colour108]",
|
||||
"#[fg=black,bg=colour144]",
|
||||
"#[fg=black,bg=colour144]",
|
||||
"#[fg=black,bg=colour144]",
|
||||
"#[fg=black,bg=colour144]",
|
||||
"#[fg=black,bg=colour144]",
|
||||
"#[fg=black,bg=colour144]",
|
||||
"#[fg=black,bg=colour144]",
|
||||
"#[fg=black,bg=colour144]",
|
||||
"#[fg=black,bg=colour144]",
|
||||
"#[fg=black,bg=colour144]",
|
||||
"#[fg=black,bg=colour150]",
|
||||
"#[fg=black,bg=colour150]",
|
||||
"#[fg=black,bg=colour186]",
|
||||
"#[fg=black,bg=colour186]",
|
||||
"#[fg=black,bg=colour186]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour180]",
|
||||
"#[fg=black,bg=colour181]",
|
||||
"#[fg=black,bg=colour181]",
|
||||
"#[fg=black,bg=colour181]",
|
||||
"#[fg=black,bg=colour181]",
|
||||
"#[fg=black,bg=colour187]",
|
||||
"#[fg=black,bg=colour187]",
|
||||
"#[fg=black,bg=colour187]",
|
||||
"#[fg=black,bg=colour187]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour224]",
|
||||
"#[fg=black,bg=colour224]",
|
||||
"#[fg=black,bg=colour224]",
|
||||
"#[fg=black,bg=colour224]",
|
||||
"#[fg=black,bg=colour224]",
|
||||
"#[fg=black,bg=colour231]",
|
||||
"#[fg=black,bg=colour231]",
|
||||
"#[fg=black,bg=colour231]",
|
||||
"#[fg=black,bg=colour231]"
|
||||
}; // end mem_lut
|
||||
|
||||
static const char load_lut[][32] = {
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour16]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour17]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour59]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour60]",
|
||||
"#[fg=brightwhite,bg=colour102]",
|
||||
"#[fg=brightwhite,bg=colour102]",
|
||||
"#[fg=brightwhite,bg=colour102]",
|
||||
"#[fg=brightwhite,bg=colour102]",
|
||||
"#[fg=brightwhite,bg=colour102]",
|
||||
"#[fg=brightwhite,bg=colour102]",
|
||||
"#[fg=brightwhite,bg=colour102]",
|
||||
"#[fg=brightwhite,bg=colour102]",
|
||||
"#[fg=brightwhite,bg=colour103]",
|
||||
"#[fg=brightwhite,bg=colour103]",
|
||||
"#[fg=brightwhite,bg=colour103]",
|
||||
"#[fg=brightwhite,bg=colour103]",
|
||||
"#[fg=brightwhite,bg=colour103]",
|
||||
"#[fg=brightwhite,bg=colour103]",
|
||||
"#[fg=brightwhite,bg=colour103]",
|
||||
"#[fg=black,bg=colour103]",
|
||||
"#[fg=black,bg=colour103]",
|
||||
"#[fg=black,bg=colour109]",
|
||||
"#[fg=black,bg=colour109]",
|
||||
"#[fg=black,bg=colour109]",
|
||||
"#[fg=black,bg=colour109]",
|
||||
"#[fg=black,bg=colour109]",
|
||||
"#[fg=black,bg=colour109]",
|
||||
"#[fg=black,bg=colour145]",
|
||||
"#[fg=black,bg=colour145]",
|
||||
"#[fg=black,bg=colour145]",
|
||||
"#[fg=black,bg=colour145]",
|
||||
"#[fg=black,bg=colour145]",
|
||||
"#[fg=black,bg=colour145]",
|
||||
"#[fg=black,bg=colour145]",
|
||||
"#[fg=black,bg=colour145]",
|
||||
"#[fg=black,bg=colour146]",
|
||||
"#[fg=black,bg=colour146]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour152]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour188]",
|
||||
"#[fg=black,bg=colour195]",
|
||||
"#[fg=black,bg=colour195]",
|
||||
"#[fg=black,bg=colour195]",
|
||||
"#[fg=black,bg=colour195]",
|
||||
"#[fg=black,bg=colour231]",
|
||||
"#[fg=black,bg=colour231]",
|
||||
"#[fg=black,bg=colour231]",
|
||||
"#[fg=black,bg=colour231]",
|
||||
"#[fg=black,bg=colour231]",
|
||||
"#[fg=black,bg=colour231]",
|
||||
"#[fg=black,bg=colour231]",
|
||||
"#[fg=black,bg=colour231]"
|
||||
}; // end load_lut
|
||||
|
||||
#endif
|
||||
302
dot_tmux/plugins/tmux-mem-cpu-load/common/main.cc
Normal file
302
dot_tmux/plugins/tmux-mem-cpu-load/common/main.cc
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <cstdlib> // EXIT_SUCCESS, atoi()
|
||||
#include <getopt.h> // getopt_long
|
||||
|
||||
#include "version.h"
|
||||
#include "graph.h"
|
||||
|
||||
// Tmux color lookup tables for the different metrics.
|
||||
#include "luts.h"
|
||||
|
||||
#include "cpu.h"
|
||||
#include "memory.h"
|
||||
#include "load.h"
|
||||
|
||||
#include "powerline.h"
|
||||
|
||||
std::string cpu_string( CPU_MODE cpu_mode, unsigned int cpu_usage_delay, unsigned int graph_lines,
|
||||
bool use_colors = false,
|
||||
bool use_powerline_left = false, bool use_powerline_right = false, bool use_vert_graph = false)
|
||||
{
|
||||
|
||||
float percentage;
|
||||
float multiplier = 1.0f;
|
||||
|
||||
//output stuff
|
||||
std::ostringstream oss;
|
||||
oss.precision( 1 );
|
||||
oss.setf( std::ios::fixed | std::ios::right );
|
||||
|
||||
// get %
|
||||
percentage = cpu_percentage( cpu_usage_delay );
|
||||
|
||||
// set multiplier to number of threads ?
|
||||
if ( cpu_mode == CPU_MODE_THREADS )
|
||||
{
|
||||
multiplier = get_cpu_count();
|
||||
}
|
||||
|
||||
// if percentage*multiplier >= 100, remove decimal point to keep number short
|
||||
if ( percentage*multiplier >= 100.0f )
|
||||
{
|
||||
oss.precision( 0 );
|
||||
}
|
||||
|
||||
unsigned int percent = static_cast<unsigned int>( percentage );
|
||||
if( use_colors )
|
||||
{
|
||||
if( use_powerline_right )
|
||||
{
|
||||
powerline( oss, cpu_percentage_lut[percent], POWERLINE_RIGHT );
|
||||
}
|
||||
else if( use_powerline_left )
|
||||
{
|
||||
powerline( oss, cpu_percentage_lut[percent], POWERLINE_LEFT );
|
||||
}
|
||||
else
|
||||
{
|
||||
powerline( oss, cpu_percentage_lut[percent], NONE );
|
||||
}
|
||||
}
|
||||
|
||||
if( use_vert_graph )
|
||||
{
|
||||
oss << "▕";
|
||||
oss << get_graph_vert( unsigned( percentage ) );
|
||||
oss << "▏";
|
||||
}
|
||||
else if( graph_lines > 0)
|
||||
{
|
||||
oss << " [";
|
||||
oss << get_graph_by_percentage( unsigned( percentage ), graph_lines );
|
||||
oss << "]";
|
||||
}
|
||||
oss.width( 6 );
|
||||
oss.setf( std::ios::fixed, std::ios::floatfield );
|
||||
oss.precision( 1 );
|
||||
oss.fill( ' ' );
|
||||
oss << std::right << percentage * multiplier;
|
||||
oss << "%";
|
||||
if( use_colors )
|
||||
{
|
||||
if( use_powerline_left )
|
||||
{
|
||||
powerline( oss, cpu_percentage_lut[percent], POWERLINE_LEFT, true );
|
||||
}
|
||||
else if( !use_powerline_right )
|
||||
{
|
||||
oss << "#[fg=default,bg=default]";
|
||||
}
|
||||
}
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
void print_help()
|
||||
{
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
cout << "tmux-mem-cpu-load v" << tmux_mem_cpu_load_VERSION << endl
|
||||
<< "Usage: tmux-mem-cpu-load [OPTIONS]\n\n"
|
||||
<< "Available options:\n"
|
||||
<< "-h, --help\n"
|
||||
<< "\t Prints this help message\n"
|
||||
<< "-c, --colors\n"
|
||||
<< "\tUse tmux colors in output\n"
|
||||
<< "-p, --powerline-left\n"
|
||||
<< "\tUse powerline left symbols throughout the output, enables --colors\n"
|
||||
<< "-q, --powerline-right\n"
|
||||
<< "\tUse powerline right symbols throughout the output, enables --colors\n"
|
||||
<< "-v, --vertical-graph\n"
|
||||
<< "\tUse vertical bar chart for CPU graph\n"
|
||||
<< "-l <value>, --segments-left <value>\n"
|
||||
<< "\tEnable blending bg/fg color (depending on -p or -q use) with segment to left\n"
|
||||
<< "\tProvide color to be used depending on -p or -q option for seamless segment blending\n"
|
||||
<< "\tColor is an integer value which uses the standard tmux color palette values\n"
|
||||
<< "-r <value>, --segments-right <value>\n"
|
||||
<< "\tEnable blending bg/fg color (depending on -p or -q use) with segment to right\n"
|
||||
<< "\tProvide color to be used depending on -p or -q option for seamless segment blending\n"
|
||||
<< "\tColor is an integer value which uses the standard tmux color palette values\n"
|
||||
<< "-i <value>, --interval <value>\n"
|
||||
<< "\tSet tmux status refresh interval in seconds. Default: 1 second\n"
|
||||
<< "-g <value>, --graph-lines <value>\n"
|
||||
<< "\tSet how many lines should be drawn in a graph. Default: 10\n"
|
||||
<< "-m <value>, --mem-mode <value>\n"
|
||||
<< "\tSet memory display mode. 0: Default, 1: Free memory, 2: Usage percent.\n"
|
||||
<< "-t <value>, --cpu-mode <value>\n"
|
||||
<< "\tSet cpu % display mode. 0: Default max 100%, 1: Max 100% * number of threads. \n"
|
||||
<< "-a <value>, --averages-count <value>\n"
|
||||
<< "\tSet how many load-averages should be drawn. Default: 3\n"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
unsigned cpu_usage_delay = 990000;
|
||||
short averages_count = 3;
|
||||
short graph_lines = 10; // max 32767 should be enough
|
||||
short left_color = 0;
|
||||
short right_color = 0;
|
||||
bool use_colors = false;
|
||||
bool use_powerline_left = false;
|
||||
bool use_powerline_right = false;
|
||||
bool use_vert_graph = false;
|
||||
bool segments_to_left = false;
|
||||
bool segments_to_right= false;
|
||||
MEMORY_MODE mem_mode = MEMORY_MODE_DEFAULT;
|
||||
CPU_MODE cpu_mode = CPU_MODE_DEFAULT;
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
// Struct is a s follows:
|
||||
// const char * name, int has_arg, int *flag, int val
|
||||
// if *flag is null, val is option identifier to use in switch()
|
||||
// otherwise it's a value to set the variable *flag points to
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "colors", no_argument, NULL, 'c' },
|
||||
{ "powerline-left", no_argument, NULL, 'p' },
|
||||
{ "powerline-right", no_argument, NULL, 'q' },
|
||||
{ "vertical-graph", no_argument, NULL, 'v' },
|
||||
{ "interval", required_argument, NULL, 'i' },
|
||||
{ "graph-lines", required_argument, NULL, 'g' },
|
||||
{ "mem-mode", required_argument, NULL, 'm' },
|
||||
{ "cpu-mode", required_argument, NULL, 't' },
|
||||
{ "averages-count", required_argument, NULL, 'a' },
|
||||
{ "segments-left", required_argument, NULL, 'l' },
|
||||
{ "segments-right", required_argument, NULL, 'r' },
|
||||
{ 0, 0, 0, 0 } // used to handle unknown long options
|
||||
};
|
||||
|
||||
int c;
|
||||
// while c != -1
|
||||
while( (c = getopt_long( argc, argv, "hi:cpqvl:r:g:m:a:t:", long_options, NULL) ) != -1 )
|
||||
{
|
||||
switch( c )
|
||||
{
|
||||
case 'h': // --help, -h
|
||||
print_help();
|
||||
return EXIT_FAILURE;
|
||||
break;
|
||||
case 'c': // --colors
|
||||
use_colors = true;
|
||||
break;
|
||||
case 'p': // --powerline-left
|
||||
use_colors = true;
|
||||
use_powerline_left = true;
|
||||
break;
|
||||
case 'q': // --powerline-right
|
||||
use_colors = true;
|
||||
use_powerline_right = true;
|
||||
break;
|
||||
case 'v': // --vertical-graph
|
||||
use_vert_graph = true;
|
||||
break;
|
||||
case 'l': // --segments-left
|
||||
segments_to_left = true;
|
||||
if( atoi( optarg ) < 0 || atoi( optarg ) > 255 )
|
||||
{
|
||||
std::cerr << "Valid color vaues are from 0 to 255.\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
left_color = atoi( optarg ) ;
|
||||
break;
|
||||
case 'r': // --segments-right
|
||||
segments_to_right= true;
|
||||
if( atoi( optarg ) < 0 || atoi( optarg ) > 255 )
|
||||
{
|
||||
std::cerr << "Valid color vaues are from 0 to 255.\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
right_color = atoi( optarg ) ;
|
||||
break;
|
||||
case 'i': // --interval, -i
|
||||
if( atoi( optarg ) < 1 )
|
||||
{
|
||||
std::cerr << "Status interval argument must be one or greater.\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
cpu_usage_delay = atoi( optarg ) * 1000000 - 10000;
|
||||
break;
|
||||
case 'g': // --graph-lines, -g
|
||||
if( atoi( optarg ) < 0 )
|
||||
{
|
||||
std::cerr << "Graph lines argument must be zero or greater.\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
graph_lines = atoi( optarg );
|
||||
break;
|
||||
case 'm': // --mem-mode, -m
|
||||
if( atoi( optarg ) < 0 )
|
||||
{
|
||||
std::cerr << "Memory mode argument must be zero or greater.\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
mem_mode = static_cast< MEMORY_MODE >( atoi( optarg ) );
|
||||
break;
|
||||
case 't': // --cpu-mode, -t
|
||||
if( atoi( optarg ) < 0 )
|
||||
{
|
||||
std::cerr << "CPU mode argument must be zero or greater.\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
cpu_mode = static_cast< CPU_MODE >( atoi( optarg ) );
|
||||
break;
|
||||
case 'a': // --averages-count, -a
|
||||
if( atoi( optarg ) < 0 || atoi( optarg ) > 3 )
|
||||
{
|
||||
std::cerr << "Valid averages-count arguments are: 0, 1, 2, 3\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
averages_count = atoi( optarg );
|
||||
break;
|
||||
case '?':
|
||||
// getopt_long prints error message automatically
|
||||
return EXIT_FAILURE;
|
||||
break;
|
||||
default:
|
||||
std::cerr << "?? getopt returned character code 0 " << c << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
// Detect old option specification and return and error message.
|
||||
if( argc > optind )
|
||||
{
|
||||
std::cout <<
|
||||
"The interval and graph lines options are now specified with flags.\n\n";
|
||||
print_help();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
MemoryStatus memory_status;
|
||||
mem_status( memory_status );
|
||||
std::cout << mem_string( memory_status, mem_mode, use_colors, use_powerline_left, use_powerline_right, segments_to_left, left_color )
|
||||
<< cpu_string( cpu_mode, cpu_usage_delay, graph_lines, use_colors, use_powerline_left, use_powerline_right, use_vert_graph )
|
||||
<< load_string( use_colors, use_powerline_left, use_powerline_right, averages_count, segments_to_right, right_color );
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
122
dot_tmux/plugins/tmux-mem-cpu-load/common/memory.cc
Normal file
122
dot_tmux/plugins/tmux-mem-cpu-load/common/memory.cc
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "memory.h"
|
||||
#include "luts.h"
|
||||
#include "conversions.h"
|
||||
#include "powerline.h"
|
||||
|
||||
std::string mem_string( const MemoryStatus & mem_status,
|
||||
MEMORY_MODE mode,
|
||||
bool use_colors,
|
||||
bool use_powerline_left,
|
||||
bool use_powerline_right,
|
||||
bool segments_to_left,
|
||||
short left_color )
|
||||
{
|
||||
std::ostringstream oss;
|
||||
// Change the percision for floats, for a pretty output
|
||||
oss.precision( 2 );
|
||||
oss.setf( std::ios::fixed | std::ios::right );
|
||||
|
||||
unsigned int color = static_cast< unsigned int >((100 * mem_status.used_mem) / mem_status.total_mem);
|
||||
if( use_colors )
|
||||
{
|
||||
if( use_powerline_right && segments_to_left )
|
||||
{
|
||||
powerline_char( oss, mem_lut[color], left_color, POWERLINE_RIGHT, false);
|
||||
oss << ' ';
|
||||
}
|
||||
else if( use_powerline_right && !segments_to_left )
|
||||
{
|
||||
oss << "#[bg=default]";
|
||||
powerline( oss, mem_lut[color], POWERLINE_RIGHT );
|
||||
oss << ' ';
|
||||
}
|
||||
else if( use_powerline_left && segments_to_left )
|
||||
{
|
||||
powerline_char( oss, mem_lut[color], left_color, POWERLINE_LEFT, false);
|
||||
oss << ' ';
|
||||
}
|
||||
else if( use_powerline_left )
|
||||
{
|
||||
//powerline( oss, mem_lut[color], POWERLINE_LEFT );
|
||||
// We do not know how to invert the default background color
|
||||
powerline( oss, mem_lut[color], NONE );
|
||||
oss << ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
powerline( oss, mem_lut[color], NONE );
|
||||
}
|
||||
}
|
||||
|
||||
switch( mode )
|
||||
{
|
||||
case MEMORY_MODE_FREE_MEMORY: // Show free memory in MB or GB
|
||||
{
|
||||
const float free_mem = mem_status.total_mem - mem_status.used_mem;
|
||||
const float free_mem_in_gigabytes = convert_unit( free_mem, GIGABYTES, MEGABYTES );
|
||||
|
||||
// if free memory is less than 1 GB, use MB instead
|
||||
if( free_mem_in_gigabytes < 1.0f )
|
||||
{
|
||||
oss << free_mem << "MB";
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << free_mem_in_gigabytes << "GB";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MEMORY_MODE_USAGE_PERCENTAGE:
|
||||
{
|
||||
// Calculate the percentage of used memory
|
||||
const float percentage_mem = mem_status.used_mem /
|
||||
static_cast<float>( mem_status.total_mem ) * 100.0;
|
||||
|
||||
oss << percentage_mem << '%';
|
||||
break;
|
||||
}
|
||||
default: // Default mode, just show the used/total memory in MB
|
||||
if(mem_status.used_mem>10000 && mem_status.total_mem>10000)
|
||||
oss<<static_cast<unsigned int>(mem_status.used_mem/1024)<<"/"<<static_cast<unsigned int>(mem_status.total_mem/1024)<<"GB";
|
||||
else if(mem_status.used_mem<10000 && mem_status.total_mem>10000)
|
||||
oss<<static_cast<unsigned int>(mem_status.used_mem)<<"MB/"<<static_cast<unsigned int>(mem_status.total_mem/1024)<<"GB";
|
||||
else
|
||||
oss<<static_cast<unsigned int>(mem_status.used_mem)<<"/"<<static_cast<unsigned int>(mem_status.total_mem)<<"MB";
|
||||
}
|
||||
|
||||
if( use_colors )
|
||||
{
|
||||
if( use_powerline_left )
|
||||
{
|
||||
powerline( oss, mem_lut[color], POWERLINE_LEFT, true );
|
||||
}
|
||||
else if( !use_powerline_right )
|
||||
{
|
||||
oss << "#[fg=default,bg=default]";
|
||||
}
|
||||
}
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
58
dot_tmux/plugins/tmux-mem-cpu-load/common/memory.h
Normal file
58
dot_tmux/plugins/tmux-mem-cpu-load/common/memory.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MEMORY_H_
|
||||
#define MEMORY_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
/** Memory status in megabytes */
|
||||
struct MemoryStatus
|
||||
{
|
||||
float used_mem;
|
||||
float total_mem;
|
||||
};
|
||||
|
||||
/** Get the current memory status */
|
||||
void mem_status( MemoryStatus & status );
|
||||
|
||||
|
||||
/** Memory status string output mode.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* MEMORY_MODE_DEFAULT: 11156/16003MB
|
||||
* MEMORY_MODE_FREE_MEMORY:
|
||||
* MEMORY_MODE_USAGE_PERCENTAGE:
|
||||
*/
|
||||
enum MEMORY_MODE
|
||||
{
|
||||
MEMORY_MODE_DEFAULT,
|
||||
MEMORY_MODE_FREE_MEMORY,
|
||||
MEMORY_MODE_USAGE_PERCENTAGE
|
||||
};
|
||||
|
||||
std::string mem_string( const MemoryStatus & mem_status,
|
||||
MEMORY_MODE mode = MEMORY_MODE_DEFAULT,
|
||||
bool use_colors = false,
|
||||
bool use_powerline_left = false,
|
||||
bool use_powerline_right = false,
|
||||
bool segments_to_left = false,
|
||||
short left_color = 0 );
|
||||
|
||||
#endif
|
||||
100
dot_tmux/plugins/tmux-mem-cpu-load/common/powerline.cc
Normal file
100
dot_tmux/plugins/tmux-mem-cpu-load/common/powerline.cc
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2016 Michał Goliński
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "powerline.h"
|
||||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
|
||||
#define PWL_LEFT_FILLED ""
|
||||
#define PWL_RIGHT_FILLED ""
|
||||
|
||||
const char * bg2fg( const char s[] )
|
||||
{
|
||||
static char buf[40] = {0};
|
||||
const char *substr = strchr(s, ',');
|
||||
buf[0] = '#';
|
||||
buf[1] = '[';
|
||||
buf[2] = 'f';
|
||||
strcpy(buf+3, substr+2);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
void powerline( std::ostringstream & oss, const char color[],
|
||||
POWERLINE_DIRECTION direction, bool background_only )
|
||||
{
|
||||
switch( direction )
|
||||
{
|
||||
case NONE:
|
||||
oss << color;
|
||||
break;
|
||||
case POWERLINE_LEFT:
|
||||
if( background_only )
|
||||
{
|
||||
oss << ' ' << bg2fg( color );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string colorstr( color );
|
||||
oss << "#[" << colorstr.substr( colorstr.find( "," ) + 1 )
|
||||
<< PWL_LEFT_FILLED
|
||||
<< color;
|
||||
}
|
||||
break;
|
||||
case POWERLINE_RIGHT:
|
||||
oss << ' '
|
||||
<< bg2fg( color )
|
||||
<< PWL_RIGHT_FILLED
|
||||
<< color;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
void powerline_char( std::ostringstream & oss, const char dynamic_color[],
|
||||
short static_color, POWERLINE_DIRECTION direction, bool eol )
|
||||
{
|
||||
char write_color[7];
|
||||
sprintf(write_color, "%d", static_color);
|
||||
switch( direction )
|
||||
{
|
||||
case POWERLINE_LEFT:
|
||||
if ( eol )
|
||||
{
|
||||
oss << bg2fg( dynamic_color ) << "#[bg=colour" << write_color << "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << dynamic_color << "#[fg=colour" << write_color << "]";
|
||||
}
|
||||
oss << PWL_LEFT_FILLED << dynamic_color;
|
||||
break;
|
||||
case POWERLINE_RIGHT:
|
||||
if ( eol )
|
||||
{
|
||||
oss << dynamic_color << "#[fg=colour" << write_color << "] ";
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << bg2fg(dynamic_color) << " #[bg=colour" << write_color << "]";
|
||||
}
|
||||
oss << PWL_RIGHT_FILLED << dynamic_color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
40
dot_tmux/plugins/tmux-mem-cpu-load/common/powerline.h
Normal file
40
dot_tmux/plugins/tmux-mem-cpu-load/common/powerline.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2016 Michał Goliński
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef POWERLINE_H
|
||||
#define POWERLINE_H
|
||||
|
||||
#include <sstream>
|
||||
|
||||
enum POWERLINE_DIRECTION
|
||||
{
|
||||
NONE,
|
||||
POWERLINE_LEFT,
|
||||
POWERLINE_RIGHT
|
||||
};
|
||||
|
||||
/** Print out a powerline left character inverted version of the given
|
||||
* color. In the case of of using powerline left, the background color needs
|
||||
* to be inverted to the foreground before the powerline character is printed
|
||||
* in the next entr. */
|
||||
void powerline( std::ostringstream & oss, const char color[],
|
||||
POWERLINE_DIRECTION direction, bool background_only = false );
|
||||
void powerline_char( std::ostringstream & oss, const char dynamic_color[],
|
||||
short static_color, POWERLINE_DIRECTION direction, bool eol = false );
|
||||
|
||||
#endif // POWERLINE_H
|
||||
24
dot_tmux/plugins/tmux-mem-cpu-load/common/version.h.in
Normal file
24
dot_tmux/plugins/tmux-mem-cpu-load/common/version.h.in
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/* vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap
|
||||
*
|
||||
* Copyright 2012 Matthew McCormick
|
||||
* Copyright 2015 Pawel 'l0ner' Soltys
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// the configured options and settings for sysstat
|
||||
#define tmux_mem_cpu_load_VERSION_MAJOR @tmux-mem-cpu-load_VERSION_MAJOR@
|
||||
#define tmux_mem_cpu_load_VERSION_MINOR @tmux-mem-cpu-load_VERSION_MINOR@
|
||||
#define tmux_mem_cpu_load_VERSION_PATCH @tmux-mem-cpu-load_VERSION_PATCH@
|
||||
#define tmux_mem_cpu_load_VERSION "@tmux-mem-cpu-load_VERSION@"
|
||||
|
||||
1
dot_tmux/plugins/tmux-mem-cpu-load/dot_git/FETCH_HEAD
Normal file
1
dot_tmux/plugins/tmux-mem-cpu-load/dot_git/FETCH_HEAD
Normal file
|
|
@ -0,0 +1 @@
|
|||
6549a6cf2f4d33dd698a91c08c7d476b5d5ae08e branch 'master' of https://github.com/thewtex/tmux-mem-cpu-load
|
||||
1
dot_tmux/plugins/tmux-mem-cpu-load/dot_git/HEAD
Normal file
1
dot_tmux/plugins/tmux-mem-cpu-load/dot_git/HEAD
Normal file
|
|
@ -0,0 +1 @@
|
|||
ref: refs/heads/master
|
||||
1
dot_tmux/plugins/tmux-mem-cpu-load/dot_git/ORIG_HEAD
Normal file
1
dot_tmux/plugins/tmux-mem-cpu-load/dot_git/ORIG_HEAD
Normal file
|
|
@ -0,0 +1 @@
|
|||
6549a6cf2f4d33dd698a91c08c7d476b5d5ae08e
|
||||
13
dot_tmux/plugins/tmux-mem-cpu-load/dot_git/config
Normal file
13
dot_tmux/plugins/tmux-mem-cpu-load/dot_git/config
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
[submodule]
|
||||
active = .
|
||||
[remote "origin"]
|
||||
url = https://git::@github.com/thewtex/tmux-mem-cpu-load
|
||||
fetch = +refs/heads/master:refs/remotes/origin/master
|
||||
[branch "master"]
|
||||
remote = origin
|
||||
merge = refs/heads/master
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue