added wrapper around yadm, changed to /usr/bin/env fish
This commit is contained in:
		
							parent
							
								
									317eca7eb1
								
							
						
					
					
						commit
						e05888f731
					
				@ -50,7 +50,6 @@ bindsym $alt+F4                   kill
 | 
				
			|||||||
# program launcher
 | 
					# program launcher
 | 
				
			||||||
bindsym $mod+Shift+d              exec --no-startup-id j4-dmenu-desktop
 | 
					bindsym $mod+Shift+d              exec --no-startup-id j4-dmenu-desktop
 | 
				
			||||||
bindsym $mod+d                    exec --no-startup-id $rofiexec
 | 
					bindsym $mod+d                    exec --no-startup-id $rofiexec
 | 
				
			||||||
bindsym $mod+w                    exec --no-startup-id rofi-wifi-menu
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# change focus
 | 
					# change focus
 | 
				
			||||||
bindsym $mod+$left                focus left
 | 
					bindsym $mod+$left                focus left
 | 
				
			||||||
@ -126,9 +125,9 @@ workspace 10                      output eDP-1
 | 
				
			|||||||
{% endif -%}
 | 
					{% endif -%}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# reload the configuration file
 | 
					# reload the configuration file
 | 
				
			||||||
bindsym $mod+Shift+c              reload
 | 
					bindsym $mod+Shift+c              exec yadm alt && i3-msg reload
 | 
				
			||||||
# restart i3 inplace
 | 
					# restart i3 inplace
 | 
				
			||||||
bindsym $mod+Shift+r              restart
 | 
					bindsym $mod+Shift+r              exec yadm alt && i3-msg restart
 | 
				
			||||||
# exit i3
 | 
					# exit i3
 | 
				
			||||||
bindsym $mod+Shift+e              exec $exiti3
 | 
					bindsym $mod+Shift+e              exec $exiti3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -185,7 +184,7 @@ bindsym $mod+$alt+c               exec speedcrunch
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bindsym $mod+F3                   exec arandr
 | 
					bindsym $mod+F3                   exec arandr
 | 
				
			||||||
bindsym $mod+Shift+l              exec dmenu-lpass
 | 
					bindsym $mod+Shift+l              exec dmenu-lpass
 | 
				
			||||||
bindsym $mod+Shift+p              exec ~/.config/polybar/launch.sh
 | 
					bindsym $mod+Shift+p              exec polybar-launch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Brightness keyboard shortcuts
 | 
					# Brightness keyboard shortcuts
 | 
				
			||||||
bindsym XF86MonBrightnessUp       exec "light -A 5"
 | 
					bindsym XF86MonBrightnessUp       exec "light -A 5"
 | 
				
			||||||
@ -215,6 +214,7 @@ bindsym $mod+Shift+h              exec $term htop
 | 
				
			|||||||
bindsym $mod+Ctrl+m               exec rofi-mount
 | 
					bindsym $mod+Ctrl+m               exec rofi-mount
 | 
				
			||||||
bindsym $mod+Ctrl+u               exec rofi-dumount
 | 
					bindsym $mod+Ctrl+u               exec rofi-dumount
 | 
				
			||||||
bindsym $mod+$alt+e               exec rofi-emoji
 | 
					bindsym $mod+$alt+e               exec rofi-emoji
 | 
				
			||||||
 | 
					bindsym $mod+w                    exec wacom-setup
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Music shortcuts
 | 
					# Music shortcuts
 | 
				
			||||||
bindsym $alt+XF86AudioRaiseVolume exec mpc next
 | 
					bindsym $alt+XF86AudioRaiseVolume exec mpc next
 | 
				
			||||||
@ -267,7 +267,7 @@ exec        --no-startup-id       compton -F --opengl --config ~/.config/compton
 | 
				
			|||||||
exec        --no-startup-id       /usr/lib/mate-polkit/polkit-mate-authentication-agent-1
 | 
					exec        --no-startup-id       /usr/lib/mate-polkit/polkit-mate-authentication-agent-1
 | 
				
			||||||
{% endif -%}
 | 
					{% endif -%}
 | 
				
			||||||
exec_always --no-startup-id       enable_touch
 | 
					exec_always --no-startup-id       enable_touch
 | 
				
			||||||
exec_always --no-startup-id       ~/.config/polybar/launch.sh
 | 
					exec_always --no-startup-id       polybar-launch
 | 
				
			||||||
exec        --no-startup-id       xss-lock -- i3lock -fol
 | 
					exec        --no-startup-id       xss-lock -- i3lock -fol
 | 
				
			||||||
exec        --no-startup-id       xfce4-power-manager
 | 
					exec        --no-startup-id       xfce4-power-manager
 | 
				
			||||||
exec        --no-startup-id       clight
 | 
					exec        --no-startup-id       clight
 | 
				
			||||||
 | 
				
			|||||||
@ -46,7 +46,8 @@
 | 
				
			|||||||
- [[#askpass][Askpass]]
 | 
					- [[#askpass][Askpass]]
 | 
				
			||||||
- [[#dmenu][Dmenu]]
 | 
					- [[#dmenu][Dmenu]]
 | 
				
			||||||
- [[#emoji-picker][Emoji picker]]
 | 
					- [[#emoji-picker][Emoji picker]]
 | 
				
			||||||
- [[#rofimount][Rofimount]]
 | 
					- [[#polybar-launch][Polybar-launch]]
 | 
				
			||||||
 | 
					- [[#rofi-mount][Rofi-mount]]
 | 
				
			||||||
  - [[#get-the-mountable-elements][Get the mountable elements]]
 | 
					  - [[#get-the-mountable-elements][Get the mountable elements]]
 | 
				
			||||||
  - [[#get-the-drive-to-mount][Get the drive to mount]]
 | 
					  - [[#get-the-drive-to-mount][Get the drive to mount]]
 | 
				
			||||||
  - [[#mount-a-usb-drive-hard-drive-or-partition][Mount a USB drive, hard drive or partition]]
 | 
					  - [[#mount-a-usb-drive-hard-drive-or-partition][Mount a USB drive, hard drive or partition]]
 | 
				
			||||||
@ -54,7 +55,7 @@
 | 
				
			|||||||
  - [[#mount-a-cd-drive][Mount a CD drive]]
 | 
					  - [[#mount-a-cd-drive][Mount a CD drive]]
 | 
				
			||||||
  - [[#ask-what-type-of-drive-we-want-to-mount][Ask what type of drive we want to mount]]
 | 
					  - [[#ask-what-type-of-drive-we-want-to-mount][Ask what type of drive we want to mount]]
 | 
				
			||||||
  - [[#launch-the-mounting-functions][Launch the mounting functions]]
 | 
					  - [[#launch-the-mounting-functions][Launch the mounting functions]]
 | 
				
			||||||
- [[#rofiumount][Rofiumount]]
 | 
					- [[#rofi-umount][Rofi-umount]]
 | 
				
			||||||
  - [[#get-the-unmountable-drives][Get the unmountable drives]]
 | 
					  - [[#get-the-unmountable-drives][Get the unmountable drives]]
 | 
				
			||||||
  - [[#unmount-disk-partitions][Unmount disk partitions]]
 | 
					  - [[#unmount-disk-partitions][Unmount disk partitions]]
 | 
				
			||||||
  - [[#unmount-android-device][Unmount Android device]]
 | 
					  - [[#unmount-android-device][Unmount Android device]]
 | 
				
			||||||
@ -67,6 +68,7 @@
 | 
				
			|||||||
  - [[#select-our-screen][Select our screen]]
 | 
					  - [[#select-our-screen][Select our screen]]
 | 
				
			||||||
  - [[#adjust-the-tablet][Adjust the tablet]]
 | 
					  - [[#adjust-the-tablet][Adjust the tablet]]
 | 
				
			||||||
  - [[#lauch-the-functions][Lauch the functions]]
 | 
					  - [[#lauch-the-functions][Lauch the functions]]
 | 
				
			||||||
 | 
					- [[#yadm][Yadm]]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Presentation
 | 
					* Presentation
 | 
				
			||||||
  :PROPERTIES:
 | 
					  :PROPERTIES:
 | 
				
			||||||
@ -94,7 +96,7 @@
 | 
				
			|||||||
  and with [[https://wiki.archlinux.org/index.php/Rofi][rofi]] support instead of [[https://wiki.archlinux.org/index.php/Dmenu][dmenu]]. As  you can see, this is a oneliner if
 | 
					  and with [[https://wiki.archlinux.org/index.php/Rofi][rofi]] support instead of [[https://wiki.archlinux.org/index.php/Dmenu][dmenu]]. As  you can see, this is a oneliner if
 | 
				
			||||||
  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 :exports code
 | 
					  #+BEGIN_SRC fish :exports code
 | 
				
			||||||
    #!/usr/bin/fish
 | 
					    #!/usr/bin/env fish
 | 
				
			||||||
    rofi -dmenu -font 'DejaVu Sans 10' -password -no-fixed-num-lines \
 | 
					    rofi -dmenu -font 'DejaVu Sans 10' -password -no-fixed-num-lines \
 | 
				
			||||||
    -p (printf $argv[1] | sed s/://)
 | 
					    -p (printf $argv[1] | sed s/://)
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
@ -108,8 +110,8 @@
 | 
				
			|||||||
  emulation  of dmenu,  since I  prefer  rofi’s appearance.  It basically  calls
 | 
					  emulation  of dmenu,  since I  prefer  rofi’s appearance.  It basically  calls
 | 
				
			||||||
  rofi’s dmenu emulation with the arguments initially passed to dmenu.
 | 
					  rofi’s dmenu emulation with the arguments initially passed to dmenu.
 | 
				
			||||||
  #+BEGIN_SRC fish
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
    #!/usr/bin/fish
 | 
					    #!/usr/bin/env fish
 | 
				
			||||||
    /usr/bin/rofi -dmenu $argv
 | 
					    rofi -dmenu $argv
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Emoji picker
 | 
					* Emoji picker
 | 
				
			||||||
@ -121,7 +123,7 @@
 | 
				
			|||||||
  [[file:~/.config/emoji.txt][~/.config/emoji.txt]]  to provide  a small,  local search  for emojis.  Once the
 | 
					  [[file:~/.config/emoji.txt][~/.config/emoji.txt]]  to provide  a small,  local search  for emojis.  Once the
 | 
				
			||||||
  emoji is selected, it is copied to the clipboard using =xclipboard=.
 | 
					  emoji is selected, it is copied to the clipboard using =xclipboard=.
 | 
				
			||||||
  #+BEGIN_SRC fish
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
    #!/usr/bin/fish
 | 
					    #!/usr/bin/env fish
 | 
				
			||||||
    grep -v "#" ~/.config/emoji.txt | rofi -dmenu -i | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard
 | 
					    grep -v "#" ~/.config/emoji.txt | rofi -dmenu -i | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -135,7 +137,49 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  It is inspired from [[https://www.youtube.com/watch?v=UCEXY46t3OA][this video]] from [[https://lukesmith.xyz/][Luke Smith]], rewritten in Fish.
 | 
					  It is inspired from [[https://www.youtube.com/watch?v=UCEXY46t3OA][this video]] from [[https://lukesmith.xyz/][Luke Smith]], rewritten in Fish.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Rofimount
 | 
					* Polybar-launch
 | 
				
			||||||
 | 
					  :PROPERTIES:
 | 
				
			||||||
 | 
					  :CUSTOM_ID: h-68587918-879b-42db-b304-901d01233f95
 | 
				
			||||||
 | 
					  :HEADER-ARGS: :tangle polybar-launch :exports code
 | 
				
			||||||
 | 
					  :END:
 | 
				
			||||||
 | 
					  This scripts  allows the user  to kill polybar and  relaunch it, or  to simply
 | 
				
			||||||
 | 
					  launch it  if polybar  isn’t launched yet.  This script is  a bash  script, so
 | 
				
			||||||
 | 
					  let’s declare its shebang.
 | 
				
			||||||
 | 
					  #+BEGIN_SRC bash
 | 
				
			||||||
 | 
					  #!/usr/bin/env bash
 | 
				
			||||||
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  First thing to do is kill all polybar processes.
 | 
				
			||||||
 | 
					  #+BEGIN_SRC bash
 | 
				
			||||||
 | 
					  killall -q polybar
 | 
				
			||||||
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Now we have to wait untill all polybar processes have been shut down.
 | 
				
			||||||
 | 
					  #+BEGIN_SRC bash
 | 
				
			||||||
 | 
					  while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
 | 
				
			||||||
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Now that  our system isn’t running  polybar anymore, we’ll launch  it again on
 | 
				
			||||||
 | 
					  all of our  screens. By the way, I  have two bars, so I’ll have  to lauch them
 | 
				
			||||||
 | 
					  both.
 | 
				
			||||||
 | 
					  #+BEGIN_SRC bash
 | 
				
			||||||
 | 
					    if type "xrandr"; then
 | 
				
			||||||
 | 
					        for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
 | 
				
			||||||
 | 
					            MONITOR=$m polybar --reload top &
 | 
				
			||||||
 | 
					            MONITOR=$m polybar --reload bottom &
 | 
				
			||||||
 | 
					        done
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        polybar --reload top &
 | 
				
			||||||
 | 
					        polybar --reload bottom &
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  And we’re done! Let’s just launch a notification polybar has been relaunched.
 | 
				
			||||||
 | 
					  #+BEGIN_SRC bash
 | 
				
			||||||
 | 
					    notify-send "Polybar restarted!" -a "polybar-launch"
 | 
				
			||||||
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Rofi-mount
 | 
				
			||||||
  :PROPERTIES:
 | 
					  :PROPERTIES:
 | 
				
			||||||
  :HEADER-ARGS: :tangle rofi-mount :exports code
 | 
					  :HEADER-ARGS: :tangle rofi-mount :exports code
 | 
				
			||||||
  :CUSTOM_ID: h-32ee4a66-e7fb-4abf-a168-fa259efdb1f4
 | 
					  :CUSTOM_ID: h-32ee4a66-e7fb-4abf-a168-fa259efdb1f4
 | 
				
			||||||
@ -146,7 +190,7 @@
 | 
				
			|||||||
  original script.  For the  record, this  is a fish  script. Let’s  declare our
 | 
					  original script.  For the  record, this  is a fish  script. Let’s  declare our
 | 
				
			||||||
  shebang.
 | 
					  shebang.
 | 
				
			||||||
  #+BEGIN_SRC fish
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
  #!/usr/bin/fish
 | 
					  #!/usr/bin/env fish
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
** Get the mountable elements
 | 
					** Get the mountable elements
 | 
				
			||||||
@ -527,7 +571,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
   And with that, this is the end of our script!
 | 
					   And with that, this is the end of our script!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Rofiumount
 | 
					* Rofi-umount
 | 
				
			||||||
  :PROPERTIES:
 | 
					  :PROPERTIES:
 | 
				
			||||||
  :CUSTOM_ID: h-68a1f671-5dc6-4120-81c8-c94fffa7d7a3
 | 
					  :CUSTOM_ID: h-68a1f671-5dc6-4120-81c8-c94fffa7d7a3
 | 
				
			||||||
  :HEADER-ARGS: :tangle rofi-umount :exports code
 | 
					  :HEADER-ARGS: :tangle rofi-umount :exports code
 | 
				
			||||||
@ -535,7 +579,7 @@
 | 
				
			|||||||
  =rofiumount=  is the  counterpart of  =rofimount= for  unmounting our  mounted
 | 
					  =rofiumount=  is the  counterpart of  =rofimount= for  unmounting our  mounted
 | 
				
			||||||
  partitions. It is a fish script, so let’s declare it as that with its shebang.
 | 
					  partitions. It is a fish script, so let’s declare it as that with its shebang.
 | 
				
			||||||
  #+BEGIN_SRC fish
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
  #!/usr/bin/fish
 | 
					  #!/usr/bin/env fish
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
** Get the unmountable drives
 | 
					** Get the unmountable drives
 | 
				
			||||||
@ -773,7 +817,7 @@
 | 
				
			|||||||
  This is a one-liner that allows you to  watch Star Wars episode 4 in ASCII art
 | 
					  This is a one-liner that allows you to  watch Star Wars episode 4 in ASCII art
 | 
				
			||||||
  in your terminal. Here is the code:
 | 
					  in your terminal. Here is the code:
 | 
				
			||||||
  #+BEGIN_SRC fish
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
    #!/usr/bin/fish
 | 
					    #!/usr/bin/env fish
 | 
				
			||||||
    telnet towel.blinkenlights.nl
 | 
					    telnet towel.blinkenlights.nl
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -785,7 +829,7 @@
 | 
				
			|||||||
  I made a small and quick utility to set up my Wacom tablet so it is only bound
 | 
					  I made a small and quick utility to set up my Wacom tablet so it is only bound
 | 
				
			||||||
  to one screen. This is a fish script, so let’s insert the sheband.
 | 
					  to one screen. This is a fish script, so let’s insert the sheband.
 | 
				
			||||||
  #+BEGIN_SRC fish
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
  #!/usr/bin/fish
 | 
					  #!/usr/bin/env fish
 | 
				
			||||||
  #+END_SRC
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
** Set our variables
 | 
					** Set our variables
 | 
				
			||||||
@ -944,3 +988,17 @@
 | 
				
			|||||||
     set_screen
 | 
					     set_screen
 | 
				
			||||||
     adjust_device
 | 
					     adjust_device
 | 
				
			||||||
   #+END_SRC
 | 
					   #+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Yadm
 | 
				
			||||||
 | 
					  :PROPERTIES:
 | 
				
			||||||
 | 
					  :CUSTOM_ID: h-9535957b-7559-4244-a5e0-d056c4770fea
 | 
				
			||||||
 | 
					  :HEADER-ARGS: :tangle yadm :exports code
 | 
				
			||||||
 | 
					  :END:
 | 
				
			||||||
 | 
					  For some  reason, =yadm= won’t stop  making polybar crash. So,  I created this
 | 
				
			||||||
 | 
					  script  that  will  wrap yadm  with  a  call  to  yadm,  and then  a  call  to
 | 
				
			||||||
 | 
					  =polybar-launch= declared  in [[#polybar-launch][Polybar-launch]]. This  is a oneliner, as  you can
 | 
				
			||||||
 | 
					  see below:
 | 
				
			||||||
 | 
					  #+BEGIN_SRC fish
 | 
				
			||||||
 | 
					    #!/usr/bin/env fish
 | 
				
			||||||
 | 
					    /usr/bin/yadm $argv; polybar-launch 2>/dev/null >/dev/null
 | 
				
			||||||
 | 
					  #+END_SRC
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,3 @@
 | 
				
			|||||||
#!/usr/bin/fish
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
rofi -dmenu -font 'DejaVu Sans 10' -password -no-fixed-num-lines \
 | 
					rofi -dmenu -font 'DejaVu Sans 10' -password -no-fixed-num-lines \
 | 
				
			||||||
-p (printf $argv[1] | sed s/://)
 | 
					-p (printf $argv[1] | sed s/://)
 | 
				
			||||||
 | 
				
			|||||||
@ -1,2 +1,2 @@
 | 
				
			|||||||
#!/usr/bin/fish
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
/usr/bin/rofi -dmenu $argv
 | 
					rofi -dmenu $argv
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/fish
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
grep -v "#" ~/.config/emoji.txt | rofi -dmenu -i | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard
 | 
					grep -v "#" ~/.config/emoji.txt | rofi -dmenu -i | awk '{print $1}' | tr -d '\n' | xclip -selection clipboard
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set emoji (xclip -o -selection clipboard | tr -d '\n')
 | 
					set emoji (xclip -o -selection clipboard | tr -d '\n')
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/fish
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
 | 
					
 | 
				
			||||||
begin
 | 
					begin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/fish
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set -g drives (lsblk -nrpo "name,type,size,mountpoint" | \
 | 
					set -g drives (lsblk -nrpo "name,type,size,mountpoint" | \
 | 
				
			||||||
awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
 | 
					awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
 | 
				
			||||||
 | 
				
			|||||||
@ -1,2 +1,2 @@
 | 
				
			|||||||
#!/usr/bin/fish
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
telnet towel.blinkenlights.nl
 | 
					telnet towel.blinkenlights.nl
 | 
				
			||||||
 | 
				
			|||||||
@ -1,63 +1,63 @@
 | 
				
			|||||||
#!/usr/bin/fish
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function set_device
 | 
					function set_device
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set -g DEVICE "Wacom USB Bamboo PAD Pen stylus"
 | 
					set -g DEVICE "Wacom USB Bamboo PAD Pen stylus"
 | 
				
			||||||
    set -g DEVICETOUCH "Wacom USB Bamboo PAD Finger touch"
 | 
					set -g DEVICETOUCH "Wacom USB Bamboo PAD Finger touch"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set -g WACOMPROPTOUCHSPEED "Device Accel Velocity Scaling"
 | 
					set -g WACOMPROPTOUCHSPEED "Device Accel Velocity Scaling"
 | 
				
			||||||
    set -g WACOMPROPSCROLLPSEED "ScrollDistance"
 | 
					set -g WACOMPROPSCROLLPSEED "ScrollDistance"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xsetwacom set "$DEVICE" ResetArea
 | 
					xsetwacom set "$DEVICE" ResetArea
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set -l AREATOT (xsetwacom get "$DEVICE" Area)
 | 
					set -l AREATOT (xsetwacom get "$DEVICE" Area)
 | 
				
			||||||
    set -g AREAX (echo $AREATOT | awk '{print $3}')
 | 
					set -g AREAX (echo $AREATOT | awk '{print $3}')
 | 
				
			||||||
    set -g AREAY (echo $AREATOT | awk '{print $4}')
 | 
					set -g AREAY (echo $AREATOT | awk '{print $4}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function set_screen
 | 
					function set_screen
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set CONNECTED_DISPLAYS (xrandr -q --current | \
 | 
					set CONNECTED_DISPLAYS (xrandr -q --current | \
 | 
				
			||||||
    sed -n 's/^\([^ ]\+\) connected .*/\1/p') desktop
 | 
					sed -n 's/^\([^ ]\+\) connected .*/\1/p') desktop
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set -g SCREEN (for d in $CONNECTED_DISPLAYS
 | 
					set -g SCREEN (for d in $CONNECTED_DISPLAYS
 | 
				
			||||||
    echo $d
 | 
					    echo $d
 | 
				
			||||||
    end | rofi -dmenu -i -p "Select your dispaly" | tr -d '\n')
 | 
					end | rofi -dmenu -i -p "Select your dispaly" | tr -d '\n')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set -l LINE (xrandr -q --current | if [ "$SCREEN" = "desktop" ]
 | 
					set -l LINE (xrandr -q --current | if [ "$SCREEN" = "desktop" ]
 | 
				
			||||||
    sed -n 's/^Screen 0:.*, current \([0-9]\+\) x \([0-9]\+\),.*/\1 \2/p'
 | 
					    sed -n 's/^Screen 0:.*, current \([0-9]\+\) x \([0-9]\+\),.*/\1 \2/p'
 | 
				
			||||||
    else
 | 
					else
 | 
				
			||||||
    sed -n "s/^$SCREEN"' connected \(primary \)\{0,1\}\([0-9]\+\)x\([0-9]\+\)+.*/\2 \3/p'
 | 
					    sed -n "s/^$SCREEN"' connected \(primary \)\{0,1\}\([0-9]\+\)x\([0-9]\+\)+.*/\2 \3/p'
 | 
				
			||||||
    end)
 | 
					end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    echo $LINE | read -g WIDTH HEIGHT
 | 
					echo $LINE | read -g WIDTH HEIGHT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if test -z $WIDTH || test -z $HEIGHT
 | 
					if test -z $WIDTH || test -z $HEIGHT
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
    end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function adjust_device
 | 
					function adjust_device
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set RATIOAREAY (math ceil \($AREAX \* $HEIGHT \/ $WIDTH\))
 | 
					set RATIOAREAY (math ceil \($AREAX \* $HEIGHT \/ $WIDTH\))
 | 
				
			||||||
    set RATIOAREAX (math ceil \($AREAY \* $WIDTH \/ $HEIGHT\))
 | 
					set RATIOAREAX (math ceil \($AREAY \* $WIDTH \/ $HEIGHT\))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if test $AREAY -gt $RATIOAREAY
 | 
					if test $AREAY -gt $RATIOAREAY
 | 
				
			||||||
    set -g NEWAREAX $AREAX
 | 
					    set -g NEWAREAX $AREAX
 | 
				
			||||||
    set -g NEWAREAY $RATIOAREAY
 | 
					    set -g NEWAREAY $RATIOAREAY
 | 
				
			||||||
    else
 | 
					else
 | 
				
			||||||
    set -g NEWAREAX $RATIOAREAX
 | 
					    set -g NEWAREAX $RATIOAREAX
 | 
				
			||||||
    set -g NEWAREAY $AREAY
 | 
					    set -g NEWAREAY $AREAY
 | 
				
			||||||
    end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xsetwacom set "$DEVICE" Area 0 0 $NEWAREAX $NEWAREAY
 | 
					xsetwacom set "$DEVICE" Area 0 0 $NEWAREAX $NEWAREAY
 | 
				
			||||||
    xsetwacom set "$DEVICE" MapToOutput "$SCREEN"
 | 
					xsetwacom set "$DEVICE" MapToOutput "$SCREEN"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xinput set-float-prop $DEVICETOUCH $WACOMPROPTOUCHSPEED 0.5
 | 
					xinput set-float-prop $DEVICETOUCH $WACOMPROPTOUCHSPEED 0.5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xsetwacom set $DEVICETOUCH $WACOMPROPSCROLLPSEED "90"
 | 
					xsetwacom set $DEVICETOUCH $WACOMPROPSCROLLPSEED "90"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								.local/bin/yadm
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										2
									
								
								.local/bin/yadm
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env fish
 | 
				
			||||||
 | 
					/usr/bin/yadm $argv; polybar-launch 2>/dev/null >/dev/null
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user