rofi-chemacs
is a GUI wrapper script for Chemacs2 using Rofi. It manages profiles, daemons, and configs!
The script is a complete wrapper for anything you could want to do with Chemacs and Emacs. It supports:
Launching
- Default Chemacs profile
-
Chemacs profiles
- Automatically finds your Chemacs2 profiles!
-
Emacs Daemon
- Uses the default profile for the daemon.
-
Support for instance (emacs) or client (emacsclient) commands
- Set globally, all commands can use either form of launching.
Killing
- Of instances and daemons
Setting
- Choose new Chemacs default profile from your configured profiles
Editing
-
Able to launch any configs (set in configs.sh) in Emacs
- Default has some common configs including Chemacs profiles!
- Default theme: Dracula! Please submit more!
rofi
andchemacs2
- Font based icons: default: Font Awesome 5
- For use with daemons:
- must use
server-name
matching your profile name, in chemacs profiles association list.- e.g.
("doom" . ((user-emacs-directory . "/opt/doom-emacs") (server-name . "doom")))
- e.g.
- must use
- Free to use either chemacs config directories/file names. Recommend: $XDG_CONFIG_HOME/chemacs
- These are the locations the script searches for your chemacs configs.
- Must use the chemacs profile config.
~/.emacs-profile
or$XDG_CONFIG_HOME/chemacs/profile
- DO NOT set your default in the profiles config.
- Install dependencies.
- Reccomended Install:
- This install method allows you to version control rofi-chemacs into your rofi dotfiles, so it’s available as soon as your dotfiles are installed.
cd $HOME/.config/rofi/
git clone https://github.com/noncog/rofi-chemacs
- configure
rofi-chemacs.sh
andconfigs.sh
then launch using preferred method.
- This install method allows you to version control rofi-chemacs into your rofi dotfiles, so it’s available as soon as your dotfiles are installed.
rofi-chemacs
is designed to be easily configured from the top level script rofi-chemacs.sh
and the main settings are passed into subsequent scripts. In this case, there is only one: configs.sh
, which you may want to customize as well.
The options you can change in each script are clearly marked at the top in the comments.
Make sure you configure them before using.
Additionally, make sure you complete all of the requirements
above.
The EDITOR
and VISUAL
environment variables allow you to use Emacs as your system text editor. This is useful for commands like git commit
. Especially using Magit. To launch the default Chemacs profile using the Emacs daemon, use something like the following.
export EDITOR="emacsclient -c -s $(cat $HOME/.config/chemacs/profile)" export VISUAL=$EDITOR
This script uses only one rofi config file rofi-chemacs.rasi
, it is located in configs.
Because of this, the menus are centered and the position is set relative to the top of the screen by the variable vertical_offset
located in rofi-chemacs.sh
. This should be an integer representing your desired pixel offset.
To change the theme, just modify the rofi config.
- By default the scripts’ rofi config inherits the font from your global rofi config.rasi.
- If you would like to explicitly set the font, uncomment the font line in rofi-chemacs.rasi and set your desired font.
- Just use any font-based icons you want. Place the icon glyphs in the string for the menu item.
- If you want it to “just work” then install Font Awesome 5
- Launches using the default chemacs profile.
- For use with an autostart script or window manager launch the daemon as normal:
emacs --daemon
- This option works like this:
- Selects new default from profiles.
- Kills the daemon or instance of Emacs if it’s running.
- If using daemon mode, launches a new daemon with the new default profile.
This is done out of the assumption that if you’re setting the default to a new profile, that’s what you want to use now.
NOTE
- There currently is not a save-buffer feature implemented, this is a hard kill. Don’t switch your default profile if you’re in the middle of working on something. Be warned.
- Kills both instances and daemons, without saving.
- Simply runs the daemon command using the default profile.
- I will probably never allow running of multiple daemons for multiple profiles as this simply complicates the logic significantly and I see no reason why one user should be using two daemons and emacsclients at once.
- This executes all commands where possible using the emacsclient and daemon.
- If a daemon is running with a matching profile it will connect to it, if not, makes an instance.
- Remember, the daemon only runs using the default profile, so selecting any non-default profile will always run as an instance.
Guide:
- Clone the repo and create a new branch:
git checkout https://github.com/noncog/rofi-chemacs -b name_for_new_branch
- Make changes and test.
- Submit pull request with comprehensive description of changes.
I consider this script feature complete, but if you come up with something I’m missing, let me see it!