termonad 0.2.0.0 → 0.2.1.0
raw patch · 13 files changed
+426/−17 lines, 13 filesdep ~gi-vtebinary-addedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: gi-vte
API changes (from Hackage documentation)
Files
- .nix-helpers/nixops.nix +110/−0
- .nix-helpers/nixpkgs.nix +11/−0
- .nix-helpers/running-termonad.nix +26/−0
- .nix-helpers/stack-nix-shell.nix +36/−0
- .nix-helpers/termonad.nix +34/−0
- CHANGELOG.md +6/−0
- README.md +139/−14
- default.nix +32/−0
- img/termonad.png binary
- shell.nix +16/−0
- src/Termonad/App.hs +3/−0
- src/Termonad/Term.hs +3/−1
- termonad.cabal +10/−2
+ .nix-helpers/nixops.nix view
@@ -0,0 +1,110 @@+# This file can be used with `nixops` to create a virtual machine that has+# Termonad installed.+#+# I use this to test out Termonad in a desktop environment with a menubar.+#+# On my development machine, I use XMonad as a Window Manager, so there are+# no Window decorations for any X application. This file creates a VM+# with Termonad installed in Gnome 3. This lets you see what Termonad+# looks like when it has Window decorations, a title bar, etc.+#+# A virtual machine can be created based on this file with the following+# commands:+#+# $ nixops create --deployment termonad-test .nix-helpers/nixops.nix+# $ nixops deploy --deployment termonad-test+#+# This should open up a VirtualBox machine and start installing Gnome 3,+# Termonad, etc.+#+# You should be able to login with the username "myuser" and password "foobar".+#+# When you are done you can destroy the machine and delete the deployment:+#+# $ nixops destroy --deployment termonad-test+# $ nixops delete --deployment termonad-test+#++{+ network.description = "Gnome With Termonad";++ termonad-machine =+ { config, pkgs, ...}:+ {+ imports = [ ];++ deployment = {+ targetEnv = "virtualbox";+ virtualbox = {+ disks.disk1.size = 20480;+ headless = false;+ memorySize = 2024;+ vcpu = 1;+ };+ };++ environment = {+ systemPackages =+ let+ pkgList = with pkgs; [+ acpi aspell aspellDicts.en autojump bash bash-completion bc+ chromium curl dmenu emacs evince file firefoxWrapper gcc geeqie+ gimp gitAndTools.gitFull gitAndTools.hub gnumake gnupg hexchat+ htop imagemagick jq k2pdfopt ltrace manpages ncurses+ nix-bash-completions nixops p7zip pkgconfig psmisc python3+ redshift roxterm screen strace tree unzip usbutils vimHugeX wget+ wirelesstools xfce.terminal xorg.xbacklight xorg.xmodmap+ xscreensaver xterm zlib+ ];+ termonad = import ../default.nix { };+ in [ termonad ] ++ pkgList;+ variables.EDITOR = "vim";+ };++ fonts.fonts = with pkgs; [+ dejavu_fonts ipafont source-code-pro ttf_bitstream_vera+ ];++ i18n = {+ consoleFont = "Lat2-Terminus16";+ consoleKeyMap = "us";+ defaultLocale = "en_US.UTF-8";+ inputMethod = {+ enabled = "fcitx";+ fcitx.engines = with pkgs.fcitx-engines; [ mozc ];+ };+ };++ programs.bash.enableCompletion = true;++ services = {+ xserver = {+ enable = true;+ layout = "us";+ desktopManager.gnome3.enable = true;+ };+ openssh = {+ enable = true;+ forwardX11 = true;+ challengeResponseAuthentication = true;+ passwordAuthentication = true;+ permitRootLogin = "yes";+ };+ };++ security.sudo = {+ enable = true;+ extraConfig = ''+ %wheel ALL=(ALL:ALL) NOPASSWD: ${pkgs.systemd}/bin/poweroff+ %wheel ALL=(ALL:ALL) NOPASSWD: ${pkgs.systemd}/bin/reboot+ %wheel ALL=(ALL:ALL) NOPASSWD: ${pkgs.systemd}/bin/systemctl suspend+ '';+ };++ users.extraUsers.myuser = {+ extraGroups = [ "audio" "systemd-journal" "video" "wheel" ];+ initialPassword = "foobar";+ isNormalUser = true;+ };+ };+}
+ .nix-helpers/nixpkgs.nix view
@@ -0,0 +1,11 @@+# This file pins the version of nixpkgs to a known good version.+# It is imported from various other files.++let+ nixpkgsTarball = builtins.fetchTarball {+ # recent version of nixpkgs as of 2018-07-29+ url = "https://github.com/NixOS/nixpkgs/archive/a2c6dbe370160ffea5537f64dda04489184c5ce1.tar.gz";+ sha256 = "1x993g9343yv5wyp29i6vskdcc3rl42xipv79nwmmrj8ay2yhh3b";+ };+in+import nixpkgsTarball { }
+ .nix-helpers/running-termonad.nix view
@@ -0,0 +1,26 @@+# Running `nix-shell .nix-helpers/running-termonad.nix` will put us in an environment+# with termonad available, as well as GHC and a few other packages (lens and colour).+#+# If you run `termonad` while in this environment, `termonad` should be able to see+# GHC and all the Haskell libraries listed below. This will let `termonad` be able to+# recompile the `~/.config/termonad/termonad.hs` file.+#+# This file is really only used when you want to run termonad in an environment where it+# has access to specific libraries.++{ compiler ? "ghc843" }:++let+ nixpkgs = import ./nixpkgs.nix;++ termonad = nixpkgs.callPackage ../. { inherit compiler; };++ ghcStuff = nixpkgs.pkgs.haskell.packages.${compiler}.ghcWithPackages (pkgs: [+ pkgs.colour+ pkgs.lens+ termonad+ ]);++in++nixpkgs.runCommand "dummy" { buildInputs = [ ghcStuff termonad ]; } ""
+ .nix-helpers/stack-nix-shell.nix view
@@ -0,0 +1,36 @@+# This is the shell file specified in the stack.yaml file.+# This forces stack to use ghc-8.0.2 and stack-lts-9.yaml to compile termonad.++let+ nixpkgsTarball = builtins.fetchTarball {+ # 17.09 (this works)+ #url = "https://github.com/NixOS/nixpkgs/archive/39cd40f7bea40116ecb756d46a687bfd0d2e550e.tar.gz";+ #sha256 = "0kpx4h9p1lhjbn1gsil111swa62hmjs9g93xmsavfiki910s73sh";++ # 18.03+ url = "https://github.com/NixOS/nixpkgs/archive/120b013e0c082d58a5712cde0a7371ae8b25a601.tar.gz";+ sha256 = "0hk4y2vkgm1qadpsm4b0q1vxq889jhxzjx3ragybrlwwg54mzp4f";++ # recent version of nixpkgs as of 2018-07-25 (this only seems to sometimes work...?))+ #url = "https://github.com/NixOS/nixpkgs/archive/4ccaa7de8eb34a0bb140f109a0e88095480118eb.tar.gz";+ #sha256 = "0szbxfrzmlmxrgkqz5wnfgmsjp82vaddgz7mhdz7jj0jhd0hza4i";+ };+ nixpkgs = import nixpkgsTarball { };+in++with nixpkgs;++haskell.lib.buildStackProject {+ name = "termonad";+ buildInputs = [+ cairo+ gnome3.vte+ gobjectIntrospection+ gtk3+ zlib+ ];+ ghc = haskell.compiler.ghc802;+ extraArgs = [+ "--stack-yaml stack-lts-9.yaml"+ ];+}
+ .nix-helpers/termonad.nix view
@@ -0,0 +1,34 @@+{ mkDerivation, base, Cabal, cabal-doctest, classy-prelude, colour+, constraints, data-default, doctest, dyre, gi-gdk, gi-gio, gi-glib+, gi-gtk, gi-pango, gi-vte, gtk3, haskell-gi-base, hedgehog, lens+, pretty-simple, QuickCheck, stdenv, tasty, tasty-hedgehog+, template-haskell, xml-conduit, xml-html-qq+}:+mkDerivation {+ pname = "termonad";+ version = "0.2.0.0";+ src = builtins.filterSource (path: type:+ baseNameOf path != ".git" &&+ baseNameOf path != "result" &&+ baseNameOf path != ".stack-work" &&+ baseNameOf path != "dist") ./..;+ isLibrary = true;+ isExecutable = true;+ doCheck = false;+ enableSeparateDataOutput = true;+ setupHaskellDepends = [ base Cabal cabal-doctest ];+ libraryHaskellDepends = [+ base classy-prelude colour constraints data-default dyre gi-gdk+ gi-gio gi-glib gi-gtk gi-pango gi-vte haskell-gi-base lens+ pretty-simple QuickCheck xml-conduit xml-html-qq+ ];+ libraryPkgconfigDepends = [ gtk3 ];+ executableHaskellDepends = [ base ];+ testHaskellDepends = [+ base doctest hedgehog lens QuickCheck tasty tasty-hedgehog+ template-haskell+ ];+ homepage = "https://github.com/cdepillabout/termonad";+ description = "Terminal emulator configurable in Haskell";+ license = stdenv.lib.licenses.bsd3;+}
CHANGELOG.md view
@@ -1,3 +1,9 @@++## 0.2.1.0++* Make sure the window title is set to "Termonad".+* Relabel tabs when termonad is started.+ ## 0.2.0.0 * Open dialog asking if you want to quit when you try to use your WM to quit.
README.md view
@@ -12,6 +12,8 @@ customizable and provides hooks to modify the default behavior. It can be thought of as the "XMonad" of terminal emulators. ++ <!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc --> **Table of Contents** @@ -20,24 +22,34 @@ - [Arch Linux](#arch-linux) - [Ubuntu / Debian](#ubuntu--debian) - [NixOS](#nixos)+ - [Mac OS X](#mac-os-x)+ - [Windows](#windows) - [How to use Termonad](#how-to-use-termonad)+ - [Configuring Termonad](#configuring-termonad)+ - [Compiling Local Settings](#compiling-local-settings)+ - [Running with `stack`](#running-with-stack)+ - [Running with `nix`](#running-with-nix) - [Goals](#goals)+ - [Contributions](#contributions) - [Maintainers](#maintainers) <!-- markdown-toc end --> ## Installation -Termonad can be able to be installed on any system as long as the necessary GTK-libraries are installed. The following lists instructions for a few-distributions. If the given steps don't work for you, or you want to add-instructions for an additional distribution, please send a pull request.+Termonad can be installed on any system as long as the necessary GTK libraries+are available. The following are instructions for installing Termonad on a few+different distributions and systems. If the given steps don't work for you, or+you want to add instructions for an additional system, please send a pull+request. The following steps use the [`stack`](https://docs.haskellstack.org/en/stable/README/) build tool to build-Termonad, but [`cabal`](https://www.haskell.org/cabal/) can be used as well.-If `cabal` doesn't work for you, please open an issue or send a pull request.+Termonad, but [`cabal`](https://www.haskell.org/cabal/) can be used as well. Steps for+installing `stack` can be found on+[this page](https://docs.haskellstack.org/en/stable/install_and_upgrade/). + ### Arch Linux First, you must install the required GTK system libraries:@@ -46,10 +58,6 @@ $ pacman -S vte3 ``` -You must have `stack` to be able to build Termonad. Steps for-installing `stack` can be found on-[this page](https://docs.haskellstack.org/en/stable/install_and_upgrade/).- In order to install Termonad, clone this repository and run `stack install`. This will install the `termonad` binary to `~/.local/bin/`: @@ -67,10 +75,6 @@ $ apt-get install gobject-introspection libgirepository1.0-dev libgtk-3-dev libvte-2.91-dev ``` -You must have `stack` to be able to build Termonad. Steps for-installing `stack` can be found on-[this page](https://docs.haskellstack.org/en/stable/install_and_upgrade/).- In order to install Termonad, clone this repository and run `stack install`. This will install the `termonad` binary to `~/.local/bin/`: @@ -103,6 +107,14 @@ $ nix-build ``` +### Mac OS X++(*currently no instructions available. please send a PR adding instructions if you get termonad to build.*)++### Windows++(*currently no instructions available. please send a PR adding instructions if you get termonad to build.*)+ ## How to use Termonad Termonad is similar to XMonad. The above steps will install a `termonad` binary@@ -181,7 +193,120 @@ defaultMain termonadConf ``` +### Compiling Local Settings++If you lauch Termonad by calling `~/.local/bin/termonad`, it will try to+compile the `~/.config/termonad/termonad.hs` file if it exists. The problem is+that `~/.local/bin/termonad` needs to be able to see GHC and the required+Haskell libraries to be able to compile `~/.config/termonad/termonad.hs`.++There are a couple solutions to this problem, listed in the sections below.++(These steps are definitely confusing, and I would love to figure out a better+way to do this. Please submit an issue or PR if you have a good idea about+how to fix this.)++#### Running with `stack`++If you originally compiled Termonad with `stack`, you can use `stack` to+execute Termonad. First, you must change to the directory with the Termonad+source code. From there, you can run `stack exec`:++```sh+$ cd termonad/ # change to the termonad source code directory+$ stack exec -- termonad+```++`stack` will pick up the correct GHC version and libraries from the+`stack.yaml` and `termonad.cabal` file. `termonad` will be run in an+environment with GHC available. `termonad` will use this GHC and libraries to+compile your `~/.config/termonad/termonad.hs` file. It if succeeds, it should+create a `~/.cache/termonad/termonad-linux-x86_64` binary.++If you need extra Haskell libraries available when compiling your+`~/.config/termonad/termonad.hs` file, you can specify them to `stack exec`:++```sh+$ stack exec --package lens --package conduit -- termonad+```++The problem with this is that `stack exec` changes quite a few of your+environment variables. It is not recommended to actually run Termonad from+within `stack exec`. After you run `stack exec -- termonad` and let it+recompile your `~/.config/termonad/termonad.hs` file, exit Termonad.+Re-run Termonad by calling it directly. Termonad will notice that+`~/.config/termonad/termonad.hs` hasn't changed since+`~/.cache/termonad/termonad-linux-x86_64` has been recompiled, so it will+directly execute `~/.cache/termonad/termonad-linux-x86_64`.++#### Running with `nix`++If you originally compiled Termonad with `nix`, you can use `nix` to create+an environment with GHC and specified Haskell libraries available.++There is a `.nix` file available you can use to do this:++[`.nix-helpers/running-termonad.nix`](./.nix-helpers/running-termonad.nix)++This file will give us an environment with `termonad`, GHC, and a few Haskell+libraries installed. You can enter this environment using `nix-shell`:++```sh+$ cd termonad/ # change to the termonad source code directory+$ nix-shell ./.nix-helpers/running-termonad.nix+```++From within this environment, you can run `termonad`. It will find the+`~/.config/termonad/termonad.hs` file and compile it, outputting the+`.cache/termonad/termonad-linux-x86_64` binary. Termonad will then re-exec+this binary.++The problem with this is that `nix-shell` may change your environment variables+in ways you do not want. I recommend running `termonad` to get it to+recompile your `~/.config/termonad/termonad.hs` file, then exit the nix-shell environment and+rerun Termonad by calling it directly. Termonad will notice that+`~/.config/termonad/termonad.hs` hasn't been changed since+`~/.cache/termonad/termonad-linux-x86_64` has been recompiled, so it will+directly execute `~/.cache/termonad/termonad-linux-x86_64`.+ ## Goals++Termonad has the following goals:++* fully configurable in Haskell++ There are already+ [many](https://gnometerminator.blogspot.com/p/introduction.html)+ [good](https://www.enlightenment.org/about-terminology.md)+ [terminal](http://software.schmorp.de/pkg/rxvt-unicode.html)+ [emulators](https://launchpad.net/sakura). However, there are no terminal+ emulators fully configurable in Haskell. Termonad fills this niche.++* flexible++ Most people only need a terminal emulator that lets you change the font-size,+ cursor color, etc. They don't need tons of configuration options.+ Termonad should be for people that like lots of configuration options.+ Termonad should provide many hooks to allow the user to change it's behavior.++* stable++ Termonad should be able to be used as everyday as your main terminal+ emulator. It should not crash for any reason. If you experience a crash,+ please file an issue or a pull request!++* good documentation++ The [documentation](https://hackage.haskell.org/package/termonad) for+ Termonad on Hackage should be good. You shouldn't have to guess at what+ certain data types or functions do. If you have a hard time understanding+ anything in the documentation, please submit an issue or PR.++## Contributions++Contributions are highly appreciated. Termonad is currently missing many+helpful configuration options and behavior hooks. If there is something you+would like to add, please submit an issue or PR. ## Maintainers
+ default.nix view
@@ -0,0 +1,32 @@+# This is the main nix file for termonad. It will just build the termonad binary.+# It can be built with the command `nix-build` in the main top directory.+#+# The termonad binary will be created at `result/bin/termonad`.++{ compiler ? "ghc843" }:++let+ nixpkgs = import ./.nix-helpers/nixpkgs.nix;++ set-gi-vte-version = _: {+ version = "2.91.19";+ sha256 = "1hnhidjr7jh7i826lj6kdn264i592sfl5kwvymnpiycmcb37dd4y";+ };++ set-gi-gtk-version = _: {+ version = "3.0.24";+ sha256 = "14cyj1acxs39avciyzqqb1qa5dr4my8rv3mfwv1kv92wa9a5i97v";+ };++ allHaskellPackages = nixpkgs.pkgs.haskell.packages.${compiler}.override {+ overrides = self: super: let lib = nixpkgs.pkgs.haskell.lib; in {+ gi-gtk = lib.overrideCabal super.gi-gtk set-gi-gtk-version;+ gi-vte = lib.overrideCabal (lib.addPkgconfigDepend (super.gi-vte.override { vte = nixpkgs.gnome3.vte; }) nixpkgs.gnome3.gtk) set-gi-vte-version;+ };+ };++in++allHaskellPackages.callPackage .nix-helpers/termonad.nix {+ inherit (nixpkgs.gnome3) gtk3;+}
+ img/termonad.png view
binary file changed (absent → 15194 bytes)
+ shell.nix view
@@ -0,0 +1,16 @@+# This is a file that allows you to jump into an environment to be able to build termonad.+# You can jump into this environment by running the command `nix-shell`.+#+# This also installs cabal, so you should be able to build termonad by running `cabal new-build`.+#+# In general, if you prefer to use `stack`, you probably won't use this file.++{ compiler ? "ghc843" }:++let+ nixpkgs = import .nix-helpers/nixpkgs.nix;+in++(import ./default.nix { inherit compiler; }).env.overrideAttrs (oldAttrs: rec {+ nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ nixpkgs.pkgs.haskell.packages.${compiler}.cabal-install ];+})
src/Termonad/App.hs view
@@ -57,6 +57,7 @@ , windowClose , windowPresent , windowSetDefaultIconFromFile+ , windowSetTitle , windowSetTransientFor ) import qualified GI.Gtk as Gtk@@ -325,6 +326,8 @@ menuBuilder <- builderNewFromString menuText $ fromIntegral (length menuText) menuModel <- objFromBuildUnsafe menuBuilder "menubar" MenuModel applicationSetMenubar app (Just menuModel)++ windowSetTitle win "Termonad" void $ onWidgetDeleteEvent win $ \_ -> do userRequestedExit <- getUserRequestedExit mvarTMState
src/Termonad/Term.hs view
@@ -184,7 +184,8 @@ relabelTab :: Notebook -> Label -> ScrolledWindow -> Terminal -> IO () relabelTab notebook label scrolledWin term' = do pageNum <- notebookPageNum notebook scrolledWin- title <- terminalGetWindowTitle term'+ maybeTitle <- terminalGetWindowTitle term'+ let title = fromMaybe "bash" maybeTitle labelSetLabel label $ tshow (pageNum + 1) <> ". " <> title showScrollbarToPolicy :: ShowScrollbar -> PolicyType@@ -301,6 +302,7 @@ notebookSetCurrentPage note pageIndex pure (newTMState, setCurrPageAction) setCurrPageAction+ relabelTab (tmNotebook currNote) tabLabel scrolledWin vteTerm void $ onTerminalWindowTitleChanged vteTerm $ do TMState{tmStateNotebook} <- readMVar mvarTMState let notebook = tmNotebook tmStateNotebook
termonad.cabal view
@@ -1,5 +1,5 @@ name: termonad-version: 0.2.0.0+version: 0.2.1.0 synopsis: Terminal emulator configurable in Haskell description: Please see <https://github.com/cdepillabout/termonad#readme README.md>. homepage: https://github.com/cdepillabout/termonad@@ -13,6 +13,14 @@ cabal-version: >=1.12 extra-source-files: README.md , CHANGELOG.md+ , default.nix+ , img/termonad.png+ , .nix-helpers/nixops.nix+ , .nix-helpers/nixpkgs.nix+ , .nix-helpers/running-termonad.nix+ , .nix-helpers/stack-nix-shell.nix+ , .nix-helpers/termonad.nix+ , shell.nix data-files: img/termonad-lambda.png custom-setup setup-depends: base@@ -45,7 +53,7 @@ , gi-glib , gi-gtk >= 3.0.24 , gi-pango- , gi-vte >= 2.91.18+ , gi-vte >= 2.91.19 , haskell-gi-base , lens , pretty-simple