Skip to content

Commit

Permalink
Merge branch 'bugfix/sigstatus' into dev
Browse files Browse the repository at this point in the history
- Fixes #21 on system using procps-ng
- Change the logic of sigstatus segment to use a static list of signame
  instead of calling kill everytime
  • Loading branch information
0rax committed Jun 9, 2016
2 parents 82e2a37 + 3f815ea commit d50e55c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
10 changes: 7 additions & 3 deletions init.fish
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ else
source $FLINE_PATH/themes/default_256_colors.fish
end

# Load default symbol & themes based if on a tty or not
# Load default symbols
source $FLINE_PATH/themes/default_symbols.fish

# Set special themes based if on a tty or not
if begin; [ (uname) != "Darwin" ]; and tty | grep tty > /dev/null; end
source $FLINE_PATH/themes/tty_compatible.fish
else
source $FLINE_PATH/themes/default_symbols.fish
end

# Default Fishline Prompt
set FLINE_DEFAULT_PROMPT vimode sigstatus jobs pwd git write n root

# Set Signal Code list for internal use
set FLSEG_STATUS_NAME (command kill -l| tr ' [a-z]' '\n[A-Z]')
11 changes: 9 additions & 2 deletions internals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- Used by: `fishline -v`
- Description: show `fishline` software version based on `git describe` and exit

## Global variables
## Internal variables (used in fishline's scope)

- `FLINT_STATUS`
- Possible values: `false` | copy of `-s $status` value
Expand Down Expand Up @@ -64,6 +64,13 @@
- `FLINE_DEFAULT_PROMPT`
- Possible values: list of segment
- Used by: `fishline`
- `FLINT_PROMPT`
- `FLINE_PROMPT`
- Possible values: list of segment
- Used by: `fishline`

## Segment initialization variables (initialized for the session)

- `FLSEG_STATUS_NAME`
- Value: list of signal name indexed from their code
- Used by: `__flseg_sigstatus`
- Initialized in: `init.fish`
2 changes: 1 addition & 1 deletion segments/__flseg_sigstatus.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function __flseg_sigstatus

if [ $FLINT_STATUS -gt 128 -a $FLINT_STATUS -lt 160 ]
__fishline_segment $FLCLR_STATUS_BG $FLCLR_STATUS_FG
printf SIG(kill -l $FLINT_STATUS | tr '[a-z]' '[A-Z]')
printf "SIG%s" $FLSEG_STATUS_NAME[(math "$FLINT_STATUS" - 128)]
else if [ $FLINT_STATUS -eq 126 ]
__fishline_segment $FLCLR_STATUS_BG $FLCLR_STATUS_FG
printf "NOEXEC"
Expand Down

0 comments on commit d50e55c

Please sign in to comment.