• Stars
    star
    265
  • Rank 154,577 (Top 4 %)
  • Language
    Go
  • License
    GNU General Publi...
  • Created about 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A shell in every text input on your system

Shin: Shell input method

Shin lets you run shell commands anywhere you can type text. Watch this:

Screencast

This works in almost every Linux application, including Firefox, Chrome, LibreOffice, all GTK and Qt applications, and many more. The possibilities are endless as static editing and dynamic evaluation become one.

Shin stays completely out of your way until you press the magic key that brings it to life. When not in use, Shin consumes zero CPU time and memory. I despise software that wastes computing resources, and Shin is designed accordingly.

Ready to give it a try?

Installation

Installing Shin is a painless procedure on most Linux distributions.

Step 1: Set up IBus

Shin is implemented as an IBus input engine. Before Shin can be installed, IBus must be installed and configured.

If you use GNOME, you can skip this step, because the GNOME desktop comes with a fully configured IBus installation out of the box.

On KDE, it usually suffices to install any IBus input method (e.g. Typing Booster) from the KDE Software Center, after which you will be prompted to switch to IBus as the system input method. After logging out and back in, you should be ready to go.

For other desktop environments and window managers, the setup may involve manually installing the IBus daemon, and setting environment variables. See this ArchWiki article for more information.

Before filing an issue of the type "Shin is not working!", please verify that you have a functioning IBus setup. You can do this by trying out any other IBus input method, such as Typing Booster or Pinyin.

Step 2: Install Shin

Make sure you have Go, a C compiler, Make, and Git. Then run:

git clone https://github.com/p-e-w/shin.git
cd shin
make
sudo make install
ibus restart

Note 1: Occasionally, ibus restart fails to actually restart IBus. In that case, you have to restart the IBus daemon manually, or simply restart your system.

Note 2: The above commands assume that your IBus installation is located in /usr/share. In the vast majority of cases, this is correct. If you have installed IBus elsewhere, you must run both make and make install with the IBUS_INSTALL_DIR variable set to the actual location, e.g. make IBUS_INSTALL_DIR=/usr/share.

Step 3: Make Shin activatable

The Shin input engine is intended to be activated using a hotkey, and automatically deactivates itself after a shell command has been entered. This allows for normal text editing to continue without having to manually switch back to the default input method.

For this reason, it is not recommended to add Shin to the desktop's input method switcher.

Instead, simply bind the command ibus engine shin to a global keyboard shortcut such as Alt+Space. On GNOME, this can be done using Settings > Keyboard > View and Customize Shortcuts > Custom Shortcuts. On KDE, System Settings > Shortcuts > Custom Shortcuts does the same thing. For other desktop environments and window managers, see the appropriate documentation.

That's it! Shin is now just a keypress away whenever you need it.

The shin/bin directory

If you use Shin frequently, it's quite natural to want to define custom commands for inserting commonly needed text. For example, you might like to have a sig command that inserts a signature with your name and address for use in emails and online discussions.

Of course, you could just create a shell script which prints that text, and place it in any of the directories in the shell's search path. But then sig would also be available in regular interactive shells, and you probably don't want to pollute your global command namespace with Shin-specific commands. You may also wish to override some of the standard commands in Shin, but only in Shin.

To solve these problems, Shin prepends the directory $XDG_CONFIG_HOME/shin/bin (which usually expands to ~/.config/shin/bin) to the shell's search path when running commands. To define Shin-specific commands, simply create that directory, and drop executable scripts with the desired names there. They will be available in Shin, without affecting the behavior of the shell anywhere else.

Security considerations

By design, Shin turns every text input on your system into a basic terminal emulator with full shell access. This shouldn't be a problem under normal circumstances, since anyone with unsupervised access to your computer can just launch a terminal anyway, but in some situations, such as a system running in "kiosk mode", extra caution may be warranted.

Most screen locking applications explicitly disable input methods, but if you use a non-standard screen locker, you should verify that Shin cannot be accessed from the lock screen inputs, because that would create a trivial way to bypass the lock by running a shell command that kills the lock screen process.

To the best of my knowledge, web browsers do not allow JavaScript code to synthesize the low-level input events needed to control an IME. I therefore believe that Shin is safe to use in browser inputs, even on untrusted websites. A carefully designed website might however use concealed inputs and fake input overlays to trick you into thinking that you have typed something different from what you actually did. This represents a rather low security risk though, since the site still cannot control which commands are entered and executed.

Acknowledgments

Shin depends on the xdg, go-sqlite3, and dbus Go packages, as well as on BambooEngine's fork of the goibus package (the only fork with proper Wayland support).

This project was my first encounter with IBus, a system that in practice is used almost exclusively for typing East Asian scripts. I was pleasantly surprised to find that IBus is flexible enough to support a use case like Shin, which it was obviously not intended for and yet able to accommodate. My respect goes to the creators of IBus for their clean and versatile design.

License

Copyright Β© 2022 Philipp Emanuel Weidmann ([email protected])

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

By contributing to this project, you agree to release your contributions under the same license.

More Repositories

1

maybe

πŸ“‚ πŸ‡ 🎩 See what a program does before deciding whether you really want it to happen (NO LONGER MAINTAINED)
Python
6,362
star
2

finalterm

At last – a modern terminal emulator (NO LONGER MAINTAINED)
Vala
3,860
star
3

argos

Create GNOME Shell extensions in seconds
JavaScript
1,612
star
4

ternimal

Simulate a lifeform in the terminal
Rust
1,042
star
5

plotinus

A searchable command palette in every modern GTK+ application
Vala
1,010
star
6

krill

πŸ“° The hacker's way of keeping up with the world (NO LONGER MAINTAINED)
Python
807
star
7

savage

A primitive computer algebra system
Rust
548
star
8

hegemon

A modular system monitor written in Rust
Rust
324
star
9

ranwhen

Visualize when your system was running (NO LONGER MAINTAINED)
Python
262
star
10

language-javascript-semantic

JavaScript Semantic Highlighting Package for Atom (NO LONGER MAINTAINED)
JavaScript
82
star
11

GTKDarkThemeVariantSetter

Make Sublime Text use the dark GTK+ theme variant (NO LONGER MAINTAINED)
Python
51
star
12

quicksafe

The easiest way to securely encrypt notes (NO LONGER MAINTAINED)
Python
51
star
13

envy

Text editing supercharger
JavaScript
35
star
14

chatbot_clinic

Science-driven chatbot development
Python
27
star
15

sequencer

Purely algorithmic number sequence identification
Scala
25
star
16

pingpong

End-to-end latency monitoring for Matrix
Go
10
star
17

cal-ender

A modern, practical date model simplifying what people actually use a calendar for (NO LONGER MAINTAINED)
JavaScript
7
star
18

wd2sql

Transform a Wikidata JSON dump into an SQLite database
Rust
6
star
19

tree-saw

tree-sitter and compilers testing each other
JavaScript
4
star
20

pastevents

A structured, searchable archive of Wikipedia's "Current Events" portal
Python
3
star
21

enough

Rust
2
star
22

curv-solids

A library for working with polyhedra in Curv
1
star
23

humergesort

Rank arbitrary lists through human-powered comparison sorting (NO LONGER MAINTAINED)
1
star
24

graduality

Rust
1
star
25

arrows

A frontend for creative writing with LLMs
TypeScript
1
star