Added set-screens, simplified some lines
Simplified lines for askpass and rofi-pass. Added set-screens for automatic external screen setup.
This commit is contained in:
parent
880c3518ab
commit
9bacfc1eaa
@ -1,12 +1,12 @@
|
|||||||
#+TITLE: Phundrak’s executable scripts
|
#+TITLE: Phundrak’s executable scripts
|
||||||
#+INCLUDE: ~/org/config-website/headers.org
|
#+INCLUDE: headers.org
|
||||||
#+OPTIONS: auto-id:t
|
#+OPTIONS: auto-id:t
|
||||||
#+HTML_HEAD_EXTRA: <meta name="description" content="Phundrak's i3 config" />
|
#+HTML_HEAD_EXTRA: <meta name="description" content="Phundrak's i3 config" />
|
||||||
#+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundrak's i3 config" />
|
#+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundrak's i3 config" />
|
||||||
#+HTML_HEAD_EXTRA: <meta property="og:description" content="Description of the i3 config file of Phundrak" />
|
#+HTML_HEAD_EXTRA: <meta property="og:description" content="Description of the i3 config file of Phundrak" />
|
||||||
#+PROPERTY: header-args :exports code
|
#+PROPERTY: header-args :exports code
|
||||||
|
|
||||||
* Table of Contents :TOC_4_gh:noexport:
|
* Table of Contents :TOC:noexport:
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: h-400070eb-725f-4416-a4c6-da3053df750b
|
:CUSTOM_ID: h-400070eb-725f-4416-a4c6-da3053df750b
|
||||||
:END:
|
:END:
|
||||||
@ -39,6 +39,7 @@
|
|||||||
- [[#unmount-cd-drive][Unmount CD drive]]
|
- [[#unmount-cd-drive][Unmount CD drive]]
|
||||||
- [[#ask-what-type-of-drive-to-unmount][Ask what type of drive to unmount]]
|
- [[#ask-what-type-of-drive-to-unmount][Ask what type of drive to unmount]]
|
||||||
- [[#launch-the-unmounting-functions][Launch the unmounting functions]]
|
- [[#launch-the-unmounting-functions][Launch the unmounting functions]]
|
||||||
|
- [[#set-screens][set-screens]]
|
||||||
- [[#starwars][Starwars]]
|
- [[#starwars][Starwars]]
|
||||||
- [[#updateflutter][UpdateFlutter]]
|
- [[#updateflutter][UpdateFlutter]]
|
||||||
- [[#wacom-setup][Wacom setup]]
|
- [[#wacom-setup][Wacom setup]]
|
||||||
@ -145,8 +146,7 @@
|
|||||||
we ignore the initial shebang. This executable is pointed at by the
|
we ignore the initial shebang. This executable is pointed at by the
|
||||||
#+BEGIN_SRC fish
|
#+BEGIN_SRC fish
|
||||||
#!/usr/bin/env fish
|
#!/usr/bin/env fish
|
||||||
rofi -dmenu -font 'DejaVu Sans 10' -password -no-fixed-num-lines \
|
rofi -dmenu -password -no-fixed-num-lines -p (printf $argv[1] | sed s/://)
|
||||||
-p (printf $argv[1] | sed s/://)
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Backup
|
* Backup
|
||||||
@ -805,11 +805,7 @@
|
|||||||
#+BEGIN_SRC fish
|
#+BEGIN_SRC fish
|
||||||
for arg in $argv
|
for arg in $argv
|
||||||
switch $arg
|
switch $arg
|
||||||
case '--type'
|
case '--type' '-t' 'type'
|
||||||
set -g TYPE "yes"
|
|
||||||
case '-t'
|
|
||||||
set -g TYPE "yes"
|
|
||||||
case 'type'
|
|
||||||
set -g TYPE "yes"
|
set -g TYPE "yes"
|
||||||
case '*'
|
case '*'
|
||||||
printf 'Unknown argument: %s\n.' $arg
|
printf 'Unknown argument: %s\n.' $arg
|
||||||
@ -1109,6 +1105,41 @@
|
|||||||
rm -f $undrivefile
|
rm -f $undrivefile
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
* set-screens
|
||||||
|
:PROPERTIES:
|
||||||
|
:HEADER-ARGS: :tangle ~/.local/bin/set-screens
|
||||||
|
:CUSTOM_ID: h-74ec5080-51f4-408f-a65c-6e1f5e8e8163
|
||||||
|
:END:
|
||||||
|
~set-screens~ is a small script that allows the user to automatically set up
|
||||||
|
an external monitor
|
||||||
|
#+BEGIN_SRC fish
|
||||||
|
#!/usr/bin/env fish
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
First, let’s set some variables so we don’t have to type in hidden places some
|
||||||
|
values that should be easily modifiable.
|
||||||
|
#+BEGIN_SRC fish
|
||||||
|
set internal "eDP1"
|
||||||
|
set external "HDMI1"
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Now, let’s set the ~DETECTEDSCREEN~ variable with a simple ~grep~. If the
|
||||||
|
variable turns out to be empty, this means the display was not detected.
|
||||||
|
However, if it’s not, then it will be an array with its second value that
|
||||||
|
holds the maximum resolution the display can handle. It needs to be passed
|
||||||
|
through ~awk~ in order to get only the resolution itself and not the refresh
|
||||||
|
rate, but once we’ve got that, we can set our external monitor as the main
|
||||||
|
monitor with its maximum resolution. i3 is also restarted in order to properly
|
||||||
|
display the wallpaper and Polybar on the new screen.
|
||||||
|
#+BEGIN_SRC fish
|
||||||
|
set externaldisplay (xrandr -q --current | grep -A 1 -i "$external connected")
|
||||||
|
if test -n "$externaldisplay"
|
||||||
|
set resolution (echo $externaldisplay[2] | awk '{$1=$1;print $1}')
|
||||||
|
xrandr --output "$external" --primary --auto --mode "$resolution" --right-of "$internal"
|
||||||
|
i3-msg restart
|
||||||
|
end
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
* Starwars
|
* Starwars
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: h-127de2b2-d84b-4508-89d2-b4577e8dbece
|
:CUSTOM_ID: h-127de2b2-d84b-4508-89d2-b4577e8dbece
|
||||||
|
Loading…
Reference in New Issue
Block a user