Skype for Linux - Disable autostart

January 8, 2021

TL;DR

Insert "app.autoStartEnabled":false into ~/.config/skypeforlinux/settings.json.

See also my answer at askubuntu.com.

Intro

The native Skype app for Linux - I guess I should be thankful there even is one - auto-starts itself on boot1, and there is no way to turn off that behaviour as a guest because the Settings pane can only be accessed by logged-in users.

Auto-start works on Linux desktops works by inserting a .desktop file in a config folder, so Skype’s is at ~/.config/autostart/skypeforlinux.desktop. Even if you delete the file, Skype just re-creates it every time it launches. You could just empty and then chmod a-w the desktop file, but that’s lame and Skype might change their auto-start behaviour in the future using systemd units or some other shenanigans; it’s always whack-a-mole since Skype’s business interest lies in having its app always present to create “engagement”.

We have to find a way to access the auto-start setting from outside of the UI then.

Digging into the source

Since every “app” nowadays is just webshit upon turtles-all-the-way-down fragile tech stacks, the whole skypeforlinux app is just a giant pile of minified javascript running on Electron, whose source code you can thankfully inspect.

/usr/share/skypeforlinux/resources/app.asar, is an asar archive2 that you can extract using asar extract app.asar app-extracted.

Packages for e.g. Ubuntu or Arch Linux are available.

You’ll find a file named main.js which contains the settings handling and autostart creation code.

I’ve pretty-printed relevant parts using js-beautify, which is available via pip install jsbeautifier or as an Arch Linux package.

The t.AutoStartLinux object contains the main creation logic:

class u extends a.AutoStartBase {
    _enable(e) {
        e ? this._createFile() : this._removeFile()
    }
    _createFile() {
        try {
            s.ensureDir(this._dir), i.writeFileSync(this._file, this._content),
            l.getInstance().info("[AutoStartLinux] Created file " + this._file)
        } catch (e) {
            l.getInstance().error("[AutoStartLinux] Unable to create file " + this._file, e)
        }
    }
    _removeFile() {
        try {
            i.unlinkSync(this._file)
        } catch (e) {
            l.getInstance().error("[AutoStartLinux] Unable to remove file " + this._file, e)
        }
    }
    get _dir() {
        return o.join(r.homedir(), ".config", "autostart")
    }
    get _file() {
        return o.join(this._dir, "skypeforlinux.desktop")
    }
    get _content() {
        return ["[Desktop Entry]", "Name=Skype for Linux",
                "Comment=Skype Internet Telephony", "Exec=/usr/bin/skypeforlinux",
                "Icon=skypeforlinux", "Terminal=false", "Type=Application",
                "StartupNotify=false", "X-GNOME-Autostart-enabled=true"].join("\n")
    }
}
t.AutoStartLinux = u

The AutoStartBase class, which the AutoStartLinux subclass inherits, reads a setting called autoStartEnabled:

t.AutoStartBase = class {
    constructor() {
        this._appSettings = i.getInstance()
    }
    sync() {
        this._appSettings || (i.init(), this._appSettings = i.getInstance());
        const e = !!this._appSettings.get().autoStartEnabled;
        void 0 !== this._isEnabled && this._isEnabled === e || this._enable(e), this._isEnabled = e
    }
}

This setting is translated into a key read from the json file by SettingsKeys:

t.SettingsKeys = {
    AutoStartEnabled: "app.autoStartEnabled",
    OnCloseKeepRunning: "app.onCloseKeepRunning",
    Crashed: "didCrashInLastSession",
    RegisterProtocols: "app.registerProtocols",
    LaunchMinimized: "app.launchMinimized",
    CheckNonAdminUser: "app.checkNonAdmin",
    LoggingLevel: "logging.level",
    LoggingEnabled: "logging.enabled",
    LoggingConsole: "logging.console",
    UpgradedFromDelphi: "app.upgradedFromDelphi",
    UpgradedFromDelphiDate: "app.upgradedFromDelphiDate",
    MainWindowPosition: "main-window.position",
    WindowMaximized: "main-window.isMaximised",
    ZoomLevel: "main-window.zoom-level"
};

Gotcha!

Background

The whole working-from-home fad has reached me as well. Every person in a position of authority insists on choosing their own videoconferencing solution, which wouldn’t be as bad if those products were at least all web-based.

But, because we live in the shittiest of all possible universes, every large company scrambled to push their brittle technology out the door as fast as possible, of course with maximum lock-in and native “apps” to increase user retention, and hopefully sell some of that sweet data.

Color me surprised then to find out Microsoft-owned Skype’s “Skype for Web” does not work at all in both Firefox or Chromium but wants you to install Microsoft Edge (a 1-to-1 clone of Chrome with different lipstick on top). Synergy!


  1. On every session login, not on every Skype login. ↩︎

  2. Yes, of course the javascript people had to “invent” their own archive format. ↩︎