"It has happened before, but there is nothing to compare it to now."
This commit is contained in:
commit
63ad68ac70
2 changed files with 112 additions and 0 deletions
31
README.org
Normal file
31
README.org
Normal file
|
@ -0,0 +1,31 @@
|
|||
* quiet
|
||||
|
||||
A simple package to disconnect from the online world for a while, possibly reconnecting later. Any interuptions or distractions which occur once the command is run are guaranteed to be local.
|
||||
|
||||
* disconnection
|
||||
|
||||
``M-x quiet`` will disconnect from the network, optionally reconecting after a certain time.
|
||||
|
||||
the function ``quiet`` can be used anywhere in emacs where lack of network access could be seen a as a feature, e.g. as a mode-hook (or with ``defadvice``) to your preferred distraction free writing environment.
|
||||
|
||||
* reconection
|
||||
|
||||
``M-x quiet-reconnect`` will manually reconect to the network, however you can enable a timer to automatically reconnect by setting ``quiet-timer`` to a number of minutes. e.g. ``(setq quiet-timer 60)`` will let ``quiet`` to reconnect after one hour. if ``quiet-timer`` is set to 0 it won't reconnect automatically.
|
||||
|
||||
* network interfaces
|
||||
|
||||
you may want to ``customize`` or ``setq`` ``quiet-disconnect`` and ``quiet-connect`` to the appropriate shell commands to turn your network (or single interface) on or off.
|
||||
|
||||
- MacOS (current default)
|
||||
% networksetup -setairportpower airport {on,off}
|
||||
- Linux
|
||||
% ifup wlan0
|
||||
% ifdown wlan0
|
||||
- BSD
|
||||
% service netif {stop, start}
|
||||
|
||||
* further
|
||||
|
||||
- Mihaly Csikszentmihályi (1990). Flow: The Psychology of Optimal Experience. Harper & Row. ISBN 9780060162535
|
||||
- The Myth of Monotasking. https://hbr.org/2011/11/the-myth-of-monotasking/
|
||||
|
81
quiet.el
Normal file
81
quiet.el
Normal file
|
@ -0,0 +1,81 @@
|
|||
;;; quiet.el --- disconnect from the online world for a while
|
||||
|
||||
;; Copyright 2016 FoAM vzw
|
||||
;;
|
||||
;; Author: nik gaffney <nik@fo.am>
|
||||
;; Created: 2016-05-05
|
||||
;; Version: 0.1
|
||||
;; Keywords: quiet, distraction, network, detachment, offline
|
||||
;; X-URL: https://github.com/zzkt/quiet
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; 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; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
;;
|
||||
;; 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, write to the Free Software
|
||||
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; disconnect from the online world for a while, possibly reconnecting later
|
||||
;;
|
||||
;; you may need to customize or setq quiet-disconnect and quiet-connect to
|
||||
;; the appropriate shell commands to turn your network (interface) on or off
|
||||
;;
|
||||
;; MacOS
|
||||
;; % networksetup -setairportpower airport {on,off}
|
||||
;; Linux
|
||||
;; % ifup wlan0
|
||||
;; % ifdown wlan0
|
||||
;; BSD
|
||||
;; % service netif {stop, start}
|
||||
|
||||
;;; Code:
|
||||
|
||||
(provide 'quiet)
|
||||
|
||||
(defcustom quiet-disconnect "networksetup -setairportpower airport off"
|
||||
"Shell command to turn off network connection(s)"
|
||||
:type 'string
|
||||
:options '("networksetup -setairportpower airport off" "ifdown wlan0")
|
||||
:group 'quiet)
|
||||
|
||||
(defcustom quiet-connect "networksetup -setairportpower airport on"
|
||||
"Shell command to turn on network connection(s)"
|
||||
:type 'string
|
||||
:options '("networksetup -setairportpower airport off" "ifup wlan0")
|
||||
:group 'quiet)
|
||||
|
||||
(defcustom quiet-timer 0
|
||||
"Timer to reconnect network after a given time (in minutes). A value of 0 will leave the connection off"
|
||||
:type 'integer
|
||||
:group 'quiet)
|
||||
|
||||
;; M-x quiet
|
||||
(defun quiet ()
|
||||
"quieten network distractions for a while..."
|
||||
(interactive)
|
||||
(save-window-excursion
|
||||
(message "disconnecting...")
|
||||
(async-shell-command quiet-disconnect))
|
||||
(if (not (= quiet-timer 0))
|
||||
(progn
|
||||
(run-at-time (* quiet-timer 60) nil 'quiet-reconnect))))
|
||||
|
||||
(defun quiet-reconnect ()
|
||||
(interactive)
|
||||
(save-window-excursion
|
||||
(message "reconnecting after ~%d %s" quiet-timer (if (= quiet-timer 1) "minute" "minutes"))
|
||||
(async-shell-command quiet-connect)))
|
||||
|
||||
;;; quiet.el ends here
|
Loading…
Reference in a new issue