diff options
author | shmibs <shmibs@gmail.com> | 2014-01-06 10:16:16 -0700 |
---|---|---|
committer | shmibs <shmibs@gmail.com> | 2014-01-06 10:16:16 -0700 |
commit | eb52ab2616e8e004499333656307d01c45c369ef (patch) | |
tree | a704f4c2abbfabb4dd2867cd333db48b3e323811 | |
download | dotfiles-eb52ab2616e8e004499333656307d01c45c369ef.tar.gz |
initial commit
99 files changed, 3250 insertions, 0 deletions
@@ -0,0 +1,37 @@ +# +# /home/shmibs/.bashrc +# + +# coloured +# PS1="$(if [[ ${EUID} == 0 ]]; then echo '\033[1;31m'; else echo '\033[1;32m'; fi)\u@\h\033[1;34m[\W]\$\033[0m " + +# plain +# PS1='[\u@\h \W]\$ ' + +# If not running interactively, don't do anything + +[[ $- != *i* ]] && return + +shopt -s checkwinsize + +alias ls='ls --color=auto' +alias grep='grep --color=auto' +alias diff='colordiff' + +PS1='[\u@\h \W]\$ ' +PS2='> ' +PS3='> ' +PS4='+ ' + +case ${TERM} in + xterm*|rxvt*|Eterm|aterm|kterm|gnome*|mate*) + PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"' + ;; + screen) + PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"' + ;; +esac + +[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion + +export EDITOR="vim" diff --git a/.compton.conf b/.compton.conf new file mode 100644 index 0000000..1a466dc --- /dev/null +++ b/.compton.conf @@ -0,0 +1,11 @@ +# Shadow +shadow = true +no-dock-shadow = false +no-dnd-shadow = true +clear-shadow = true +shadow-radius = 10 +shadow-offset-x = -10 +shadow-offset-y = -10 +shadow-opacity = 0.85 +shadow-ignore-shaped = true +shadow-exclude = "window_type != 'dock'" diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua new file mode 100644 index 0000000..bb81982 --- /dev/null +++ b/.config/awesome/rc.lua @@ -0,0 +1,668 @@ +-- Standard awesome library +local gears = require("gears") +local awful = require("awful") +awful.rules = require("awful.rules") +require("awful.autofocus") +-- Widget and layout library +local wibox = require("wibox") +-- Theme handling library +local beautiful = require("beautiful") +-- Notification library +local naughty = require("naughty") +local menubar = require("menubar") +-- Vicious widget library +local vicious = require("vicious") +-- lain layouts n stuff +local lain = require("lain") + +-- {{{ Error handling +-- Check if awesome encountered an error during startup and fell back to +-- another config (This code will only ever execute for the fallback config) +if awesome.startup_errors then + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors }) +end + +-- Handle runtime errors after startup +do + local in_error = false + awesome.connect_signal("debug::error", function (err) + -- Make sure we don't go into an endless error loop + if in_error then return end + in_error = true + + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = err }) + in_error = false + end) +end +-- }}} + +-- {{{ Variable definitions +-- Themes define colours, icons, and wallpapers +beautiful.init("/home/shmibs/.config/awesome/themes/current/theme.lua") + +-- This is used later as the default terminal and editor to run. +terminal = "mate-terminal" editor = "vim " + +-- Default modkey. +-- Usually, Mod4 is the key with a logo between Control and Alt. +-- If you do not like this or do not have such a key, +-- I suggest you to remap Mod4 to another key using xmodmap or other tools. +-- However, you can use another modifier like Mod1, but it may interact with others. +modkey = "Mod4" + +-- Table of layouts to cover with awful.layout.inc, order matters. +local layouts = +{ + awful.layout.suit.max, + lain.layout.uselessfair, +} +-- }}} + +-- {{{ Wallpaper +if beautiful.wallpaper then + for s = 1, screen.count() do + gears.wallpaper.maximized(beautiful.wallpaper, s, false) + end +end +-- }}} + +-- {{{ Tags +-- Define a tag table which hold all screen tags. +tags = {} +for s = 1, screen.count() do + -- Each screen has its own tag table. + tags[s] = awful.tag({ 1, 2, 3, 4, 5 }, s, layouts[1]) +end +-- }}} + +-- {{{ Menu +-- Create a laucher widget and a main menu +myawesomemenu = { + { "manual", terminal .. " -e man awesome" }, + { "restart", awesome.restart }, + { "reboot", "reboot" }, + { "poweroff", "poweroff" }, + { "logout", "mate-session-save --logout" }, +} + +myinternetmenu = { + { "firefox", "firefox", "/home/shmibs/.icons/FaenzaWolfe/apps/16/firefox.png" }, + { "tor", "/home/shmibs/stuffs/tor/start-tor-browser" }, + { "qtransmission", "transmission-qt", "/home/shmibs/.icons/FaenzaWolfe/apps/16/transmission.png" }, + { "qtscrobbler", "qtscrobbler", "/home/shmibs/.icons/FaenzaWolfe/apps/16/lastfm.png" }, + { "midori", "midori", "/home/shmibs/.icons/FaenzaWolfe/apps/16/midori.png" }, + { "pidgin", "pidgin", "/home/shmibs/.icons/FaenzaWolfe/apps/16/pidgin.png" }, +} + +-- {{ game menus + +myongamesmenu = { + { "SleepIsDeath", "/home/shmibs/Games/SleepIsDeath_v16_UnixSource/run.sh", "/home/shmibs/Games/SleepIsDeath_v16_UnixSource/sleepisdeath.png" }, +} + +myplgamesmenu = { +} + +mysisgamesmenu = { +} + +myemgamesmenu = { + { "M64Py", "m64py", "/home/shmibs/icons/mupen64plus.png" }, + { "mednafen", "mfe", "/home/shmibs/icons/mednafen.png" }, + { "snes9x", "snes9x-gtk", "/usr/share/icons/hicolor/16x16/apps/snes9x.png" }, +} + +mystgamesmenu = { + { "MCDroid", "/home/shmibs/Games/desura/common/mcdroid/desura_launch_Play.sh" }, +} + +myargamesmenu = { + { "voxatron", "voxatron" }, + { "Jamestown", "jamesown" }, + { "VVVVVV", "vvvvvv" }, + { "Steel Storm", "/home/shmibs/Games/desura/common/steel-storm/desura_launch_Play.sh" }, +} + +mypggamesmenu = { + { "DoD", "/home/shmibs/Games/desura/common/dungeons-of-dredmor/desura_launch_Play.sh" }, + { "Minecraft", "java -jar /home/shmibs/Games/minecraft/minecraft.jar" }, + { "Dwarf Fortress", "dwarffortress" }, +} + +myadgamesmenu = { + { "The Neverhood", "/usr/share/playonlinux/playonlinux --run \"The Neverhood\" %F" }, + { "Bastion", "bastion" }, + { "Fallout", "/home/shmibs/Games/desura/common/fallout/desura_launch_Play.sh" }, +} + +mypzgamesmenu = { + { "Night Sky", "nightsky-game" }, + { "splice", "splice-hib" }, +} + +mygamesmenu = { + { "Online", myongamesmenu }, + { "Platforming", myplgamesmenu }, + { "Simulation", mysigamesmenu }, + { "Emu", myemgamesmenu }, + { "Strategy", mystgamesmenu }, + { "Arcade", myargamesmenu }, + { "Proc-Gen", mypggamesmenu }, + { "Adventure", myadgamesmenu }, + { "Puzzle", mypzgamesmenu }, + { "desura", "/home/shmibs/Games/desura/desura" }, + { "desura -f", "/home/shmibs/Games/desura/desura -f" }, + { "playonlinux", "playonlinux" }, +} + +-- }} + +mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, "/home/shmibs/.icons/FaenzaWolfe/places/22/distributor-logo-archlinux.png" }, + { "internet", myinternetmenu, "/home/shmibs/.icons/FaenzaWolfe/categories/16/applications-internet.png" }, + { "games", mygamesmenu, "/home/shmibs/.icons/FaenzaWolfe/categories/16/applications-games.png" } + } + }) + +mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, + menu = mymainmenu }) + +-- Menubar configuration +menubar.utils.terminal = terminal -- Set the terminal for applications that require it +-- }}} + +-- {{{ Wibox +-- Create a textclock widget +mytextclock = awful.widget.textclock(" %a %b %d, %H:%M:%S ",1) + +-- Create two wiboxen for each screen and add them +mywibox = {} +mypromptbox = {} +mylayoutbox = {} +mytaglist = {} +mytaglist.buttons = awful.util.table.join( + awful.button({ }, 1, awful.tag.viewonly), + awful.button({ modkey }, 1, awful.client.movetotag), + awful.button({ }, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, awful.client.toggletag), + awful.button({ }, 5, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end), + awful.button({ }, 4, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end) + ) +mytasklist = {} +mytasklist.buttons = awful.util.table.join( + awful.button({ }, 1, function (c) + if c == client.focus then + -- disable minimisation + --~ c.minimized = true + else + -- Without this, the following + -- :isvisible() makes no sense + c.minimized = false + if not c:isvisible() then + awful.tag.viewonly(c:tags()[1]) + end + -- This will also un-minimize + -- the client, if needed + client.focus = c + c:raise() + end + end), + -- right click closes + awful.button({ }, 3, function (c) + c:kill() + --~ if instance then + --~ instance:hide() + --~ instance = nil + --~ else + --~ instance = awful.menu.clients({ width=250 }) + --~ end + + end), + awful.button({ }, 5, function () + awful.client.focus.byidx(1) + if client.focus then client.focus:raise() end + end), + awful.button({ }, 4, function () + awful.client.focus.byidx(-1) + if client.focus then client.focus:raise() end + end)) + +mywibox2 = {} +myssid = "N/A" + +-- Kernel +oswidget = wibox.widget.textbox() +vicious.register(oswidget, vicious.widgets.os, " $2", 600) +-- top process +procwidget = wibox.widget.textbox() +proctimer = timer{ timeout = 0 } +proctimer:connect_signal("timeout", function() + proctimer:stop() + procwidget:set_text(" | " .. awful.util.pread("ps -e --no-header --sort -%cpu -o comm | head -1")) + proctimer.timeout = 6 + proctimer:start() +end) +proctimer:start() +-- CPU TEMP +ctempwidget = wibox.widget.textbox() +vicious.register(ctempwidget, vicious.widgets.thermal, " CPU ($1° ", 4, "thermal_zone2") +-- CPU +cpuwidget = wibox.widget.textbox() +vicious.register(cpuwidget, vicious.widgets.cpu, "$2% $3% $4% $5%) |", 4) +-- RAM +memwidget = wibox.widget.textbox() +vicious.register(memwidget, vicious.widgets.mem, " RAM ($2 MB / $3 MB) | Swap ($6 MB / $7 MB)", 10) +-- ssid +wifiwidget = wibox.widget.textbox() +vicious.register(wifiwidget, vicious.widgets.wifi, + function (widget, args) + myssid = args["{ssid}"] + return '(' .. args["{ssid}"] .. ') ' + end, + 3, "wlp7s0") +-- speed ↑ ↓ +netwidget = wibox.widget.textbox() +vicious.register(netwidget, vicious.widgets.net, + function (widget, args) + --local down = tonumber(args["{enp3s0 down_kb}"]) + tonumber(args["{wpl7s0 down_kb}"]) + --local up = tonumber(args["{enp3s0 up_kb}"]) + tonumber(args["{wpl7s0 up_kb}"]) + + if myssid == "N/A" then + return '[ ↓' .. args["{enp3s0 down_kb}"] .. 'KiB, ↑' .. args["{enp3s0 up_kb}"] .. 'KiB ] ' + else + return '(' .. myssid .. ') [ ↓' .. args["{wlp7s0 down_kb}"] .. 'KiB, ↑' .. args["{wlp7s0 up_kb}"] .. 'KiB ] ' + end + end + ) + +--~ -- Weather +--~ weatherwidget = wibox.widget.textbox() +--~ vicious.register(weatherwidget, vicious.widgets.weather, "$1") + +for s = 1, screen.count() do + -- Create a promptbox for each screen + mypromptbox[s] = awful.widget.prompt() + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + mylayoutbox[s] = awful.widget.layoutbox(s) + mylayoutbox[s]:buttons(awful.util.table.join( + awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), + awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), + awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), + awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) + -- Create a taglist widget + mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) + + -- Create a tasklist widget + mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) + + -- Create the wibox + mywibox[s] = awful.wibox({ position = "top", screen = s, class = "Wibox" }) + if s == 1 then mywibox2 = awful.wibox({position = "bottom", screen = 1, class = "Wibox" }) end + + -- Widgets that are aligned to the left + local left_layout = wibox.layout.fixed.horizontal() + local left_layout2 = wibox.layout.fixed.horizontal() + left_layout:add(mylauncher) + left_layout:add(mytaglist[s]) + left_layout:add(mypromptbox[s]) + if s == 1 then + left_layout2:add(oswidget) + left_layout2:add(procwidget) + end + + -- Widgets that are aligned to the right + local right_layout = wibox.layout.fixed.horizontal() + local right_layout2 = wibox.layout.fixed.horizontal() + if s == 1 then right_layout:add(wibox.widget.systray()) end + right_layout:add(mytextclock) + right_layout:add(mylayoutbox[s]) + if s == 1 then + --~ right_layout2:add(wifiwidget) + right_layout2:add(netwidget) + end + + -- Widgets that are aligned to the bottom centre + local middle_layout2 = wibox.layout.fixed.horizontal() + if s == 1 then + middle_layout2:add(ctempwidget) + middle_layout2:add(cpuwidget) + middle_layout2:add(memwidget) + end + + -- Now bring it all together (with the tasklist in the middle) + local layout = wibox.layout.align.horizontal() + local layout2 = wibox.layout.align.horizontal() + layout:set_left(left_layout) + layout:set_middle(mytasklist[s]) + layout:set_right(right_layout) + if s == 1 then + layout2:set_left(left_layout2) + layout2:set_middle(middle_layout2) + layout2:set_right(right_layout2) + end + + mywibox[s]:set_widget(layout) + if s == 1 then mywibox2:set_widget(layout2) end +end +-- }}} + +-- {{{ Mouse bindings +root.buttons(awful.util.table.join( + awful.button({ }, 3, function () mymainmenu:toggle() end), + awful.button({ }, 5, awful.tag.viewnext), + awful.button({ }, 4, awful.tag.viewprev) +)) +-- }}} + +-- {{{ Key bindings +globalkeys = awful.util.table.join( + awful.key({ modkey, }, "Escape", awful.tag.history.restore), + + awful.key({ modkey, }, "a", + function () + awful.client.focus.byidx(-1) + if client.focus then client.focus:raise() end + end), + awful.key({ modkey, }, "d", + function () + awful.client.focus.byidx( 1) + if client.focus then client.focus:raise() end + end), + + --~ awful.key({ modkey, }, "Tab", + --~ function () + --~ awful.client.focus.history.previous() + --~ if client.focus then + --~ client.focus:raise() + --~ end + --~ end), + + -- power button + awful.key({ }, "XF86PowerOff", function () awful.util.spawn_with_shell("mate-session-save --shutdown-dialog") end), + + -- banshee commands + awful.key({ modkey, "Shift" }, "Up", function () awful.util.spawn_with_shell("banshee --show") end), + awful.key({ modkey, "Shift" }, "Down", function () awful.util.spawn_with_shell("banshee --hide") end), + awful.key({ modkey, }, "Left", function () awful.util.spawn_with_shell("banshee --restart-or-previous") end), + awful.key({ modkey, }, "Right", function () awful.util.spawn_with_shell("banshee --next") end), + awful.key({ modkey, }, "Down", function () awful.util.spawn_with_shell("banshee --toggle-playing") end), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn_with_shell(terminal) end), + awful.key({ modkey, "Shift" }, "f", function () awful.util.spawn_with_shell("firefox") end), + awful.key({ modkey, "Shift" }, "g", function () awful.util.spawn_with_shell("geany") end), + awful.key({ modkey, "Shift" }, "i", function () awful.util.spawn_with_shell("gimp") end), + awful.key({ modkey, "Shift" }, "w", function () awful.util.spawn_with_shell("mathematica") end), + awful.key({ modkey, "Shift" }, "c", function () awful.util.spawn_with_shell("mate-calc") end), + awful.key({ modkey, "Shift" }, "l", function () awful.util.spawn_with_shell("liferea") end), + awful.key({ modkey, "Shift" }, "v", function () awful.util.spawn_with_shell("mate-terminal -e \"vim\"") end), + awful.key({ modkey, "Shift" }, "x", function () awful.util.spawn_with_shell("mcomix") end), + awful.key({ modkey, "Shift" }, "s", function () awful.util.spawn_with_shell("pavucontrol") end), + awful.key({ modkey, }, "#19", function () awful.util.spawn_with_shell("dmenu_run -fn \"TI Calc Fonts Clean-8\" -h 16 -nb \"#333333\" -nf \"#FCFCFC\" -sb \"#7a658f\" -sf \"#FCFCFC\"") end), + awful.key({ }, "Print", function () awful.util.spawn_with_shell("mate-screenshot") end), + + -- bindings for quick access to folders + awful.key({modkey, "Shift", "Control" }, "Return" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs\"") end), + awful.key({modkey, "Shift", "Control" }, "d" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/Downloads\"") end), + awful.key({modkey, "Shift", "Control" }, "s" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/Desktop\"") end), + awful.key({modkey, "Shift", "Control" }, "m" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/Music\"") end), + awful.key({modkey, "Shift", "Control" }, "g" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/Games\"") end), + awful.key({modkey, "Shift", "Control" }, "p" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/projects\"") end), + awful.key({modkey, "Shift", "Control" }, "r" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/ROMz\"") end), + awful.key({modkey, "Shift", "Control" }, "c" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/comics\"") end), + awful.key({modkey, "Shift", "Control" }, "o" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/iso\"") end), + awful.key({modkey, "Shift", "Control" }, "i" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/Images\"") end), + awful.key({modkey, "Shift", "Control" }, "b" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/backdrops\"") end), + awful.key({modkey, "Shift", "Control" }, "t" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/thcool\"") end), + awful.key({modkey, "Shift", "Control" }, "v" , function () awful.util.spawn_with_shell(terminal .. " -t ranger -e \"ranger /home/shmibs/Videos\"") end), + + -- focus and swap by direction. + awful.key({ modkey, }, "k", function () awful.client.focus.bydirection( "up" ) + if client.focus then client.focus:raise() end + end), + awful.key({ modkey, }, "j", function () awful.client.focus.bydirection( "down" ) + if client.focus then client.focus:raise() end + end), + awful.key({ modkey, }, "h", function () awful.client.focus.bydirection( "left" ) + if client.focus then client.focus:raise() end + end), + awful.key({ modkey, }, "l", function () awful.client.focus.bydirection( "right" ) + if client.focus then client.focus:raise() end + end), + awful.key({ modkey, "Control" }, "k", function () awful.client.swap.bydirection( "up" ) end), + awful.key({ modkey, "Control" }, "j", function () awful.client.swap.bydirection( "down" ) end), + awful.key({ modkey, "Control" }, "h", function () awful.client.swap.bydirection( "left" ) end), + awful.key({ modkey, "Control" }, "l", function () awful.client.swap.bydirection( "right" ) end), + + -- switch between screens + awful.key({ modkey, }, "s", function() + awful.screen.focus_relative(1) + end), + + -- switch between window layouts + awful.key({ modkey, }, "space", function () + awful.layout.inc(layouts, 1) + end), + awful.key({ modkey, "Shift" }, "space", function () + awful.layout.inc(layouts, -1) + end), + + -- show menu + awful.key({ modkey, }, "w", function () mymainmenu:show() end), + + -- restart + awful.key({ modkey, "Control" }, "r", awesome.restart) +) + +clientkeys = awful.util.table.join( + -- rotate the screen of the current client + awful.key({ modkey, "Control" }, "s", + function(c) + awful.screen.focus_relative(1) + awful.client.movetoscreen(c, mouse.screen) + awful.client.jumpto(c) + end), + + awful.key({ modkey, "Shift" }, "q", + function (c) + if c.type ~= "dock" and c.type ~= "desktop" then + c.fullscreen = not c.fullscreen + end + end), + awful.key({ modkey, }, "e", + function (c) + if c.type ~= "dock" and c.type ~= "desktop" then + if c.class ~= "Ftjerm" then + c:kill() + end + end + end), + awful.key({ modkey, }, "t", + function (c) + if c.type ~= "dock" and c.type ~= "desktop" then + c.ontop = not c.ontop + end + end), + awful.key({ modkey, }, "q", + function (c) + if c.type ~= "dock" and c.type ~= "desktop" then + if c.maximized_horizontal == true or c.maximized_vertical == true then + --~ c.border_width = beautiful.border_width + c.maximized_horizontal = false + c.maximized_vertical = false + else + --~ c.border_width = 0 + c.maximized_horizontal = true + c.maximized_vertical = true + end + end + end) +) + +-- Bind all key numbers to tags. +-- Be careful: we use keycodes to make it works on any keyboard layout. +-- This should map on the top row of your keyboard, usually 1 to 9. +for i = 1, 9 do + globalkeys = awful.util.table.join(globalkeys, + awful.key({ modkey }, "#" .. i + 9, + function () + local screen = mouse.screen + local tag = awful.tag.gettags(screen)[i] + if tag then + awful.tag.viewonly(tag) + end + end), + awful.key({ modkey, "Control" }, "#" .. i + 9, + function () + local tag = awful.tag.gettags(client.focus.screen)[i] + if client.focus and tag then + awful.client.movetotag(tag) + end + end)) +end + +clientbuttons = awful.util.table.join( + awful.button({ }, 1, function (c) + if c.type ~= "dock" and c.type ~= "desktop" then + client.focus = c; + c:raise() + end + end), + awful.button({ "Mod1" }, 1, awful.mouse.client.move), + awful.button({ "Mod1", "Shift" }, 1, awful.mouse.client.resize)) + +-- Set keys +root.keys(globalkeys) +-- }}} + +-- {{{ Rules +awful.rules.rules = { + -- All clients will match this rule. + { rule = { }, + properties = { border_width = beautiful.border_width, + border_color = beautiful.border_normal, + maximized_horizontal = false, + maximized_vertical = false, + focus = awful.client.focus.filter, + keys = clientkeys, + buttons = clientbuttons } }, + { rule = { type = "desktop" }, + properties = { border_width = 0, + sticky = true, + floating = true } }, + { rule = { class = "banshee" }, + properties = { floating = true, + maximized_vertical = true, + maximized_horizontal = true } }, + { rule_any = { type = { "splash" }, name = { "ftjerm" } }, + properties = { border_width = 0, + floating = true, + ontop = true } }, + { rule_any = { type = { "Dialog" }, name = { "plugin-container", "Firefox Preferences", "File Operation Progress" }, class = { "Wine", "M64py", "Pcsx2", "MPlayer", "pinentry", "Gimp", "pavucontrol" } }, + properties = { floating = true } }, + { rule_any = { role = { "gimp-image-window" } }, + properties = { floating = false } } +} +-- }}} + +-- {{{ Signals + +--~ -- Switch focus to screen upon mouse entry +--~ for s = 1, screen.count() do + --~ screen[s]:connect_signal("mouse::enter", function(s) + --~ screen.focus(s) + --~ client.focus = client.focus.history.get(s) + --~ end) +--~ end + +-- Signal function to execute when a new client appears. +client.connect_signal("manage", function (c, startup) + if c.type == "desktop" then + c:unmanage() + else + -- Enable sloppy focus + --~ c:connect_signal("mouse::enter", function(c) + --~ if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + --~ and awful.client.focus.filter(c) then + --~ client.focus = c + --~ end + --~ end) + + if not startup then + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Put windows in a smart way, only if they does not set an initial position. + if not c.size_hints.user_position and not c.size_hints.program_position then + awful.placement.no_overlap(c) + awful.placement.no_offscreen(c) + end + end + + local titlebars_enabled = false + if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then + -- buttons for the titlebar + local buttons = awful.util.table.join( + awful.button({ }, 1, function() + client.focus = c + c:raise() + awful.mouse.client.move(c) + end), + awful.button({ }, 3, function() + client.focus = c + c:raise() + awful.mouse.client.resize(c) + end) + ) + + -- Widgets that are aligned to the left + local left_layout = wibox.layout.fixed.horizontal() + left_layout:add(awful.titlebar.widget.iconwidget(c)) + left_layout:buttons(buttons) + + -- Widgets that are aligned to the right + local right_layout = wibox.layout.fixed.horizontal() + right_layout:add(awful.titlebar.widget.floatingbutton(c)) + right_layout:add(awful.titlebar.widget.maximizedbutton(c)) + right_layout:add(awful.titlebar.widget.stickybutton(c)) + right_layout:add(awful.titlebar.widget.ontopbutton(c)) + right_layout:add(awful.titlebar.widget.closebutton(c)) + + -- The title goes in the middle + local middle_layout = wibox.layout.flex.horizontal() + local title = awful.titlebar.widget.titlewidget(c) + title:set_align("center") + middle_layout:add(title) + middle_layout:buttons(buttons) + + -- Now bring it all together + local layout = wibox.layout.align.horizontal() + layout:set_left(left_layout) + layout:set_right(right_layout) + layout:set_middle(middle_layout) + + awful.titlebar(c):set_widget(layout) + end + end +end) + +client.connect_signal("focus", function(c) + c:raise() + c.border_color = beautiful.border_focus + c.opacity = 1.0 +end) +client.connect_signal("unfocus", function(c) + c.border_color = beautiful.border_normal + -- Uncomment to make unfocused terminals transparent when not in "max" mode + --if awful.layout.getname(awful.layout.get(mouse.screen)) ~= "max" then + -- if c.class == "Mate-terminal" then + -- c.opacity = 0.8 + -- end + --end +end) +-- }}} diff --git a/.config/awesome/themes/current b/.config/awesome/themes/current new file mode 120000 index 0000000..89917c7 --- /dev/null +++ b/.config/awesome/themes/current @@ -0,0 +1 @@ +gits/
\ No newline at end of file diff --git a/.config/awesome/themes/gits/awesome-icon.png b/.config/awesome/themes/gits/awesome-icon.png Binary files differnew file mode 100644 index 0000000..ec2a22d --- /dev/null +++ b/.config/awesome/themes/gits/awesome-icon.png diff --git a/.config/awesome/themes/gits/backdrop.jpg b/.config/awesome/themes/gits/backdrop.jpg Binary files differnew file mode 100644 index 0000000..15de50b --- /dev/null +++ b/.config/awesome/themes/gits/backdrop.jpg diff --git a/.config/awesome/themes/gits/layouts/big/dwindle.png b/.config/awesome/themes/gits/layouts/big/dwindle.png Binary files differnew file mode 100644 index 0000000..df0cbff --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/dwindle.png diff --git a/.config/awesome/themes/gits/layouts/big/fairh.png b/.config/awesome/themes/gits/layouts/big/fairh.png Binary files differnew file mode 100644 index 0000000..bf81e12 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/fairh.png diff --git a/.config/awesome/themes/gits/layouts/big/fairv.png b/.config/awesome/themes/gits/layouts/big/fairv.png Binary files differnew file mode 100644 index 0000000..06fdde4 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/fairv.png diff --git a/.config/awesome/themes/gits/layouts/big/floating.png b/.config/awesome/themes/gits/layouts/big/floating.png Binary files differnew file mode 100644 index 0000000..56de86b --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/floating.png diff --git a/.config/awesome/themes/gits/layouts/big/fullscreen.png b/.config/awesome/themes/gits/layouts/big/fullscreen.png Binary files differnew file mode 100644 index 0000000..9561be8 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/fullscreen.png diff --git a/.config/awesome/themes/gits/layouts/big/magnifier.png b/.config/awesome/themes/gits/layouts/big/magnifier.png Binary files differnew file mode 100644 index 0000000..8cc1698 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/magnifier.png diff --git a/.config/awesome/themes/gits/layouts/big/max.png b/.config/awesome/themes/gits/layouts/big/max.png Binary files differnew file mode 100644 index 0000000..e6ffd1c --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/max.png diff --git a/.config/awesome/themes/gits/layouts/big/spiral.png b/.config/awesome/themes/gits/layouts/big/spiral.png Binary files differnew file mode 100644 index 0000000..2bb2751 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/spiral.png diff --git a/.config/awesome/themes/gits/layouts/big/tile.png b/.config/awesome/themes/gits/layouts/big/tile.png Binary files differnew file mode 100644 index 0000000..a3f4435 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/tile.png diff --git a/.config/awesome/themes/gits/layouts/big/tilebottom.png b/.config/awesome/themes/gits/layouts/big/tilebottom.png Binary files differnew file mode 100644 index 0000000..44742a0 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/tilebottom.png diff --git a/.config/awesome/themes/gits/layouts/big/tileleft.png b/.config/awesome/themes/gits/layouts/big/tileleft.png Binary files differnew file mode 100644 index 0000000..99220f0 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/tileleft.png diff --git a/.config/awesome/themes/gits/layouts/big/tiletop.png b/.config/awesome/themes/gits/layouts/big/tiletop.png Binary files differnew file mode 100644 index 0000000..ef7729f --- /dev/null +++ b/.config/awesome/themes/gits/layouts/big/tiletop.png diff --git a/.config/awesome/themes/gits/layouts/dwindle.png b/.config/awesome/themes/gits/layouts/dwindle.png Binary files differnew file mode 100644 index 0000000..df0cbff --- /dev/null +++ b/.config/awesome/themes/gits/layouts/dwindle.png diff --git a/.config/awesome/themes/gits/layouts/fairh.png b/.config/awesome/themes/gits/layouts/fairh.png Binary files differnew file mode 100644 index 0000000..bf81e12 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/fairh.png diff --git a/.config/awesome/themes/gits/layouts/fairv.png b/.config/awesome/themes/gits/layouts/fairv.png Binary files differnew file mode 100644 index 0000000..b6b15d3 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/fairv.png diff --git a/.config/awesome/themes/gits/layouts/floating.png b/.config/awesome/themes/gits/layouts/floating.png Binary files differnew file mode 100644 index 0000000..56de86b --- /dev/null +++ b/.config/awesome/themes/gits/layouts/floating.png diff --git a/.config/awesome/themes/gits/layouts/fullscreen.png b/.config/awesome/themes/gits/layouts/fullscreen.png Binary files differnew file mode 100644 index 0000000..9561be8 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/fullscreen.png diff --git a/.config/awesome/themes/gits/layouts/magnifier.png b/.config/awesome/themes/gits/layouts/magnifier.png Binary files differnew file mode 100644 index 0000000..8cc1698 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/magnifier.png diff --git a/.config/awesome/themes/gits/layouts/max.png b/.config/awesome/themes/gits/layouts/max.png Binary files differnew file mode 100644 index 0000000..7819398 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/max.png diff --git a/.config/awesome/themes/gits/layouts/spiral.png b/.config/awesome/themes/gits/layouts/spiral.png Binary files differnew file mode 100644 index 0000000..2bb2751 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/spiral.png diff --git a/.config/awesome/themes/gits/layouts/tile.png b/.config/awesome/themes/gits/layouts/tile.png Binary files differnew file mode 100644 index 0000000..eaa469c --- /dev/null +++ b/.config/awesome/themes/gits/layouts/tile.png diff --git a/.config/awesome/themes/gits/layouts/tilebottom.png b/.config/awesome/themes/gits/layouts/tilebottom.png Binary files differnew file mode 100644 index 0000000..44742a0 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/tilebottom.png diff --git a/.config/awesome/themes/gits/layouts/tileleft.png b/.config/awesome/themes/gits/layouts/tileleft.png Binary files differnew file mode 100644 index 0000000..99220f0 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/tileleft.png diff --git a/.config/awesome/themes/gits/layouts/tiletop.png b/.config/awesome/themes/gits/layouts/tiletop.png Binary files differnew file mode 100644 index 0000000..ef7729f --- /dev/null +++ b/.config/awesome/themes/gits/layouts/tiletop.png diff --git a/.config/awesome/themes/gits/layouts/uselessfair.png b/.config/awesome/themes/gits/layouts/uselessfair.png Binary files differnew file mode 100644 index 0000000..0182a42 --- /dev/null +++ b/.config/awesome/themes/gits/layouts/uselessfair.png diff --git a/.config/awesome/themes/gits/layouts/uselesstile.png b/.config/awesome/themes/gits/layouts/uselesstile.png Binary files differnew file mode 100644 index 0000000..6d4a18c --- /dev/null +++ b/.config/awesome/themes/gits/layouts/uselesstile.png diff --git a/.config/awesome/themes/gits/submenu.png b/.config/awesome/themes/gits/submenu.png Binary files differnew file mode 100644 index 0000000..a723e10 --- /dev/null +++ b/.config/awesome/themes/gits/submenu.png diff --git a/.config/awesome/themes/gits/taglist/squarefz.png b/.config/awesome/themes/gits/taglist/squarefz.png Binary files differnew file mode 100644 index 0000000..2172561 --- /dev/null +++ b/.config/awesome/themes/gits/taglist/squarefz.png diff --git a/.config/awesome/themes/gits/taglist/squarez.png b/.config/awesome/themes/gits/taglist/squarez.png Binary files differnew file mode 100644 index 0000000..870d6d8 --- /dev/null +++ b/.config/awesome/themes/gits/taglist/squarez.png diff --git a/.config/awesome/themes/gits/theme.lua b/.config/awesome/themes/gits/theme.lua new file mode 100644 index 0000000..6e9ac30 --- /dev/null +++ b/.config/awesome/themes/gits/theme.lua @@ -0,0 +1,134 @@ +------------------------------- +-- "current" current theme -- +-- By Adrian C. (anrxc) -- +------------------------------- + +-- Alternative icon sets and widget icons: +-- * http://current.naquadah.org/wiki/Nice_Icons + +-- {{{ Main +theme = {} +theme.directory = "/home/shmibs/.config/awesome/themes/current/" +theme.wallpaper = theme.directory .. "backdrop.jpg" + +-- }}} + +-- {{{ Styles +theme.font = "TI Calc Fonts Clean 8" + +-- {{{ Colors +theme.fg_focus = "#FCFCFC" +theme.fg_normal = "#FCFCFC" +theme.fg_urgent = "#FCFCFC" +theme.bg_focus = "#7a658f" +theme.bg_normal = "#333333" +theme.bg_urgent = "#df3c29" +theme.bg_systray = theme.bg_normal +-- }}} + +-- {{{ Borders +theme.border_width = 2 +theme.border_focus = theme.bg_focus +theme.border_normal = theme.bg_normal +theme.border_marked = theme.bg_urgent +-- }}} + +-- {{{ Titlebars +theme.titlebar_bg_normal = "#93A8C2" +theme.titlebar_bg_focus = "#7F91A7" +-- }}} + +-- There are other variable sets +-- overriding the default one when +-- defined, the sets are: +-- [taglist|tasklist]_[bg|fg]_[focus|urgent] +-- titlebar_[normal|focus] +-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color] +-- Example: +--theme.taglist_bg_focus = "#CC9393" +-- }}} + +-- {{{ Widgets +-- You can add as many variables as +-- you wish and access them by using +-- beautiful.variable in your rc.lua +--theme.fg_widget = "#AECF96" +--theme.fg_center_widget = "#88A175" +--theme.fg_end_widget = "#FF5656" +--theme.bg_widget = "#494B4F" +--theme.border_widget = "#3F3F3F" +-- }}} + +-- {{{ Mouse finder +theme.mouse_finder_color = "#79412E" +-- mouse_finder_[timeout|animate_timeout|radius|factor] +-- }}} + +-- {{{ Menu +-- Variables set for theming the menu: +-- menu_[bg|fg]_[normal|focus] +-- menu_[border_color|border_width] +theme.menu_height = 15 +theme.menu_width = 108 +-- }}} + +-- {{{ lain +theme.useless_gap_width = 10 +-- }}} + +-- {{{ Icons +-- {{{ Taglist +theme.taglist_squares_sel = theme.directory .. "taglist/squarefz.png" +theme.taglist_squares_unsel = theme.directory .. "taglist/squarez.png" +--theme.taglist_squares_resize = "false" +-- }}} + +-- {{{ Misc +theme.awesome_icon = theme.directory .. "awesome-icon.png" +theme.menu_submenu_icon = theme.directory .. "submenu.png" +-- }}} + +-- {{{ Layout +theme.layout_tile = theme.directory .. "layouts/tile.png" +theme.layout_tileleft = theme.directory .. "layouts/tileleft.png" +theme.layout_tilebottom = theme.directory .. "layouts/tilebottom.png" +theme.layout_tiletop = theme.directory .. "layouts/tiletop.png" +theme.layout_uselesstile= theme.directory .. "layouts/tile.png" +theme.layout_fairv = theme.directory .. "layouts/fairv.png" +theme.layout_fairh = theme.directory .. "layouts/fairh.png" +theme.layout_uselessfair= theme.directory .. "layouts/fairv.png" +theme.layout_spiral = theme.directory .. "layouts/spiral.png" +theme.layout_dwindle = theme.directory .. "layouts/dwindle.png" +theme.layout_max = theme.directory .. "layouts/max.png" +theme.layout_fullscreen = theme.directory .. "layouts/fullscreen.png" +theme.layout_magnifier = theme.directory .. "layouts/magnifier.png" +theme.layout_floating = theme.directory .. "layouts/floating.png" +-- }}} + +-- {{{ Titlebar +theme.titlebar_close_button_focus = theme.directory .. "titlebar/close_focus.png" +theme.titlebar_close_button_normal = theme.directory .. "titlebar/close_normal.png" + +theme.titlebar_ontop_button_focus_active = theme.directory .. "titlebar/ontop_focus_active.png" +theme.titlebar_ontop_button_normal_active = theme.directory .. "titlebar/ontop_normal_active.png" +theme.titlebar_ontop_button_focus_inactive = theme.directory .. "titlebar/ontop_focus_inactive.png" +theme.titlebar_ontop_button_normal_inactive = theme.directory .. "titlebar/ontop_normal_inactive.png" + +theme.titlebar_sticky_button_focus_active = theme.directory .. "titlebar/sticky_focus_active.png" +theme.titlebar_sticky_button_normal_active = theme.directory .. "titlebar/sticky_normal_active.png" +theme.titlebar_sticky_button_focus_inactive = theme.directory .. "titlebar/sticky_focus_inactive.png" +theme.titlebar_sticky_button_normal_inactive = theme.directory .. "titlebar/sticky_normal_inactive.png" + +theme.titlebar_floating_button_focus_active = theme.directory .. "titlebar/floating_focus_active.png" +theme.titlebar_floating_button_normal_active = theme.directory .. "titlebar/floating_normal_active.png" +theme.titlebar_floating_button_focus_inactive = theme.directory .. "titlebar/floating_focus_inactive.png" +theme.titlebar_floating_button_normal_inactive = theme.directory .. "titlebar/floating_normal_inactive.png" + +theme.titlebar_maximized_button_focus_active = theme.directory .. "titlebar/maximized_focus_active.png" +theme.titlebar_maximized_button_normal_active = theme.directory .. "titlebar/maximized_normal_active.png" +theme.titlebar_maximized_button_focus_inactive = theme.directory .. "titlebar/maximized_focus_inactive.png" +theme.titlebar_maximized_button_normal_inactive = theme.directory .. "titlebar/maximized_normal_inactive.png" +-- }}} +-- }}} + +return theme diff --git a/.config/awesome/themes/gits/titlebar/close_focus.png b/.config/awesome/themes/gits/titlebar/close_focus.png Binary files differnew file mode 100644 index 0000000..e9b4179 --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/close_focus.png diff --git a/.config/awesome/themes/gits/titlebar/close_normal.png b/.config/awesome/themes/gits/titlebar/close_normal.png Binary files differnew file mode 100644 index 0000000..9c8d3ba --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/close_normal.png diff --git a/.config/awesome/themes/gits/titlebar/floating_focus_active.png b/.config/awesome/themes/gits/titlebar/floating_focus_active.png Binary files differnew file mode 100644 index 0000000..0f9ee0d --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/floating_focus_active.png diff --git a/.config/awesome/themes/gits/titlebar/floating_focus_inactive.png b/.config/awesome/themes/gits/titlebar/floating_focus_inactive.png Binary files differnew file mode 100644 index 0000000..7973f6a --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/floating_focus_inactive.png diff --git a/.config/awesome/themes/gits/titlebar/floating_normal_active.png b/.config/awesome/themes/gits/titlebar/floating_normal_active.png Binary files differnew file mode 100644 index 0000000..403b2e9 --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/floating_normal_active.png diff --git a/.config/awesome/themes/gits/titlebar/floating_normal_inactive.png b/.config/awesome/themes/gits/titlebar/floating_normal_inactive.png Binary files differnew file mode 100644 index 0000000..829e223 --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/floating_normal_inactive.png diff --git a/.config/awesome/themes/gits/titlebar/maximized_focus_active.png b/.config/awesome/themes/gits/titlebar/maximized_focus_active.png Binary files differnew file mode 100644 index 0000000..7e8498a --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/maximized_focus_active.png diff --git a/.config/awesome/themes/gits/titlebar/maximized_focus_inactive.png b/.config/awesome/themes/gits/titlebar/maximized_focus_inactive.png Binary files differnew file mode 100644 index 0000000..46d3f96 --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/maximized_focus_inactive.png diff --git a/.config/awesome/themes/gits/titlebar/maximized_normal_active.png b/.config/awesome/themes/gits/titlebar/maximized_normal_active.png Binary files differnew file mode 100644 index 0000000..2ebf811 --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/maximized_normal_active.png diff --git a/.config/awesome/themes/gits/titlebar/maximized_normal_inactive.png b/.config/awesome/themes/gits/titlebar/maximized_normal_inactive.png Binary files differnew file mode 100644 index 0000000..524fc5c --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/maximized_normal_inactive.png diff --git a/.config/awesome/themes/gits/titlebar/ontop_focus_active.png b/.config/awesome/themes/gits/titlebar/ontop_focus_active.png Binary files differnew file mode 100644 index 0000000..86e61b7 --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/ontop_focus_active.png diff --git a/.config/awesome/themes/gits/titlebar/ontop_focus_inactive.png b/.config/awesome/themes/gits/titlebar/ontop_focus_inactive.png Binary files differnew file mode 100644 index 0000000..3bee67e --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/ontop_focus_inactive.png diff --git a/.config/awesome/themes/gits/titlebar/ontop_normal_active.png b/.config/awesome/themes/gits/titlebar/ontop_normal_active.png Binary files differnew file mode 100644 index 0000000..4d78f44 --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/ontop_normal_active.png diff --git a/.config/awesome/themes/gits/titlebar/ontop_normal_inactive.png b/.config/awesome/themes/gits/titlebar/ontop_normal_inactive.png Binary files differnew file mode 100644 index 0000000..9809c2c --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/ontop_normal_inactive.png diff --git a/.config/awesome/themes/gits/titlebar/sticky_focus_active.png b/.config/awesome/themes/gits/titlebar/sticky_focus_active.png Binary files differnew file mode 100644 index 0000000..b10e604 --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/sticky_focus_active.png diff --git a/.config/awesome/themes/gits/titlebar/sticky_focus_inactive.png b/.config/awesome/themes/gits/titlebar/sticky_focus_inactive.png Binary files differnew file mode 100644 index 0000000..cf953c4 --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/sticky_focus_inactive.png diff --git a/.config/awesome/themes/gits/titlebar/sticky_normal_active.png b/.config/awesome/themes/gits/titlebar/sticky_normal_active.png Binary files differnew file mode 100644 index 0000000..607a55c --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/sticky_normal_active.png diff --git a/.config/awesome/themes/gits/titlebar/sticky_normal_inactive.png b/.config/awesome/themes/gits/titlebar/sticky_normal_inactive.png Binary files differnew file mode 100644 index 0000000..82161e9 --- /dev/null +++ b/.config/awesome/themes/gits/titlebar/sticky_normal_inactive.png diff --git a/.config/ranger/commands.py b/.config/ranger/commands.py new file mode 100644 index 0000000..4d290e7 --- /dev/null +++ b/.config/ranger/commands.py @@ -0,0 +1,1244 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> +# This configuration file is licensed under the same terms as ranger. +# =================================================================== +# This file contains ranger's commands. +# It's all in python; lines beginning with # are comments. +# +# Note that additional commands are automatically generated from the methods +# of the class ranger.core.actions.Actions. +# +# You can customize commands in the file ~/.config/ranger/commands.py. +# It has the same syntax as this file. In fact, you can just copy this +# file there with `ranger --copy-config=commands' and make your modifications. +# But make sure you update your configs when you update ranger. +# +# =================================================================== +# Every class defined here which is a subclass of `Command' will be used as a +# command in ranger. Several methods are defined to interface with ranger: +# execute(): called when the command is executed. +# cancel(): called when closing the console. +# tab(): called when <TAB> is pressed. +# quick(): called after each keypress. +# +# The return values for tab() can be either: +# None: There is no tab completion +# A string: Change the console to this string +# A list/tuple/generator: cycle through every item in it +# +# The return value for quick() can be: +# False: Nothing happens +# True: Execute the command afterwards +# +# The return value for execute() and cancel() doesn't matter. +# +# =================================================================== +# Commands have certain attributes and methods that facilitate parsing of +# the arguments: +# +# self.line: The whole line that was written in the console. +# self.args: A list of all (space-separated) arguments to the command. +# self.quantifier: If this command was mapped to the key "X" and +# the user pressed 6X, self.quantifier will be 6. +# self.arg(n): The n-th argument, or an empty string if it doesn't exist. +# self.rest(n): The n-th argument plus everything that followed. For example, +# If the command was "search foo bar a b c", rest(2) will be "bar a b c" +# self.start(n): The n-th argument and anything before it. For example, +# If the command was "search foo bar a b c", rest(2) will be "bar a b c" +# +# =================================================================== +# And this is a little reference for common ranger functions and objects: +# +# self.fm: A reference to the "fm" object which contains most information +# about ranger. +# self.fm.notify(string): Print the given string on the screen. +# self.fm.notify(string, bad=True): Print the given string in RED. +# self.fm.reload_cwd(): Reload the current working directory. +# self.fm.thisdir: The current working directory. (A File object.) +# self.fm.thisfile: The current file. (A File object too.) +# self.fm.thistab.get_selection(): A list of all selected files. +# self.fm.execute_console(string): Execute the string as a ranger command. +# self.fm.open_console(string): Open the console with the given string +# already typed in for you. +# self.fm.move(direction): Moves the cursor in the given direction, which +# can be something like down=3, up=5, right=1, left=1, to=6, ... +# +# File objects (for example self.fm.thisfile) have these useful attributes and +# methods: +# +# cf.path: The path to the file. +# cf.basename: The base name only. +# cf.load_content(): Force a loading of the directories content (which +# obviously works with directories only) +# cf.is_directory: True/False depending on whether it's a directory. +# +# For advanced commands it is unavoidable to dive a bit into the source code +# of ranger. +# =================================================================== + +from ranger.api.commands import * + +class alias(Command): + """:alias <newcommand> <oldcommand> + + Copies the oldcommand as newcommand. + """ + + context = 'browser' + resolve_macros = False + + def execute(self): + if not self.arg(1) or not self.arg(2): + self.fm.notify('Syntax: alias <newcommand> <oldcommand>', bad=True) + else: + self.fm.commands.alias(self.arg(1), self.rest(2)) + +class cd(Command): + """:cd [-r] <dirname> + + The cd command changes the directory. + The command 'cd -' is equivalent to typing ``. + Using the option "-r" will get you to the real path. + """ + + def execute(self): + import os.path + if self.arg(1) == '-r': + self.shift() + destination = os.path.realpath(self.rest(1)) + if os.path.isfile(destination): + destination = os.path.dirname(destination) + else: + destination = self.rest(1) + + if not destination: + destination = '~' + + if destination == '-': + self.fm.enter_bookmark('`') + else: + self.fm.cd(destination) + + def tab(self): + import os + from os.path import dirname, basename, expanduser, join + + cwd = self.fm.thisdir.path + rel_dest = self.rest(1) + + bookmarks = [v.path for v in self.fm.bookmarks.dct.values() + if rel_dest in v.path ] + + # expand the tilde into the user directory + if rel_dest.startswith('~'): + rel_dest = expanduser(rel_dest) + + # define some shortcuts + abs_dest = join(cwd, rel_dest) + abs_dirname = dirname(abs_dest) + rel_basename = basename(rel_dest) + rel_dirname = dirname(rel_dest) + + try: + # are we at the end of a directory? + if rel_dest.endswith('/') or rel_dest == '': + _, dirnames, _ = next(os.walk(abs_dest)) + + # are we in the middle of the filename? + else: + _, dirnames, _ = next(os.walk(abs_dirname)) + dirnames = [dn for dn in dirnames \ + if dn.startswith(rel_basename)] + except (OSError, StopIteration): + # os.walk found nothing + pass + else: + dirnames.sort() + dirnames = bookmarks + dirnames + + # no results, return None + if len(dirnames) == 0: + return + + # one result. since it must be a directory, append a slash. + if len(dirnames) == 1: + return self.start(1) + join(rel_dirname, dirnames[0]) + '/' + + # more than one result. append no slash, so the user can + # manually type in the slash to advance into that directory + return (self.start(1) + join(rel_dirname, dirname) for dirname in dirnames) + + +class chain(Command): + """:chain <command1>; <command2>; ... + + Calls multiple commands at once, separated by semicolons. + """ + def execute(self): + for command in self.rest(1).split(";"): + self.fm.execute_console(command) + + +class shell(Command): + escape_macros_for_shell = True + + def execute(self): + if self.arg(1) and self.arg(1)[0] == '-': + flags = self.arg(1)[1:] + command = self.rest(2) + else: + flags = '' + command = self.rest(1) + + if not command and 'p' in flags: + command = 'cat %f' + if command: + if '%' in command: + command = self.fm.substitute_macros(command, escape=True) + self.fm.execute_command(command, flags=flags) + + def tab(self): + from ranger.ext.get_executables import get_executables + if self.arg(1) and self.arg(1)[0] == '-': + command = self.rest(2) + else: + command = self.rest(1) + start = self.line[0:len(self.line) - len(command)] + + try: + position_of_last_space = command.rindex(" ") + except ValueError: + return (start + program + ' ' for program \ + in get_executables() if program.startswith(command)) + if position_of_last_space == len(command) - 1: + selection = self.fm.thistab.get_selection() + if len(selection) == 1: + return self.line + selection[0].shell_escaped_basename + ' ' + else: + return self.line + '%s ' + else: + before_word, start_of_word = self.line.rsplit(' ', 1) + return (before_word + ' ' + file.shell_escaped_basename \ + for file in self.fm.thisdir.files \ + if file.shell_escaped_basename.startswith(start_of_word)) + +class open_with(Command): + def execute(self): + app, flags, mode = self._get_app_flags_mode(self.rest(1)) + self.fm.execute_file( + files = [f for f in self.fm.thistab.get_selection()], + app = app, + flags = flags, + mode = mode) + + def tab(self): + return self._tab_through_executables() + + def _get_app_flags_mode(self, string): + """Extracts the application, flags and mode from a string. + + examples: + "mplayer f 1" => ("mplayer", "f", 1) + "aunpack 4" => ("aunpack", "", 4) + "p" => ("", "p", 0) + "" => None + """ + + app = '' + flags = '' + mode = 0 + split = string.split() + + if len(split) == 0: + pass + + elif len(split) == 1: + part = split[0] + if self._is_app(part): + app = part + elif self._is_flags(part): + flags = part + elif self._is_mode(part): + mode = part + + elif len(split) == 2: + part0 = split[0] + part1 = split[1] + + if self._is_app(part0): + app = part0 + if self._is_flags(part1): + flags = part1 + elif self._is_mode(part1): + mode = part1 + elif self._is_flags(part0): + flags = part0 + if self._is_mode(part1): + mode = part1 + elif self._is_mode(part0): + mode = part0 + if self._is_flags(part1): + flags = part1 + + elif len(split) >= 3: + part0 = split[0] + part1 = split[1] + part2 = split[2] + + if self._is_app(part0): + app = part0 + if self._is_flags(part1): + flags = part1 + if self._is_mode(part2): + mode = part2 + elif self._is_mode(part1): + mode = part1 + if self._is_flags(part2): + flags = part2 + elif self._is_flags(part0): + flags = part0 + if self._is_mode(part1): + mode = part1 + elif self._is_mode(part0): + mode = part0 + if self._is_flags(part1): + flags = part1 + + return app, flags, int(mode) + + def _is_app(self, arg): + return not self._is_flags(arg) and not arg.isdigit() + + def _is_flags(self, arg): + from ranger.core.runner import ALLOWED_FLAGS + return all(x in ALLOWED_FLAGS for x in arg) + + def _is_mode(self, arg): + return all(x in '0123456789' for x in arg) + + +class set_(Command): + """:set <option name>=<python expression> + + Gives an option a new value. + """ + name = 'set' # don't override the builtin set class + def execute(self): + name = self.arg(1) + name, value, _ = self.parse_setting_line() + self.fm.set_option_from_string(name, value) + + def tab(self): + name, value, name_done = self.parse_setting_line() + settings = self.fm.settings + if not name: + return sorted(self.firstpart + setting for setting in settings) + if not value and not name_done: + return (self.firstpart + setting for setting in settings \ + if setting.startswith(name)) + if not value: + return self.firstpart + str(settings[name]) + if bool in settings.types_of(name): + if 'true'.startswith(value.lower()): + return self.firstpart + 'True' + if 'false'.startswith(value.lower()): + return self.firstpart + 'False' + + +class setlocal(set_): + """:setlocal path=<python string> <option name>=<python expression> + + Gives an option a new value. + """ + PATH_RE = re.compile(r'^\s*path="?(.*?)"?\s*$') + def execute(self): + import os.path + match = self.PATH_RE.match(self.arg(1)) + if match: + path = os.path.normpath(os.path.expanduser(match.group(1))) + self.shift() + elif self.fm.thisdir: + path = self.fm.thisdir.path + else: + path = None + + if path: + name = self.arg(1) + name, value, _ = self.parse_setting_line() + self.fm.set_option_from_string(name, value, localpath=path) + + +class setintag(setlocal): + """:setintag <tag or tags> <option name>=<option value> + + Sets an option for directories that are tagged with a specific tag. + """ + def execute(self): + tags = self.arg(1) + self.shift() + name, value, _ = self.parse_setting_line() + self.fm.set_option_from_string(name, value, tags=tags) + + +class quit(Command): + """:quit + + Closes the current tab. If there is only one tab, quit the program. + """ + + def execute(self): + if len(self.fm.tabs) <= 1: + self.fm.exit() + self.fm.tab_close() + + +class quitall(Command): + """:quitall + + Quits the program immediately. + """ + + def execute(self): + self.fm.exit() + + +class quit_bang(quitall): + """:quit! + + Quits the program immediately. + """ + name = 'quit!' + allow_abbrev = False + + +class terminal(Command): + """:terminal + + Spawns an "x-terminal-emulator" starting in the current directory. + """ + def execute(self): + import os + from ranger.ext.get_executables import get_executables + command = os.environ.get('TERMCMD', os.environ.get('TERM')) + if command not in get_executables(): + command = 'x-terminal-emulator' + if command not in get_executables(): + command = 'xterm' + self.fm.run(command, flags='f') + + +class delete(Command): + """:delete + + Tries to delete the selection. + + "Selection" is defined as all the "marked files" (by default, you + can mark files with space or v). If there are no marked files, + use the "current file" (where the cursor is) + + When attempting to delete non-empty directories or multiple + marked files, it will require a confirmation. + """ + + allow_abbrev = False + + def execute(self): + import os + if self.rest(1): + self.fm.notify("Error: delete takes no arguments! It deletes " + "the selected file(s).", bad=True) + return + + cwd = self.fm.thisdir + cf = self.fm.thisfile + if not cwd or not cf: + self.fm.notify("Error: no file selected for deletion!", bad=True) + return + + confirm = self.fm.settings.confirm_on_delete + many_files = (cwd.marked_items or (cf.is_directory and not cf.is_link \ + and len(os.listdir(cf.path)) > 0)) + + if confirm != 'never' and (confirm != 'multiple' or many_files): + self.fm.ui.console.ask("Confirm deletion of: %s (y/N)" % + ', '.join(f.basename for f in self.fm.thistab.get_selection()), + self._question_callback, ('n', 'N', 'y', 'Y')) + else: + # no need for a confirmation, just delete + self.fm.delete() + + def _question_callback(self, answer): + if answer == 'y' or answer == 'Y': + self.fm.delete() + + +class mark_tag(Command): + """:mark_tag [<tags>] + + Mark all tags that are tagged with either of the given tags. + When leaving out the tag argument, all tagged files are marked. + """ + do_mark = True + + def execute(self): + cwd = self.fm.thisdir + tags = self.rest(1).replace(" ","") + if not self.fm.tags: + return + for fileobj in cwd.files: + try: + tag = self.fm.tags.tags[fileobj.realpath] + except KeyError: + continue + if not tags or tag in tags: + cwd.mark_item(fileobj, val=self.do_mark) + self.fm.ui.status.need_redraw = True + self.fm.ui.need_redraw = True + + +class console(Command): + """:console <command> + + Open the console with the given command. + """ + def execute(self): + position = None + if self.arg(1)[0:2] == '-p': + try: + position = int(self.arg(1)[2:]) + self.shift() + except: + pass + self.fm.open_console(self.rest(1), position=position) + + +class load_copy_buffer(Command): + """:load_copy_buffer + + Load the copy buffer from confdir/copy_buffer + """ + copy_buffer_filename = 'copy_buffer' + def execute(self): + from ranger.container.file import File + from os.path import exists + try: + fname = self.fm.confpath(self.copy_buffer_filename) + f = open(fname, 'r') + except: + return self.fm.notify("Cannot open %s" % \ + (fname or self.copy_buffer_filename), bad=True) + self.fm.copy_buffer = set(File(g) \ + for g in f.read().split("\n") if exists(g)) + f.close() + self.fm.ui.redraw_main_column() + + +class save_copy_buffer(Command): + """:save_copy_buffer + + Save the copy buffer to confdir/copy_buffer + """ + copy_buffer_filename = 'copy_buffer' + def execute(self): + fname = None + try: + fname = self.fm.confpath(self.copy_buffer_filename) + f = open(fname, 'w') + except: + return self.fm.notify("Cannot open %s" % \ + (fname or self.copy_buffer_filename), bad=True) + f.write("\n".join(f.path for f in self.fm.copy_buffer)) + f.close() + + +class unmark_tag(mark_tag): + """:unmark_tag [<tags>] + + Unmark all tags that are tagged with either of the given tags. + When leaving out the tag argument, all tagged files are unmarked. + """ + do_mark = False + + +class mkdir(Command): + """:mkdir <dirname> + + Creates a directory with the name <dirname>. + """ + + def execute(self): + from os.path import join, expanduser, lexists + from os import mkdir + + dirname = join(self.fm.thisdir.path, expanduser(self.rest(1))) + if not lexists(dirname): + mkdir(dirname) + else: + self.fm.notify("file/directory exists!", bad=True) + + def tab(self): + return self._tab_directory_content() + + +class touch(Command): + """:touch <fname> + + Creates a file with the name <fname>. + """ + + def execute(self): + from os.path import join, expanduser, lexists + + fname = join(self.fm.thisdir.path, expanduser(self.rest(1))) + if not lexists(fname): + open(fname, 'a').close() + else: + self.fm.notify("file/directory exists!", bad=True) + + def tab(self): + return self._tab_directory_content() + + +class edit(Command): + """:edit <filename> + + Opens the specified file in vim + """ + + def execute(self): + if not self.arg(1): + self.fm.edit_file(self.fm.thisfile.path) + else: + self.fm.edit_file(self.rest(1)) + + def tab(self): + return self._tab_directory_content() + + +class eval_(Command): + """:eval [-q] <python code> + + Evaluates the python code. + `fm' is a reference to the FM instance. + To display text, use the function `p'. + + Examples: + :eval fm + :eval len(fm.directories) + :eval p("Hello World!") + """ + name = 'eval' + resolve_macros = False + + def execute(self): + if self.arg(1) == '-q': + code = self.rest(2) + quiet = True + else: + code = self.rest(1) + quiet = False + import ranger + global cmd, fm, p, quantifier + fm = self.fm + cmd = self.fm.execute_console + p = fm.notify + quantifier = self.quantifier + try: + try: + result = eval(code) + except SyntaxError: + exec(code) + else: + if result and not quiet: + p(result) + except Exception as err: + p(err) + + +class rename(Command): + """:rename <newname> + + Changes the name of the currently highlighted file to <newname> + """ + + def execute(self): + from ranger.container.file import File + from os import access + + new_name = self.rest(1) + + if not new_name: + return self.fm.notify('Syntax: rename <newname>', bad=True) + + if new_name == self.fm.thisfile.basename: + return + + if access(new_name, os.F_OK): + return self.fm.notify("Can't rename: file already exists!", bad=True) + + self.fm.rename(self.fm.thisfile, new_name) + f = File(new_name) + self.fm.thisdir.pointed_obj = f + self.fm.thisfile = f + + def tab(self): + return self._tab_directory_content() + + +class chmod(Command): + """:chmod <octal number> + + Sets the permissions of the selection to the octal number. + + The octal number is between 0 and 777. The digits specify the + permissions for the user, the group and others. + + A 1 permits execution, a 2 permits writing, a 4 permits reading. + Add those numbers to combine them. So a 7 permits everything. + """ + + def execute(self): + mode = self.rest(1) + if not mode: + mode = str(self.quantifier) + + try: + mode = int(mode, 8) + if mode < 0 or mode > 0o777: + raise ValueError + except ValueError: + self.fm.notify("Need an octal number between 0 and 777!", bad=True) + return + + for file in self.fm.thistab.get_selection(): + try: + os.chmod(file.path, mode) + except Exception as ex: + self.fm.notify(ex) + + try: + # reloading directory. maybe its better to reload the selected + # files only. + self.fm.thisdir.load_content() + except: + pass + + +class bulkrename(Command): + """:bulkrename + + This command opens a list of selected files in an external editor. + After you edit and save the file, it will generate a shell script + which does bulk renaming according to the changes you did in the file. + + This shell script is opened in an editor for you to review. + After you close it, it will be executed. + """ + def execute(self): + import sys + import tempfile + from ranger.container.file import File + from ranger.ext.shell_escape import shell_escape as esc + py3 = sys.version > "3" + + # Create and edit the file list + filenames = [f.basename for f in self.fm.thistab.get_selection()] + listfile = tempfile.NamedTemporaryFile() + + if py3: + listfile.write("\n".join(filenames).encode("utf-8")) + else: + listfile.write("\n".join(filenames)) + listfile.flush() + self.fm.execute_file([File(listfile.name)], app='editor') + listfile.seek(0) + if py3: + new_filenames = listfile.read().decode("utf-8").split("\n") + else: + new_filenames = listfile.read().split("\n") + listfile.close() + if all(a == b for a, b in zip(filenames, new_filenames)): + self.fm.notify("No renaming to be done!") + return + + # Generate and execute script + cmdfile = tempfile.NamedTemporaryFile() + cmdfile.write(b"# This file will be executed when you close the editor.\n") + cmdfile.write(b"# Please double-check everything, clear the file to abort.\n") + if py3: + cmdfile.write("\n".join("mv -vi -- " + esc(old) + " " + esc(new) \ + for old, new in zip(filenames, new_filenames) \ + if old != new).encode("utf-8")) + else: + cmdfile.write("\n".join("mv -vi -- " + esc(old) + " " + esc(new) \ + for old, new in zip(filenames, new_filenames) if old != new)) + cmdfile.flush() + self.fm.execute_file([File(cmdfile.name)], app='editor') + self.fm.run(['/bin/sh', cmdfile.name], flags='w') + cmdfile.close() + + +class relink(Command): + """:relink <newpath> + + Changes the linked path of the currently highlighted symlink to <newpath> + """ + + def execute(self): + from ranger.container.file import File + + new_path = self.rest(1) + cf = self.fm.thisfile + + if not new_path: + return self.fm.notify('Syntax: relink <newpath>', bad=True) + + if not cf.is_link: + return self.fm.notify('%s is not a symlink!' % cf.basename, bad=True) + + if new_path == os.readlink(cf.path): + return + + try: + os.remove(cf.path) + os.symlink(new_path, cf.path) + except OSError as err: + self.fm.notify(err) + + self.fm.reset() + self.fm.thisdir.pointed_obj = cf + self.fm.thisfile = cf + + def tab(self): + if not self.rest(1): + return self.line+os.readlink(self.fm.thisfile.path) + else: + return self._tab_directory_content() + + +class help_(Command): + """:help + + Display ranger's manual page. + """ + name = 'help' + def execute(self): + if self.quantifier == 1: + self.fm.dump_keybindings() + elif self.quantifier == 2: + self.fm.dump_commands() + elif self.quantifier == 3: + self.fm.dump_settings() + else: + self.fm.display_help() + + +class copymap(Command): + """:copymap <keys> <newkeys1> [<newkeys2>...] + + Copies a "browser" keybinding from <keys> to <newkeys> + """ + context = 'browser' + + def execute(self): + if not self.arg(1) or not self.arg(2): + return self.fm.notify("Not enough arguments", bad=True) + + for arg in self.args[2:]: + self.fm.ui.keymaps.copy(self.context, self.arg(1), arg) + + +class copypmap(copymap): + """:copypmap <keys> <newkeys1> [<newkeys2>...] + + Copies a "pager" keybinding from <keys> to <newkeys> + """ + context = 'pager' + + +class copycmap(copymap): + """:copycmap <keys> <newkeys1> [<newkeys2>...] + + Copies a "console" keybinding from <keys> to <newkeys> + """ + context = 'console' + + +class copytmap(copymap): + """:copycmap <keys> <newkeys1> [<newkeys2>...] + + Copies a "taskview" keybinding from <keys> to <newkeys> + """ + context = 'taskview' + + +class unmap(Command): + """:unmap <keys> [<keys2>, ...] + + Remove the given "browser" mappings + """ + context = 'browser' + + def execute(self): + for arg in self.args[1:]: + self.fm.ui.keymaps.unbind(self.context, arg) + + +class cunmap(unmap): + """:cunmap <keys> [<keys2>, ...] + + Remove the given "console" mappings + """ + context = 'browser' + + +class punmap(unmap): + """:punmap <keys> [<keys2>, ...] + + Remove the given "pager" mappings + """ + context = 'pager' + + +class tunmap(unmap): + """:tunmap <keys> [<keys2>, ...] + + Remove the given "taskview" mappings + """ + context = 'taskview' + + +class map_(Command): + """:map <keysequence> <command> + + Maps a command to a keysequence in the "browser" context. + + Example: + map j move down + map J move down 10 + """ + name = 'map' + context = 'browser' + resolve_macros = False + + def execute(self): + self.fm.ui.keymaps.bind(self.context, self.arg(1), self.rest(2)) + + +class cmap(map_): + """:cmap <keysequence> <command> + + Maps a command to a keysequence in the "console" context. + + Example: + cmap <ESC> console_close + cmap <C-x> console_type test + """ + context = 'console' + + +class tmap(map_): + """:tmap <keysequence> <command> + + Maps a command to a keysequence in the "taskview" context. + """ + context = 'taskview' + + +class pmap(map_): + """:pmap <keysequence> <command> + + Maps a command to a keysequence in the "pager" context. + """ + context = 'pager' + + +class scout(Command): + """:scout [-FLAGS] <pattern> + + Swiss army knife command for searching, traveling and filtering files. + The command takes various flags as arguments which can be used to + influence its behaviour: + + -a = automatically open a file on unambiguous match + -e = open the selected file when pressing enter + -f = filter files that match the current search pattern + -g = interpret pattern as a glob pattern + -i = ignore the letter case of the files + -k = keep the console open when changing a directory with the command + -l = letter skipping; e.g. allow "rdme" to match the file "readme" + -m = mark the matching files after pressing enter + -M = unmark the matching files after pressing enter + -p = permanent filter: hide non-matching files after pressing enter + -s = smart case; like -i unless pattern contains upper case letters + -t = apply filter and search pattern as you type + -v = inverts the match + + Multiple flags can be combined. For example, ":scout -gpt" would create + a :filter-like command using globbing. + """ + AUTO_OPEN = 'a' + OPEN_ON_ENTER = 'e' + FILTER = 'f' + SM_GLOB = 'g' + IGNORE_CASE = 'i' + KEEP_OPEN = 'k' + SM_LETTERSKIP = 'l' + MARK = 'm' + UNMARK = 'M' + PERM_FILTER = 'p' + SM_REGEX = 'r' + SMART_CASE = 's' + AS_YOU_TYPE = 't' + INVERT = 'v' + + def __init__(self, *args, **kws): + Command.__init__(self, *args, **kws) + self._regex = None + self.flags, self.pattern = self.parse_flags() + + def execute(self): + thisdir = self.fm.thisdir + flags = self.flags + pattern = self.pattern + regex = self._build_regex() + count = self._count(move=True) + + self.fm.thistab.last_search = regex + self.fm.set_search_method(order="search") + + if self.MARK in flags or self.UNMARK in flags: + value = flags.find(self.MARK) > flags.find(self.UNMARK) + if self.FILTER in flags: + for f in thisdir.files: + thisdir.mark_item(f, value) + else: + for f in thisdir.files: + if regex.search(f.basename): + thisdir.mark_item(f, value) + + if self.PERM_FILTER in flags: + thisdir.filter = regex if pattern else None + + # clean up: + self.cancel() + + if self.OPEN_ON_ENTER in flags or \ + self.AUTO_OPEN in flags and count == 1: + if os.path.exists(pattern): + self.fm.cd(pattern) + else: + self.fm.move(right=1) + + if self.KEEP_OPEN in flags and thisdir != self.fm.thisdir: + # reopen the console: + self.fm.open_console(self.line[0:-len(pattern)]) + + if thisdir != self.fm.thisdir and pattern != "..": + self.fm.block_input(0.5) + + def cancel(self): + self.fm.thisdir.temporary_filter = None + self.fm.thisdir.refilter() + + def quick(self): + asyoutype = self.AS_YOU_TYPE in self.flags + if self.FILTER in self.flags: + self.fm.thisdir.temporary_filter = self._build_regex() + if self.PERM_FILTER in self.flags and asyoutype: + self.fm.thisdir.filter = self._build_regex() + if self.FILTER in self.flags or self.PERM_FILTER in self.flags: + self.fm.thisdir.refilter() + if self._count(move=asyoutype) == 1 and self.AUTO_OPEN in self.flags: + return True + return False + + def tab(self): + self._count(move=True, offset=1) + + def _build_regex(self): + if self._regex is not None: + return self._regex + + frmat = "%s" + flags = self.flags + pattern = self.pattern + + if pattern == ".": + return re.compile("") + + # Handle carets at start and dollar signs at end separately + if pattern.startswith('^'): + pattern = pattern[1:] + frmat = "^" + frmat + if pattern.endswith('$'): + pattern = pattern[:-1] + frmat += "$" + + # Apply one of the search methods + if self.SM_REGEX in flags: + regex = pattern + elif self.SM_GLOB in flags: + regex = re.escape(pattern).replace("\\*", ".*").replace("\\?", ".") + elif self.SM_LETTERSKIP in flags: + regex = ".*".join(re.escape(c) for c in pattern) + else: + regex = re.escape(pattern) + + regex = frmat % regex + + # Invert regular expression if necessary + if self.INVERT in flags: + regex = "^(?:(?!%s).)*$" % regex + + # Compile Regular Expression + options = re.LOCALE | re.UNICODE + if self.IGNORE_CASE in flags or self.SMART_CASE in flags and \ + pattern.islower(): + options |= re.IGNORECASE + try: + self._regex = re.compile(regex, options) + except: + self._regex = re.compile("") + return self._regex + + def _count(self, move=False, offset=0): + count = 0 + cwd = self.fm.thisdir + pattern = self.pattern + + if not pattern: + return 0 + if pattern == '.': + return 0 + if pattern == '..': + return 1 + + deq = deque(cwd.files) + deq.rotate(-cwd.pointer - offset) + i = offset + regex = self._build_regex() + for fsobj in deq: + if regex.search(fsobj.basename): + count += 1 + if move and count == 1: + cwd.move(to=(cwd.pointer + i) % len(cwd.files)) + self.fm.thisfile = cwd.pointed_obj + if count > 1: + return count + i += 1 + + return count == 1 + + +class grep(Command): + """:grep <string> + + Looks for a string in all marked files or directories + """ + + def execute(self): + if self.rest(1): + action = ['grep', '--line-number'] + action.extend(['-e', self.rest(1), '-r']) + action.extend(f.path for f in self.fm.thistab.get_selection()) + self.fm.execute_command(action, flags='p') + + +# Version control commands +# -------------------------------- +class stage(Command): + """ + :stage + + Stage selected files for the corresponding version control system + """ + def execute(self): + from ranger.ext.vcs import VcsError + + filelist = [f.path for f in self.fm.thistab.get_selection()] + self.fm.thisdir.vcs_outdated = True +# for f in self.fm.thistab.get_selection(): +# f.vcs_outdated = True + + try: + self.fm.thisdir.vcs.add(filelist) + except VcsError: + self.fm.notify("Could not stage files.") + + self.fm.reload_cwd() + + +class unstage(Command): + """ + :unstage + + Unstage selected files for the corresponding version control system + """ + def execute(self): + from ranger.ext.vcs import VcsError + + filelist = [f.path for f in self.fm.thistab.get_selection()] + self.fm.thisdir.vcs_outdated = True +# for f in self.fm.thistab.get_selection(): +# f.vcs_outdated = True + + try: + self.fm.thisdir.vcs.reset(filelist) + except VcsError: + self.fm.notify("Could not unstage files.") + + self.fm.reload_cwd() + + +class diff(Command): + """ + :diff + + Displays a diff of selected files against last last commited version + """ + def execute(self): + from ranger.ext.vcs import VcsError + import tempfile + + L = self.fm.thistab.get_selection() + if len(L) == 0: return + + filelist = [f.path for f in L] + vcs = L[0].vcs + + diff = vcs.get_raw_diff(filelist=filelist) + if len(diff.strip()) > 0: + tmp = tempfile.NamedTemporaryFile() + tmp.write(diff.encode('utf-8')) + tmp.flush() + + pager = os.environ.get('PAGER', ranger.DEFAULT_PAGER) + self.fm.run([pager, tmp.name]) + else: + raise Exception("diff is empty") + + +class log(Command): + """ + :log + + Displays the log of the current repo or files + """ + def execute(self): + from ranger.ext.vcs import VcsError + import tempfile + + L = self.fm.thistab.get_selection() + if len(L) == 0: return + + filelist = [f.path for f in L] + vcs = L[0].vcs + + log = vcs.get_raw_log(filelist=filelist) + tmp = tempfile.NamedTemporaryFile() + tmp.write(log.encode('utf-8')) + tmp.flush() + + pager = os.environ.get('PAGER', ranger.DEFAULT_PAGER) + self.fm.run([pager, tmp.name]) diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf new file mode 100644 index 0000000..20f9ea3 --- /dev/null +++ b/.config/ranger/rc.conf @@ -0,0 +1,532 @@ +# ================================================================== +# This file contains the default startup commands for ranger. +# To change them, it is recommended to create the file +# ~/.config/ranger/rc.conf and add your custom commands there. +# +# If you copy this whole file there, you may want to set the environment +# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice. +# +# The purpose of this file is mainly to define keybindings and settings. +# For running more complex python code, please create a plugin in "plugins/" or +# a command in "commands.py". +# +# Each line is a command that will be run before the user interface +# is initialized. As a result, you can not use commands which rely +# on the UI such as :delete or :mark. +# =================================================================== + +# =================================================================== +# == Options +# =================================================================== + +# How many columns are there, and what are their relative widths? +set column_ratios 1,3,4 + +# Which files should be hidden? (regular expression) +set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$ + +# Show hidden files? You can toggle this by typing 'zh' +set show_hidden false + +# Ask for a confirmation when running the "delete" command? +# Valid values are "always" (default), "never", "multiple" +# With "multiple", ranger will ask only if you delete multiple files at once. +set confirm_on_delete always + +# Which script is used to generate file previews? +# ranger ships with scope.sh, a script that calls external programs (see +# README for dependencies) to preview images, archives, etc. +set preview_script ~/.config/ranger/scope.sh + +# Use the external preview script or display simple plain text previews? +set use_preview_script true + +# Open all images in this directory when running certain image viewers +# like feh or sxiv? You can still open selected files by marking them. +set open_all_images true + +# Be aware of version control systems and display information. +set vcs_aware false + +# State of the three backends git, hg, bzr. The possible states are +# disabled, local (only show local info), enabled (show local and remote +# information). +set vcs_backend_git enabled +set vcs_backend_hg disabled +set vcs_backend_bzr disabled + +# Preview images in full color with the external command "w3mimgpreview"? +# This requires the console web browser "w3m" and a supported terminal. +# It has been successfully tested with "xterm" and "urxvt" without tmux. +set preview_images false + +# Use a unicode "..." character to mark cut-off filenames? +set unicode_ellipsis true + +# Show dotfiles in the bookmark preview box? +set show_hidden_bookmarks true + +# Which colorscheme to use? These colorschemes are available by default: +# default, jungle, snow +set colorscheme default + +# Preview files on the rightmost column? +# And collapse (shrink) the last column if there is nothing to preview? +set preview_files true +set preview_directories true +set collapse_preview false + +# Save the console history on exit? +set save_console_history true + +# Draw the status bar on top of the browser window (default: bottom) +set status_bar_on_top false + +# Draw a progress bar in the status bar which displays the average state of all +# currently running tasks which support progress bars? +set draw_progress_bar_in_status_bar true + +# Draw borders around columns? +set draw_borders false + +# Display the directory name in tabs? +set dirname_in_tabs true + +# Enable the mouse support? +set mouse_enabled true + +# Display the file size in the main column or status bar? +set display_size_in_main_column true +set display_size_in_status_bar true + +# Display files tags in all columns or only in main column? +set display_tags_in_all_columns true + +# Set a title for the window? +set update_title true + +# Set the title to "ranger" in the tmux program? +set update_tmux_title false + +# Shorten the title if it gets long? The number defines how many +# directories are displayed at once, 0 turns off this feature. +set shorten_title 3 + +# Abbreviate $HOME with ~ in the titlebar (first line) of ranger? +set tilde_in_titlebar true + +# How many directory-changes or console-commands should be kept in history? +set max_history_size 20 +set max_console_history_size 50 + +# Try to keep so much space between the top/bottom border when scrolling: +set scroll_offset 8 + +# Flush the input after each key hit? (Noticable when ranger lags) +set flushinput true + +# Padding on the right when there's no preview? +# This allows you to click into the space to run the file. +set padding_right true + +# Save bookmarks (used with mX and `X) instantly? +# This helps to synchronize bookmarks between multiple ranger +# instances but leads to *slight* performance loss. +# When false, bookmarks are saved when ranger is exited. +set autosave_bookmarks true + +# You can display the "real" cumulative size of directories by using the +# command :get_cumulative_size or typing "dc". The size is expensive to +# calculate and will not be updated automatically. You can choose +# to update it automatically though by turning on this option: +set autoupdate_cumulative_size false + +# Turning this on makes sense for screen readers: +set show_cursor false + +# One of: size, basename, mtime, type +set sort natural + +# Additional sorting options +set sort_reverse false +set sort_case_insensitive true +set sort_directories_first true + +# Enable this if key combinations with the Alt Key don't work for you. +# (Especially on xterm) +set xterm_alt_key false + +# =================================================================== +# == Local Options +# =================================================================== +# You can set local options that only affect a single directory. + +# Examples: +# setlocal path=~/downloads sort mtime + +# =================================================================== +# == Command Aliases in the Console +# =================================================================== + +alias e edit +alias q quit +alias q! quitall +alias qall quitall +alias setl setlocal + +alias filter scout -prt +alias find scout -aet +alias mark scout -mr +alias unmark scout -Mr +alias search scout -rs +alias search_inc scout -rts +alias travel scout -aefiklst + +# =================================================================== +# == Define keys for the browser +# =================================================================== + +# Basic +map Q quit! +map q quit +copymap q ZZ ZQ + +map R reload_cwd +map <C-r> reset +map <C-l> redraw_window +map <C-c> abort +map <esc> change_mode normal + +map i display_file +map ? help +map W display_log +map w taskview_open +map S shell $SHELL + +map de delete + +map : console +map ; console +map ! console shell +map @ console -p6 shell %%s +map # console shell -p +map s console shell +map r chain draw_possible_programs; console open_with +map f console find +map cd console cd + +# Tagging / Marking +map t tag_toggle +map ut tag_remove +map "<any> tag_toggle tag=%any +map <Space> mark_files toggle=True +map v mark_files all=True toggle=True +map uv mark_files all=True val=False +map V toggle_visual_mode +map uV toggle_visual_mode reverse=True + +# For the nostalgics: Midnight Commander bindings +map <F1> help +map <F3> display_file +map <F4> edit +map <F5> copy +map <F6> cut +map <F7> console mkdir +map <F8> console delete +map <F10> exit + +# In case you work on a keyboard with dvorak layout +map <UP> move up=1 +map <DOWN> move down=1 +map <LEFT> move left=1 +map <RIGHT> move right=1 +map <HOME> move to=0 +map <END> move to=-1 +map <PAGEDOWN> move down=1 pages=True +map <PAGEUP> move up=1 pages=True +map <CR> move right=1 +map <DELETE> console delete +map <INSERT> console touch + +# VIM-like +copymap <UP> k +copymap <DOWN> j +copymap <LEFT> h +copymap <RIGHT> l +copymap <HOME> gg +copymap <END> G +copymap <PAGEDOWN> <C-F> +copymap <PAGEUP> <C-B> + +map J move down=0.5 pages=True +map K move up=0.5 pages=True +copymap J <C-D> +copymap K <C-U> + +# Jumping around +map H history_go -1 +map L history_go 1 +map ] move_parent 1 +map [ move_parent -1 +map } traverse + +map gh cd ~ +map ge cd /etc +map gu cd /usr +map gd cd /dev +map gl cd -r . +map gL cd -r %f +map go cd /opt +map gv cd /var +map gm cd /media +map gM cd /mnt +map gs cd /srv +map gr cd / +map gR eval fm.cd(ranger.RANGERDIR) +map g/ cd / +map g? cd /usr/share/doc/ranger + +# External Programs +map E edit +map du shell -p du --max-depth=1 -h --apparent-size +map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh +map yp shell -d echo -n %d/%f | xsel -i +map yd shell -d echo -n %d | xsel -i +map yn shell -d echo -n %f | xsel -i + +# Filesystem Operations +map = chmod + +map cw console rename +map A eval fm.open_console('rename ' + fm.thisfile.basename) +map I eval fm.open_console('rename ' + fm.thisfile.basename, position=7) + +map pp paste +map po paste overwrite=True +map pl paste_symlink relative=False +map pL paste_symlink relative=True +map phl paste_hardlink +map pht paste_hardlinked_subtree + +map dd cut +map ud uncut +map da cut mode=add +map dr cut mode=remove + +map yy copy +map uy uncut +map ya copy mode=add +map yr copy mode=remove + +# Temporary workarounds +map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier) +map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier) +map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier) +map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier) +map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier) +map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier) +map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier) +map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier) + +# Searching +map / console search +map n search_next +map N search_next forward=False +map ct search_next order=tag +map cs search_next order=size +map ci search_next order=mimetype +map cc search_next order=ctime +map cm search_next order=mtime +map ca search_next order=atime + +# Tabs +map <C-n> tab_new ~ +map <C-w> tab_close +map <TAB> tab_move 1 +map <S-TAB> tab_move -1 +map <A-Right> tab_move 1 +map <A-Left> tab_move -1 +map gt tab_move 1 +map gT tab_move -1 +map gn tab_new ~ +map gc tab_close +map uq tab_restore +map <a-1> tab_open 1 +map <a-2> tab_open 2 +map <a-3> tab_open 3 +map <a-4> tab_open 4 +map <a-5> tab_open 5 +map <a-6> tab_open 6 +map <a-7> tab_open 7 +map <a-8> tab_open 8 +map <a-9> tab_open 9 + +# Sorting +map or toggle_option sort_reverse +map os chain set sort=size; set sort_reverse=False +map ob chain set sort=basename; set sort_reverse=False +map on chain set sort=natural; set sort_reverse=False +map om chain set sort=mtime; set sort_reverse=False +map oc chain set sort=ctime; set sort_reverse=False +map oa chain set sort=atime; set sort_reverse=False +map ot chain set sort=type; set sort_reverse=False + +map oS chain set sort=size; set sort_reverse=True +map oB chain set sort=basename; set sort_reverse=True +map oN chain set sort=natural; set sort_reverse=True +map oM chain set sort=mtime; set sort_reverse=True +map oC chain set sort=ctime; set sort_reverse=True +map oA chain set sort=atime; set sort_reverse=True +map oT chain set sort=type; set sort_reverse=True + +map dc get_cumulative_size + +# Settings +map zc toggle_option collapse_preview +map zd toggle_option sort_directories_first +map zh toggle_option show_hidden +map <C-h> toggle_option show_hidden +map zi toggle_option flushinput +map zm toggle_option mouse_enabled +map zp toggle_option preview_files +map zP toggle_option preview_directories +map zs toggle_option sort_case_insensitive +map zu toggle_option autoupdate_cumulative_size +map zv toggle_option use_preview_script +map zf console filter + +# Bookmarks +map `<any> enter_bookmark %any +map '<any> enter_bookmark %any +map m<any> set_bookmark %any +map um<any> unset_bookmark %any + +map m<bg> draw_bookmarks +copymap m<bg> um<bg> `<bg> '<bg> + +# Generate all the chmod bindings with some python help: +eval for arg in "rwxXst": cmd("map +u{0} shell -d chmod u+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +g{0} shell -d chmod g+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +o{0} shell -d chmod o+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +a{0} shell -d chmod a+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +{0} shell -d chmod u+{0} %s".format(arg)) + +eval for arg in "rwxXst": cmd("map -u{0} shell -d chmod u-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -g{0} shell -d chmod g-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -o{0} shell -d chmod o-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -a{0} shell -d chmod a-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -{0} shell -d chmod u-{0} %s".format(arg)) + +# =================================================================== +# == Define keys for the console +# =================================================================== +# Note: Unmapped keys are passed directly to the console. + +# Basic +cmap <tab> eval fm.ui.console.tab() +cmap <s-tab> eval fm.ui.console.tab(-1) +cmap <ESC> eval fm.ui.console.close() +cmap <CR> eval fm.ui.console.execute() +cmap <C-l> redraw_window + +copycmap <ESC> <C-c> +copycmap <CR> <C-j> + +# Move around +cmap <up> eval fm.ui.console.history_move(-1) +cmap <down> eval fm.ui.console.history_move(1) +cmap <left> eval fm.ui.console.move(left=1) +cmap <right> eval fm.ui.console.move(right=1) +cmap <home> eval fm.ui.console.move(right=0, absolute=True) +cmap <end> eval fm.ui.console.move(right=-1, absolute=True) + +# Line Editing +cmap <backspace> eval fm.ui.console.delete(-1) +cmap <delete> eval fm.ui.console.delete(0) +cmap <C-w> eval fm.ui.console.delete_word() +cmap <C-k> eval fm.ui.console.delete_rest(1) +cmap <C-u> eval fm.ui.console.delete_rest(-1) +cmap <C-y> eval fm.ui.console.paste() + +# And of course the emacs way +copycmap <up> <C-p> +copycmap <down> <C-n> +copycmap <left> <C-b> +copycmap <right> <C-f> +copycmap <home> <C-a> +copycmap <end> <C-e> +copycmap <delete> <C-d> +copycmap <backspace> <C-h> + +# Note: There are multiple ways to express backspaces. <backspace> (code 263) +# and <backspace2> (code 127). To be sure, use both. +copycmap <backspace> <backspace2> + +# This special expression allows typing in numerals: +cmap <allow_quantifiers> false + +# =================================================================== +# == Pager Keybindings +# =================================================================== + +# Movement +pmap <down> pager_move down=1 +pmap <up> pager_move up=1 +pmap <left> pager_move left=4 +pmap <right> pager_move right=4 +pmap <home> pager_move to=0 +pmap <end> pager_move to=-1 +pmap <pagedown> pager_move down=1.0 pages=True +pmap <pageup> pager_move up=1.0 pages=True +pmap <C-d> pager_move down=0.5 pages=True +pmap <C-u> pager_move up=0.5 pages=True + +copypmap <UP> k <C-p> +copypmap <DOWN> j <C-n> <CR> +copypmap <LEFT> h +copypmap <RIGHT> l +copypmap <HOME> g +copypmap <END> G +copypmap <C-d> d +copypmap <C-u> u +copypmap <PAGEDOWN> n f <C-F> <Space> +copypmap <PAGEUP> p b <C-B> + +# Basic +pmap <ESC> pager_close +copypmap <ESC> q Q i <F3> +pmap E edit_file + +# =================================================================== +# == Taskview Keybindings +# =================================================================== + +# Movement +tmap <up> taskview_move up=1 +tmap <down> taskview_move down=1 +tmap <home> taskview_move to=0 +tmap <end> taskview_move to=-1 +tmap <pagedown> taskview_move down=1.0 pages=True +tmap <pageup> taskview_move up=1.0 pages=True +tmap <C-d> taskview_move down=0.5 pages=True +tmap <C-u> taskview_move up=0.5 pages=True + +copytmap <UP> k <C-p> +copytmap <DOWN> j <C-n> <CR> +copytmap <HOME> g +copytmap <END> G +copytmap <C-u> u +copytmap <PAGEDOWN> n f <C-F> <Space> +copytmap <PAGEUP> p b <C-B> + +# Changing priority and deleting tasks +tmap J eval -q fm.ui.taskview.task_move(-1) +tmap K eval -q fm.ui.taskview.task_move(0) +tmap dd eval -q fm.ui.taskview.task_remove() +tmap <pagedown> eval -q fm.ui.taskview.task_move(-1) +tmap <pageup> eval -q fm.ui.taskview.task_move(0) +tmap <delete> eval -q fm.ui.taskview.task_remove() + +# Basic +tmap <ESC> taskview_close +copytmap <ESC> q Q w <C-c> diff --git a/.config/ranger/rifle.conf b/.config/ranger/rifle.conf new file mode 100644 index 0000000..e7fed6b --- /dev/null +++ b/.config/ranger/rifle.conf @@ -0,0 +1,193 @@ +# vim: ft=cfg +# +# This is the configuration file of "rifle", ranger's file executor/opener. +# Each line consists of conditions and a command. For each line the conditions +# are checked and if they are met, the respective command is run. +# +# Syntax: +# <condition1> , <condition2> , ... = command +# +# The command can contain these environment variables: +# $1-$9 | The n-th selected file +# $@ | All selected files +# +# If you use the special command "ask", rifle will ask you what program to run. +# +# Prefixing a condition with "!" will negate its result. +# These conditions are currently supported: +# match <regexp> | The regexp matches $1 +# ext <regexp> | The regexp matches the extension of $1 +# mime <regexp> | The regexp matches the mime type of $1 +# name <regexp> | The regexp matches the basename of $1 +# path <regexp> | The regexp matches the absolute path of $1 +# has <program> | The program is installed (i.e. located in $PATH) +# file | $1 is a file +# directory | $1 is a directory +# number <n> | change the number of this command to n +# terminal | stdin, stderr and stdout are connected to a terminal +# X | $DISPLAY is not empty (i.e. Xorg runs) +# +# There are also pseudo-conditions which have a "side effect": +# flag <flags> | Change how the program is run. See below. +# label <label> | Assign a label or name to the command so it can +# | be started with :open_with <label> in ranger +# | or `rifle -p <label>` in the standalone executable. +# else | Always true. +# +# Flags are single characters which slightly transform the command: +# f | Fork the program, make it run in the background. +# | New command = setsid $command >& /dev/null & +# r | Execute the command with root permissions +# | New command = sudo $command +# t | Run the program in a new terminal. If $TERMCMD is not defined, +# | rifle will attempt to extract it from $TERM. +# | New command = $TERMCMD -e $command +# Note: The "New command" serves only as an illustration, the exact +# implementation may differ. +# Note: When using rifle in ranger, there is an additional flag "c" for +# only running the current file even if you have marked multiple files. + +#------------------------------------------- +# Websites +#------------------------------------------- +# Rarely installed browsers get higher priority; It is assumed that if you +# install a rare browser, you probably use it. Firefox/konqueror/w3m on the +# other hand are often only installed as fallback browsers. +ext x?html?, has surf, X, flag f = surf -- file://"$1" +ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@" +ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@" +ext x?html?, has jumanji, X, flag f = jumanji -- "$@" +ext x?html?, has luakit, X, flag f = luakit -- "$@" +ext x?html?, has uzbl, X, flag f = uzbl -- "$@" +ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@" +ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@" +ext x?html?, has midori, X, flag f = midori -- "$@" +ext x?html?, has chromium, X, flag f = chromium -- "$@" +ext x?html?, has opera, X, flag f = opera -- "$@" +ext x?html?, has firefox, X, flag f = firefox -- "$@" +ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@" +ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@" +ext x?html?, has epiphany, X, flag f = epiphany -- "$@" +ext x?html?, has konqueror, X, flag f = konqueror -- "$@" +ext x?html?, has elinks, terminal = elinks "$@" +ext x?html?, has links2, terminal = links2 "$@" +ext x?html?, has links, terminal = links "$@" +ext x?html?, has lynx, terminal = lynx -- "$@" +ext x?html?, has w3m, terminal = w3m "$@" + +#------------------------------------------- +# Misc +#------------------------------------------- +# Define the "editor" for text files as first action +mime ^text, label editor = "$EDITOR" -- "$@" +mime ^text, label pager = "$PAGER" -- "$@" +!mime ^text, label editor, ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@" +!mime ^text, label pager, ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@" + +ext 1 = man "$1" +ext s[wmf]c, has zsnes, X = zsnes "$1" +ext nes, has fceux, X = fceux "$1" +ext exe = wine "$1" +name ^[mM]akefile$ = make + +#-------------------------------------------- +# Code +#------------------------------------------- +ext py = python -- "$1" +ext pl = perl -- "$1" +ext rb = ruby -- "$1" +ext sh = sh -- "$1" +ext php = php -- "$1" + +#-------------------------------------------- +# Audio without X +#------------------------------------------- +mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@" +mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@" +ext midi?, terminal, has wildmidi = wildmidi -- "$@" + +#-------------------------------------------- +# Video/Audio with a GUI +#------------------------------------------- +mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@" +mime ^video|audio, has smplayer, X, flag f = smplayer "$@" +mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" +mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" +mime ^video, has mplayer, X, flag f = mplayer -- "$@" +mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@" +mime ^video|audio, has vlc, X, flag f = vlc -- "$@" +mime ^video|audio, has totem, X, flag f = totem -- "$@" +mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@" + +#-------------------------------------------- +# Video without X: +#------------------------------------------- +mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@" +mime ^video, terminal, !X, has mplayer = mplayer -- "$@" + +#------------------------------------------- +# Image Viewing: +#------------------------------------------- +mime ^image, has eog, X, flag f = eog -- "$@" +mime ^image, has sxiv, X, flag f = sxiv -- "$@" +mime ^image, has feh, X, flag f = feh -- "$@" +mime ^image, has mirage, X, flag f = mirage -- "$@" +mime ^image, has gimp, X, flag f = gimp -- "$@" +ext xcf, X, flag f = gimp -- "$@" + +#------------------------------------------- +# Documents +#------------------------------------------- +ext pdf, has llpp, X, flag f = llpp "$@" +ext pdf, has zathura, X, flag f = zathura -- "$@" +ext pdf, has mupdf, X, flag f = mupdf -- "$@" +ext pdf, has apvlv, X, flag f = apvlv -- "$@" +ext pdf, has xpdf, X, flag f = xpdf -- "$@" +ext pdf, has evince, X, flag f = evince -- "$@" +ext pdf, has okular, X, flag f = okular -- "$@" +ext pdf, has epdfview, X, flag f = epdfview -- "$@" + +ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER" + +ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@" +ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@" +ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric|rtf, has libreoffice, X, flag f = libreoffice "$@" +ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric|rtf, has soffice, X, flag f = soffice "$@" +ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric|rtf, has ooffice, X, flag f = ooffice "$@" + +ext djvu, has evince, X, flag f = evince -- "$@" + +#------------------------------------------- +# Archives +#------------------------------------------- +# This requires atool +ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has als = als -- "$@" | "$PAGER" +ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has als = als -- "$@" | "$PAGER" +ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack = aunpack -- "$@" +ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@" +ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has engrampa, X, flag f = engrampa -- "$@" +ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has engrampa, X, flag f = engrampa -- "$@" + +# Fallback: +ext tar|gz, has tar = tar vvtf "$@" | "$PAGER" +ext tar|gz, has tar = tar vvxf "$@" + +#------------------------------------------- +# Calc +#------------------------------------------- +ext 8xp|8xk|8xv|8xu, has tilem2, X, flag f = tilem2 "$@" +ext rom, has tilem2, X, flag f = tilem2 --rom="$1" +ext 8xp|8xk|8xv|8xu, has tilp = tilp --no-gui "$@" + +#------------------------------------------- +# Misc +#------------------------------------------- +label wallpaper, number 11, mime ^image, X = feh --bg-scale "$1" +label wallpaper, number 12, mime ^image, X = feh --bg-tile "$1" +label wallpaper, number 13, mime ^image, X = feh --bg-center "$1" +label wallpaper, number 14, mime ^image, X = feh --bg-fill "$1" + +# Define the editor for non-text files + pager as last action + !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = ask +label editor, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@" +label pager, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@" diff --git a/.config/ranger/scope.sh b/.config/ranger/scope.sh new file mode 100755 index 0000000..4786154 --- /dev/null +++ b/.config/ranger/scope.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env sh +# ranger supports enhanced previews. If the option "use_preview_script" +# is set to True and this file exists, this script will be called and its +# output is displayed in ranger. ANSI color codes are supported. + +# NOTES: This script is considered a configuration file. If you upgrade +# ranger, it will be left untouched. (You must update it yourself.) +# Also, ranger disables STDIN here, so interactive scripts won't work properly + +# Meanings of exit codes: +# code | meaning | action of ranger +# -----+------------+------------------------------------------- +# 0 | success | success. display stdout as preview +# 1 | no preview | failure. display no preview at all +# 2 | plain text | display the plain content of the file +# 3 | fix width | success. Don't reload when width changes +# 4 | fix height | success. Don't reload when height changes +# 5 | fix both | success. Don't ever reload + +# Meaningful aliases for arguments: +path="$1" # Full path of the selected file +width="$2" # Width of the preview pane (number of fitting characters) +height="$3" # Height of the preview pane (number of fitting characters) + +maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln + +# Find out something about the file: +mimetype=$(file --mime-type -Lb "$path") +extension=${path##*.} + +# Functions: +# runs a command and saves its output into $output. Useful if you need +# the return value AND want to use the output in a pipe +try() { output=$(eval '"$@"'); } + +# writes the output of the previouosly used "try" command +dump() { echo "$output"; } + +# a common post-processing function used after most commands +trim() { head -n "$maxln"; } + +# wraps highlight to treat exit code 141 (killed by SIGPIPE) as success +highlight() { command highlight "$@"; test $? = 0 -o $? = 141; } + +case "$extension" in + # Archive extensions: + 7z|a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\ + rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip) + try als "$path" && { dump | trim; exit 0; } + try acat "$path" && { dump | trim; exit 3; } + try bsdtar -lf "$path" && { dump | trim; exit 0; } + exit 1;; + rar) + try unrar -p- lt "$path" && { dump | trim; exit 0; } || exit 1;; + # PDF documents: + pdf) + try pdftotext -l 10 -nopgbrk -q "$path" - && \ + { dump | trim | fmt -s -w $width; exit 0; } || exit 1;; + # BitTorrent Files + torrent) + try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;; + # HTML Pages: + htm|html|xhtml) + try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } + try lynx -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } + try elinks -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } + ;; # fall back to highlight/cat if the text browsers fail +esac + +case "$mimetype" in + # Syntax highlight for text files: + text/* | */xml) + try highlight --out-format=ansi "$path" && { dump | trim; exit 5; } || exit 2;; + ## Ascii-previews of images: + #image/*) + # img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;; + # Display information about media files: + image/* | video/* | audio/*) + exiftool "$path" && exit 5 + # Use sed to remove spaces so the output fits into the narrow window + try mediainfo "$path" && { dump | trim | sed 's/ \+:/: /;'; exit 5; } || exit 1;; +esac + +exit 1 diff --git a/.config/redshift.conf b/.config/redshift.conf new file mode 100644 index 0000000..8493121 --- /dev/null +++ b/.config/redshift.conf @@ -0,0 +1,9 @@ +[redshift] +temp-day=6500 +temp-night=6000 +transition=1 +location-provider=manual + +[manual] +lat=33.4 +lon=-112.1 diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc new file mode 100644 index 0000000..3910d30 --- /dev/null +++ b/.config/zathura/zathurarc @@ -0,0 +1,4 @@ +set font "Droid Sans Mono 10" +set inputbar-fg "#333333" +set tabbar-focus-fg "#333333" +set completion-highlight-bg "#7A658F" diff --git a/.ftjerm/1/commands/connect b/.ftjerm/1/commands/connect new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/1/commands/connect diff --git a/.ftjerm/1/commands/general b/.ftjerm/1/commands/general new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/1/commands/general diff --git a/.ftjerm/1/commands/get b/.ftjerm/1/commands/get new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/1/commands/get diff --git a/.ftjerm/1/commands/getp b/.ftjerm/1/commands/getp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/1/commands/getp diff --git a/.ftjerm/1/commands/saguaro b/.ftjerm/1/commands/saguaro new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/1/commands/saguaro diff --git a/.ftjerm/1/commands/send b/.ftjerm/1/commands/send new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/1/commands/send diff --git a/.ftjerm/1/commands/sendp b/.ftjerm/1/commands/sendp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/1/commands/sendp diff --git a/.ftjerm/1/commands/withg b/.ftjerm/1/commands/withg new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/1/commands/withg diff --git a/.ftjerm/1/ssh.sh b/.ftjerm/1/ssh.sh new file mode 100755 index 0000000..002560c --- /dev/null +++ b/.ftjerm/1/ssh.sh @@ -0,0 +1,94 @@ +#!/bin/bash +input="" +filename="" +temp="" +action="" +destination="" +sleep .125s + +cd /home/shmibs/.ftjerm/1/commands + +while IFS="" read -r -e -d $'\n' -p "ssh: " -a input; do + history -s "$input" + + IFS=" " + input=($input) + + if [ -n "$input" ]; then + + if [ "${input[0]}" == "send" ]; then + destination="" + if [ "${input[1]}" == "general" ]; then + destination="gamarti6@general.asu.edu:/afs/asu.edu/users/g/a/m/gamarti6/" + fi + + if [ "${input[1]}" == "withg" ]; then + destination="shmibs@withg.org:/home/shmibs/" + fi + + if [ "${input[1]}" == "saguaro" ]; then + destination="gamarti6@saguaro.fulton.asu.edu:/home/gamarti6/" + fi + + if [ -n "$destination" ]; then + cd ~ + read -r -e -d $'\n' -p "~/" -a filename + temp=`basename $filename` + scp -r '/home/shmibs/$filename' '$destination$temp' + cd /home/shmibs/.ftjerm/1/commands + + fi + fi + + if [ "$input" == "sendp" ]; then + cd ~ + read -r -e -d $'\n' -p "~/" -a filename + cd /home/shmibs/.ftjerm/1/commands + temp=`basename $filename` + scp -r /home/shmibs/$filename shmibs@withg.org:/home/shmibs/www/$temp + echo "http://withg.org/shmibs/$temp" | xclip -selection clipboard + fi + + if [ "$input" == "get" ]; then + cd ~ + read -r -e -d $'\n' -p "~/" -a filename + cd /home/shmibs/.ftjerm/1/commands + temp=`basename $filename` + scp -r shmibs@withg.org:~/$filename ~/Desktop/$temp + fi + + if [ "$input" == "getp" ]; then + cd ~ + read -r -e -d $'\n' -p "~/www/" -a filename + cd /home/shmibs/.ftjerm/1/commands + temp=`basename $filename` + scp -r shmibs@withg.org:/home/shimbs/www/$filename ~/Desktop/$temp + fi + + if [ "${input[0]}" == "connect" ]; then + if [ "${input[2]}" != "-X" ]; then + unset ${input[2]} + fi + + destination="" + + if [ "${input[1]}" == "general" ]; then + destination=gamarti6@general.asu.edu + fi + + if [ "${input[1]}" == "withg" ]; then + destination=shmibs@withg.org + fi + + if [ "${input[1]}" == "saguaro" ]; then + destination=gamarti6@saguaro.fulton.asu.edu + fi + + if [ "$destination" != "" ]; then + ssh ${input[2]} $destination + fi + fi + + fi + +done diff --git a/.ftjerm/2/commands/connect b/.ftjerm/2/commands/connect new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/2/commands/connect diff --git a/.ftjerm/2/commands/search b/.ftjerm/2/commands/search new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/2/commands/search diff --git a/.ftjerm/2/weechat.sh b/.ftjerm/2/weechat.sh new file mode 100755 index 0000000..3285c6b --- /dev/null +++ b/.ftjerm/2/weechat.sh @@ -0,0 +1,40 @@ +#!/bin/bash +sleep .125s +input="" +cd /home/shmibs/.ftjerm/2/commands +while IFS="" read -r -e -d $'\n' -p "irc: " -a input; do + history -s "$input" + + IFS=" " + input=($input) + if [ -n "$input" ]; then + + if [ ${input[0]} == "connect" ]; then + weechat-curses + fi + + if [ ${input[0]} == "logs" ]; then + if [ -z ${input[1]} ]; then + for i in $( ls /home/shmibs/.weechat/logs ); do + echo $i: + ls /home/shmibs/.weechat/logs/$i + echo + done + else + less "/home/.weechat/logs/${input[1]}.log" + fi + fi + + if [ ${input[0]} == "clear" ]; then + clear + fi + + if [ ${input[0]} == "search" ]; then + if [ -n ${input[1]} ]; then + cd /home/shmibs/.weechat/logs + grep --color=always "${input[1]}" ./irc.*${input[2]}* | sed -e 's/.\/irc.\|.weechatlog\|grep: * No such file or directory//g' + cd /home/shmibs/.tilda/2/commands + fi + fi + fi +done diff --git a/.ftjerm/3/commands/aur b/.ftjerm/3/commands/aur new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/aur diff --git a/.ftjerm/3/commands/clear b/.ftjerm/3/commands/clear new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/clear diff --git a/.ftjerm/3/commands/define b/.ftjerm/3/commands/define new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/define diff --git a/.ftjerm/3/commands/install b/.ftjerm/3/commands/install new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/install diff --git a/.ftjerm/3/commands/logout b/.ftjerm/3/commands/logout new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/logout diff --git a/.ftjerm/3/commands/poweroff b/.ftjerm/3/commands/poweroff new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/poweroff diff --git a/.ftjerm/3/commands/reboot b/.ftjerm/3/commands/reboot new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/reboot diff --git a/.ftjerm/3/commands/record b/.ftjerm/3/commands/record new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/record diff --git a/.ftjerm/3/commands/remove b/.ftjerm/3/commands/remove new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/remove diff --git a/.ftjerm/3/commands/scrobble b/.ftjerm/3/commands/scrobble new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/scrobble diff --git a/.ftjerm/3/commands/search b/.ftjerm/3/commands/search new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/search diff --git a/.ftjerm/3/commands/spell b/.ftjerm/3/commands/spell new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/spell diff --git a/.ftjerm/3/commands/suspend b/.ftjerm/3/commands/suspend new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/suspend diff --git a/.ftjerm/3/commands/thesaurus b/.ftjerm/3/commands/thesaurus new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/thesaurus diff --git a/.ftjerm/3/commands/update b/.ftjerm/3/commands/update new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/update diff --git a/.ftjerm/3/commands/update-keys b/.ftjerm/3/commands/update-keys new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/update-keys diff --git a/.ftjerm/3/commands/upgrade b/.ftjerm/3/commands/upgrade new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.ftjerm/3/commands/upgrade diff --git a/.ftjerm/3/system.sh b/.ftjerm/3/system.sh new file mode 100755 index 0000000..d665d84 --- /dev/null +++ b/.ftjerm/3/system.sh @@ -0,0 +1,97 @@ +#!/bin/bash +sleep .125s +input="" +first="" + +cd /home/shmibs/.ftjerm/3/commands + +while IFS="" read -r -e -d $'\n' -p "sys: " -a input; do + history -s "$input" + + IFS=" " + input=($input) + + if [ -n "$input" ]; then + + first=${input[0]} + unset input[0] + + if [ "$first" == "upgrade" ]; then + if [ "${input[1]}" == "-a" ]; then + yaourt -Syua + else + sudo pacman -Syu + fi + fi + + if [ "$first" == "update" ]; then + sudo pacman -Syy + fi + + if [ "$first" == "update-keys" ]; then + sudo pacman-key --populate archlinux + fi + + if [ "$first" == "clear" ]; then + clear + fi + + if [ "$first" == "install" ]; then + sudo pacman -S ${input[*]} + fi + + if [ "$first" == "remove" ]; then + sudo pacman -R ${input[*]} + fi + + if [ "$first" == "search" ]; then + if [ "${input[1]}" == "-a" ]; then + unset input[1] + yaourt -Ss ${input[*]} + else + pacman -Ss ${input[*]} + fi + fi + + if [ "$first" == "aur" ]; then + yaourt -S ${input[*]} + fi + + if [ "$first" == "reboot" ]; then + systemctl reboot + fi + + if [ "$first" == "poweroff" ]; then + poweroff + fi + + if [ "$first" == "logout" ]; then + mate-session-save --logout + fi + + if [ "$first" == "spell" ]; then + echo "${input[*]}" | aspell -a + fi + + if [ $first == "thesaurus" ]; then + aiksaurus "${input[1]}" + fi + + if [ "$first" == "define" ]; then + sdcv "${input[1]}" + fi + + if [ "$first" == "record" ]; then + if [ -f ~/Desktop/temp.mkv ]; then + rm ~/Desktop/temp.mkv + fi + ffmpeg -f alsa -i pulse -f x11grab -s 1920x1080 -i :0.0 -preset ultrafast -vcodec libx264 -threads 0 -qp 0 ~/Desktop/temp.mkv + fi + + if [ "$first" == "suspend" ]; then + systemctl suspend + fi + + fi + +done diff --git a/.ftjerm/ed-cut-mono.png b/.ftjerm/ed-cut-mono.png Binary files differnew file mode 100644 index 0000000..0610447 --- /dev/null +++ b/.ftjerm/ed-cut-mono.png diff --git a/.ftjerm/lain-cut-mono.png b/.ftjerm/lain-cut-mono.png Binary files differnew file mode 100644 index 0000000..e7877fb --- /dev/null +++ b/.ftjerm/lain-cut-mono.png diff --git a/.ftjerm/major-cut-mono.png b/.ftjerm/major-cut-mono.png Binary files differnew file mode 100644 index 0000000..3acf720 --- /dev/null +++ b/.ftjerm/major-cut-mono.png diff --git a/.ftjerm/run.sh b/.ftjerm/run.sh new file mode 100755 index 0000000..b865857 --- /dev/null +++ b/.ftjerm/run.sh @@ -0,0 +1,6 @@ +cd /home/shmibs/.ftjerm/1 +ftjerm -k 7 -m windows -km alt -c0 000000 -c8 282E2B -c1 FF4D52 -c9 FF8083 -c2 4BEB4B -c10 7AEB7A -c3 EDB655 -c11 EDC785 -c4 53CDE0 -c12 80D3E0 -c5 CD00CD -c13 FF00FF -c6 5FD4D0 -c14 8AD4D1 -c7 E3E2D6 -c15 FFFEF9 -bg Black -fg White -ah false -fn "TI Calc Fonts Clean 8" -fy 16 -w 1920 -h 266 -o 0 -sh '/home/shmibs/.ftjerm/1/ssh.sh' -bgimg /home/shmibs/.ftjerm/major-cut-mono.png & +cd /home/shmibs/.ftjerm/2 +ftjerm -k 8 -m windows -km alt -c0 000000 -c8 282E2B -c1 FF4D52 -c9 FF8083 -c2 4BEB4B -c10 7AEB7A -c3 EDB655 -c11 EDC785 -c4 53CDE0 -c12 80D3E0 -c5 CD00CD -c13 FF00FF -c6 5FD4D0 -c14 8AD4D1 -c7 E3E2D6 -c15 FFFEF9 -bg Black -fg White -ah false -fn "TI Calc Fonts Clean 8" -fy 16 -w 1920 -h 266 -o 0 -sh '/home/shmibs/.ftjerm/2/weechat.sh' -bgimg /home/shmibs/.ftjerm/ed-cut-mono.png & +cd /home/shmibs/.ftjerm/3 +ftjerm -k 9 -m windows -km alt -c0 000000 -c8 282E2B -c1 FF4D52 -c9 FF8083 -c2 4BEB4B -c10 7AEB7A -c3 EDB655 -c11 EDC785 -c4 53CDE0 -c12 80D3E0 -c5 CD00CD -c13 FF00FF -c6 5FD4D0 -c14 8AD4D1 -c7 E3E2D6 -c15 FFFEF9 -bg Black -fg White -ah false -fn "TI Calc Fonts Clean 8" -fy 16 -w 1920 -h 266 -o 0 -sh '/home/shmibs/.ftjerm/3/system.sh' -bgimg /home/shmibs/.ftjerm/lain-cut-mono.png & diff --git a/.pentadactylrc b/.pentadactylrc new file mode 100644 index 0000000..73d5204 --- /dev/null +++ b/.pentadactylrc @@ -0,0 +1,9 @@ +"hg6960 + +loadplugins '\.(js|penta)$' +group user +map -count -modes=n,v s <count>:tabopen<Space>duckduckgo<Space> +map -count -modes=n,v S <count>:open<Space>duckduckgo<Space> +map -count -modes=n,v ! <count>:tabopen<Space>duckduckgo<Space>! + +" vim: set ft=pentadactyl: diff --git a/.profile b/.profile new file mode 100644 index 0000000..42b0fb4 --- /dev/null +++ b/.profile @@ -0,0 +1,29 @@ +# /etc/profile + +#Set our umask +umask 022 + +# Set our default path +PATH="/usr/local/sbin:/usr/local/bin:/usr/bin" +export PATH + +# Load profiles from /etc/profile.d +if test -d /etc/profile.d/; then + for profile in /etc/profile.d/*.sh; do + test -r "$profile" && . "$profile" + done + unset profile +fi + +# Source global bash config +if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then + . /etc/bash.bashrc +fi + +# Termcap is outdated, old, and crusty, kill it. +unset TERMCAP + +# Man is much better than us at figuring this out +unset MANPATH + +export EDITOR="vim" diff --git a/.sxiv/exec/key-handler b/.sxiv/exec/key-handler new file mode 100755 index 0000000..f47c88a --- /dev/null +++ b/.sxiv/exec/key-handler @@ -0,0 +1,14 @@ +#!/bin/sh + +# The key combo argument has the following form: "[C-][M-][S-]KEY", +# where C/M/S indicate Ctrl/Meta(Alt)/Shift modifier states and KEY is the X +# keysym as listed in /usr/include/X11/keysymdef.h without the "XK_" prefix. + +case "$1" in +"C-c") + echo -n "$2" | xclip -selection clipboard ;; +"C-d") + rm "$2" ;; +"C-g") + gimp "$2" & ;; +esac @@ -0,0 +1,34 @@ +syntax on +filetype plugin on +set autoindent + +"tab controls to match pentadactyl +map <C-n> <Esc>:tabn<CR> +map <C-p> <Esc>:tabp<CR> +map <C-t> <Esc>:tabnew<CR> + +"insert lines above and below with (=|+) +nnoremap = O<Esc>j +nnoremap + O<Esc> + +"copy words from above and below the cursor +inoremap <expr> <c-y> pumvisible() ? "\<c-y>" : matchstr(getline(line('.')-1), '\%' . virtcol('.') . 'v\%(\k\+\\|.\)') +inoremap <expr> <c-e> pumvisible() ? "\<c-e>" : matchstr(getline(line('.')+1), '\%' . virtcol('.') . 'v\%(\k\+\\|.\)') + +"use the X clipboard for things when running in a virtual terminal, because yes +if &term != "linux" + nnoremap <expr> y (v:register ==# '"' ? '"+' : '') . 'y' + nnoremap <expr> Y (v:register ==# '"' ? '"+' : '') . 'Y' + xnoremap <expr> y (v:register ==# '"' ? '"+' : '') . 'y' + xnoremap <expr> Y (v:register ==# '"' ? '"+' : '') . 'Y' + + nnoremap <expr> d (v:register ==# '"' ? '"+' : '') . 'd' + nnoremap <expr> D (v:register ==# '"' ? '"+' : '') . 'D' + xnoremap <expr> d (v:register ==# '"' ? '"+' : '') . 'd' + xnoremap <expr> D (v:register ==# '"' ? '"+' : '') . 'D' + + nnoremap <expr> p (v:register ==# '"' ? '"+' : '') . 'p' + nnoremap <expr> P (v:register ==# '"' ? '"+' : '') . 'P' + xnoremap <expr> p (v:register ==# '"' ? '"+' : '') . 'p' + xnoremap <expr> P (v:register ==# '"' ? '"+' : '') . 'P' +end diff --git a/.xinitrc b/.xinitrc new file mode 100644 index 0000000..921b404 --- /dev/null +++ b/.xinitrc @@ -0,0 +1,10 @@ +#smplayer screenshot tmp dir +if [ ! -d /tmp/smplayer_screenshots ] +then + mkdir /tmp/smplayer_screenshots +fi + +xsetroot -cursor_name left_ptr +compton -b -o 0.8 -r 10 -l -10 -t -10 --backend glx --paint-on-overlay & + +exec mate-session |