Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrewchambers/godothecorrectthing
A script to do actions based on the current window and selected text.
https://github.com/andrewchambers/godothecorrectthing
Last synced: about 1 month ago
JSON representation
A script to do actions based on the current window and selected text.
- Host: GitHub
- URL: https://github.com/andrewchambers/godothecorrectthing
- Owner: andrewchambers
- License: mit
- Created: 2017-11-22T06:04:10.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-23T08:42:40.000Z (almost 6 years ago)
- Last Synced: 2024-11-06T19:40:51.285Z (about 1 month ago)
- Language: Shell
- Size: 14.6 KB
- Stars: 127
- Watchers: 8
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome-github-stars - andrewchambers/godothecorrectthing - A script to do actions based on the current window and selected text. (Shell)
README
# go do the correct thing
A script to do actions based on the current window and selected text.
With this you can:
- Select any compiler error text in any terminal and open the correct file and line in your text editor.
- Click on the output of ls in any terminal and open the corresponding file with the correct program.
- Open any url from any text on your OS and open it in your browser.
- Do simple code search and setup text links/bookmarks without any editor support.# How to use
Although I use it this tool every day, It is not packaged in a friendly way (yet), so
as it stands, you probably need to fork it and read the code to make minor modifications to get it working.- You need to read your window manager docs to setup a hotkey to run this script.
For `i3` add something like `bindsym $mod+g exec /home/ac/bin/godothecorrectthing.sh`
to the i3 config file.
For `KDE`, go to `SystemSettings`->`Shortcuts`->`CustomShortcuts`, then add `New`->`GlobalShortcut`->`Command`.
- You need to configure your software to have a window title that contains the current working directory, for me, my operating system PS1 variable
made it work for xterm and sublime text did this automatically. Being able to read the current directory from the window title is important
so the script can open 'bare' file names like 'main.go' in the example video.
- You need to customize the window scraping code in the script, it is specific to my own personal PS1 variable (The nixos default) and sublime text.
If you have different configuration or software it will not work and will guess the wrong working directory, making all links relative to your
home directory instead of what you intended.
- You need to customize the code which executes actions to run your desired software.Demo videos - [original](https://www.youtube.com/watch?v=PrBDJd4Qgzs) and [followup](https://www.youtube.com/watch?v=bsUPE5W-NmI)
# Other places to look for inspiration
- [A tour of acme](https://research.swtch.com/acme)
- [Controlling music and other things from dmenu](https://github.com/halfwit/dotfiles)