#+title: Desktop
#+setupfile: headers
#+property: header-args:emacs-lisp  :mkdirp yes :lexical t :exports code
#+property: header-args:emacs-lisp+ :tangle ~/.config/emacs/desktop.el
#+property: header-args:emacs-lisp+ :mkdirp yes :noweb no-export
#+property: header-args:lisp :mkdirp :tangle ~/.stumpwm.d/desktop.lisp :noweb yes

* Desktop
Many settings formerly present in this website’s index are related to
my desktop settings, while some others are not.

** Theme and graphical tweaks
*** GTK Settings
**** GTK2
***** General configuration
:PROPERTIES:
:HEADER-ARGS: :mkdirp yes :tangle ~/.config/gtk-2.0/gtkrc
:END:
This file is tangled at ~$HOME/.config/gtk-2.0/gtkrc~. This is an
equivalent for the GTK3 configuration file you will see below, and it
shares most of its settings. First, let’s select the Nordic theme for
GTK2. Let’s also set the icon theme.
#+BEGIN_SRC conf-unix
# -*- mode: unix-config -*-
gtk-theme-name="Nordic"
gtk-icon-theme-name="Flat-Remix-Dark"
#+END_SRC

#+BEGIN_SRC conf-unix
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintslight"
#+END_SRC

This changes the shortcuts in menu, let’s also make the menus snappier.
#+BEGIN_SRC conf-unix
gtk-can-change-accels=1
gtk-menu-bar-popup-delay=0
gtk-menu-popdown-delay=0
gtk-menu-popup-delay=0
#+END_SRC

***** Filechooser
:PROPERTIES:
:HEADER-ARGS: :mkdirp yes :tangle ~/.config/gtk-2.0/gtkfilechooser.ini
:END:
#+BEGIN_SRC conf-unix
[Filechooser Settings]
#+END_SRC

The first option allows me to open the file chooser in the current
working directory:
#+BEGIN_SRC conf-unix
StartupMode=cwd
#+END_SRC

Next, setting the location mode to ~path-bar~ will show the path as buttons that
can be clicked rather than the full path.
#+BEGIN_SRC conf-unix
LocationMode=path-bar
#+END_SRC

With this configuration, by default we won’t see hidden files.
#+BEGIN_SRC conf-unix
ShowHidden=true
#+END_SRC

And we'll also see the size of the visible files.
#+BEGIN_SRC conf-unix
ShowSizeColumn=true
#+END_SRC

Now, let’s choose the geometry of our file picker. These two first lines set
where the file picker appears:
#+BEGIN_SRC conf-unix
GeometryX=566
GeometryY=202
#+END_SRC

And these two describe the size of the window:
#+BEGIN_SRC conf-unix
GeometryWidth=800
GeometryHeight=400
#+END_SRC

With these two lines, we set how our files are sorted: by name, and in the
ascending order.
#+BEGIN_SRC conf-unix
SortColumn=name
SortOrder=ascending
#+END_SRC

Our default view mode is a list of files:
#+BEGIN_SRC conf-unix
ViewMode=list-view
#+END_SRC

And finally, setting our icon view scale to ~-1~ sets the icon view to the max
size.
#+BEGIN_SRC conf-unix
IconViewScale=-1
#+END_SRC

**** GTK3
:PROPERTIES:
:HEADER-ARGS: :mkdirp yes :tangle ~/.config/gtk-3.0/settings.ini
:END:
The following file helps me to choose the aspect of various GTK+ 3
software, including their theme and icons. First, let’s declare the
header:
#+BEGIN_SRC conf-unix
[Settings]
#+END_SRC

Now, let’s hint to GTK that I prefer dark themes. This can have an influence
also on some websites that can detect this preference and therefore set their
own theme to dark by themselves.
#+BEGIN_SRC conf-unix
gtk-application-prefer-dark-theme = true
#+END_SRC

Next, the icon theme is the Flat Remix Dark icon theme:
#+BEGIN_SRC conf-unix
gtk-icon-theme-name = Nordzy
#+END_SRC

Now, the general theme for GTK3 is Nordic.
#+BEGIN_SRC conf-unix
gtk-theme-name = Nordic
#+END_SRC

#+BEGIN_SRC conf-unix
gtk-can-change-accels=1
gtk-menu-bar-popup-delay=0
gtk-menu-popdown-delay=0
gtk-menu-popup-delay=0
#+END_SRC

#+BEGIN_SRC conf-unix
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintslight
# gtk-xft-rgba=rgb
#+END_SRC

Since window decorations are handled by my WMs, I will leave this variable
empty.
#+BEGIN_SRC conf-unix
gtk-decoration-layout=
#+END_SRC

*** Xresources
:PROPERTIES:
:HEADER-ARGS: :mkdirp yes :tangle ~/.config/X11/Xresources :exports code
:END:
The main body in my Xresources declaration is the declaration of my
colour theme. It is based on the [[https://www.nordtheme.com/][Nord]] theme, from their [[https://github.com/arcticicestudio/nord-xresources/][Git
repository]].
#+BEGIN_SRC conf
#define nord0 #2E3440
#define nord1 #3B4252
#define nord2 #434C5E
#define nord3 #4C566A
#define nord4 #D8DEE9
#define nord5 #E5E9F0
#define nord6 #ECEFF4
#define nord7 #8FBCBB
#define nord8 #88C0D0
#define nord9 #81A1C1
#define nord10 #5E81AC
#define nord11 #BF616A
#define nord12 #D08770
#define nord13 #EBCB8B
#define nord14 #A3BE8C
#define nord15 #B48EAD

,*.foreground:   nord4
,*.background:   nord0
,*.cursorColor:  nord4
,*fading: 35
,*fadeColor: nord3

,*.color0: nord1
,*.color1: nord11
,*.color2: nord14
,*.color3: nord13
,*.color4: nord9
,*.color5: nord15
,*.color6: nord8
,*.color7: nord5
,*.color8: nord3
,*.color9: nord11
,*.color10: nord14
,*.color11: nord13
,*.color12: nord9
,*.color13: nord15
,*.color14: nord7
,*.color15: nord6
#+END_SRC

** Email signature
:PROPERTIES:
:HEADER-ARGS: :mkdirp yes :tangle ~/.signature
:END:
This file gets inserted automatically at the end of my emails.
#+BEGIN_SRC text
Lucien “Phundrak” Cartier-Tilet
https://phundrak.com (Français)
https://phundrak.com/en (English)
Sent from GNU/Emacs
#+END_SRC

** ~.desktop~ files for custom applications
Some software I use are not packaged (yet) on my system. Therefore, in
order to make them available in ~rofi~, I need to write a ~.desktop~ file
to launch them.

*** Emacs
Emacs does have a default ~.desktop~ file, but I want to override it to
just “open with Emacs” from other software (such as Nemo) and it will
open with ~emacsclient~ instead of just =emacs=.
#+begin_src conf-desktop :tangle ~/.local/share/applications/emacs.desktop
[Desktop Entry]
Name=Emacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=emacsclient -c %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs
Keywords=Text;Editor;
#+end_src

I also have ~mu4e.desktop~ which is used to set my default email client.
It relies on ~emacsmail~ defined in [[file:bin.org::#Emacsmail-afffb7cd][this document]].
#+begin_src conf-desktop :tangle ~/.local/share/applications/mu4e.desktop
[Desktop Entry]
Name=Mu4e
GenericName=Mu4e
Comment=Maildir Utils for Emacs
MimeType=x-scheme-handler/mailto;
Exec=/home/phundrak/.local/bin/emacsmail %U
Icon=emacs
Type=Application
Terminal=false
Categories=Network;Email;TextEditor
StartupWMClass=Gnus
Keywords=Text;Editor;
#+end_src

Then I also have ~org-protocol.desktop~ that helps capture elements from
other software, mainly web pages from Firefox through the [[https://github.com/sprig/org-capture-extension][org-capture
extension]].
#+begin_src conf-desktop :tangle ~/.local/share/applications/org-protocol.desktop
[Desktop Entry]
Name=org-protocol
Exec=emacsclient %u
Type=Application
Terminal=false
Categories=System;
MimeType=x-scheme-handler/org-protocol;
#+end_src

*** FlowScape
[[https://pixelforest.itch.io/flowscape][FlowScape]] is a nice 3D compositing software I sometimes use to create
landscapes. I always install it in =~/.local/opt/Flowscape=, so the
~.desktop~ file is relatively straightforward.
#+begin_src conf-desktop :tangle ~/.local/share/applications/FlowScape.desktop
[Desktop Entry]
Version=1.5
Name=FlowScape
Comment=Create gorgeous 3D landscapes with ease.
Exec=/usr/bin/prime-run /home/phundrak/.local/opt/FlowScape/FlowScape.x86_64
Path=/home/phundrak/.local/opt/FlowScape
Icon=/home/phundrak/.local/opt/FlowScape/icon.jpg
Terminal=false
Type=Application
Categories=Graphics
#+end_src

*** macOS
You did not read wrong! Yes I have an entry for macOS, but this is for
a virtual machine located in ~~/VMs/macOS~.
#+begin_src conf-desktop :tangle ~/.local/share/applications/macos.desktop
[Desktop Entry]
Version=1
Name=macOS
Comment=macOS in a virtual machine
Exec=/usr/bin/prime-run /home/phundrak/VMs/macOS/basic.sh
Path=/home/phundrak/VMs/macOS
Icon=/home/phundrak/VMs/macOS/macOS.png
Terminal=false
Type=Application
Categories=Development
#+end_src

*** Minecraft
Yup, I play Minecraft. And yes, it does have a default ~.desktop~ file,
but this one overrides it to launch automatically Minecraft with
[[https://wiki.archlinux.org/title/PRIME][prime-run]], using my Nvidia GPU instead of my integrated GPU.
#+begin_src conf-desktop :tangle ~/.local/share/applications/minecraft-launcher.desktop
[Desktop Entry]
Type=Application
Version=1.0
Name=Minecraft Launcher (Nvidia)
Comment=Official Minecraft Launcher
Exec=/usr/bin/prime-run /usr/bin/minecraft-launcher
Path=/usr/bin/
Icon=minecraft-launcher
Terminal=false
Categories=Game;Application;
#+end_src

*** OtherWorldMapper
OtherWorldMapper is a map creation software. It is always installed in
~~/.local/opt/OtherWorldMapper~.
#+begin_src conf-desktop :tangle ~/.local/share/applications/OWM.desktop
[Desktop Entry]
Version=1.0.4
Name=OtherWorldMapper
Comment=OtherWorldMapper is a powerful yet intuitive fantasy map creation tool.
Exec=/usr/bin/prime-run /home/phundrak/.local/opt/OtherWorldMapper/OWM
Path=/home/phundrak/.local/opt/OtherWorldMapper
Icon=/home/phundrak/.local/opt/OtherWorldMapper/owm.ico
Terminal=false
Type=Application
Categories=Graphics
#+end_src

*** YouTube ~.desktop~ files
The first ~.desktop~ file related to YouTube is ~ytdl.desktop~ which runs
~ytdl~ defined in [[file:bin.org::#ytdl-a-youtube-dl-wrapper-03bd63e0][this document]].
#+begin_src conf-desktop :tangle ~/.local/share/applications/ytdl.desktop
[Desktop Entry]
Version=0.3
Name=YTDL
Comment=YouTube (and more) video downloader
Exec=/home/phundrak/.local/bin/rofi-ytdl
Path=/home/phundrak/.local/bin
Terminal=false
Type=Application
Categories=Network;Video
#+end_src

There is also ~ytplay.desktop~ for ~ytplay~ defined in [[file:bin.org::#Media-youtube-dl-wrappers-ytplay-z6ka39h0m9j0][this document]].
#+begin_src conf-desktop
[Desktop Entry]
Type=Application
Version=1.0
Name=ytplay (YouTube in mpv)
Comment=Play YouTube videos in mpv
Exec=/home/phundrak/.local/bin/ytplay
Path=/home/phundrak/.local/bin
Terminal=false
Categories=Media
#+end_src
