On 22.02.2018 22:39, '[799]' via qubes-users wrote:
Hello Florian

-------- Original-Nachricht --------
An 22. Feb. 2018, 09:07, Florian Brandes schrieb:

 > I use i3 under Q4rc4 without any issues
 > or problems.

Would you mind sharing your i3-config files?


Hi,

not at all. config file taken from /home/dom0user/.config/i3/config

The only line I changed from the default setup is:
# start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop --dmenu="dmenu -i -nb #d2d2d2 
-nf #000000 -sb #63a0ff"

where I added the "-i" option.

I also added the /usr/bin/qubes-i3status bash script.

I changed

local qubes=$(qvm-ls 2>/dev/null | grep ' \* ' | wc -l)
to
local qubes=$(qvm-ls 2>/dev/null | grep 'Running ' | wc -l)


and
local disk=`df -h / | tail -n 1 | awk '{print $4}'`
to
local disk=`sudo lvs --noheadings -o lv_size,data_percent /dev/mapper/qubes_dom0-pool00 | 
perl -pe 's/\s*([0-9.]+)([a-zA-Z]*)\s+([0-9.]+).*/sprintf("%.1f%s", ($1 * (100 
-$3) \/ 100.0), $2)/e'`

Both are attached.

Regards,

Florian






--
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-users@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/7b75712c-3288-90aa-d939-b76efab12197%40gmx.de.
For more options, visit https://groups.google.com/d/optout.
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!

set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.

client.background       dom0            #121212
client.focused          dom0    #522702 #522702 #ffffff #a6907d
client.focused_inactive dom0    #522702 #361a01 #ffffff #a6907d
client.unfocused        dom0    #522702 #361a01 #999999 #a6907d
client.urgent           dom0    #666666 #a6907d #ce0000 #a6907d

client.background       red             #121212
client.focused          red     #e53b27 #e53b27 #ffffff #f19b90
client.focused_inactive red     #e53b27 #902519 #ffffff #f19b90
client.unfocused        red     #e53b27 #902519 #999999 #f19b90
client.urgent           red     #e53b27 #f19b90 #ce0000 #f19b90

client.background       orange          #121212
client.focused          orange  #d05f03 #d05f03 #ffffff #daa67e
client.focused_inactive orange  #d05f03 #7b3702 #ffffff #daa67e
client.unfocused        orange  #d05f03 #7b3702 #999999 #daa67e
client.urgent           orange  #d05f03 #daa67e #ce0000 #daa67e

client.background       yellow          #121212
client.focused          yellow  #999b00 #999b00 #ffffff #cacb7c
client.focused_inactive yellow  #999b00 #666700 #ffffff #cacb7c
client.unfocused        yellow  #999b00 #666700 #999999 #cacb7c
client.urgent           yellow  #999b00 #cacb7c #ce0000 #cacb7c

client.background       green           #121212
client.focused          green   #04af5b #04af5b #ffffff #7dd5aa
client.focused_inactive green   #04af5b #02713b #ffffff #7dd5aa
client.unfocused        green   #04af5b #02713b #999999 #7dd5aa
client.urgent           green   #04af5b #7dd5aa #ce0000 #7dd5aa

client.background       gray            #121212
client.focused          gray    #8c959f #8c959f #ffffff #c3c8cd
client.focused_inactive gray    #8c959f #676d75 #ffffff #c3c8cd
client.unfocused        gray    #8c959f #676d75 #999999 #c3c8cd
client.urgent           gray    #8c959f #c3c8cd #ce0000 #c3c8cd

client.background       blue            #121212
client.focused          blue    #3384d6 #3384d6 #ffffff #95bee8
client.focused_inactive blue    #3384d6 #1f5082 #ffffff #95bee8
client.unfocused        blue    #3384d6 #1f5082 #999999 #95bee8
client.urgent           blue    #3384d6 #95bee8 #ce0000 #95bee8

client.background       purple          #121212
client.focused          purple  #8f5cbe #8f5cbe #ffffff #c6abdd
client.focused_inactive purple  #8f5cbe #5c3e78 #ffffff #c6abdd
client.unfocused        purple  #8f5cbe #5c3e78 #999999 #c6abdd
client.urgent           purple  #8f5cbe #c6abdd #ce0000 #c6abdd

client.background       black           #121212
client.focused          black   #595959 #595959 #ffffff #a3a3a3
client.focused_inactive black   #595959 #3a3a3a #ffffff #a3a3a3
client.unfocused        black   #595959 #3a3a3a #999999 #a3a3a3
client.urgent           black   #595959 #a3a3a3 #ce0000 #a3a3a3

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal in the domain of the currently active window
bindsym $mod+Return exec qubes-i3-sensible-terminal

# kill focused window
bindsym $mod+Shift+q kill

# start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop --dmenu="dmenu -i -nb 
#d2d2d2 -nf #000000 -sb #63a0ff"

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+odiaeresis focus right

# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+odiaeresis move right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

# split in horizontal orientation
bindsym $mod+h split h

# split in vertical orientation
bindsym $mod+v split v

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen

# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# focus the parent container
bindsym $mod+a focus parent

# focus the child container
#bindsym $mod+d focus child

# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit 
shortcut. Do you really want to exit i3? This will end your X session.' -b 
'Yes, exit i3' 'i3-msg exit'"

# resize window (you can also use the mouse for that)
mode "resize" {
        # These bindings trigger as soon as you enter the resize mode

        # Pressing left will shrink the window’s width.
        # Pressing right will grow the window’s width.
        # Pressing up will shrink the window’s height.
        # Pressing down will grow the window’s height.
        bindsym j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 10 px or 10 ppt
        bindsym l resize shrink height 10 px or 10 ppt
        bindsym odiaeresis resize grow width 10 px or 10 ppt

        # same bindings, but for the arrow keys
        bindsym Left resize shrink width 10 px or 10 ppt
        bindsym Down resize grow height 10 px or 10 ppt
        bindsym Up resize shrink height 10 px or 10 ppt
        bindsym Right resize grow width 10 px or 10 ppt

        # back to normal: Enter or Escape
        bindsym Return mode "default"
        bindsym Escape mode "default"
}

bindsym $mod+r mode "resize"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
        status_command qubes-i3status
        colors {
            background #d2d2d2
            statusline #00000

            #class               #border #backgr #text
            focused_workspace    #4c7899 #63a0ff #000000
            active_workspace     #333333 #5f676a #ffffff
            inactive_workspace   #222222 #333333 #888888
            urgent_workspace     #BD2727 #E79E27 #000000
        }
}

# Use a screen locker
exec --no-startup-id "xautolock -detectsleep -time 3 -locker 'i3lock -d -c 
000000' -notify 30 -notifier \"notify-send -t 2000 'Locking screen in 30 
seconds'\""

# Make sure all xdg autostart entries are started, this is (among other things)
# necessary to make sure transient vm's come up
exec --no-startup-id qubes-i3-xdg-autostart
#!/bin/bash

json() {
    if [[ -n "$3" ]]; then
        echo -n "{\"name\":\"$1\",\"color\":\"$3\",\"full_text\":\"$2\"},"
    else
        echo -n "{\"name\":\"$1\",\"full_text\":\"$2\"},"
    fi
}

status_net() {
    local netvms=$(qvm-ls | awk -F "|" '$5 ~ /.*Net.*/ {match($1, /.*{(.*)}.*/, 
arr); print arr[1]}')

    IFS_BAK=$IFS
    IFS=$'\n'
    for netvm in $netvms; do
        local ip_addr=$(qvm-run "$netvm" -p 'ip -o -f inet addr' 2>/dev/null)
        for ip_addr_line in $ip_addr; do
            local device_name=${ip_addr_line#* }
            device_name=${device_name%% *}

            if [[ $device_name == wl* ]]; then # this is a wifi device
                local net=$(qvm-run $netvm -p 'iwconfig' 2>/dev/null)
                local ssid=$(echo "$net" | perl -ne 'print "$1" if 
/ESSID:"(.*)"/')
                local ip=${ip_addr_line#* inet }
                ip=${ip%%/*}
                if [[ -n $ssid ]]; then
                    local quality=$(echo "$net" | perl -ne 'print "$1" if 
/Quality=([^ ]+)/')
                    json $device_name "$netvm: $ssid $ip $quality"
                fi
            elif [[ $device_name == en* ]]; then # this is an ethernet device
                local ip=${ip_addr_line#* inet }
                ip=${ip%%/*}
                json $device_name "$netvm: $ip"
            fi
        done
    done
    IFS=$IFS_BAK
    IFS_BAK=
}

status_time() {
    local time=$(date '+%F %T')
    echo -n "{\"name\":\"time\",\"full_text\":\"$time\"}" # last entry
}

status_bat() {
    local accum_now=0;
    local accum_full=0;

    for battery in /sys/class/power_supply/BAT*; do
        accum_now=$((accum_now + $(cat $battery/energy_now)))
        accum_full=$((accum_full + $(cat $battery/energy_full)))
    done
    local bat=$((100*accum_now/accum_full))

    local ac=''
    local color=''
    if [[ $(cat /sys/class/power_supply/AC/online) == '1' ]]; then
        ac=' AC'
    elif ((bat < 25)); then
        color='#ff0000'
    elif ((bat < 50)); then
        color='#ffff00'
    fi

    json bat "Bat: $bat%$ac" "$color"
}

status_load() {
    local load=$(uptime)
    load=${load/#*load average: }
    load=${load%,*,*}
    json load "Load: $load"
}

status_qubes() {
#    local qubes=$(qvm-ls 2>/dev/null | grep ' \* ' | wc -l)
    local qubes=$(qvm-ls 2>/dev/null | grep 'Running ' | wc -l)
    json qubes "$qubes Qubes"
}

status_disk() {
#    local disk=`df -h / | tail -n 1 | awk '{print $4}'`
    local disk=`sudo lvs --noheadings -o lv_size,data_percent 
/dev/mapper/qubes_dom0-pool00 | perl -pe 
's/\s*([0-9.]+)([a-zA-Z]*)\s+([0-9.]+).*/sprintf("%.1f%s", ($1 * (100 -$3) \/ 
100.0), $2)/e'`
    json disk "Disk free: $disk"
}

main() {
    echo '{"version":1}'
    echo '['
    echo '[]'
    local n
    for ((n=0; ; ++n)); do
        if (( n % 10 == 0 )); then
            local qubes=$(status_qubes)
            # network status disabled by default as it's dangerous to run a
            # command on a qube from dom0
            # local net=$(status_net)
            local disk=$(status_disk)
            local bat=$(status_bat)
            local load=$(status_load)
        fi
        local time=$(status_time)
        echo ",[$qubes$disk$bat$load$time]"
        sleep 1
    done
}

main

Reply via email to