Finish up the first working flake to build FG42

This commit is contained in:
Sameer Rahmani 2024-02-20 14:53:50 +00:00
parent 6893e2d991
commit 82b377f00e
Signed by: lxsameer
GPG Key ID: B0A4AF28AB9FD90B
27 changed files with 205 additions and 360 deletions

3
.gitignore vendored
View File

@ -39,4 +39,5 @@ emacs.d/
docs/site/orgs/cubes/
**/*/sitemap.inc
result
result
v4/

71
dev.org
View File

@ -1,71 +0,0 @@
#+TITLE: FG42 Development
#+AUTHOR: Sameer Rahmani
#+SEQ_TODO: TODO(t/!) NEXT(n/!) BLOCKED(b@/!) | DONE(d%) WONT_DO(c@/!) FAILED(f@/!)
#+TAGS: DOCS(d) EXAMPLES(e) Misc(m) Lib(l)
#+STARTUP: logdrawer logdone logreschedule indent content align constSI entitiespretty nolatexpreview
#+OPTIONS: tex:t
#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Eule
#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [a4paper]
#+LATEX_HEADER: \usepackage{tcolorbox}
#+LATEX_HEADER: \usepackage{mathabx}
#+LATEX_HEADER: \newtcolorbox{infobox}[2][]{colback=cyan!5!white,before skip=14pt,after skip=8pt,colframe=cyan!75!black,sharp corners,title={#2},#1}
This document is dedicated to the resources, TODOs, research summary, ideas and whatever that is
part of the development process.
* Development Goals
In the past we tried many different ideas and features but since we didn't have a clear goal set,
we couldn't really make it work and differentiate good ideas from bad ones.
** Who are the target audience?
On the first level, I should feel comfortable with it.
** What set of features are important to us?
* Tools
** Straight
We gave it a shot before and it didn't work out but our requirements were different back then.
We should give it a shot again
* Libraries
** Midnight mode
It's a cool library that run some action every midnight, we can use it to clean up old buffers
or other maintenance jobs
* Tasks
** TODO =fpkg/use= doesn't work with =:init=
** TODO Add a =:default= key to the cube indicating whether it should be enabled by default or not
** TODO Reformat the modeline
** TODO Create a macro similar to =with-ability= to run a block of code only if the given cube was active
** TODO Enable =straight= and =use-package= integration on compile time. Checout out =fpkg/core.el=
** TODO Check the =dracula= theme settings and configurations
** TODO Add support for MacOS by create a cube with the following content
#+BEGIN_SRC elisp
(package-install 'exec-path-from-shell)
(exec-path-from-shell-initialize)
#+END_SRC
** TODO Integrate window-purpose mode
** TODO Turn on yasnippet mode for Go mode
* Things that didn't work out
- rbenv
- helm
- linum
- tabbar
- ido
- ivy
- spaceline
- doom-modeline
- smart-mode-line
- desktop-mode
- jedi
- file-browser
- dired+
- guru
- emoji
- elpy
- github
- versioned-backup

View File

@ -28,11 +28,12 @@
};
lemacs = pkgs.emacs29.override {
# Gtk causes a flickering issue on WM mode
withGTK3 = false;
toolkit = "lucid";
};
elispDepsFile = ./deps.el;
elispDepsFile = ./lisp/fg42/deps.el;
elispPkgs = pkgs.callPackage ./nix/deps.nix {
inherit elispDepsFile;
@ -41,7 +42,7 @@
ourPackages = pkgs.callPackage ./nix/packages.nix {};
fg42 = pkgs.callPackage ./nix/fg42.nix {
inherit elispPkgs ourPackages;
inherit elispPkgs ourPackages nixpkgs;
srcDir = ./.;
emacs = lemacs;
};
@ -49,58 +50,15 @@
in {
inherit pkgs;
packages.emacs = fg42.emacsInUse;
packages.default = pkgs.writeScriptBin "fg42" ''
#!${pkgs.stdenv.shell}
packages.default = fg42;
export FG42_HOME=${fg42}/fg42
export FG42_USE_NIX=true;
LIBRARY_PATH="$(cc -print-file-name=libgccjit.so):$LIBRARY_PATH" \
FG42_WM=false ${fg42.emacsInUse}/bin/emacs \
--name FG42 \
-q \
--no-splash --title FG42 \
-l $FG42_HOME/fg42-config.el "$@"
'';
packages.wm = pkgs.writeScriptBin "fg42-wm" ''
#!${pkgs.stdenv.shell}
# Disable access control for the current user.
xhost +SI:localuser:$USER
# Make Java applications aware this is a non-reparenting window manager.
export _JAVA_AWT_WM_NONREPARENTING=1
# Set default cursor.
xsetroot -cursor_name left_ptr
# Set keyboard repeat rate.
xset r rate 400 30
# Uncomment the following block to use the exwm-xim module.
#export XMODIFIERS=@im=exwm-xim
#export GTK_IM_MODULE=xim
#export QT_IM_MODULE=xim
#export CLUTTER_IM_MODULE=xim
export FG42_USE_NIX=true;
export FG42_HOME=${fg42}/fg42
LIBRARY_PATH=$(cc -print-file-name=libgccjit.so):$LIBRARY_PATH \
FG42_WM=true ${fg42.emacsInUse}/bin/emacs \
--name FG42 \
--no-site-file --no-site-lisp \
--no-splash --title FG42 \
-l $FG42_HOME/fg42-config.el "$@"
'';
# devShells.default = pkgs.mkShell {
# nativeBuildInputs = deps ++ [ pkgs.fish ];
# shellHook = ''
# fish && exit
# '';
# };
devShells.default = pkgs.mkShell {
nativeBuildInputs = [ fg42 pkgs.fish ];
buildInputs = [ fg42 ];
shellHook = ''
fish && exit
'';
};
}
);
}

View File

@ -47,9 +47,11 @@
;; (fg42/-startup-optimization)
(require 'fpkg/core)
(fpkg/initialize)
(when (file-exists-p user-init-file)
(require 'fg42/cube)
(load user-init-file))
(add-hook 'emacs-startup-hook
(lambda ()
(run-hooks 'fg42/-cubes-body-hook)

View File

@ -31,11 +31,14 @@
(defvar fg42/debug-p nil
"The hook tha runs when FG42 finished running the user configuration.")
(defvar fg42-config-dir (or (getenv "FG42_CONFIG_DIR") "~/.fg42")
"Where to store installation specific data.")
(defvar fg42-home (getenv "FG42_HOME")
"The pass to fg42-home.")
(defvar fg42-tmp (concat fg42-home "/tmp"))
(defvar fg42-tmp (concat fg42-config-dir "/tmp"))
(provide 'fg42/core)

View File

@ -32,6 +32,7 @@
(fpkg/use flycheck
:defer ()
:init
(require 'flycheck)
(global-flycheck-mode)))

View File

@ -44,6 +44,7 @@
(eval
`(fpkg/use bm
:init
(require 'bm)
;; restore on load (even before you require bm)
(setq bm-restore-repository-on-load t)

View File

@ -58,6 +58,7 @@ It not only gives Dired an appealing and highly customizable user interface,
but also comes together with almost all possible parts required for full usability
as a modern file manager."
:init
(require 'dirvish)
(dirvish-override-dired-mode))
@ -96,6 +97,7 @@ contextual information."
(fpkg/use pinentry
:init
(progn
(require 'pinentry)
(setq epa-pinentry-mode 'loopback)
(pinentry-start))))
@ -278,12 +280,14 @@ https://emacsthemes.com/themes/badwolf-theme.html"
(fpkg/use selectrum
:defer nil
:init
(require 'selectrum)
(selectrum-mode +1))
(fpkg/use selectrum-prescient
:defer t
:init
(progn
(require 'selectrum-prescient)
(setq prescient-filter-method '(literal fuzzy regexp initialism))
(selectrum-prescient-mode +1)
(prescient-persist-mode +1)))
@ -292,6 +296,7 @@ https://emacsthemes.com/themes/badwolf-theme.html"
(fpkg/use ctrlf
:defer t
:init
(require 'ctrlf)
(ctrlf-mode +1)))

View File

@ -36,6 +36,7 @@
(fpkg/use eros
:init
(require 'eros)
(eros-mode))
(add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode))

View File

@ -43,6 +43,7 @@ For more info check out [[https://github.com/dgutov/diff-hl][diff-hl]] 's page."
(fpkg/use diff-hl
:init
(progn
(require 'diff-hl)
(when-flag git
(add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh))

View File

@ -37,5 +37,5 @@ package."
:if (display-graphic-p)))
(provide 'fg42/cubes/icons)
;;; icons.el ends here
(provide 'fg42/cubes/iconspack)
;;; iconspack.el ends here

View File

@ -23,7 +23,7 @@
;;; Code:
(require 'fpkg)
(require 'fg42/cube)
(require 'fg42/cubes/icons)
(require 'fg42/cubes/iconspack)
(autoload-cube 'fg42/statusbar-default
"modeline/statusbar-default.el"
@ -68,6 +68,7 @@ to Emacs modeline."
:defer nil
:init
(progn
(require 'smart-mode-line)
(setq sml/theme 'respectful)
(setq sml/no-confirm-load-theme t)
(sml/setup))))
@ -110,6 +111,7 @@ to Emacs modeline."
:after smart-mode-line
:init
(progn
(require 'smart-mode-line)
(setq mini-modeline-enhance-visual nil)
(setq fg42/modeline-setter #'fg42/mini-modeline-setter))
:defer nil

View File

@ -23,17 +23,17 @@
;;; Code:
(require 'fpkg)
(require 'fg42/cube)
(require 'fg42/cubes/icons)
(require 'fg42/cubes/iconspack)
(->cube noether-mode
(->cube noether
"Smart mode line is a pretty simple yet fantastic alternative
to Emacs modeline."
:straight (noether-mode :repo "https://devheroes.codes/lxsameer/noether.git")
:straight (noether :repo "https://devheroes.codes/lxsameer/noether.git")
:init
(require 'noether)
(require 'noether-views)
(let ((views (or (plist-get fg42/noether-mode-cube-params :views)
(let ((views (or (plist-get fg42/noether-cube-params :views)
(list
noether-minimal-mode-line
noether-minimal-location

View File

@ -83,6 +83,7 @@ For more information checkout [[https://github.com/alphapapa/org-super-agenda]]"
:after org-agenda
:init
(progn
(require 'org-super-agenda)
(setq org-agenda-skip-scheduled-if-done (or (plist-get params :skip-scheduled-if-done) t)
org-agenda-skip-deadline-if-done (or (plist-get params :skip-deadline-if-done) t)
org-agenda-include-deadlines (or (plist-get params :include-deadline) t)
@ -127,6 +128,7 @@ shows items in the narrowed portion; this allows seeing an overview of tasks in
(if-flag org-ql
(fpkg/use org-sidebar
:init
(require 'org-sidebar)
(setq org-sidebar-default-fns fns)
:bind
(("<f9>" . fg42/org-sidebar-toggle-sidebar-default)))
@ -178,6 +180,7 @@ For more info on ~org-mode~ check out [[https://orgmode.org/]]"
(fpkg/use org-journal
:defer t
:init
(require 'org-journal)
;; Change default prefix key; needs to be set before loading org-journal
(setq org-journal-prefix-key "C-c j ")
:config
@ -187,9 +190,10 @@ For more info on ~org-mode~ check out [[https://orgmode.org/]]"
org-journal-date-format "%Y-%m-%d (%A): ")))
(fpkg/use org-mode
(fpkg/use org
:init
(progn
(require 'org)
(require 'org-capture)
(global-set-key capture-key 'org-capture)
(setq org-tag-alist global-tags)

View File

@ -25,7 +25,6 @@
(require 'fg42/cube)
(defcube fg42/projectile-cube
"Projectile Cube"
:title "fg42/cubes/fg42/projectile-cube.org"
@ -36,6 +35,7 @@
())))
(fpkg/use projectile
:init
(require 'projectile)
(projectile-mode +1)
:config
(progn

View File

@ -34,9 +34,11 @@
(fpkg/use yasnippet
:init
(require 'yasnippet)
(let* ((snippet-home (expand-file-name "snippets"
(file-name-directory (locate-library "yasnippet-snippets"))))
(local-snippet (expand-file-name "core/fg42/cubes/snippets" fg42-home))
(file-name-directory (locate-library "yasnippet-snippets"))))
(local-snippet (expand-file-name
"lisp/fg42/cubes/snippets" fg42-home))
(user-snippets (or (plist-get fg42/yasnippet-cube-params :snippets-dir)
;; Just to make sure that we don't return nil. Since
;; yas-snippet-dirs shoud not contain nil value

View File

@ -33,6 +33,7 @@
(fpkg/use vterm
:init
(progn
(require 'vterm)
(setq vterm-shell _shell)))))

View File

@ -36,6 +36,7 @@
(fpkg/use dracula-theme
:init
(fg42/setup-theme
(require 'dracula-theme)
(load-theme 'dracula t)
(custom-theme-set-faces
'dracula

View File

@ -118,4 +118,5 @@
all-the-icons
)
(provide 'fg42/deps)
;;; deps.el ends here

View File

@ -20,8 +20,10 @@
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;
;;; Commentary:
;; This is the very first file that Emacs will load to setup FG42
;;; Code:
(setq debug-on-error t)
(when (string= (getenv "FG42_DEBUG") "1")
(setq debug-on-error t))
(eval-when-compile
(defvar package-archives)
@ -29,7 +31,9 @@
(defvar fg42-use-nix (or (getenv "FG42_USE_NIX") nil))
(add-to-list 'load-path (concat (getenv "FG42_HOME") "/core"))
;; (when fg42-use-nix
;; (require 'site-start))
(add-to-list 'load-path (concat (getenv "FG42_HOME") "/lisp"))
;; Prevent package.el to install anything at startup
(setq package-enable-at-startup nil)
@ -40,7 +44,7 @@
(setq tab-width 2)
(let ((emacsd (or (getenv "FG42_EMACSD") "~/.fg42/emacs.d")))
(let ((emacsd (or (getenv "FG42_EMACSD") (format "%s/emacs.d" (getenv "FG42_HOME")))))
(setq custom-file (format "%s/.fg42.custom.el" emacsd))
(setq user-emacs-directory emacsd)
(setq user-init-file
@ -48,7 +52,6 @@
(format "%s/.fg42.el"
(getenv "HOME")))))
;; Load the customization file. In FG42 it is different than
;; the default `user-init-file'
(if (file-exists-p custom-file)
@ -57,5 +60,5 @@
(require 'fg42)
(fg42/initialize)
(provide 'fg42-config)
;;; fg42-config.el ends here
(provide 'fg42/init)
;;; init.el ends here

View File

@ -27,7 +27,7 @@
(require 'fpkg)
(require 'fg42/flags)
(fpkg/require 'projectile)
;;(fpkg/require 'projectile)
(fpkg/require 'f)
(defflag fg42-project

View File

@ -56,22 +56,22 @@
"Install the given package DETAILS PKG via `use-package' and straight."
(declare (indent defun))
(if (and (listp details) (< 0 (length details)))
(let ((params (inject-straight (inject-params details))))
`(progn
(require ,pkg)
(use-package ,pkg ,@params)))
(let ((p (inject-straight (inject-params details))))
`(progn
(use-package ,pkg ,@p)))
`(progn
(require ,pkg)
(use-package ,pkg :defer t :ensure nil))))
(use-package ,pkg :defer t :ensure nil))))
(defmacro fpkg/require (pkg)
"Work like require but make sure that PKG is installed first."
(let ((pkg-name (intern (symbol-name `,(cadr pkg)))))
`(fpkg/use ,pkg-name
:init
(require ,pkg))))
(if fg42-use-nix
`(require ,pkg)
`(fpkg/use ,pkg-name
:init
(require ,pkg)))))
(provide 'fpkg)
;;; fpkg.el ends here

View File

@ -29,11 +29,6 @@
(defvar bootstrap-version 5)
(defcustom fpkg-package-directory (concat fg42-home "/.fpkg")
"Specify the directory to store all the dependencies."
:group 'fpkg
:type 'string)
(defun fpkg/install-and-load-use-package ()
"Install and load the `use-package' in compile time."

View File

@ -14,13 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{
lib,
nixpkgs,
stdenv,
elispPkgs,
srcDir,
emacsPackagesFor,
emacsPackages,
ourPackages,
writeScriptBin,
writeText,
symlinkJoin,
# This is a set of system tools required for FG42
# to work.
@ -31,65 +32,138 @@
vazir-fonts,
fira-code,
nerdfonts,
gcc,
ltex-ls,
}:
with builtins;
let
getEpkg = epkgs: x:
if hasAttr x epkgs
then getAttr x epkgs
else getAttr x ourPackages;
epkgSet = emacsPackagesFor emacs;
#epkgs = (map getEpkg elispPkgs);
emacsBundle = epkgSet.emacsWithPackages (epkgs:
(map (getEpkg epkgs) elispPkgs)
);
stdenv.mkDerivation (final:
let
getPkg = epkgs: pkg:
if hasAttr pkg epkgs
then getAttr pkg epkgs
else getAttr pkg ourPackages;
in stdenv.mkDerivation (final: rec{
pname = "fg42";
version = "4.0.0";
emacsBundle = (emacsPackagesFor emacs).withPackages (epkgs:
(map (x: getPkg epkgs x) elispPkgs)
);
src = srcDir;
outputs = [ "out" ];
maintainers = import ./maintainers.nix;
buildPhase = ''
mkdir -p $out/fg42
mkdir -p $out/bin/
in rec{
pname = "fg42";
version = "4.0.0";
cp -rv ${src}/core $out/fg42/
cp -rv ${src}/share $out/
src = srcDir;
outputs = [ "out" ];
runHook preBuild
cd $out/fg42
emacs -L . --batch -f batch-byte-compile *.el
cd -
cp -v ${src}/fg42-config.el $out/fg42/
buildPhase = ''
LISPDIR=$out/share/fg42/
mkdir -p $out/bin
install -d $LISPDIR
cp -rv ${src}/lisp/ $LISPDIR
cp -rv ${src}/share $out/
runHook postBuild
runHook preBuild
'';
cd $LISPDIR
emacs -L . --batch -f batch-byte-compile *.el
cd -
installPhase = ''
runHook preInstall
cat >> $out/bin/fg42 << EOF
#!${stdenv.shell}
# LISPDIR=$out/share/emacs/site-lisp
# install -d $LISPDIR
# install *.el *.elc $LISPDIR
emacs --batch -l package --eval "(package-generate-autoloads \"${pname}\" \"$out/fg42\")"
export FG42_HOME=${placeholder "out"}/share/fg42/
export FG42_EMACSD=~/.fg42/v4/emacs.d
export FG42_USE_NIX=true;
runHook postInstall
'';
LIBRARY_PATH="\$(cc -print-file-name=libgccjit.so):\$LIBRARY_PATH" \
FG42_WM=false ${emacsBundle}/bin/emacs \
--name FG42 \
-q --no-splash --title FG42 \
-l \$FG42_HOME/lisp/fg42/init.el "\$@"
EOF
chmod +x $out/bin/fg42
propagatedUserEnvPkgs = [
emacsBundle
ripgrep
git
texinfo
vazir-fonts
fira-code
nerdfonts
];
buildInputs = propagatedUserEnvPkgs;
cat >> $out/bin/fg42-wm << EOF
#!${stdenv.shell}
emacsInUse = emacsBundle;
})
export FG42_HOME=${placeholder "out"}/share/fg42/
export FG42_EMACSD=~/.fg42/v4/emacs.d
export FG42_USE_NIX=true;
# Disable access control for the current user.
xhost +SI:localuser:$USER
# Make Java applications aware this is a non-reparenting window manager.
export _JAVA_AWT_WM_NONREPARENTING=1
# Set default cursor.
xsetroot -cursor_name left_ptr
# Set keyboard repeat rate.
xset r rate 400 30
# Uncomment the following block to use the exwm-xim module.
# export XMODIFIERS=@im=exwm-xim
# export GTK_IM_MODULE=xim
# export QT_IM_MODULE=xim
# export CLUTTER_IM_MODULE=xim
LIBRARY_PATH="\$(cc -print-file-name=libgccjit.so):\$LIBRARY_PATH" \
FG42_WM=true ${emacsBundle}/bin/emacs \
--name FG42 \
-q --no-splash --title FG42 \
-l \$FG42_HOME/lisp/fg42/init.el "\$@"
EOF
chmod +x $out/bin/fg42-wm
runHook postBuild
'';
installPhase = ''
runHook preInstall
#LISPDIR=$out/share/fg42/lisp/
#emacs --batch -l package --eval "(package-generate-autoloads \"${pname}\" \"$LISPDIR\")"
runHook postInstall
'';
buildInputs = [
gcc
emacs
texinfo
emacsBundle
ripgrep
git
texinfo
vazir-fonts
fira-code
nerdfonts
gcc
ltex-ls
];
addEmacsNativeLoadPath = true;
meta = {
broken = false;
platforms = emacs.meta.platforms;
homepage = "https://fg42.org/";
maintainers = [ maintainers.lxsameer ];
description = "The mighty editor for the emacsians";
longDescription = ''
FG42 is a framework to create and editor and window manager based on GNU/Emacs.
It has a pre-defined setup as well which can be installed out of the box. But the
goal of this project is to provide the API necessary to create an integrated editor.
So you need to know about Emacs in advance.
'';
license = lib.licenses.gpl3Plus;
};
})

View File

@ -1,4 +1,3 @@
#! /bin/sh
# Fg42 - Emacs Editor for advance users
#
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
@ -15,5 +14,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
export FG42_HOME=___FG42_HOME___
LIBRARY_PATH=$(cc -print-file-name=libgccjit.so):$LIBRARY_PATH FG42_WM=false ${EMACS_PATH:-emacs} --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $FG42_HOME/fg42-config.el "$@"
{
lxsameer = {
email = "lxsameer@lxsameer.com";
github = "lxsameer";
git = "lxsameer";
matrix = "@lxsameer:matrix.org";
name = "Sameer Rahmani";
keys = [{
fingerprint = "6F3F A93B 4BD9 C3CA EF38 77E6 384A 12C3 1023 3CC5";
}];
};
}

View File

@ -1,112 +0,0 @@
#! /bin/bash
# Fg42 - Emacs Editor for advance users
#
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# 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, version 2.
#
# 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 <http://www.gnu.org/licenses/>.
set -e
current=$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)
fg42_home="$current/.."
# Coloring Functions
info() {
if [ "$1" ]
then
echo "[\033[01;32mINFO\033[00m]: $1"
fi
}
error() {
if [ "$1" ]
then
echo "[\033[01;31mERR\033[00m]: $1"
fi
}
warn() {
if [ "$1" ]
then
echo "[\033[01;33mWARN\033[00m]: $1"
fi
}
install_fonts() {
info "Downloading and installing fonts..."
mkdir -p ~/.fonts
wget "https://dl.fg42.org/fonts/0.1.0.tar.gz" -O ~/.fonts/fg42.tar.gz
tar zxf ~/.fonts/fg42.tar.gz -C ~/.fonts --strip 1
cp -r "$fg42_home/share/fonts/vazir/*" ~/.fonts/
info "Font installation is done."
}
install_runners() {
info "Creating the runner scripts..."
cp "$current/templates/fg42" "$current/../fg42"
cp "$current/templates/fg42-wm" "$current/../fg42-wm"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sed -i "s'___FG42_HOME___'$fg42_home'" "$fg42_home/fg42"
sed -i "s'___FG42_HOME___'$fg42_home'" "$fg42_home/fg42-wm"
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i'' -e "s'___FG42_HOME___'$fg42_home'" "$fg42_home/fg42"
sed -i'' -e "s'___FG42_HOME___'$fg42_home'" "$fg42_home/fg42-wm"
fi
chmod +x "$fg42_home/fg42"
chmod +x "$fg42_home/fg42-wm"
info "Copying conifg file to ~/.fg42.el..."
cp "$fg42_home/config/fg42.user.el" ~/.fg42.el
info "Installing the runners..."
sudo mkdir -p /usr/local/bin/
sudo rm -f /usr/local/bin/fg42
sudo rm -f /usr/local/bin/fg42-wm
sudo ln -s "$fg42_home/fg42" /usr/local/bin/fg42
sudo ln -s "$fg42_home/fg42-wm" /usr/local/bin/fg42-wm
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
info "Copying share files..."
sudo mkdir -p /usr/share/fg42/
sudo mkdir -p /usr/local/share/applications
sudo cp "$fg42_home/share/applications/fg42.desktop" /usr/local/share/applications
sudo cp -r "$fg42_home/share/icons/hicolor/" /usr/local/share/icons
sudo cp -r "$fg42_home/share/*" /usr/share/fg42/
sudo mkdir -p /usr/share/xsessions/
sudo cp -r "$fg42_home/share/xsessions/fg42.desktop" /usr/share/xsessions/
else
info "Skipping share files since this is not a Linux env..."
fi
}
install_extras() {
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
info "Copying share files..."
sudo mkdir -p /usr/share/fg42/
sudo cp "$fg42_home/share/applications/fg42.desktop" /usr/local/share/applications
sudo cp -r "$fg42_home/share/icons/hicolor/" /usr/local/share/icons
sudo cp -r "$fg42_home/share/*" /usr/share/fg42/
sudo cp -r "$fg42_home/share/xsessions/fg42.desktop" /usr/share/xsessions/
else
info "Skipping share files since this is not a Linux env..."
fi
}
eval "install_$1"

View File

@ -1,37 +0,0 @@
#! /bin/sh
# Fg42 - Emacs Editor for advance users
#
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# 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, version 2.
#
# 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 <http://www.gnu.org/licenses/>.
# Disable access control for the current user.
xhost +SI:localuser:$USER
# Make Java applications aware this is a non-reparenting window manager.
export _JAVA_AWT_WM_NONREPARENTING=1
# Set default cursor.
xsetroot -cursor_name left_ptr
# Set keyboard repeat rate.
xset r rate 400 30
# Uncomment the following block to use the exwm-xim module.
#export XMODIFIERS=@im=exwm-xim
#export GTK_IM_MODULE=xim
#export QT_IM_MODULE=xim
#export CLUTTER_IM_MODULE=xim
export FG42_HOME=___FG42_HOME___
LIBRARY_PATH=$(cc -print-file-name=libgccjit.so):$LIBRARY_PATH FG42_WM=true ${EMACS_PATH:-emacs} --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $FG42_HOME/fg42-config.el "$@"