Un peu d'épice?
μ | 📰 | | 📧 |

    Fluxbox sur OpenBSD

    L'histoire

    Ma chérie utilisait debian depuis longtemps. Mais depuis la mise à jour vers buster, c'était très lent. J'ai décidé d'installer OpenBSD à la place, et ça semble mieux lui convenir.

    Screenshots

    great desktop experience openbsd fluxbox 1

    great desktop experience openbsd fluxbox 2

    Configuration

    Installation

    OpenBSD est facile à installer. J'ai choisi de chiffrer tout le système (et vous devriez probablement en faire autant…)

    Xenodm

    Le gestionnaire de connexion est xenodm. J'ai activé l'autologin puisqu'elle est seule à s'en servir :

    # rcctl enable xenodm # echo ‘DisplayManager._0.autoLogin: user’ >> /etc/X11/xenodm/xenodm-config

    Paquets installés

    GraphicsMagick
    cups
    cups-filters-*
    cups-libs
    curl
    dmenu
    ffmpeg
    foomatic-db
    ghostscript-fonts
    gimp
    gnome-themes-standard
    gtk+2-cups
    gtk+3-cups
    gtk+4-cups
    gtk-engines2
    gutenprint
    hotplug-diskmount
    firefox-esr
    firefox-esr-i18n-fr
    fluxbox
    libdvdcss
    libdvdnav
    libdvdread
    liberation-fonts
    libreoffice
    libreoffice-i18n-fr
    lynx
    vlc
    evince-*-light
    noto-emoji
    noto-fonts
    ntfs_3g
    numlockx
    optipng
    p7zip
    pcmanfm
    roboto-fonts
    leafpad
    sct
    gnome-colors-icon-theme
    xclip
    viewnior
    xdg-user-dirs
    xdg-utils
    xdotool
    youtube-dl
    thunderbird
    thunderbird-i18n-fr
    arandr
    dunst
    rsync
    xarchiver
    

    Configuration de Fluxbox

    Style

    Le style s'appelle ion. Il va bien avec le thème gtk Adwaita.

    Toolbar

    Le menu peut s'ouvrir en cliquant en bas à gauche de la barre d'outils. Dans ~/.fluxbox/init :

    session.screen0.toolbar.tools:  RootMenu, iconbar, systemtray, ,prevworkspace, workspacename, nextworkspace, clock
    session.screen0.workspaceNames: # 1,# 2,# 3,# 4
    session.screen0.strftimeFormat: %d/%m - %H:%M
    

    Le volume du son

    Scroller sur la barre ou le bureau change le niveau sonore. Dans ~/.fluxbox/keys

    XF86AudioRaiseVolume :Exec mixerctl outputs.master=+10
    XF86AudioLowerVolume :Exec muxerctl outputs.master=-10
    XF86AudioMute :Exec mixerctl outputs.master.mute=toggle
    # volume on bar and desktop
    XF86AudioRaiseVolume :Exec mixerctl outputs.master=+10
    XF86AudioRaiseVolume :Exec mixerctl outputs.master=+10
    XF86AudioLowerVolume :Exec muxerctl outputs.master=-10
    XF86AudioMute :Exec mixerctl outputs.master.mute=toggle
    

    Le menu

    Le menu ne contient que ce qui est utile, pas besoin de chercher.

    ~/.fluxbox/menu :

    [begin] (· MENU ·)
    [encoding] {UTF-8}
    [exec] (Navigateur web) {firefox-esr} </usr/local/share/icons/gnome-colors-common/16x16/emblems/emblem-web.png>
    [exec] (Courriel) {thunderbird} </usr/local/share/icons/gnome-colors-common/16x16/apps/stock_mail.png>
    [exec] (Capture d'écran) {scrotncopy} </usr/local/share/icons/gnome-colors-common/16x16/devices/gnome-screenshot.png>
    [submenu] (Fichiers) {Fichiers} </usr/local/share/icons/gnome-brave/16x16/places/folder.png>
        [exec] (Gestionnaire de fichiers) {pcmanfm} </usr/local/share/icons/gnome-brave/16x16/apps/pcmanfm.png>
        [exec] (Dossier personnel) {pcmanfm} </usr/local/share/icons/gnome-brave/16x16/places/folder_home.png>
        [exec] (Cours) {pcmanfm ~/Cours} </usr/local/share/icons/gnome-brave/16x16/places/folder.png>
        [exec] (Classe) {pcmanfm ~/Classe} </usr/local/share/icons/gnome-brave/16x16/places/folder.png>
        [exec] (Recherche de fichiers) {pcmanfm -f} </usr/local/share/icons/gnome-brave/16x16/places/folder-saved-search.png>
        [exec] (MEDIAS) {pcmanfm /vol} </usr/local/share/icons/gnome-brave/16x16/places/stock_folder.png>
    [end]
    [separator]
    [exec] (Bureautique) {libreoffice} </usr/local/share/icons/hicolor/16x16/apps/libreoffice-startcenter.png>
    [exec] (Texte) {lowriter} </usr/local/share/icons/hicolor/16x16/apps/libreoffice-writer.png>
    [exec] (Présentation) {loimpress} </usr/local/share/icons/hicolor/16x16/apps/libreoffice-impress.png>
    [exec] (Tableur) {localc} </usr/local/share/icons/hicolor/16x16/apps/libreoffice-calc.png>
    [exec] (Gimp) {gimp} </usr/local/share/icons/hicolor/16x16/apps/gimp.png>
    [exec] (Éditeur de texte) {leafpad} </usr/local/share/icons/hicolor/16x16/apps/leafpad.png>
    [exec] (VLC) {vlc} </usr/local/share/icons/gnome-colors-common/16x16/apps/vlc.png>
    [separator]
    [submenu] (Volume) </usr/local/share/icons/gnome-brave/16x16/status/stock_volume.png>
            [exec] (0%) {setvol 0}
            [exec] (10%) {setvol 10}
            [exec] (20%) {setvol 20}
            [exec] (30%) {setvol 30}
            [exec] (40%) {setvol 40}
            [exec] (50%) {setvol 50}
            [exec] (60%) {setvol 60}
            [exec] (70%) {setvol 70}
            [exec] (80%) {setvol 80}
            [exec] (90%) {setvol 90}
            [exec] (100%) {setvol 100}
    [end]
    [submenu] (Température d'écran) </usr/local/share/icons/gnome-colors-common/16x16/apps/preferences-desktop-wallpaper.png>
            [exec] (Mars) {sct 2000}
            [exec] (Feu de camp) {sct 4500}
            [exec] (Normal) {sct}
            [exec] (Café) {sct 8000}
    [end]
    [exec] (Résolution d'écran) {arandr} </usr/local/share/icons/gnome-colors-common/16x16/apps/preferences-desktop-screensaver.png>
    [separator]
    [submenu] (Session) </usr/local/share/icons/gnome-colors-common/16x16/apps/gnome-session-properties.png>
        [submenu] (Configurer)
            [exec] (Changer le thème GTK) {lxappearance}
            [submenu] (System Styles) {Choose a style...}
                [stylesdir] (/usr/local/share/fluxbox/styles)
            [end]
            [config] (Configuration Fluxbox)
            [submenu] (User Styles) {Choose a style...}
                [stylesdir] (~/.fluxbox/styles)
            [end]
            [reconfig] (Recharger la configuration)
        [end]
        [separator]
        [exec] (Verouiller l'écran) {xlock} </usr/local/share/icons/gnome-colors-common/16x16/actions/system-lock-screen.png>
        [exit] (Fermer la session) </usr/local/share/icons/gnome-colors-common/16x16/actions/gnome-session-logout.png>
        [separator]
        [exec] (Suspendre) {doas /usr/sbin/apm -S} </usr/local/share/icons/gnome-colors-common/16x16/actions/system-lock-screen.png>
        [exec] (Hiberner) {doas /usr/sbin/apm -z} </usr/local/share/icons/gnome-colors-common/16x16/apps/gnome-session-sleep.png>
        [exec] (Redémarrer) {doas /sbin/reboot} </usr/local/share/icons/gnome-colors-common/16x16/apps/gnome-session-reboot.png>
        [exec] (Éteindre) {doas /sbin/shutdown -hp now} </usr/local/share/icons/gnome-colors-common/16x16/apps/gnome-session-halt.png>
    [end]
    [endencoding]
    [end]
    

    Quelques précisions :

    La capture d'écran permet de sélectionner une partie de l'écran, et copie la capture dans le presse papier pour coller rapidement dans LibreOffice ensuite. Il faut juste Graphicsmagick et xclip. scrotncopy.

    L'entrée “volume” appelle setvol :

    #!/bin/sh
    # set volume to percent
    vol=$(( $1 * 255 / 100 ))
    mixerctl outputs.master=${vol}
    exit
    

    Pour redémarrer/éteindre le système : /etc/doas.conf :

    echo "permit persist :wheel " >> /etc/doas.conf
    echo "permit nopass :wheel cmd /sbin/shutdown" >> /etc/doas.conf
    echo "permit nopass :wheel cmd /sbin/reboot" >> /etc/doas.conf
    echo "permit nopass :wheel cmd /usr/sbin/apm" >> /etc/doas.conf
    

    Session

    Dans ~/.xsession :

    # translations and environment
    . ~/.profile
    # dbus
    if [ -x /usr/local/bin/dbus-launch -a -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then
        eval `dbus-launch --sh-syntax --exit-with-x11` &
    fi
    # Load X options
    xrdb -merge ~/.Xresources &
    # disable bell
    xset b off &
    # numpad
    numlockx &
    # notification
    dunst &
    # take care of you eyes, change temperature color
    sct 5000 1>/dev/null &
    # desktop
    pcmanfm --desktop &
    
    startfluxbox
    

    Divers

    softdeps

    sed -i 's/rw,/rw,softdep,/g' /etc/fstab
    

    unwind et adblock

    rcctl enable unwind
    echo 'prepend domain-name-servers 127.0.0.1;' >> /etc/dhclient.conf
    # or
    echo 'nameserver 127.0.0.1' > /etc/resolv.conf
    echo 'lookup file bind' >> /etc/resolv.conf
    echo "prepend domain-name-servers 127.0.0.1;" >> /etc/dhclient.conf
    ftp -o /usr/local/sbin/zerohosts \
        https://dev.ybad.name/OpenBSD-stuff/zerohosts
    touch /etc/hosts.include
    echo "/usr/local/sbin/zerohosts /etc/hosts.include &" >> /etc/rc.local
    

    ntpd

    rcctl enable ntpd
    sed -i 's/www\.google\.com/www.openbsd.org/' /etc/ntpd.conf
    

    hotplug

    Tous les médias comme les clés USB sont montés dans /vol

    /usr/local/libexec/hotplug-diskmount init
    chmod +x /etc/hotplug/{attach,detach}
    rcctl enable hotplugd
    

    /etc/hotplug/attach :

    #!/bin/sh
    
    DEVCLASS=${1}
    DEVNAME=${2}
    
    case "${DEVCLASS}" in
            0)
                if [ -n "$(echo $DEVNAME | grep -o "ugen[0-9]")" ]; then
                    addr=$(dmesg | grep $DEVNAME | \
                        tail -n1 | \
                        cut -d' ' -f3 | \
                        tr -d '[:alpha:]' \
                        )
                    chown _cups /dev/${DEVNAME}.* /dev/usb$addr
                fi
            ;;
    
            2)
                /usr/local/libexec/hotplug-diskmount attach -f dirty -m 0777 "${DEVNAME}"
            ;;
    esac
    

    /etc/hotplug/detach :

    #!/bin/sh
    
    DEVCLASS=$1
    DEVNAME=$2
    
    case $DEVCLASS in
        2)
            /sbin/umount "/mnt/$DEVNAME"
        ;;
    esac
    exit 0
    

    cups

    Pour les imprimantes USB :

    # cat rc.shutdown 
    echo "* Disable ulpt to use USB printers"
    printf 'disable ulpt\nq\n' | config -ef /bsd
    echo "* Recompute sha256 sum"
    sha256 /bsd >/var/db/kernel.SHA256
    

    Français

    Dans ~/.profile :

    LC_CTYPE="fr_FR.UTF-8"
    LC_MESSAGES="fr_FR.UTF-8"
    LC_COLLATE=fr_FR.UTF-8
    LC_ALL='fr_FR.UTF-8'
    LANG='fr_FR.UTF-8'
    
    export LC_COLLATE LC_CTYPE LC_MESSAGES LC_ALL LANG
    

    Et pour firefox et thunderbird :

    https://wiki.openbsd.fr.eu.org/system:www:mozilla-firefox#langue-francaise

    https://wiki.openbsd.fr.eu.org/system:mail:mozilla-thunderbird#langue-francaise