1
0
mirror of https://github.com/balkian/dotfiles.git synced 2024-11-21 19:52:29 +00:00

Functions i3 lock/suspend/hibernate

This commit is contained in:
J. Fernando Sánchez 2015-02-23 07:07:14 +01:00
parent 3bc784c4bf
commit 7769406c92
7 changed files with 129 additions and 76 deletions

View File

@ -1,38 +0,0 @@
#!/bin/bash
while [ "$select" != "NO" -a "$select" != "YES" ]; do
select=$(echo -e 'NO\nYES' | dmenu -fn "-*-cure-medium-*-*-*-11-*-*-*-*-*-*-*" -nb "#101010" -nf "#5f5f5f" -sb "#191919" -sf "#c72f62" -i -p "Do you really want to exit?");
[ -z "$select" ] && exit 0
done
[ "$select" = "NO" ] && exit 0
i3-msg exit
##!/bin/sh
#lock() {
#i3lock
#}
#case "$1" in
#lock)
#lock
#;;
#logout)
#i3-msg exit
#;;
#suspend)
#lock && systemctl suspend
#;;
#hibernate)
#lock && systemctl hibernate
#;;
#reboot)
#systemctl reboot
#;;
#shutdown)
#systemctl poweroff
#;;
#*)
#echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
#exit 2
#esac
#exit 0

34
bin/i3-exit.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
case "$1" in
lock)
xautolock -locknow
;;
logout)
while [ "$select" != "NO" -a "$select" != "YES" ]; do
select=$(echo -e 'NO\nYES' | dmenu -fn "-*-cure-medium-*-*-*-11-*-*-*-*-*-*-*" -nb "#101010" -nf "#5f5f5f" -sb "#191919" -sf "#c72f62" -i -p "Do you really want to exit?");
[ -z "$select" ] && exit 0
done
[ "$select" = "NO" ] && exit 0
i3-msg exit
;;
suspend)
xautolock -locknow
dbus-send --system --print-reply --dest="org.freedesktop.login1" /org/freedesktop/login1 org.freedesktop.login1.Manager.Suspend boolean:true # XFCE4-power settings
;;
hibernate)
xautolock -locknow
dbus-send --system --print-reply --dest="org.freedesktop.login1" /org/freedesktop/login1 org.freedesktop.login1.Manager.Hibernate boolean:true # XFCE4-power settings
;;
reboot)
dbus-send --system --print-reply --dest="org.freedesktop.login1" /org/freedesktop/login1 org.freedesktop.login1.Manager.Reboot boolean:true # XFCE4-power settings
;;
shutdown)
dbus-send --system --print-reply --dest="org.freedesktop.login1" /org/freedesktop/login1 org.freedesktop.login1.Manager.PowerOff boolean:true # XFCE4-power settings
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
exit 2
esac
exit 0

View File

@ -1,2 +1,2 @@
#!/bin/sh
emacsclient --alternate-editor="" -c "$@"
emacsclient --alternate-editor="" -s "$HOME/.emacs.d/HIGHLANDER" -c "$@"

View File

@ -4,8 +4,6 @@
;;; Code:
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
@ -32,29 +30,35 @@
my:el-get-packages
'(el-get ; el-get is self-hosting
ace-jump-mode
; escreen ; screen for emacs, C-\ C-h
switch-window ; takes over C-x o
auctex
auctex-latexmk
auto-complete ; complete as you type with overlays
; zencoding-mode ; http://www.emacswiki.org/emacs/ZenCoding
ein
emmet-mode
pretty-mode
; escreen ; screen for emacs, C-\ C-h
evil
fill-column-indicator
evil-jumper
evil-matchit
evil-nerd-commenter
evil-surround
jedi
fill-column-indicator
flycheck
powerline
ein
;; smex
helm
projectile
helm-projectile
auctex
gist
helm
helm-ag
helm-projectile
jedi
magit
markdown-mode
nxhtml
pivotal-tracker
powerline
pretty-mode
projectile
;; smex
switch-window ; takes over C-x o
yasnippet
; zencoding-mode ; http://www.emacswiki.org/emacs/ZenCoding
;; color-theme-solarized
;; color-theme-tango)) ; check out color-theme-olarized
@ -122,6 +126,22 @@
(setq linum-format " %d ")
(set-face-background 'hl-line-face "gray18")
(setq linum-mode-inhibit-modes-list '(eshell-mode
shell-mode
ein:notebook-bg-mode
ein:bg/ein:notebook
ein:bg
ein:notebook
)
)
(defadvice linum-on (around linum-on-inhibit-for-modes)
"Stop the load of linum-mode for some major modes."
(unless (member major-mode linum-mode-inhibit-modes-list)
ad-do-it))
(ad-activate 'linum-on)
(require 'evil-matchit)
(global-evil-matchit-mode 1)
@ -151,6 +171,8 @@
(eval-after-load 'ein-notebooklist
'(require 'config-ein))
;; Latex
(require 'config-latex)
;; Cool surrounding
(require 'evil-surround)
@ -220,6 +242,40 @@
(setq fci-rule-column 79)
(fringe-mode '(1 . 1))
(require 'org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-directory "~/Dropbox/org")
(setq org-mobile-inbox-for-pull "~/Dropbox/org/inbox.org")
(setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
(setq org-mobile-files '("~/Dropbox/org"))
(setq org-default-notes-file (concat org-directory "/notes.org"))
(setq org-agenda-files (list org-directory))
(define-key global-map "\C-cc" 'org-capture)
(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)
(yas-global-mode 1)
(require 'config-secret)
(eval-after-load 'magit
'(progn
(set-face-foreground 'magit-diff-add "green3")
(set-face-foreground 'magit-diff-del "red3")
(set-face-background 'magit-item-highlight "black")))
;; Preven #file#.txt files
(setq create-lockfiles nil)
;; Better helm fonts
(set-face-attribute 'helm-selection nil :background "yellow" :foreground "black")
;;; .emacs ends here
(custom-set-variables
;; custom-set-variables was added by Custom.
@ -232,4 +288,5 @@
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ein:cell-input-area ((t nil)) t))
'(ein:cell-input-area ((t nil)))
'(ein:cell-input-prompt ((t (:inherit header-line :background "firebrick")))))

View File

@ -8,7 +8,7 @@
[github]
user = balkian
[color]
ui = always
ui = true
[alias]
lg1 = log --graph --all --format=format:'%C(yellow)%h%C(reset) - %C(green)(%ad)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative

View File

@ -25,8 +25,7 @@ bindsym $mod+Return [instance="tmux"] scratchpad show
bindsym Control+Mod1+t exec urxvt
# start lock
#bindsym Control+Mod1+l exec i3lock -c 000000 -t -i ~/Pictures/Wallpapers/Game\ Over\ Hacker.png # Generic
bindsym Control+Mod1+l exec dm-tool lock # Lightdm
bindsym Control+Mod1+l exec i3-exit.sh lock
bindsym Control+Mod1+w exec i3-one-instance firefox
bindsym Control+Mod1+g exec i3-one-instance gvim
@ -156,8 +155,8 @@ bindsym $mod+Shift+C reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+R restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+E exec exit_i3.sh
bindsym $mod+Mod1+s exec gksudo pm-suspend
bindsym $mod+Shift+E exec i3-exit.sh logout
bindsym $mod+Mod1+s exec i3-exit.sh suspend
bindsym $mod+Shift+p exec passmenu
@ -252,23 +251,24 @@ exec --no-startup-id volti
exec --no-startup-id clipit
exec --no-startup-id syndaemon -i 0.5 -d
exec --no-startup-id synapse -s
#exec xautolock -time 10 -locker 'i3lock -t -c 000000 -i ~/Pictures/Wallpapers/Game\ Over\ Hacker.png' &
exec xautolock -time 10 -corners "----" -locker 'i3lock -t -c 000000 -i ~/Pictures/Wallpapers/Game\ Over\ Hacker.png' &
#exec --no-startup-id xautolock -corners '----' -time 10 -locker 'dm-tool lock' # lightdm
exec urxvt -name tmux -e tmux attach
#set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
#mode "$mode_system" {
#bindsym l exec --no-startup-id i3exit lock, mode "default"
#bindsym e exec --no-startup-id i3exit logout, mode "default"e
#bindsym s exec --no-startup-id i3exit suspend, mode "default"
#bindsym h exec --no-startup-id i3exit hibernate, mode "default"
#bindsym r exec --no-startup-id i3exit reboot, mode "default"
#bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default"
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id i3-exit.sh lock, mode "default"
bindsym e exec --no-startup-id i3-exit.sh logout #, mode "default"
bindsym s exec --no-startup-id i3-exit.sh suspend #, mode "default"
bindsym h exec --no-startup-id i3-exit.sh hibernate, mode "default"
bindsym r exec --no-startup-id i3-exit.sh reboot, mode "default"
bindsym Shift+s exec --no-startup-id i3-exit.sh shutdown, mode "default"
## back to normal: Enter or Escape
#bindsym Return mode "default"
#bindsym Escape mode "default"
#}
#bindsym $mod+Pause mode "$mode_system"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Delete mode "$mode_system"
exec --no-startup-id nitrogen --restore &
exec --no-startup-id xfce4-power-manager
#exec --no-startup-id compton -b --config ~/.compton.conf

4
zshrc
View File

@ -46,8 +46,8 @@ source $ZSH/oh-my-zsh.sh
# Customize to your needs...
autoload -U zmv
alias mmv='noglob zmv -W'
alias e='emacsclient --alternate-editor="" -nw -c'
alias ew='emacsclient --alternate-editor="" -c'
alias e='myemacs -nw'
alias ew='myemacs'
export ALTERNATE_EDITOR=/usr/bin/emacs EDITOR="emacsclient -nw" VISUAL=emacsclient
PYTHONSTARTUP=~/.pythonrc.py