From fd602313db9bcb31d14d0e472828eeb4aa894859 Mon Sep 17 00:00:00 2001 From: ds6 Date: Thu, 30 Aug 2018 05:28:38 -0500 Subject: [PATCH 1/1] add tridactyl native updater, trim i3 config --- bin/update-tridactyl-native.sh | 78 +++++++++++++++++++++++ xdg/i3/config | 109 +++++++++++++++------------------ 2 files changed, 127 insertions(+), 60 deletions(-) create mode 100755 bin/update-tridactyl-native.sh diff --git a/bin/update-tridactyl-native.sh b/bin/update-tridactyl-native.sh new file mode 100755 index 0000000..86bc78b --- /dev/null +++ b/bin/update-tridactyl-native.sh @@ -0,0 +1,78 @@ +#!/bin/sh + +# sh-compatible version of Tridactyl native binary updater +# Python 3 is required. If it is not present, installation will fail. + +# Installation: +# curl -fsSl 'url to this script' | sh +# or: +# wget -qO - 'url to this script' | sh + +# Handle errors (bash only) +echoerr() { + red="\033[31m" + normal="\e[0m" + echo -e "$red$@$normal" >&2 +} +trap "echoerr 'Failed to install!'" ERR >/dev/null 2>&1 #can't trap ERR in sh + +# Check requirements for native messenger +python_path=$(which python3) || python_path="" +if [ ! -x "$python_path" ]; then + echoerr "Error: Python 3 must exist in PATH." + echoerr "Please install it and run this script again." + exit 1 +fi + +# Set up environment +manifest_loc="https://raw.githubusercontent.com/cmcaine/tridactyl/master/native/tridactyl.json" +native_loc="https://raw.githubusercontent.com/cmcaine/tridactyl/master/native/native_main.py" +OSTYPE="${OSTYPE:-`uname -s | tr '[:upper:]' '[:lower:]'`}" +XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" +data_home="${XDG_LOCAL_HOME:-$XDG_DATA_HOME/tridactyl}" +native_file="$data_home/native_main.py.new" +native_file_final="$data_home/native_main.py" +# Decide where to put the manifest based on OS +case "$OSTYPE" in + darwin*) manifest_home="$HOME/Library/Application Support/Mozilla/NativeMessagingHosts";; + *) manifest_home="$HOME/.mozilla/native-messaging-hosts";; +esac +manifest_file="$manifest_home/tridactyl.json" +# Test for curl +if ! command -v curl; then + # Based on busybox-compatible wget + dl="wget -qO" +else + dl="curl -sSo" +fi + +echo "Installing script here: $data_home" +echo "Installing manifest here: $manifest_home" + +# Download files +mkdir -p "$manifest_home" "$data_home" +# Use local copy for testing and/or use in git repo +if [ "$1" == "local" ]; then + cp -f native/tridactyl.json "$manifest_file" + cp -f native/native_main.py "$native_file" +else + $dl "$manifest_file" "$manifest_loc" + $dl "$native_file" "$native_loc" +fi + +# Fix file contents +sedEscape() { + sed 's/[&/\]/\\&/g' <<_EOF_ +$@ +_EOF_ +} +# Replace native executable path in manifest +sed -i.bak "s/REPLACE_ME_WITH_SED/$(sedEscape "$native_file_final")/" "$manifest_file" +chmod +x $native_file +# Replace python shebang in native messenger script +sed -i.bak "1s/.*/#!$(sedEscape /usr/bin/env) $(sedEscape "$python_path")/" "$native_file" +mv "$native_file" "$native_file_final" + +echo +echo "Successfully installed Tridactyl native messenger!" +echo "Run ':native' in Firefox to check." diff --git a/xdg/i3/config b/xdg/i3/config index 3aaed9e..af19cae 100644 --- a/xdg/i3/config +++ b/xdg/i3/config @@ -1,48 +1,45 @@ -# i3 config file (v4) -# Please see http://i3wm.org/docs/userguide.html for a complete reference! -# Font for window titles. Will also be used by the bar unless a different font -# is used in the bar {} block below. +# master modifier key +set $mod Mod4 -font pango:Dina 7 +### important binds ### +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace +bindsym $mod+Shift+r restart +# exit i3 +bindsym $mod+Shift+e exec --no-startup-id i3-nagbar -t warning -m Exit? -b Yes 'i3-msg exit' -# This font is widely installed, provides lots of unicode glyphs, right-to-left -# text rendering and scalability on retina/hidpi displays (thanks to pango). -#font pango:DejaVu Sans Mono 8 +### applications ### +# x220t bezel buttons +bindcode 198 exec --no-startup-id rotate set normal +bindcode 204 exec --no-startup-id rotate right + +# terminal +bindsym $mod+Return exec --no-startup-id i3-sensible-terminal -# Before i3 v4.8, we used to recommend this one as the default: -# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 -# The font above is very space-efficient, that is, it looks good, sharp and -# clear in small sizes. However, its unicode glyph coverage is limited, the old -# X core fonts rendering does not support right-to-left and this being a bitmap -# font, it doesn’t scale on retina/hidpi displays. +# dmenu +bindsym $mod+d exec --no-startup-id $HOME/bin/dmenu_runsmart -p "%" -# Modifier key -set $mod Mod4 +# mpc +bindsym XF86AudioPlay exec --no-startup-id mpc -h /var/mpd/socket play +bindsym XF86AudioStop exec --no-startup-id mpc -h /var/mpd/socket pause +bindsym XF86AudioPrev exec --no-startup-id mpc -h /var/mpd/socket cdprev +bindsym XF86AudioNext exec --no-startup-id mpc -h /var/mpd/socket next -# use these keys for focus, movement, and resize directions + +### window management ### +# directional keys set $up k set $down j set $left h set $right l -# and arrow keys +# arrow keys for completeness set $up2 Up set $down2 Down set $left2 Left set $right2 Right -# use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -# start a terminal -bindsym $mod+Return exec --no-startup-id i3-sensible-terminal - -# kill focused window -bindsym $mod+Shift+q kill - -# start dmenu -bindsym $mod+d exec --no-startup-id $HOME/bin/dmenu_runsmart -p "%" - # change focus bindsym $mod+$left focus left bindsym $mod+$down focus down @@ -52,7 +49,6 @@ bindsym $mod+$left2 focus left bindsym $mod+$down2 focus down bindsym $mod+$up2 focus up bindsym $mod+$right2 focus right - # move focused window bindsym $mod+Shift+$left move left bindsym $mod+Shift+$down move down @@ -65,10 +61,12 @@ bindsym $mod+Shift+$right2 move right # split in horizontal orientation bindsym $mod+i split h - # split in vertical orientation bindsym $mod+o split v +# mouse+$mod to drag floating windows +floating_modifier $mod + # enter fullscreen mode for the focused container bindsym $mod+f fullscreen toggle bindsym $mod+Shift+f fullscreen toggle global @@ -90,6 +88,9 @@ bindsym $mod+a focus parent # focus the child container bindsym $mod+z focus child +# kill focused window +bindsym $mod+Shift+q kill + # move the currently focused window to the scratchpad bindsym $mod+Shift+minus move scratchpad @@ -108,6 +109,8 @@ bindsym $mod+7 workspace 7 bindsym $mod+8 workspace 8 bindsym $mod+9 workspace 9 bindsym $mod+0 workspace 10 +# repeat workspace to go back +workspace_auto_back_and_forth yes # move focused container to workspace bindsym $mod+Shift+1 move container to workspace 1 @@ -121,23 +124,6 @@ bindsym $mod+Shift+8 move container to workspace 8 bindsym $mod+Shift+9 move container to workspace 9 Bindsym $mod+Shift+0 move container to workspace 10 -# reload the configuration file -bindsym $mod+Shift+c reload -# restart i3 inplace -bindsym $mod+Shift+r restart -# exit i3 -bindsym $mod+Shift+e exec --no-startup-id i3-nagbar -t warning -m Exit? -b Yes 'i3-msg exit' - -# x220t bezel buttons -bindcode 198 exec --no-startup-id rotate set normal -bindcode 204 exec --no-startup-id rotate right - -# mpc -bindsym XF86AudioPlay exec --no-startup-id mpc -h /var/mpd/socket play -bindsym XF86AudioStop exec --no-startup-id mpc -h /var/mpd/socket pause -bindsym XF86AudioPrev exec --no-startup-id mpc -h /var/mpd/socket cdprev -bindsym XF86AudioNext exec --no-startup-id mpc -h /var/mpd/socket next - # move and resize [floating] windows mode "translate" { bindsym $left resize shrink width 20 px @@ -196,6 +182,11 @@ mode "translate" { } bindsym $mod+r mode "translate" + +### appearance ### +# font +font pango:Dina 7 + # windows for_window [class="Gsimplecal"] floating enable for_window [class="XMixer"] floating enable @@ -206,39 +197,36 @@ new_window pixel 1 gaps inner 6 smart_gaps on -# misc -workspace_auto_back_and_forth yes -force_display_urgency_hint 2000 ms - # color definitions -# generic +# generic set $bg #110800 set $fg #93a1a1 -# focused +# focused set $f_bdr #cc6600 set $f_bg #aa5500 set $f_fg #eee8d5 set $f_ind #4466ff set $f_chb #cc6600 -# inactive +# inactive set $i_bdr #884400 set $i_bg #221100 set $i_fg $fg set $i_ind #264bd2 set $i_chb #884400 -# urgent +# urgent set $u_bdr #ff4444 set $u_bg #dc322f set $u_fg #000000 set $u_ind #4466ff set $u_chb #ff4444 -# blue +# blue set $b_bdr #4466ff set $b_bg #268bd2 set $b_fg #fdf6e3 set $b_ind #264db2 set $b_chb #4466ff +# TODO: deprecate in favor of tint2 bar { position top output LVDS1 @@ -260,12 +248,13 @@ bar { } } -# colors +# apply colors # class border backgr. text indicator child_border client.focused $f_bdr $f_bg $f_fg $f_ind $f_chb client.focused_inactive $i_bdr $i_bg $i_fg $i_ind $i_chb client.unfocused $i_bdr $i_bg $i_fg $i_ind $i_chb client.urgent $u_bdr $u_bg $u_fg $u_ind $u_chb client.placeholder $b_bdr $b_bg $b_fg $b_ind $b_chb - client.background #221100 +# keep urgent colors around longer +force_display_urgency_hint 2000 ms -- 2.47.0