changeset 26:5d2492e352cc laptop

define ht-custom-size
author ht
date Wed, 22 Nov 2017 15:25:19 +0000
parents 0e4eb9db8a93
children 803e4156c7a0
files pers-init.el
diffstat 1 files changed, 33 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/pers-init.el	Thu Oct 22 14:28:54 2015 +0100
+++ b/pers-init.el	Wed Nov 22 15:25:19 2017 +0000
@@ -415,28 +415,37 @@
 (cd (if (fboundp 'user-home-directory)
 	(user-home-directory)
       (getenv "HOME")))
-(site-caseq (laptop
-	     (if (fboundp 'device-pixel-width)
-		 (let ((pw (device-pixel-width (selected-device))))
-		   (cond ((= pw 1680)
-			  ;; we're on a big external monitor
-			  (set-frame-pixel-size (selected-frame) 900 960)
-			  (set-frame-position (selected-frame) -3 -20))
-			 ((= (device-pixel-height (selected-device)) 768)
-			  ;; we're on a narrow cinema-ratio laptop
-			  (set-frame-pixel-size (selected-frame) 690 710)
-			  (set-frame-position (selected-frame) -5 -26))
-			 ((= (device-pixel-height (selected-device)) 900)
-			  ;; we're on a cinema-ratio laptop
-			  (set-frame-pixel-size (selected-frame) 800 820)
-			  (set-frame-position (selected-frame) -3 -20))
-			 ((= pw 1600)
-			  ;; we're on a big external monitor
-			  (set-frame-pixel-size (selected-frame) 900 1120)
-			  (set-frame-position (selected-frame) -3 -20))
-			 ((= pw 1280)
-			  (set-frame-pixel-size (selected-frame) 700 960)
-			  (set-frame-position (selected-frame) -3 -20)))))))
+(defun ht-custom-size ()
+  (interactive)
+  (site-caseq (laptop
+	       (message (format "pw: %s" (device-pixel-width (selected-device))))
+	       (if (fboundp 'device-pixel-width)
+		   (let ((pw (device-pixel-width (selected-device))))
+		     (cond ((>= pw 1680)
+			    ;; we're on a big external monitor
+			    (set-frame-pixel-size (selected-frame) 900 960)
+			    (set-frame-position (selected-frame) -3 -20)
+			   ((= (device-pixel-height (selected-device)) 768)
+			    ;; we're on a narrow cinema-ratio laptop
+			    (set-frame-pixel-size (selected-frame) 690 710)
+			    (set-frame-position (selected-frame) -5 -26))
+			   ((= (device-pixel-height (selected-device)) 900)
+			    ;; we're on a cinema-ratio laptop
+			    (set-frame-pixel-size (selected-frame) 800 820)
+			    (set-frame-position (selected-frame) -3 -20))
+			   ((= pw 1600)
+			    ;; we're on a big external monitor
+			    (set-frame-pixel-size (selected-frame) 900 1120)
+			    (set-frame-position (selected-frame) -3 -20))
+			   ((= pw 1280)
+			    (cond ((eq (device-pixel-height) 720)
+				   (set-frame-pixel-size (selected-frame) 700 655)
+				   (set-frame-position (selected-frame) -3 -30))
+				  (t
+				   (set-frame-pixel-size (selected-frame) 700 960)
+				   (set-frame-position (selected-frame) -3 -20))))))))))
+
+(ht-custom-size)
 
 ;;; make dired list directories first
 (defadvice dired-insert-directory (before my-dired-insert-directory
@@ -523,3 +532,5 @@
 		    ("1.5.0" . "/c/Program Files/j2sdk1.5.0"))
  fill-indent-according-to-mode t
  )
+(message (format "fh: %s" (frame-pixel-height (selected-frame))))
+