Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.70 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. now=$(date +"%T")
  4. notify-send "Reloading $now"
  5.  
  6. EDITOR=/usr/bin/subl
  7. FILEMANAGER=/usr/bin/thunar
  8.  
  9. # reset keyboard settings
  10. setxkbmap
  11.  
  12. # Free up the mod3 flag from all keys it may be associated with:
  13. xmodmap -e "clear mod3"
  14. xmodmap -e "clear mod4"
  15.  
  16. # Add Hyper_L to the grave key (the ` and ~ upper left, left of 1)
  17. xmodmap -e "keycode 49 = Hyper_L asciitilde grave asciitilde"
  18.  
  19. # You need a grave key somewhere else (!!!) so, bind it to a non-existing key like 250:
  20. xmodmap -e "keycode 250 = grave"
  21.  
  22. # Restore Mod4 but without Hyper_L (which was at location 4)
  23. xmodmap -e "add mod4 = Super_L Super_R Super_L"
  24.  
  25. # This does generate an error, but it works for me now:
  26. xmodmap -e "add mod3 = Hyper_L"
  27.  
  28. #Reload self:
  29. me=$(readlink -e -- "$0")
  30. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>1    -s "$me" --create -t string
  31.  
  32. # Edit self
  33. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>equal    -s "$EDITOR $me" --create -t string
  34.  
  35. dist=100 # Move fast
  36. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>Right -s "xdotool mousemove_relative -- $dist 0" --create -t string
  37. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>Down  -s "xdotool mousemove_relative -- 0 $dist" --create -t string
  38. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>Left  -s "xdotool mousemove_relative -- -$dist 0" --create -t string
  39. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>Up    -s "xdotool mousemove_relative -- 0 -$dist" --create -t string
  40.  
  41. altdist=1 # Move slow
  42. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Alt\>\<Hyper\>Right -s "xdotool mousemove_relative -- $altdist 0" --create -t string
  43. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Alt\>\<Hyper\>Down  -s "xdotool mousemove_relative -- 0 $altdist" --create -t string
  44. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Alt\>\<Hyper\>Left  -s "xdotool mousemove_relative -- -$altdist 0" --create -t string
  45. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Alt\>\<Hyper\>Up    -s "xdotool mousemove_relative -- 0 -$altdist" --create -t string
  46.  
  47. # Click mouse:
  48. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>space -s "xdotool click 1" --create -t string
  49.  
  50. # Audacious/Music:
  51. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>KP_Multiply -s "/usr/bin/audacious -t" --create -t string
  52. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>KP_Divide -s "xdotool key --window \"$(xdotool search --class audacious | tail -1)\" Left" --create -t string
  53. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>KP_Subtract -s "xdotool key --window \"$(xdotool search --class audacious | tail -1)\" Right" --create -t string
  54.  
  55. # Open shortcut menu:
  56. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>k -s "xfce4-keyboard-settings" --create -t string
  57.  
  58. # Random Album
  59. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Primary\>\<Shift\>F9 -s "$HOME/scripts/random_album.sh" --create -t string
  60.  
  61. # Open locations:
  62. /usr/bin/xfconf-query -c xfce4-keyboard-shortcuts -p /commands/custom/\<Hyper\>F5 -s "$FILEMANAGER $HOME/Music" --create -t string
  63.  
  64. ### echo close all xfconfd
  65. # killall -v xfconfd
  66. # echo starting xfconfd to background
  67. # /usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd &
  68.  
  69. ## starting xcape to produce a grave after keypress
  70. killall xcape
  71. xcape -t5000 -e "#49=grave;Super_L=Control_L|Escape" &
  72.  
  73. now=$(date +"%T")
  74. notify-send "Reload $now"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement