I struggled with this one for quite a while since I wanted the same thing. This is what I did:
Defining a segment is quite straight forward and the documentation is very good in that sense. But that's not enough to get it to show what you want. So, first define a segment that can show
Narrowed when you narrow into some defun, region or whatever:
"Display Narrowed when buffer is narrowed."
The documentation isn't quite clear about how you should insert this new segment into the whole thing. I dug around the code and found out that you can pass new segments when initiating the mode line. Since in my case I'm using
spaceline-spacemacs-theme it suffices to pass this new segment to that function call:
Note that it will insert this new segment in the right part of the mode-line, next to the line numbers and columns in my case. If you want to reorder the items you'll have to create a new theme.
The code provided here was enough for me, though.