summaryrefslogtreecommitdiff
path: root/.exwm.el
blob: 92243e6914e3421bb572ea47ee2263a43e63667a (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
;;; My EΧWM configuration
;; This files loads before .emacs/init.el when used with
;; GNU Guix emacs-desktop-environment

(defun apollo/exwm-init-hook ()
  "Do this upon start."
  (if (string= (system-name) "fsociety") ;; Check if it's my desktop, otherwise display battery
      (display-battery-mode 0)
    (display-battery-mode 1))

  (setq display-time-day-and-date t)
  (display-time-mode 1)
  
  (exwm-firefox-holyK-mode 1)

  ;;Launch apps that will run in the background
  ;;  (apollo/run-in-background "blueman-applet")
  (apollo/run-in-background "picom")
  ;;  (apollo/run-in-background "nm-applet")
  (apollo/emacs-keys)
  (apollo/restore-wallpaper)
  )

(defun apollo/exwm-update-class ()
  (exwm-workspace-rename-buffer exwm-class-name))


(setq exwm-workspace-number 6)
;; When window "class" updates, use it to set the buffer name
(add-hook 'exwm-update-class-hook #'apollo/exwm-update-class)

;;When EXWM starts up, run this hook
(add-hook 'exwm-init-hook #'apollo/exwm-init-hook)
(start-process-shell-command
 "xrandr" nil "xrandr --output DisplayPort-0 --primary --mode 2560x1440 --pos 1930x0 --rotate normal --output DisplayPort-1 --off --output DisplayPort-2 --off --output HDMI-A-0 --mode 1920x1080 --pos 0x0 --rotate normal")

;; Set the screen resolution

(require 'exwm-randr)
(setq exwm-randr-workspace-monitor-plist '(0 "DP-1" 2 "HDMI-A-0"))
(add-hook 'exwm-randr-screen-change-hook
          (lambda ()
            (start-process-shell-command
	     "xrandr" nil "xrandr --output DisplayPort-2 --primary --mode 2560x1440 --pos 1920x0 --rotate normal --output HDMI-A-0 --mode 1920x1080 --pos 0x0 --rotate normal" )))
(exwm-randr-enable)


;; Load the system tray before exwm-init
(require 'exwm-systemtray)
(exwm-systemtray-enable)

;; These keys should always pass through to Emacs
(setq exwm-input-prefix-keys
      '(?\C-x
	?\C-u
	?\C-h
	?\C-w
	?\M-x
	?\M-`
	?\M-&
	?\M-:
	?\s-d
	?\C-\M-j  ;; Buffer list
	?\C-\
	?\C-k
	?\C-y
	?\C-n
	?\C-p
	?\C-f
	?\C-b
	?\C-s
	?\M-f
	?\M-b
	?\M-<
	?\M->))

;; Ctrl+Q will enable the next key to be sent directly
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)

;; Set up global key bindings.  These always work, no matter the input state!
;; Keep in mind that changing this list after EXWM initializes has no effect.
(setq exwm-input-global-keys
      `(

        ([?\s-r] . exwm-reset)



        ;; ;; Launch applications via shell command
        ;; ([?\s-&] . (lambda (command)
        ;;              (interactive (list (read-shell-command "$ ")))
        ;;              (start-process-shell-command command nil command)))

        ;; Switch workspace
        ([?\s-e] . exwm-workspace-switch)
        ([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0)))
        ([?\s-2] . (lambda () (interactive) (exwm-workspace-switch-create 1)))
        ([?\s-3] . (lambda () (interactive) (exwm-workspace-switch-create 2)))
        ([?\s-4] . (lambda () (interactive) (exwm-workspace-switch-create 3)))
        ([?\s-5] . (lambda () (interactive) (exwm-workspace-switch-create 4)))

        ,@(mapcar (lambda (i)
                    `(,(kbd (format "s-%d" i)) .
                      (lambda ()
                        (interactive)
                        (exwm-workspace-switch-create ,i))))
                  (number-sequence 0 9))))

(defun exwm-enlarge-horizontally-50 ()
  (interactive)
  (exwm-layout-enlarge-window-horizontally 50))

(defun exwm-shrink-horizontally-50 ()
  "Shrink window horizontally by 10"
  (interactive)
  (exwm-layout-shrink-window-horizontally 50))

(defun exwm-shrink-vertically-50 ()
  "Shrink window by 50."
  (interactive)
  (exwm-layout-shrink-window 50))

(defun exwm-enlarge-vertically-50 ()
  "Enlarge window by 50."
  (interactive)
  (exwm-layout-enlarge-window 50))

(exwm-input-set-key (kbd "C-c d") 'dmenu)
(exwm-input-set-key (kbd "s-<tab>") 'rofi)
(exwm-input-set-key (kbd "s-Q") 'kill-emacs)
(exwm-input-set-key (kbd "<XF86AudioRaiseVolume>") 'apollo/volume-increase)
(exwm-input-set-key (kbd "<XF86AudioLowerVolume>") 'apollo/volume-decrease)
(exwm-input-set-key (kbd "s-0") 'apollo/emacs-keys)
(exwm-input-set-key (kbd "s-9") 'apollo/greek-keyboard)
(exwm-input-set-key (kbd "C-c C-<left>") 'exwm-shrink-horizontally-50)
(exwm-input-set-key (kbd "C-c C-<right>") 'exwm-enlarge-horizontally-50)
(exwm-input-set-key (kbd "C-c C-<up>") 'exwm-shrink-vertically-50)
(exwm-input-set-key (kbd "C-c C-<down>") 'exwm-enlarge-vertically-50)
(exwm-input-set-key (kbd "C-c C-e") 'exwm-layout-toggle-fullscreen)


(exwm-enable)

;;Transparency
(set-frame-parameter (selected-frame) 'alpha '(90 90))
(add-to-list 'default-frame-alist '(alpha 90 90))