62 Commits

Author SHA1 Message Date
6f8b418e80 Fixed a typo in the cancel button for daily reminders. 2023-10-01 14:49:15 -04:00
239d110f58 Create ~/.reminders if remind is detected, this should hopefully prevent the daemon not running error that happens with new users. 2023-10-01 14:45:31 -04:00
b24c0fad91 Try to parse reminders for url, if found and xclip is installed, place the url in the clipboard and notify the reminder without the url. Much nicker for speech. 2023-10-01 02:17:38 -04:00
00a89467fd Set the expire time on notifications so hopefully max notifications exceeded error doesn't happen any more. 2023-09-28 18:00:49 -04:00
9c3cadd7dc Do not bind f to file browser in Ratpoison Mode if no file browser was found. 2023-09-28 09:45:10 -04:00
43bec02a2c Updated reminder dialog with better button icons. 2023-09-28 09:31:01 -04:00
a7746d962c Updated readme with GTK2 configuration as well. 2023-09-28 07:20:22 -06:00
0727ff31c3 Fixed README formatting. 2023-09-28 09:13:15 -04:00
482d8ebed2 Hopefully fixed formatting. 2023-09-28 07:02:54 -06:00
df4182b32f Added another small note about GTK sound themes. 2023-09-28 06:59:58 -06:00
ef030f9cd1 Updated readme, explains how to set gtk sound theme. 2023-09-28 06:58:08 -06:00
e484405684 Updated readme to include libcanberra as an optional dependency. 2023-09-28 06:30:25 -06:00
4d5abd5489 Added login sound option, uses canberra-gtk-play if installed, if not doesn't ask. 2023-09-28 06:27:39 -06:00
cff7288c9e Add daily reminder option added. A second option for viewing today's reminders added. It is view only, and does not contain the delete option like view all reminders has. 2023-09-27 01:35:06 -04:00
b1f413660f Fixed up formatting for hours, minutes, and day of month. Properly handle window close events using cancel or escape. Add monthly reminder option. 2023-09-26 21:49:35 -04:00
1a0ad68ad2 Merge branch 'master' of ssh://git.stormux.org/storm/I38 2023-09-26 06:56:27 -06:00
556b8cb7d8 Added a window close sound to the sound script. 2023-09-26 06:38:02 -06:00
563e0277aa View reminder wil now tell you if there are no reminders. 2023-09-26 08:33:15 -04:00
4e00211c02 Reminder notifications now play a sound before they happen, so should be harder to miss. 2023-09-26 08:26:55 -04:00
e61d0394c3 Add Custom reminder option. 2023-09-25 08:54:51 -04:00
af77a60355 Reminder dialog now handles pressing escape to close. 2023-09-24 14:21:27 -04:00
80cb28dc10 Simple reminder management gui added. For now, only simple recurring reminders can be added. I may try to add more options in the future. This was a bit complex, so watch for bugs and make sure your reminders actually work before depending on its reliability. 2023-09-24 13:40:22 -04:00
2968bbe325 Forgot to remove the background from the remind command. It's handled by the i3 config. 2023-09-22 00:50:52 -04:00
15bf470616 Started work on adding reminders. 2023-09-19 21:45:00 -04:00
19d201ecf4 Experimental multiple keyboard support added. 2023-08-31 01:31:51 -04:00
cb7bfb36e8 Add lxpolkit for policy kit authentication. 2023-08-30 16:08:24 -04:00
9c16367299 Email client bound to alt+e in ratpoison mode. 2023-08-29 16:57:06 -04:00
68620696fc Forgot to actually add some of my changes. 2023-08-29 16:23:51 -04:00
43067c0efe Fixed a couple of problems with screen brightness script. 2023-08-29 16:19:43 -04:00
4773bdae87 Screen brightness script added. 2023-08-29 16:14:11 -04:00
ea7450bb8b Fixed a bug when opening a terminal with RP + c. 2023-07-05 20:43:30 -04:00
50f7bd809a Work on Sway support for the window lister. Unfortunately, most of the window IDs that get returned are "None" so you can't actually select the window, but it does list them now. 2023-06-14 02:05:36 -04:00
1de8cde4cf Updated optional applications list in the README. 2023-06-10 13:21:29 -04:00
7ee783edeb Add ability to have removable storage auto mounted if udiskie is detected. 2023-06-07 00:15:13 -04:00
9c1ac5f7f3 Sound added for custom modes. Default mode sound should only play when switching back to the default mode now. This means we now have ratpoison mode sound, bypassmode sound, default sound for when no mode is being used other than default bindings, and custom, for when you add your on modes in the customizations file. 2023-06-01 15:47:10 -04:00
dca451c996 Workspace switching sound should now work correctly in Sway. 2023-06-01 15:20:52 -04:00
61cdfffc0d Window list should now work for sway. 2023-06-01 15:10:47 -04:00
5851aec8b3 Make the sway option use the sway version of sensible-terminal. 2023-06-01 14:48:52 -04:00
8b30abc8b6 Bypass mode added. In this mode, all keys except the toggle bypass mode key, mod+shift+backspace, will be passed to the application. As far as I know, the toggle key should not conflict with anything. 2023-04-25 19:09:20 -04:00
9efa0b110d this git push brought to you by my inability to type complete words. 2023-04-09 21:48:11 -04:00
c1278a81ee work around for Void Linux weirdness. 2023-04-09 21:22:38 -04:00
fa0c32297c Added --no-startup-id to clipster because it fixes a problem for some users. 2023-04-07 17:13:31 -04:00
c6f97648c3 Found and fixed a bug in non ratpoison mode. It was creating a shit ton of conflicting keybinds. 2023-04-06 16:10:03 -04:00
ec8aa3c00a Modified prompt for using ratpoison mode to show that it is the recommended configuration. 2023-04-06 15:02:23 -04:00
de95c4284a updated the readme file. 2023-04-06 14:55:47 -04:00
390fc4c114 Fixed a bug in the run dialog. 2023-03-29 18:22:36 -04:00
71cd45f781 More work on the help display. 2023-03-29 00:47:07 -04:00
6702dc357b Added control+g to exit ratpoison mode, so that it is more in line with ratpoison. 2023-03-28 19:56:08 -04:00
a7f22597f1 Fixed a bug in rp mode kill. 2023-03-28 19:43:00 -04:00
530c9e5073 Kill window shortcut added to ratpoison mode as k. Comments should show up now that did not before in the config file. 2023-03-28 18:43:13 -04:00
73d16bde78 Added emacs as an editor choice. 2023-03-28 00:38:57 -04:00
ccbb89e372 Added a help system. It is mod+shift+f1 or in ratpoison mode, ?. I tried to make it more readable, which took some doing, so if something is wrong with it please let me know. 2023-03-27 23:44:42 -04:00
8ce2e7eb32 Updated the README. 2023-03-24 18:40:46 -04:00
0e7125d2fc Replacement for grun, added custom I38 run dialog instead. 2023-03-24 18:40:01 -04:00
5671b31715 Replacement for grun, added custom I38 run dialog instead. 2023-03-24 18:34:09 -04:00
a28cbc59ff Replacement for grun, added custom I38 run dialog instead. 2023-03-24 18:21:55 -04:00
ce5f632bfc Fixed a bug where i3's mod key was being automatically set to super if a ratpoison mode key was not selected. 2023-03-24 17:29:18 -04:00
2953ecd157 Added dex to package list. It's an optional alternative for automatically launching applications when i3 starts. 2023-03-19 17:25:25 -04:00
64cffc7fc7 Added i3-wm to dependency list because it's surprisingly easy to forget to install it. 2023-03-04 17:37:21 -05:00
e0ac69b66e Updated ocrdesktop to use -b for faster recognission.
Added mod+r in ratpoison layer for those who don't have a prinnt key.
2023-02-05 09:36:56 -07:00
689b997dae Added keybinding to ratpoison mode to launch a terminal. 2023-01-23 12:34:58 -05:00
1a0daf36a8 Ever had an old discman? I certainly did. Now music related keys apart from music volume beep, just like that discman you had back in the late 90s and early 2000s! 2022-12-23 05:27:33 -07:00
10 changed files with 800 additions and 92 deletions

View File

@ -6,6 +6,7 @@ Accessibility setup script for the i3 window manager.
Released under the terms of the WTFPL License: http://www.wtfpl.net
This is a Stormux project: https://stormux.org
## Why the name?
An uppercase I looks like a 1, 3 from i3, and 8 because the song [We Are 138](https://www.youtube.com/watch?v=-n2Mkdw4q44) rocks!
@ -13,23 +14,59 @@ An uppercase I looks like a 1, 3 from i3, and 8 because the song [We Are 138](ht
## Requirements
- i3-wm: The i3 window manager.
- acpi: [optional] for battery status. It will still work even without this package, but uses it if it is installed.
- dex: [optional] Alternative method for auto starting applications.
- clipster: clipboard manager
- grun: Run application dialog
- jq: for getting the current workspace
- libcanberra: [optional]To play the desktop login sound.
- libnotify: For sending notifications
- lxsession: For policykit authentication agent.
- notification-daemon: To handle notifications
- ocrdesktop: For getting contents of the current window with OCR.
- pamixer: for the mute-unmute script
- playerctl: music controls
- python-i3ipc: for sounds etc.
- remind: [optional]For reminder notifications, Requires notify-daemon and notify-send for automatic reminders.
- sgtk-menu: for applications menu
- sox: for sounds.
- transfersh: [optional] for file sharing GUI
- udiskie: [optional] for automatically mounting removable storage
- xclip: Clipboard support
- xbacklight: [optional] for screen brightness adjustment
- xorg-setxkbmap: [optional] for multiple keyboard layouts
- yad: For screen reader accessible dialogs
I38 will try to detect your browser, file manager, and web browser and present you with a list of options to bind to their launch keys. It will also create bindings for pidgin and mumble if they are installed. To use the bindings, press your ratpoison mode key which is set when you run the i38.sh script. next, press the binding for the application you want, w for web browser, e for text editor, f for file manager, m for mumble, etc. To learn all the bindings, find and read the mode ratpoison section of ~/.config/i3/config.
I38 will try to detect your browser, file manager, and web browser and present you with a list of options to bind to their launch keys. It will also create bindings for pidgin and mumble if they are installed. To use the bindings, press your ratpoison mode key which is set when you run the i38.sh script. next, press the binding for the application you want; w for web browser, e for text editor, f for file manager, m for mumble, etc. To learn all the bindings, find and read the mode ratpoison section of ~/.config/i3/config.
The login sound uses the GTK sound theme. Configure this using GTK configuration files or gsettings. Replace "name" with the name of the theme you want to use.
Note that if you enable all sound events as shown below, you'll also hear GTK sounds when moving around menus, buttons, etc, if the sound theme has sounds for those events.
To configure the theme name with gsettings, do as follows.
gsettings set org.gnome.desktop.sound theme-name name
If you'd like all sound types enabled:
gsettings set org.gnome.desktop.sound input-feedback-sounds true
gsettings set org.gnome.desktop.sound event-sounds true
To configure with a config file, edit or create ~/.config/gtk-3.0/settings.ini
[Settings]
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-sound-theme-name=name
gtk-modules=canberra-gtk-module
You can apply the same configuration to GTK2 appss. Create or edit ~/.gtkrc-2.0
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-sound-theme-name=name
gtk-modules=canberra-gtk-module
## Usage:
@ -38,3 +75,17 @@ I38 will try to detect your browser, file manager, and web browser and present y
- -u: Copy over the latest version of scripts.
- -x: Generate ~/.xinitrc and ~/.xprofile.
- -X: Generate ~/.xprofile only.
## Ratpoison Mode
I38 is an adaptation of the old Strychnine project which was based on the Ratpoison window manager. Ratpoison is a screen like window manager, and the important concept from that, which applies to I38, is adding keyboard shortcuts without conflicting application shortcuts. This is done with an "escape key".
When creating I38, I really wanted to port that functionality over, because it is very powerful and allows for lots and lots of shortcuts while minimizing collisions between shortcuts. So, for example, if you have chosen brave as your web browser, and selected alt+escape as your ratpoison mode key, you can quickly launch brave by pressing alt+escape followed by the letter w.
## I38 Help
To get help for I38, you can press the top level keybinding alt+shift+F1. It is also available by pressing the ratpoison mode key followed by question mark. A limitation of yad, which is used to display the help text means that the cursor starts at the bottom of the text. Please press control+home to jump to the top. You can navigate with the arrow keys, and use control+f to find text within the document.
The help text is a modified version of the configuration file itself that is intended to be easier to read. I have tried to add in comments that should also serve to make things more clear.

301
i38.sh
View File

@ -6,11 +6,12 @@
i3Path="${XDG_CONFIG_HOME:-$HOME/.config}/i3"
i3msg="i3-msg"
sensibleTerminal="i3-sensible-terminal"
# Dialog accessibility
export DIALOGOPTS='--no-lines --visit-items'
# Check to make sure minimum requirements are installed.
for i in dialog grun jq sgtk-menu yad ; do
for i in dialog jq sgtk-menu yad ; do
if ! command -v "$i" &> /dev/null ; then
missing+=("$i")
fi
@ -24,6 +25,105 @@ if [[ -n "${missing}" ]]; then
exit 1
fi
keyboard_menu() {
keyboardMenu=("us" "USA"
"ad" "Andorra"
"af" "Afghanistan"
"ara" "Arabic"
"al" "Albania"
"am" "Armenia"
"az" "Azerbaijan"
"by" "Belarus"
"be" "Belgium"
"bd" "Bangladesh"
"in" "India"
"ba" "Bosnia and Herzegovina"
"br" "Brazil"
"bg" "Bulgaria"
"ma" "Morocco"
"mm" "Myanmar"
"ca" "Canada"
"cd" "Congo, Democratic Republic of the"
"cn" "China"
"hr" "Croatia"
"cz" "Czechia"
"dk" "Denmark"
"nl" "Netherlands"
"bt" "Bhutan"
"ee" "Estonia"
"ir" "Iran"
"iq" "Iraq"
"fo" "Faroe Islands"
"fi" "Finland"
"fr" "France"
"gh" "Ghana"
"gn" "Guinea"
"ge" "Georgia"
"de" "Germany"
"gr" "Greece"
"hu" "Hungary"
"is" "Iceland"
"il" "Israel"
"it" "Italy"
"jp" "Japan"
"kg" "Kyrgyzstan"
"kh" "Cambodia"
"kz" "Kazakhstan"
"la" "Laos"
"latam" "Latin American"
"lt" "Lithuania"
"lv" "Latvia"
"mao" "Maori"
"me" "Montenegro"
"mk" "Macedonia"
"mt" "Malta"
"mn" "Mongolia"
"no" "Norway"
"pl" "Poland"
"pt" "Portugal"
"ro" "Romania"
"ru" "Russia"
"rs" "Serbia"
"si" "Slovenia"
"sk" "Slovakia"
"es" "Spain"
"se" "Sweden"
"ch" "Switzerland"
"sy" "Syria"
"tj" "Tajikistan"
"lk" "Sri Lanka"
"th" "Thailand"
"tr" "Turkey"
"tw" "Taiwan"
"ua" "Ukraine"
"gb" "United Kingdom"
"uz" "Uzbekistan"
"vn" "Vietnam"
"kr" "Korea, Republic of"
"nec_vndr/jp" "Japan (PC-98xx Series)"
"ie" "Ireland"
"pk" "Pakistan"
"mv" "Maldives"
"za" "South Africa"
"epo" "Esperanto"
"np" "Nepal"
"ng" "Nigeria"
"et" "Ethiopia"
"sn" "Senegal"
"brai" "Braille"
"tm" "Turkmenistan"
"ml" "Mali"
"tz" "Tanzania"
)
dialog --title "I38" \
--backtitle "Use the arrow keys to find the option you want, and enter to select it. When you are finished selecting layouts, use right arrow to find \"Done\" and press enter." \
--clear \
--cancel-label "Done" \
--no-tags \
--menu "Select Keyboard Layout" 0 0 0 "${keyboardMenu[@]}" --stdout
return $?
}
menulist() {
# Args: List of items for menu.
# returns: selected tag
@ -37,7 +137,7 @@ menulist() {
--backtitle "Use the arrow keys to find the option you want, and enter to select it." \
--clear \
--no-tags \
--menu "$menuText" 0 0 0 ${menuList[@]} --stdout
--menu "$menuText" 0 0 0 "${menuList[@]}" --stdout
return $?
}
@ -147,6 +247,7 @@ while getopts "${args}" i ; do
s)
i3msg="swaymsg"
i3Path="${XDG_CONFIG_HOME:-$HOME/.config}/sway"
sensibleTerminal="sway --sensible-terminal"
;;
u) update_scripts;;
x) write_xinitrc ;&
@ -155,15 +256,14 @@ while getopts "${args}" i ; do
done
# Configuration questions
export i3Mode=$(yesno "Would you like to use ratpoison mode? This behaves more like strychnine, with an escape key followed by keybindings.")
if [[ $i3Mode -eq 1 ]]; then
mod="Mod4"
fi
export i3Mode=$(yesno "Would you like to use ratpoison mode? This behaves more like strychnine, with an escape key followed by keybindings. (Recommended)")
# Prevent setting ratpoison mode key to the same as default mode key
while [[ "$escapeKey" == "$mod" ]]; do
if [[ $i3Mode -eq 0 ]]; then
escapeKey="$(menulist "Ratpoison mode key:" Control+t Control+z Control+Escape Alt+Escape Control+Space Super)"
escapeKey="${escapeKey//Alt/Mod1}"
escapeKey="${escapeKey//Super/Mod4}"
fi
mod="$(menulist "I3 mod key, for top level bindings:" Alt Control Super)"
mod="${mod//Alt/Mod1}"
mod="${mod//Super/Mod4}"
@ -171,11 +271,35 @@ while [[ "$escapeKey" == "$mod" ]]; do
dialog --title "I38" --msgbox "Ratpoison and mod key cannot be the same key." -1 -1
fi
done
# Multiple keyboard layouts
if [[ $(yesno "Do you want to use multiple keyboard layouts?") -eq 0 ]]; then
unset kbd
while : ; do
kbd+=("$(keyboard_menu)") || break
done
fi
# Volume jump
volumeJump=$(rangebox "How much should pressing the volume keys change the volume?" 1 15 5)
# Email client
unset programList
for i in betterbird evolution thunderbird ; do
if command -v ${i/#-/} &> /dev/null ; then
if [ -n "$programList" ]; then
programList="$programList $i"
else
programList="$i"
fi
fi
done
if [ "$programList" != "${programList// /}" ]; then
emailClient="$(menulist "Email client:" $programList)"
else
emailClient="${programList/#-/}"
fi
emailClient="$(command -v $emailClient)"
# Web browser
unset programList
for i in brave chromium epiphany firefox google-chrome-stable midori seamonkey ; do
for i in brave chromium epiphany firefox google-chrome-stable microsoft-edge microsoft-edge-beta microsoft-edge-dev midori seamonkey ; do
if command -v ${i/#-/} &> /dev/null ; then
if [ -n "$programList" ]; then
programList="$programList $i"
@ -192,7 +316,7 @@ fi
webBrowser="$(command -v $webBrowser)"
# Text editor
unset programList
for i in geany gedit kate kwrite l3afpad leafpad libreoffice mousepad pluma ; do
for i in emacs geany gedit kate kwrite l3afpad leafpad libreoffice mousepad pluma ; do
if hash ${i/#-/} &> /dev/null ; then
if [ -n "$programList" ]; then
programList="$programList $i"
@ -225,6 +349,11 @@ else
fileBrowser="${programList/#-/}"
fi
fileBrowser="$(command -v $fileBrowser)"
# Auto mount removable media
udiskie=1
if command -v udiskie &> /dev/null ; then
export udiskie=$(yesno "Would you like removable drives to automatically mount when plugged in?")
fi
# Auto start with dex
dex=1
if command -v dex &> /dev/null ; then
@ -237,6 +366,11 @@ brlapi=1
brlapi=$(yesno "Do you want to use a braille display with Orca?")
sounds=1
sounds=$(yesno "Do you want window event sounds?")
# Play Login Sound
loginSound=1
if command -v canberra-gtk-play &> /dev/null ; then
export loginSound=$(yesno "Would you like to play the default desktop-login sound according to your GTK sound theme upon login?")
fi
if [[ -d "${i3Path}" ]]; then
yesno "This will replace your existing configuration at ${i3Path}. Do you want to continue?" || exit 0
@ -274,8 +408,11 @@ focus_follows_mouse no
# is used in the bar {} block below.
font pango:monospace 8
# I38 help
bindsym \$mod+Shift+F1 exec ${i3Path}/scripts/i38-help.sh
# Run dialog
bindsym \$mod+F2 exec grun
bindsym \$mod+F2 exec ${i3Path}/scripts/run_dialog.sh
# Clipboard manager
bindsym \$mod+Control+c exec clipster -s
@ -292,15 +429,15 @@ bindsym \$mod+XF86AudioMute exec --no-startup-id ${i3Path}/scripts/mute-unmute.s
# Requires playerctl.
bindsym XF86AudioRaiseVolume exec --no-startup-id ${i3Path}/scripts/music_controler.sh incvol $volumeJump
bindsym XF86AudioLowerVolume exec --no-startup-id ${i3Path}/scripts/music_controler.sh decvol $volumeJump
bindsym XF86AudioPrev exec --no-startup-id ${i3Path}/scripts/music_controler.sh prev
bindsym XF86AudioMute exec --no-startup-id ${i3Path}/scripts/music_controler.sh pause
bindsym XF86AudioPlay exec --no-startup-id ${i3Path}/scripts/music_controler.sh play
bindsym \$mod+XF86AudioPlay exec --no-startup-id ${i3Path}/scripts/music_controler.sh info
bindsym XF86AudioStop exec --no-startup-id ${i3Path}/scripts/music_controler.sh stop
bindsym XF86AudioNext exec --no-startup-id ${i3Path}/scripts/music_controler.sh next
bindsym XF86AudioPrev exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh prev
bindsym XF86AudioMute exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh pause
bindsym XF86AudioPlay exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh play
bindsym \$mod+XF86AudioPlay exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh info
bindsym XF86AudioStop exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh stop
bindsym XF86AudioNext exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh next
# start a terminal
bindsym \$mod+Return exec i3-sensible-terminal
bindsym \$mod+Return exec $sensibleTerminal
# kill focused window
bindsym \$mod+F4 kill
@ -365,29 +502,66 @@ bindsym Control+Shift+F9 move container to workspace number \$ws9, exec spd-say
bindsym Control+Shift+F10 move container to workspace number \$ws10, exec spd-say -P important -Cw "moved to workspace 10"
# A mode that will pass all keys except $mod+shift+backspace to the current application.
# Use $mod+shift+backspace to exit the mode.
bindsym $mod+shift+BackSpace mode "bypass"
mode "bypass" {
# Exit bypass mode.
bindsym $mod+Shift+BackSpace mode "default"
}
EOF
# Multiple keyboard layouts if requested.
if [[ ${#kbd[@]} -gt 1 ]]; then
echo "bindsym Mod4+space exec ${i3Path}/scripts/keyboard.sh cycle ${kbd[@]}" >> ${i3Path}/config
fi
# Create ratpoison mode if requested.
if [[ -n "${escapeKey}" ]]; then
cat << EOF >> ${i3Path}/config
bindsym $escapeKey mode "ratpoison"
mode "ratpoison" {
# I38 help bound to ?
bindsym Shift+slash exec ${i3Path}/scripts/i38-help.sh, mode "default"
# Terminal emulator bound to c
bindsym c exec $sensibleTerminal, mode "default"
# Text editor bound to e
bindsym e exec $textEditor, mode "default"
# File browser bound to f
bindsym f exec $fileBrowser, mode "default"
$(if [[ ${#fileBrowser} -gt 3 ]]; then
echo "# File browser bound to f"
echo "bindsym f exec $fileBrowser, mode \"default\""
fi)
# Email client bound to \$mod+e
bindsym \$mod+e exec $emailClient, mode "default"
# Web browser bound to w
bindsym w exec $webBrowser, mode "default"
# Kill window bound to k
bindsym k kill, mode "default"
$(if command -v mumble &> /dev/null ; then
echo "# Mumble bound to m"
echo "bindsym m exec $(command -v mumble), mode \"default\""
fi)
$(if command -v remind &> /dev/null ; then
echo "# Reminders bound to r"
echo "bindsym r exec --no-startup-id ${i3Path}/scripts/reminder.sh, mode \"default\""
fi)
$(if command -v ocrdesktop &> /dev/null ; then
echo "bindsym Print exec $(command -v ocrdesktop), mode \"default\""
echo "# OCR desktop bound to print screen alternative \$mod+r"
echo "bindsym Print exec $(command -v ocrdesktop) -b, mode \"default\""
echo "bindsym \$mod+r exec $(command -v ocrdesktop) -b, mode \"default\""
fi)
$(if command -v pidgin &> /dev/null ; then
echo "# p bound to pidgin"
echo "bindsym p exec $(command -v pidgin), mode \"default\""
fi)
$(if command -v xrandr &> /dev/null ; then
echo "# alt+s bound to brightness control"
echo "bindsym \$mod+s exec --no-startup-id ${i3Path}/scripts/screen_controller.sh, mode \"default\""
fi)
$(if command -v transfersh &> /dev/null ; then
echo "# t bound to share file with transfer.sh"
echo 'bindsym t exec bash -c '"'"'fileName="$(yad --title "I38 Upload File" --file)" && url="$(transfersh "${fileName}" | tee >(yad --title "I38 - Uploading ${fileName##*/} ..." --progress --pulsate --auto-close))" && echo "${url#*saved at: }" | tee >(yad --title "I38 - Upload URL" --show-cursor --show-uri --button yad-close --sticky --text-info) >(xclip -selection clipboard)'"', mode \"default\""
fi)
@ -398,12 +572,12 @@ bindsym Mod1+Shift+9 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -
# Requires playerctl.
bindsym Mod1+Shift+equal exec --no-startup-id ${i3Path}/scripts/music_controler.sh incvol $volumeJump, mode "default"
bindsym Mod1+Shift+minus exec --no-startup-id ${i3Path}/scripts/music_controler.sh decvol $volumeJump, mode "default"
bindsym Mod1+Shift+z exec --no-startup-id ${i3Path}/scripts/music_controler.sh prev, mode "default"
bindsym Mod1+Shift+c exec --no-startup-id ${i3Path}/scripts/music_controler.sh pause, mode "default"
bindsym Mod1+Shift+x exec --no-startup-id ${i3Path}/scripts/music_controler.sh play, mode "default"
bindsym Mod1+Shift+v exec --no-startup-id ${i3Path}/scripts/music_controler.sh stop, mode "default"
bindsym Mod1+Shift+b exec --no-startup-id ${i3Path}/scripts/music_controler.sh next, mode "default"
bindsym Mod1+Shift+u exec --no-startup-id ${i3Path}/scripts/music_controler.sh info, mode "default"
bindsym Mod1+Shift+z exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh prev, mode "default"
bindsym Mod1+Shift+c exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh pause, mode "default"
bindsym Mod1+Shift+x exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh play, mode "default"
bindsym Mod1+Shift+v exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh stop, mode "default"
bindsym Mod1+Shift+b exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh next, mode "default"
bindsym Mod1+Shift+u exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh info, mode "default"
#Check battery status
bindsym Mod1+b exec --no-startup-id ${i3Path}/scripts/battery_status.sh, mode "default"
#Check controller battery status
@ -416,88 +590,55 @@ bindsym Shift+o exec $(command -v orca) --replace, mode "default"
bindsym Control+semicolon exec bash -c '$i3msg -t run_command reload && spd-say -P important -Cw "I38 Configuration reloaded."', mode "default"
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym Control+Shift+semicolon exec bash -c '$i3msg -t run_command restart && spd-say -P important -Cw "I3 restarted."', mode "default"
# Run dialog with exclamation
bindsym Shift+exclam exec ${i3Path}/scripts/run_dialog.sh, mode "default"
# exit i3 (logs you out of your X session)
bindsym Control+q exec bash -c 'yad --image "dialog-question" --title "I38" --button=yes:0 --button=no:1 --text "You pressed the exit shortcut. Do you really want to exit i3? This will end your X session." && $i3msg -t run_command exit'
# Exit ratpoison mode without any action escape or Control+g
bindsym Escape mode "default"
bindsym Control+g mode "default"
}
EOF
fi
# For those who do not want ratpoison mode.
if [[ -z "${escapeKey}" ]]; then
cat << EOF >> ${i3Path}/config
# Text editor bound to $mod+e
bindsym \$mod+e exec $textEditor
# File browser bound to $mod+f
bindsym \$mod+f exec $fileBrowser
# Web browser bound to $mod+w
bindsym \$mod+w exec $webBrowser
$(if command -v mumble &> /dev/null ; then
echo "bindsym \$mod+m exec $(command -v mumble)"
fi)
$(if command -v ocrdesktop &> /dev/null ; then
echo "bindsym Print exec $(command -v ocrdesktop)"
fi)
$(if command -v pidgin &> /dev/null ; then
echo "bindsym \$mod+p exec $(command -v pidgin)"
fi)
$(if command -v transfersh &> /dev/null ; then
echo 'bindsym \$mod+t exec bash -c '"'"'fileName="$(yad --title "I38 Upload File" --file)" && url="$(transfersh "${fileName}" | tee >(yad --title "I38 - Uploading ${fileName##*/} ..." --progress --pulsate --auto-close))" && echo "${url#*saved at: }" | tee >(yad --title "I38 - Upload URL" --show-cursor --show-uri --button yad-close --sticky --text-info) >(xclip -selection clipboard)'"'"
fi)
#Keyboard based volume controls using pulseaudio
bindsym \$mod+Shift+0 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +${volumeJump}% & play -qnG synth 0.03 sin 440
bindsym \$mod+Shift+9 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -${volumeJump}% & play -qnG synth 0.03 sin 440
# Music player controls
# Requires playerctl.
bindsym \$mod+Shift+equal exec --no-startup-id ${i3Path}/scripts/music_controler.sh incvol $volumeJump
bindsym \$mod+Shift+minus exec --no-startup-id ${i3Path}/scripts/music_controler.sh decvol $volumeJump
bindsym \$mod+Shift+z exec --no-startup-id ${i3Path}/scripts/music_controler.sh prev
bindsym \$mod+Shift+c exec --no-startup-id ${i3Path}/scripts/music_controler.sh pause
bindsym \$mod+Shift+x exec --no-startup-id ${i3Path}/scripts/music_controler.sh play
bindsym \$mod+Shift+v exec --no-startup-id ${i3Path}/scripts/music_controler.sh stop
bindsym \$mod+Shift+b exec --no-startup-id ${i3Path}/scripts/music_controler.sh next
bindsym \$mod+Shift+u exec --no-startup-id ${i3Path}/scripts/music_controler.sh info
#Check battery status
bindsym \$mod+b exec --no-startup-id ${i3Path}/scripts/battery_status.sh
#Check controller battery status
bindsym \$mod+g exec ${i3Path}/scripts/game_controler.sh -s
# Get a list of windows in the current workspace
bindsym \$mod+apostrophe exec --no-startup-id ${i3Path}/scripts/window_list.sh
# Restart orca
bindsym \$mod+Shift+o exec $(command -v orca) --replace
# reload the configuration file
bindsym \$mod+Control+semicolon exec bash -c '$i3msg -t run_command reload && spd-say -P important -Cw "I38 Configuration reloaded."'
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym \$mod+Control+Shift+semicolon exec bash -c '$i3msg -t run_command restart && spd-say -P important -Cw "I3 restarted."'
# exit i3 (logs you out of your X session)
bindsym \$mod+Control+q exec bash -c 'yad --image "dialog-question" --title "I38" --button=yes:0 --button=no:1 --text "You pressed the exit shortcut. Do you really want to exit i3? This will end your X session." && $i3msg -t run_command exit'
EOF
fi
cat << EOF >> ${i3Path}/config
# Auto start section
$(if [[ $sounds -eq 0 ]]; then
echo "exec_always --no-startup-id ${i3Path}/scripts/sound.py"
fi
if [[ $loginSound -eq 0 ]]; then
echo 'exec --no-startup-id canberra-gtk-play -i desktop-login'
fi
if [[ $brlapi -eq 0 ]]; then
echo 'exec --no-startup-id xbrlapi --quiet'
fi
if [[ $udiskie -eq 0 ]]; then
echo 'exec --no-startup-id udiskie'
fi
if command -v lxpolkit &> /dev/null ; then
echo "exec_always --no-startup-id $(command -v lxpolkit)"
fi
if [[ -x "/usr/lib/notification-daemon-1.0/notification-daemon" ]]; then
echo 'exec_always --no-startup-id /usr/lib/notification-daemon-1.0/notification-daemon -r'
fi
# Work around for weird Void Linux stuff.
if [[ -x "/usr/libexec/notification-daemon" ]]; then
echo 'exec_always --no-startup-id /usr/libexec/notification-daemon -r'
fi
if command -v remind &> /dev/null && command -v notify-send &> /dev/null ; then
echo "exec_always --no-startup-id $(command -v remind) -z '-k:${HOME}/.config/i3/scripts/reminder.sh %s &' ${HOME}/.reminders < /dev/null > /dev/null 2>&1"
touch ~/.reminders
fi
if [[ $dex -eq 0 ]]; then
echo '# Start XDG autostart .desktop files using dex. See also'
echo '# https://wiki.archlinux.org/index.php/XDG_Autostart'
echo 'exec --no-startup-id dex --autostart --environment i3'
else
echo '# Startup applications'
echo 'exec clipster -d'
echo 'exec --no-startup-id clipster -d'
echo 'exec orca'
fi)

View File

@ -1,8 +1,17 @@
#!/usr/bin/env bash
workSpace="$(i3-msg -t get_workspaces \
path="$(readlink -f $0)"
path="${path%/*/*}"
path="${path##*/}"
if [[ "$path" == "i3" ]]; then
workSpace="$(i3-msg -t get_workspaces \
| jq '.[] | select(.focused==true).name' \
| cut -d"\"" -f2)"
else
workSpace="$(swaymsg -t get_workspaces \
| jq '.[] | select(.focused==true).name' \
| cut -d"\"" -f2)"
fi
left=9
right=0
msg="Workspace ${workSpace}"

32
scripts/i38-help.sh Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
configPath="$(readlink -f $0)"
configPath="${configPath%/*/*}"
if [[ -f "${configPath}/config" ]]; then
mod="$(grep 'set $mod ' "${configPath}/config" | cut -d ' ' -f3)"
mod="${mod//Mod1/Alt}"
mod="${mod//Mod4/Super}"
mapfile helpText < <(sed -e '/set \($mod\|mod\)/d' \
-e '/set $ws/d' \
-e 's/bindsym/Key:/g' \
-e 's/Mod1/Alt/g' \
-e 's/, mode "default"//g' \
-e 's/--no-startup-id //g' \
-e 's/$ws\([0-9]\)/\1/g' \
-e 's/play \(.*\)& //g' \
-e "s/\$mod/$mod/g" "${configPath}/config")
else
exit 1
fi
for i in "${!helpText[@]}" ; do
helpText[$i]="${helpText[$i]//${configPath}\/scripts\//}"
helpText[$i]="${helpText[$i]/.sh/}"
helpText[$i]="${helpText[$i]/, exec announce*/$'\n'}"
helpText[$i]="${helpText[$i]/, exec spd-say*/$'\n'}"
done
helpText+=("End of text. Please press Control+Home to jump to the beginning of this document.")
echo "${helpText[@]}" | yad --text-info --show-cursor --title "I38 help" --button "Close:0" --listen
exit 0

48
scripts/keyboard.sh Executable file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env bash
# This script is a modified version of i3-keyboard-layout.
# Originally Copyright (c) 2018 Sergio Gil.
# https://github.com/porras/i3-keyboard-layout
# This modified script, like the rest of I38, is released under the WTFPL license.
# The original work was released under the MIT license.
set -e
get_kbdlayout() {
layout=$(setxkbmap -query | grep -oP 'layout:\s*\K([\w,]+)')
variant=$(setxkbmap -query | grep -oP 'variant:\s*\K(\w+)')
echo "$layout" "$variant"
}
set_kbdlayout() {
eval "array=($1)"
setxkbmap "${array[@]}" &&
spd-say -P important -Cw "${array[@]}"
}
cycle() {
current_layout=$(get_kbdlayout | xargs)
layouts=("$@" "$1") # add the first one at the end so that it cycles
index=0
while [ "${layouts[$index]}" != "$current_layout" ] && [ $index -lt "${#layouts[@]}" ]; do index=$[index +1]; done
next_index=$[index +1]
next_layout=${layouts[$next_index]}
set_kbdlayout "$next_layout"
}
subcommand="$1"
shift || exit 1
case $subcommand in
"get")
echo -n $(get_kbdlayout)
;;
"cycle")
cycle "$@"
;;
esac
exit 0

322
scripts/reminder.sh Executable file
View File

@ -0,0 +1,322 @@
#!/usr/bin/env bash
error() {
yad --form --selectable-labels --title "I38 - Reminder Error" --field="${*}":lbl --button="Close!gtk-ok":0
}
message() {
yad --form --selectable-labels --title "I38 - Reminder" --field="${*}":lbl --button="Close!gtk-ok":0
}
add_custom_reminder() {
info="$(yad --form --selectable-labels \
--title "I38 - New Custom Reminder" \
--field="Comment for ~/.reminders file":lbl "" \
--field="Reminder Comment" "" \
--field="Reminder entry. Remember for notifications, it must ccontain the +5 after the time and the %2. at the end of the MSG.":lbl "" \
--field="Reminder" "REM at +5 MSG %2.")"
if [[ $? -eq 1 || $? -eq 252 ]]; then
return
fi
while [[ $info =~ \|\| ]]; do
info="${info//||/|}"
done
info="${info#|#}"
# Get information for reminder into an array
IFS='|' read -a reminder <<< $info
if [[ "${reminder[0]}" != "# " ]]; then
echo "# ${reminder[0]}" >> ~/.reminders
fi
if [[ "${reminder[1]}" != "REM at +5 MSG %2." ]]; then
echo "${reminder[1]}" >> ~/.reminders
message "Custom reminder added."
else
error "No reminder text entered, No action taken."
fi
}
add_daily_reminder() {
info="$(yad --form --selectable-labels \
--title "I38 - New Daily Reminder" \
--field="Reminder Text" "" \
--field="Select Hour:":num '1!1..12' \
--field="Select Minute:":num '0!0..59' \
--field="Select AM or PM":cb 'AM!PM' \
--button="Cancel!gtk-cancel:1" \
--button="Create Reminder!gtk-ok:0")"
# Properly handle window close events.
if [[ $? -eq 1 || $? -eq 252 ]]; then
return
fi
# Get information for reminder into an array
IFS='|' read -a reminder <<< $info
# Fix time to be 2 digits.
[[ ${#reminder[1]} -eq 1 ]] && reminder[1]="0${reminder[1]}"
[[ ${#reminder[2]} -eq 1 ]] && reminder[2]="0${reminder[2]}"
# Make sure we have reminder text
if [[ ${#reminder[0]} -lt 3 ]]; then
error "No reminder text given, addition canceled."
return
fi
reminderEntry="REM AT ${reminder[1]}:${reminder[2]}${reminder[3]} +5 REPEAT daily MSG ${reminder[0]} %2."
echo "# Added by I38." >> ~/.reminders
echo "$reminderEntry" >> ~/.reminders
if [[ -N ~/.reminders ]]; then
message "Reminder added."
else
error "Something went wrong. The reminder was not added."
fi
}
add_monthly_reminder() {
info="$(yad --form --selectable-labels \
--title "I38 - New Monthly Reminder" \
--field="For dates over 28, some months may be skipped. If you want to be sure of the last day of the month, check the last day of month box.":lbl "" \
--field="Reminder Text" "" \
--field="Select Date:":num '1!1..31' \
--field="Select Hour:":num '1!1..12' \
--field="Select Minute:":num '0!0..59' \
--field="Select AM or PM":cb 'AM!PM' \
--field="Last day of month":chk "FALSE" \
--button="Cancel!gtk-cancel:1" \
--button="Create Reminder!gtk-ok:0")"
# Properly handle window close events.
if [[ $? -eq 1 || $? -eq 252 ]]; then
return
fi
# Get information for reminder into an array
IFS='|' read -a reminder <<< $info
# Fix time and date to be 2 digits.
[[ ${#reminder[2]} -eq 1 ]] && reminder[2]="0${reminder[2]}"
[[ ${#reminder[3]} -eq 1 ]] && reminder[3]="0${reminder[3]}"
[[ ${#reminder[4]} -eq 1 ]] && reminder[4]="0${reminder[4]}"
# Make sure we have reminder text
if [[ ${#reminder[1]} -lt 3 ]]; then
error "No reminder text given, addition canceled."
return
fi
if [[ "${reminder[6]}" == "FALSE" ]]; then
reminderEntry="REM ${reminder[2]} "
else
reminderEntry="REM 1 -1 "
fi
reminderEntry+="AT ${reminder[3]}:${reminder[4]}${reminder[5]} +5 REPEAT monthly MSG ${reminder[1]} %2."
echo "# Added by I38." >> ~/.reminders
echo "$reminderEntry" >> ~/.reminders
if [[ -N ~/.reminders ]]; then
message "Reminder added."
else
error "Something went wrong. The reminder was not added."
fi
}
add_weekly_reminder() {
info="$(yad --form --selectable-labels \
--title "I38 - New Weekly Reminder" \
--field="Reminder Text" "" \
--field="Select Days":lbl "" \
--field="Sunday":chk "FALSE" \
--field="Monday":chk "FALSE" \
--field="Tuesday":chk "FALSE" \
--field="Wednesday":chk "FALSE" \
--field="Thursday":chk "FALSE" \
--field="Friday":chk "FALSE" \
--field="Saturday":chk "FALSE" \
--field="Select Hour:":num '1!1..12' \
--field="Select Minute:":num '0!0..59' \
--field="Select AM or PM":cb 'AM!PM' \
--button="Cancel!gtk-cancel:1" \
--button="Create Reminder!gtk-ok:0")"
# Properly handle window close events.
if [[ $? -eq 1 || $? -eq 252 ]]; then
return
fi
# Get information for reminder into an array
IFS='|' read -a reminder <<< $info
# Fix time to be 2 digits.
[[ ${#reminder[9]} -eq 1 ]] && reminder[9]="0${reminder[9]}"
[[ ${#reminder[10]} -eq 1 ]] && reminder[10]="0${reminder[10]}"
# Change checked days into their name.
reminder[2]="${reminder[2]/TRUE/Sun}"
reminder[3]="${reminder[3]/TRUE/Mon}"
reminder[4]="${reminder[4]/TRUE/Tue}"
reminder[5]="${reminder[5]/TRUE/Wed}"
reminder[6]="${reminder[6]/TRUE/Thu}"
reminder[7]="${reminder[7]/TRUE/Fri}"
reminder[8]="${reminder[8]/TRUE/Sat}"
# Make sure we have reminder text
if [[ ${#reminder[0]} -lt 3 ]]; then
error "No reminder text given, addition canceled."
return
fi
reminderEntry="REM "
noDays=1
for ((i=2;i<=8;i++)) ; do
if [[ "${reminder[i]}" != "FALSE" ]]; then
reminderEntry+="${reminder[i]} "
noDays=0
fi
done
if [[ $noDays -eq 1 ]]; then
error "No days were selected for the reminder. Nothing changed."
return
fi
reminderEntry+="AT ${reminder[9]}:${reminder[10]}${reminder[11]} +5 REPEAT weekly MSG ${reminder[0]} %2."
echo "# Added by I38." >> ~/.reminders
echo "$reminderEntry" >> ~/.reminders
if [[ -N ~/.reminders ]]; then
message "Reminder added."
else
error "Something went wrong. The reminder was not added."
fi
}
view_reminders() {
if ! [[ -r ~/.reminders ]]; then
error "No reminders found."
return
fi
mapfile -t lines < ~/.reminders
# Create an empty array to store cleaned-up reminders
yadMenu=()
# Iterate through the reminder lines and clean them up
for i in "${lines[@]}"; do
# Remove the "REM" prefix and leading/trailing spaces
formattedLine="${i#*REM }"
# Remove MSG from the output.
formattedLine="${formattedLine/MSG /}"
# remove the usually %2. from the end of the line, but accept any digit in case someone changes it.
formattedLine="${formattedLine% %[[:digit:]].}"
# Add to the menu
yadMenu+=("$formattedLine")
done
# Display the reminders
reminder="$(yad --list --title "I38 - Reminders" --text "Current reminders:" \
--column "Reminder" "${yadMenu[@]}" \
--button="Close!gtk-ok:1" --button="Delete!gtk-delete:0" --response=1)"
if [[ $? -ne 0 ]]; then
return
fi
if [[ "${reminder:0:1}" == "#" ]]; then
error "Please select the actual reminder to be deleted, anything starting with # is only a comment. Nothing changed."
return
fi
# Remove the | from the end of reminder
reminder="${reminder%|}"
# Find the index to remove from lines.
for i in "${!yadMenu[@]}" ; do
if [[ "${yadMenu[i]}" == "${reminder}" ]]; then
# Delete selected reminder and possible preceeding comment.
commentIndex=$((i - 1))
if [[ "${lines[commentIndex]:0:1}" == "#" ]]; then
unset lines[$commentIndex]
fi
unset lines[$i]
message "Reminder deleted."
printf "%s\n" "${lines[@]}" > ~/.reminders
fi
done
}
view_today() {
if ! [[ -r ~/.reminders ]]; then
error "No reminders found."
return
fi
mapfile -t lines < <(rem | tr -s $'\n')
# Display the reminders
yad --list --title "I38 - Reminders" --text "Today's reminders:" \
--column "Reminder" "${lines[@]}" \
--button="Close!gtk-ok:0"
}
if ! command -v remind &> /dev/null ; then
error "Please install remind. For notifications, please make sure to have notification-daemon and notify-send as well. Run i38.sh to regenerate your i3 config after the needed components are installed."
exit 1
fi
if [[ $# -ne 0 ]]; then
sox -ndqV0 synth .1 tri 600 norm -9 pad .05 repeat
notification="$*"
if [[ "${notification}" =~ "http" ]]; then
url="${notification##*http}"
url="${url%%[[:space:]]*}"
url="http${url}"
notification="${notification/${url}[[:space:]]/}"
url="${url%[[:space:].?!]}"
fi
if command -v xclip &> /dev/null && [[ "${#url}" -gt 3 ]]; then
echo "${url}" | xclip -selection clipboard
notify-send "${notification} The URL has been copied to the clipboard." --expire-time=30000
else
notify-send "${*}" --expire-time=30000
fi
exit 0
fi
while : ; do
action=$(yad --title "I38 - Reminders" --form \
--button="_View Today's Reminders!gtk-info":2 \
--button="_View All Reminders!gtk-info":3 \
--button="_Add Daily Reminder!gtk-edit":0 \
--button="_Add Weekly Reminder!gtk-edit":4 \
--button="Add Monthly Reminder!gtk-edit":5 \
--button="Add Custom Reminder!gtk-edit":6 \
--button="Close!gtk-cancel":1 \
--separator="")
case $? in
0)
# Handle "Add Daily Reminder" button click
add_daily_reminder
;;
1|252)
# Handle "Close" button click and escape.
exit 0
;;
2)
# View today's reminders
view_today
;;
3)
# View reminders
view_reminders
;;
4)
# Handle "Add Weekly Reminder" button click
add_weekly_reminder
;;
5)
# Handle "Add Monthly Reminder" button click
add_monthly_reminder
;;
6)
# Handle "Add Custom Reminder" button click
add_custom_reminder
;;
esac
done

45
scripts/run_dialog.sh Executable file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
write_history(){
oldHistory="$(grep -v "$txt" "${historyPath}/.history" | head -n 49)"
echo -e "$txt\n$oldHistory" | sed 's/^$//g' > "${historyPath}/.history"
}
historyPath="$(readlink -f $0)"
historyPath="${historyPath%/*}"
if ! [[ -d "$historyPath" ]]; then
mkdir -p "$historyPath"
fi
if [[ -f "${historyPath}/.history" ]]; then
txt="$(yad --entry --editable --title "I38" --text "Execute program or enter file" --button "Open:0" --separator "\n" --rest "${historyPath}/.history")"
else
txt="$(yad --entry --title "I38" --text "Execute program or enter file" --button "Open:0")"
fi
if [[ -z "$txt" ]]; then
exit 0
fi
if [[ "$txt" =~ ^ftp://|^http://|^https://|^www.* ]]; then
xdg-open $txt
write_history
exit 0
fi
if [[ "$txt" =~ ^mailto://.* ]]; then
xdg-email $txt
write_history
exit 0
fi
if [[ "$txt" =~ ^man://.* ]]; then
eval "${txt/:\/\// }" | yad --text-info --show-cursor --button "Close:0" --title "I38" -
write_history
exit 0
fi
if command -v "$(echo "$txt" | cut -d " " -f1)" &> /dev/null ; then
eval $txt&
else
xdg-open $txt&
fi
write_history
exit 0

24
scripts/screen_controller.sh Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Not for multiple screens.
# Get the name of the screen.
screenName="$(xrandr --query | grep "connected" | cut -d ' ' -f1 | head -n 1)"
menuOptions=(
"1.0" "Maximum Brightness"
"0.75" "75 percent"
"0.5" "50 percent"
"0.25" "25 percent"
"0" "Screen Curtain"
)
brightness="$(yad --list --title "I38" --text "Set Screen Brightness" --columns 2 --hide-column 1 --column "" --column "Select" "${menuOptions[@]}")"
if [[ ${#brightness} -lt 1 ]]; then
exit 0
fi
xrandr --output ${screenName} --brightness ${brightness%%|*} &&
spd-say -P important -Cw "Screen set to ${brightness#*|}."
exit 0

View File

@ -12,12 +12,19 @@ i3 = i3ipc.Connection()
def on_new_window(self,i3):
system('play -n synth .25 sin 440:880 sin 480:920 remix - norm -3 pitch -500 &')
def on_close_window(self,i3):
system('play -n synth .25 sin 880:440 sin 920:480 remix - norm -3 pitch -500 &')
def on_mode(self,event):
mode= event.change
if mode == 'default':
if mode == 'ratpoison':
system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 &')
elif mode == 'bypass':
system('play -nqV0 synth .1 saw 700 saw 1200 delay 0 .04 remix - norm -6')
elif mode == 'default':
system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 reverse &')
else:
system('play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20 &')
system('play -n synth 0.05 pluck F3 norm -8 : synth 0.05 pluck C4 norm -8 : synth 0.05 pluck F4 norm -8 : synth 0.05 pluck C5 norm -8')
def on_workspace_focus(self,i3):
#system('play -qnV0 synth pi fade 0 .25 .15 pad 0 1 reverb overdrive riaa norm -8 speed 1 &')
@ -38,6 +45,7 @@ def on_fullscreen(self,i3):
i3 = i3ipc.Connection()
i3.on('window::new', on_new_window)
i3.on('window::close', on_close_window)
i3.on(Event.MODE, on_mode)
i3.on('workspace::focus', on_workspace_focus)
i3.on('window::move', on_workspace_move)

View File

@ -1,5 +1,9 @@
#!/usr/bin/env bash
path="$(readlink -f $0)"
path="${path%/*/*}"
path="${path##*/}"
if [[ "$path" == "i3" ]]; then
mapfile -t windowList < <(python3 -c '
import i3ipc
@ -13,4 +17,28 @@ id="$(yad --title "I38" --list --separator "" --column "id" --column "Select Win
if [[ -z "${id}" ]]; then
exit 0
fi
i3-msg \[id="${id}"\] focus
i3-msg \[id="${id}"\] focus
else
mapfile -t windowList < <(python3 -c '
import i3ipc
i3 = i3ipc.Connection()
for con in i3.get_tree():
if con.window or con.type == "con":
if con.name:
print(con.window)
print(con.name)')
# Remove the first entry if it is "none"
if [[ "${windowList[0]}" == "none" ]]; then
unset "windowList[0]"
fi
id="$(yad --title "I38" --list --separator "" --column "id" --column "Select Window" --hide-column 1 --print-column 1 "${windowList[@]}")"
if [[ -z "${id}" ]]; then
exit 0
fi
swaymsg \[id="${id}"\] focus
fi